@undefineds.co/models 0.2.34 → 0.2.37

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 (120) hide show
  1. package/README.md +13 -16
  2. package/dist/agent.repository.d.ts +48 -0
  3. package/dist/agent.repository.js +1 -1
  4. package/dist/agent.schema.d.ts +24 -0
  5. package/dist/agent.schema.js +16 -5
  6. package/dist/ai-config/index.d.ts +28 -2
  7. package/dist/ai-config/index.js +154 -13
  8. package/dist/ai-model.schema.js +11 -12
  9. package/dist/ai-provider.schema.d.ts +4 -0
  10. package/dist/ai-provider.schema.js +11 -10
  11. package/dist/ai-runtime.schema.d.ts +4 -4
  12. package/dist/ai-runtime.schema.js +43 -45
  13. package/dist/approval.schema.d.ts +0 -1
  14. package/dist/approval.schema.js +2 -11
  15. package/dist/audit.schema.d.ts +0 -1
  16. package/dist/audit.schema.js +2 -11
  17. package/dist/automation-rule.schema.d.ts +63 -0
  18. package/dist/automation-rule.schema.js +51 -0
  19. package/dist/bin/udfs.js +3 -3
  20. package/dist/chat.repository.d.ts +4 -4
  21. package/dist/chat.repository.js +1 -1
  22. package/dist/chat.schema.d.ts +2 -2
  23. package/dist/chat.schema.js +3 -4
  24. package/dist/chat.utils.d.ts +7 -0
  25. package/dist/chat.utils.js +35 -6
  26. package/dist/contact.repository.d.ts +4 -4
  27. package/dist/contact.repository.js +1 -1
  28. package/dist/contact.schema.d.ts +2 -2
  29. package/dist/contact.schema.js +2 -3
  30. package/dist/credential.schema.js +21 -22
  31. package/dist/delivery.schema.d.ts +81 -0
  32. package/dist/delivery.schema.js +64 -0
  33. package/dist/evidence.schema.d.ts +40 -0
  34. package/dist/evidence.schema.js +48 -0
  35. package/dist/favorite/favorite.schema.d.ts +3 -5
  36. package/dist/favorite/favorite.schema.js +2 -3
  37. package/dist/favorite/starred-sync.d.ts +1 -1
  38. package/dist/favorite/starred-sync.js +11 -13
  39. package/dist/fixtures/contracts-chat-contact.js +3 -3
  40. package/dist/grant.schema.d.ts +2 -3
  41. package/dist/grant.schema.js +6 -9
  42. package/dist/idea.schema.d.ts +32 -0
  43. package/dist/idea.schema.js +36 -0
  44. package/dist/inbox-notification.schema.js +1 -2
  45. package/dist/index.d.ts +19 -14
  46. package/dist/index.js +20 -18
  47. package/dist/issue.repository.js +1 -1
  48. package/dist/issue.schema.js +1 -2
  49. package/dist/knowledge/knowledge-folder.schema.d.ts +1 -1
  50. package/dist/knowledge/knowledge-folder.schema.js +1 -1
  51. package/dist/message.repository.d.ts +8 -12
  52. package/dist/message.repository.js +1 -1
  53. package/dist/message.schema.d.ts +11 -9
  54. package/dist/message.schema.js +29 -13
  55. package/dist/namespaces.d.ts +0 -2
  56. package/dist/namespaces.js +121 -92
  57. package/dist/pod-storage-descriptor.d.ts +0 -6
  58. package/dist/pod-storage-descriptor.js +11 -12
  59. package/dist/profile.repository.d.ts +2 -2
  60. package/dist/profile.repository.js +2 -2
  61. package/dist/report.schema.d.ts +58 -0
  62. package/dist/report.schema.js +73 -0
  63. package/dist/repository.d.ts +15 -4
  64. package/dist/repository.js +16 -5
  65. package/dist/resource-id-defaults.d.ts +1 -12
  66. package/dist/resource-id-defaults.js +65 -72
  67. package/dist/resource-refs.d.ts +25 -0
  68. package/dist/resource-refs.js +45 -0
  69. package/dist/run.schema.d.ts +13 -17
  70. package/dist/run.schema.js +12 -13
  71. package/dist/schedule.schema.d.ts +56 -0
  72. package/dist/schedule.schema.js +46 -0
  73. package/dist/schema.d.ts +275 -192
  74. package/dist/schema.js +18 -10
  75. package/dist/session/index.d.ts +1 -1
  76. package/dist/session/index.js +1 -1
  77. package/dist/session/session.schema.d.ts +4 -6
  78. package/dist/session/session.schema.js +5 -16
  79. package/dist/session.repository.d.ts +8 -8
  80. package/dist/session.repository.js +1 -1
  81. package/dist/settings/settings.schema.d.ts +2 -0
  82. package/dist/settings/settings.schema.js +8 -3
  83. package/dist/sidecar/persistence-mapping.d.ts +1 -1
  84. package/dist/sidecar/sidecar-events.d.ts +36 -36
  85. package/dist/skill.schema.d.ts +39 -0
  86. package/dist/skill.schema.js +31 -0
  87. package/dist/task.schema.d.ts +22 -32
  88. package/dist/task.schema.js +17 -25
  89. package/dist/thread.repository.d.ts +8 -8
  90. package/dist/thread.repository.js +1 -1
  91. package/dist/thread.schema.d.ts +15 -10
  92. package/dist/thread.schema.js +32 -13
  93. package/dist/types/collaboration-blocks.d.ts +3 -1
  94. package/dist/types/message-block.d.ts +3 -1
  95. package/dist/vocab/chat.vocab.d.ts +1 -1
  96. package/dist/vocab/chat.vocab.js +1 -1
  97. package/dist/vocab/contact.vocab.d.ts +1 -1
  98. package/dist/vocab/contact.vocab.js +1 -1
  99. package/dist/vocab/index.d.ts +2 -0
  100. package/dist/vocab/index.js +2 -0
  101. package/dist/vocab/message.vocab.d.ts +2 -1
  102. package/dist/vocab/message.vocab.js +2 -1
  103. package/dist/vocab/session.vocab.d.ts +16 -0
  104. package/dist/vocab/session.vocab.js +17 -0
  105. package/dist/vocab/sidecar.vocab.d.ts +19 -1
  106. package/dist/vocab/sidecar.vocab.js +22 -4
  107. package/dist/vocab/thread.vocab.d.ts +2 -0
  108. package/dist/vocab/thread.vocab.js +2 -0
  109. package/dist/vocab/workflow.vocab.d.ts +135 -0
  110. package/dist/vocab/workflow.vocab.js +136 -0
  111. package/package.json +3 -3
  112. package/skills/solid-modeling/SKILL.md +70 -17
  113. package/dist/file/file.schema.d.ts +0 -60
  114. package/dist/file/file.schema.js +0 -53
  115. package/dist/file/index.d.ts +0 -1
  116. package/dist/file/index.js +0 -1
  117. package/dist/matrix.repository.d.ts +0 -183
  118. package/dist/matrix.repository.js +0 -20
  119. package/dist/matrix.schema.d.ts +0 -136
  120. package/dist/matrix.schema.js +0 -100
@@ -0,0 +1,36 @@
1
+ import { id, object, podTable, string, text, timestamp, uri } from '@undefineds.co/drizzle-solid';
2
+ import { DCTerms, UDFS } from './namespaces.js';
3
+ import { chatResource } from './chat.schema.js';
4
+ import { threadResource } from './thread.schema.js';
5
+ /**
6
+ * Lightweight candidate extracted from conversation.
7
+ *
8
+ * Idea is the buffer before committed work. It can reference source Messages
9
+ * and related records, but it is not an Issue or Task until promoted.
10
+ */
11
+ export const ideaResource = podTable('idea', {
12
+ id: id('id').default('{yyyy}/{MM}/{dd}.ttl#{key}'),
13
+ summary: string('summary').predicate(DCTerms.abstract).notNull(),
14
+ input: text('input').predicate(DCTerms.description),
15
+ status: string('status').predicate(UDFS.status).notNull().default('captured'),
16
+ commitment: string('commitment').predicate(UDFS.commitment).notNull().default('thought'),
17
+ affectedArea: string('affectedArea').predicate(UDFS.affectedArea),
18
+ currentUnderstanding: text('currentUnderstanding').predicate(UDFS.currentUnderstanding),
19
+ openQuestions: text('openQuestions').array().predicate(UDFS.openQuestions),
20
+ related: uri('related').array().predicate(DCTerms.relation),
21
+ conflicts: text('conflicts').array().predicate(UDFS.conflicts),
22
+ nextStep: text('nextStep').predicate(UDFS.nextStep),
23
+ promotedTo: uri('promotedTo').predicate(UDFS.promotedTo),
24
+ chat: uri('chat').predicate(UDFS.conversation).link(chatResource),
25
+ thread: uri('thread').predicate(UDFS.inThread).link(threadResource),
26
+ sourceMessages: uri('sourceMessages').array().predicate(DCTerms.source),
27
+ createdBy: uri('createdBy').predicate(DCTerms.creator),
28
+ metadata: object('metadata').predicate(UDFS.metadata),
29
+ createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
30
+ updatedAt: timestamp('updatedAt').predicate(DCTerms.modified).notNull().defaultNow(),
31
+ }, {
32
+ base: '/.data/ideas/',
33
+ sparqlEndpoint: '/.data/ideas/-/sparql',
34
+ type: UDFS.Idea,
35
+ namespace: UDFS,
36
+ });
@@ -2,7 +2,7 @@ import { podTable, uri, timestamp, id } from '@undefineds.co/drizzle-solid';
2
2
  import { AS, DCTerms, RDF } from './namespaces.js';
3
3
  // Solid inbox notifications (protocol channel)
4
4
  export const inboxNotificationResource = podTable('inbox_notification', {
5
- id: id('id'),
5
+ id: id('id').default('{key}.ttl'),
6
6
  // Protocol inbox messages are not always Announce. Keep rdf:type writable so
7
7
  // app notifications can use as:Announce while other Solid inbox payloads keep their own type.
8
8
  rdfType: uri('rdfType').array().predicate(RDF.type).notNull().default([AS.Announce]),
@@ -15,7 +15,6 @@ export const inboxNotificationResource = podTable('inbox_notification', {
15
15
  sparqlEndpoint: '/inbox/-/sparql',
16
16
  type: AS.Activity,
17
17
  namespace: AS,
18
- subjectTemplate: '{id}.ttl',
19
18
  });
20
19
  // Compatibility alias. New model code should prefer `inboxNotificationResource`.
21
20
  export const inboxNotificationTable = inboxNotificationResource;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { UDFS, UDFS_NAMESPACE, SIOC, DCTerms, SCHEMA, RDF, RDFS, ACL, ODRL, OWL, FOAF, MEETING, AS, VCARD, WF, LDP, XPOD_CREDENTIAL, XPOD_AI, } from "./namespaces";
1
+ export { UDFS, UDFS_NAMESPACE, SIOC, DCTerms, SCHEMA, RDF, RDFS, ACL, ODRL, OWL, FOAF, MEETING, AS, VCARD, WF, LDP, } from "./namespaces";
2
2
  export * from "./vocab";
3
3
  export * from './profile';
4
4
  export * from './profile.repository';
@@ -7,35 +7,40 @@ export { ContactGender, contactResource, contactTable, ContactClass, ContactType
7
7
  export { contactRepository } from './contact.repository';
8
8
  export { ChatStatus, chatResource, chatTable, type ChatMetadata, type ChatMemberRole, type ChatStatusType, type ChatRow, type ChatInsert, type ChatUpdate, } from './chat.schema';
9
9
  export { chatRepository } from './chat.repository';
10
- export { extractChatIdFromChatRef, extractChatThreadRef, extractThreadIdFromThreadRef, resolveThreadChatId, toTimestamp, type ChatThreadRef, } from './chat.utils';
10
+ export { buildChatTargetRef, extractChatIdFromChatRef, extractChatTargetRef, extractChatThreadRef, extractThreadIdFromThreadRef, resolveThreadChatId, toTimestamp, type ChatTargetRef, type ChatThreadRef, } from './chat.utils';
11
+ export { buildModelResourceId, buildModelResourceIri, buildModelResourceIriForDatabase, resolveModelResourceIri, resolveModelResourceIriForDatabase, type ModelResourceTarget, } from './resource-refs';
11
12
  export { ThreadStatus, threadResource, threadTable, type ThreadStatusType, type ThreadRow, type ThreadInsert, type ThreadUpdate, } from './thread.schema';
12
13
  export { threadRepository } from './thread.repository';
13
14
  export { MessageRole, MessageStatus, messageResource, messageTable, type MessageRoleType, type MessageStatusType, type MessageRow, type MessageInsert, type MessageUpdate, } from './message.schema';
14
15
  export { messageRepository } from './message.repository';
15
- export { TaskStatus, TaskTriggerKind, taskResource, taskTable, type TaskStatusType, type TaskTriggerKindType, type TaskRow, type TaskInsert, type TaskUpdate, } from './task.schema';
16
- export { MatrixMembership, MatrixRoomVisibility, matrixAccountResource, matrixAccountTable, matrixRoomResource, matrixRoomTable, matrixEventResource, matrixEventTable, type MatrixAccountRow, type MatrixAccountInsert, type MatrixAccountUpdate, type MatrixRoomRow, type MatrixRoomInsert, type MatrixRoomUpdate, type MatrixEventRow, type MatrixEventInsert, type MatrixEventUpdate, type MatrixMembershipType, type MatrixRoomVisibilityType, } from './matrix.schema';
17
- export { matrixAccountRepository, matrixRoomRepository, matrixEventRepository, } from './matrix.repository';
16
+ export { TaskStatus, taskResource, taskTable, type TaskStatusType, type TaskRow, type TaskInsert, type TaskUpdate, } from './task.schema';
17
+ export { ScheduleKind, ScheduleStatus, scheduleResource, scheduleTable, type ScheduleKindType, type ScheduleStatusType, type ScheduleRow, type ScheduleInsert, type ScheduleUpdate, } from './schedule.schema';
18
+ export { AutomationRuleKind, AutomationRuleStatus, automationRuleResource, automationRuleTable, type AutomationRuleKindType, type AutomationRuleStatusType, type AutomationRuleRow, type AutomationRuleInsert, type AutomationRuleUpdate, } from './automation-rule.schema';
19
+ export { DeliveryKind, DeliveryStatus, deliveryResource, deliveryTable, type DeliveryKindType, type DeliveryStatusType, type DeliveryRow, type DeliveryInsert, type DeliveryUpdate, } from './delivery.schema';
20
+ export { EvidenceKind, evidenceResource, type EvidenceKindType, type EvidenceRow, type EvidenceInsert, type EvidenceUpdate, } from './evidence.schema';
21
+ export { ReportKind, ReportOutcome, ReportStatus, reportResource, type ReportKindType, type ReportOutcomeType, type ReportStatusType, type ReportRow, type ReportInsert, type ReportUpdate, } from './report.schema';
18
22
  export { RunStatus, RunStepType, runResource, runStepResource, runTable, runStepTable, type RunStatusType, type RunStepTypeValue, type RunRow, type RunInsert, type RunUpdate, type RunStepRow, type RunStepInsert, type RunStepUpdate, } from './run.schema';
19
- export { chatResourceId, commandKindFromResourceId, dateParts, messageResourceId, matrixAccountResourceId, matrixEventResourceId, matrixRoomResourceId, parentDir, resourceKey, runResourceId, runStepResourceId, surfaceIdFromCommandResourceId, taskResourceId, threadResourceId, type CommandKind, type DateInput, type DateParts, } from './resource-id-defaults';
23
+ export { dateParts, parentDir, resourceKey, type DateInput, type DateParts, } from './resource-id-defaults';
24
+ export { ideaResource, type IdeaStatus, type IdeaCommitment, type IdeaRow, type IdeaInsert, type IdeaUpdate, } from './idea.schema';
20
25
  export { issueResource, issueTable, type IssueStatus, type IssuePriority, type IssueRow, type IssueInsert, type IssueUpdate, } from './issue.schema';
21
26
  export { issueRepository } from './issue.repository';
22
27
  export { MessageBlockType, MessageBlockStatus, type BaseMessageBlock, type PlaceholderMessageBlock, type MainTextMessageBlock, type ThinkingMessageBlock, type ImageMessageBlock, type CodeMessageBlock, type ToolMessageBlock, type FileMessageBlock, type ErrorMessageBlock, type CitationMessageBlock, type MessageBlock, type MessageRichContent, createMessageBlock, isBlockType, parseMessageBlocks, serializeMessageBlocks, } from './types/message-block';
23
28
  export { type ToolApprovalBlock, type ToolCallBlock, type TaskProgressBlock, type CollaborationRichBlock, type ToolRisk, type ToolApprovalStatus, type ToolCallStatus, type TaskProgressStepStatus, } from "./types/collaboration-blocks";
24
29
  export * from "./fixtures/contracts-chat-contact";
25
- export { fileResource, fileTable, type FileRow, type FileInsert, type FileUpdate, } from './file';
26
30
  export { favoriteResource, favoriteTable, type FavoriteRow, type FavoriteInsert, type FavoriteUpdate, createStarredSyncHook, registerDbForStarredSync, chatStarredSyncHook, threadStarredSyncHook, contactStarredSyncHook, chatSnapshotExtractor, threadSnapshotExtractor, contactSnapshotExtractor, type SnapshotExtractor, type StarredSyncConfig, type SourceModule, } from './favorite';
27
31
  export { settingsResource, settingsTable, SETTING_KEYS, type SettingKey, type SettingsRow, type SettingsInsert, type SettingsUpdate, } from './settings';
28
32
  export { agentResource, agentTable, type AgentRow, type AgentInsert, type AgentUpdate, } from './agent.schema';
29
33
  export { agentRepository } from './agent.repository';
34
+ export { skillResource, skillTable, type SkillRow, type SkillInsert, type SkillUpdate, } from './skill.schema';
30
35
  export { DEFAULT_AGENT_PROVIDERS, type AgentProviderMetadata, type AgentModelOption, } from './agent.providers';
31
- export { sessionResource, sessionTable, buildSessionResourceId, buildSessionSubjectPath, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, type SessionType, type SessionStatus, type SessionRow, type SessionInsert, type SessionUpdate, } from './session';
36
+ export { sessionResource, sessionTable, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, type SessionType, type SessionStatus, type SessionRow, type SessionInsert, type SessionUpdate, } from './session';
32
37
  export { sessionRepository } from './session.repository';
33
- export { approvalResource, approvalTable, buildApprovalSubjectPath, extractApprovalIdFromApprovalRef, type ApprovalRow, type ApprovalInsert, type ApprovalUpdate, } from './approval.schema';
34
- export { auditResource, auditTable, buildAuditSubjectPath, extractAuditIdFromAuditRef, type AuditRow, type AuditInsert, type AuditUpdate, } from './audit.schema';
38
+ export { approvalResource, approvalTable, extractApprovalIdFromApprovalRef, type ApprovalRow, type ApprovalInsert, type ApprovalUpdate, } from './approval.schema';
39
+ export { auditResource, auditTable, extractAuditIdFromAuditRef, type AuditRow, type AuditInsert, type AuditUpdate, } from './audit.schema';
35
40
  export { buildAuditDetailRecord, buildAuditPresentation, createResolvedAuthTimestampsIndex, formatAuditActorRole, formatInboxStatusLabel, type AuditPresentation, } from './audit.presentation';
36
- export { grantResource, grantTable, buildGrantSubjectPath, type GrantRow, type GrantInsert, type GrantUpdate, } from './grant.schema';
41
+ export { grantResource, grantTable, type GrantRow, type GrantInsert, type GrantUpdate, } from './grant.schema';
37
42
  export { inboxNotificationResource, inboxNotificationTable, type InboxNotificationRow, type InboxNotificationInsert, type InboxNotificationUpdate, } from './inbox-notification.schema';
38
- export { ApprovalVocab, AuditVocab, GrantVocab, InboxNotificationVocab } from './vocab/sidecar.vocab';
43
+ export { ApprovalVocab, AuditVocab, GrantVocab, GrantReadVocab, LegacyGrantVocab, InboxNotificationVocab } from './vocab/sidecar.vocab';
39
44
  export * from './sidecar/sidecar-events';
40
45
  export * from './sidecar/persistence-mapping';
41
46
  export { knowledgeFolderSchema, type KnowledgeFolderScope } from './knowledge';
@@ -44,10 +49,10 @@ export { apiKeyCredentialResource, apiKeyCredentialTable, credentialResource, cr
44
49
  export { aiProviderResource, aiProviderTable, type AIProviderRow, type AIProviderInsert, type AIProviderUpdate, } from "./ai-provider.schema";
45
50
  export { aiModelResource, aiModelTable, type AIModelRow, type AIModelInsert, type AIModelUpdate, } from "./ai-model.schema";
46
51
  export { agentStatusResource, agentStatusTable, aiConfigResource, aiConfigTable, indexedFileResource, indexedFileTable, vectorStoreResource, vectorStoreTable, type AgentStatusRow, type AgentStatusInsert, type AgentStatusUpdate, type AIConfigRow, type AIConfigInsert, type AIConfigUpdate as AIConfigResourceUpdate, type IndexedFileRow, type IndexedFileInsert, type IndexedFileUpdate, type VectorStoreRow, type VectorStoreInsert, type VectorStoreUpdate, } from './ai-runtime.schema';
47
- export { aiConfigModelRef, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, getAIConfigDefaultBaseUrl, getAIConfigProviderCatalog, getAIConfigProviderFamilyIds, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, normalizeAIConfigProviderId, normalizeAIConfigModelId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, type AIConfigModel, type AIConfigCredentialSelection, type AIConfigDisconnectPlan, type AIConfigMutationPlan, type AIConfigProviderCatalogEntry, type AIConfigProviderState, type AIConfigUpdate, type BuildAIConfigProviderStateMapOptions, } from './ai-config';
52
+ export { aiConfigModelRef, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, aiConfigRepository, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, getAIConfigDefaultBaseUrl, getAIConfigProviderCatalog, getAIConfigProviderFamilyIds, getAIConfigProviderIdsForBackend, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, normalizeAIConfigProviderId, normalizeAIConfigModelId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, selectAIConfigCredentialForBackend, type AIConfigModel, type AIConfigBackendCredentialSelection, type AIConfigCredentialSelection, type AIConfigDisconnectPlan, type AIConfigMutationPlan, type AIConfigProviderCatalogEntry, type AIConfigProviderState, type AIConfigUpdate, type BuildAIConfigProviderStateMapOptions, } from './ai-config';
48
53
  export { applySolidComunicaPatches, } from './comunica-patches';
49
54
  export { credentialDescriptor, createPodModelDescriptorRegistry, createPodSchema, createPodStorage, officialPodModelDescriptors, podSchema, type PodModelDescriptor, type PodModelDescriptorSource, type PodModelDescriptorTrustLevel, type PodModelFieldDescriptor, type PodModelFieldType, type PodModelMergePolicy, type PodSchemaClassEntry, type PodSchemaPredicateEntry, type PodSchemaSearchEntry, type PodStorageCommitResult, type PodStorageMutationPlan, type PodStorageValidationResult, } from './pod-storage-descriptor';
50
- export { createRepositoryDescriptor, definePodRepository, initSolidResources, initSolidTables, type AnyPodResource, type AnyPodTable, type PodRepositoryDescriptor, type RepositoryCacheOptions, type RepositoryInvalidations, type RepositoryScope, type SolidDatabase, } from './repository';
55
+ export { createResourceRepositoryDescriptor, createRepositoryDescriptor, definePodRepository, initSolidResources, initSolidTables, type AnyPodResource, type AnyPodTable, type PodRepositoryDescriptor, type PodResourceRepositoryOptions, type RepositoryCacheOptions, type RepositoryInvalidations, type RepositoryScope, type SolidDatabase, } from './repository';
51
56
  export { importJobSchema } from './import';
52
57
  export { eq, ne, and, or, drizzle } from '@undefineds.co/drizzle-solid';
53
58
  export { solidResources, solidSchema } from './schema';
package/dist/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  // ============================================
4
4
  export { UDFS, UDFS_NAMESPACE,
5
5
  // Standard vocabs
6
- SIOC, DCTerms, SCHEMA, RDF, RDFS, ACL, ODRL, OWL, FOAF, MEETING, AS, VCARD, WF, LDP,
7
- // xpod vocabs
8
- XPOD_CREDENTIAL, XPOD_AI, } from "./namespaces.js";
6
+ SIOC, DCTerms, SCHEMA, RDF, RDFS, ACL, ODRL, OWL, FOAF, MEETING, AS, VCARD, WF, LDP, } from "./namespaces.js";
9
7
  // Wave A: centralized vocab objects (downstream should prefer these over ad-hoc namespaces)
10
8
  export * from "./vocab/index.js";
11
9
  // ============================================
@@ -21,25 +19,28 @@ export { contactRepository } from './contact.repository.js';
21
19
  // Chat & Message - 聊天和消息
22
20
  export { ChatStatus, chatResource, chatTable, } from './chat.schema.js';
23
21
  export { chatRepository } from './chat.repository.js';
24
- export { extractChatIdFromChatRef, extractChatThreadRef, extractThreadIdFromThreadRef, resolveThreadChatId, toTimestamp, } from './chat.utils.js';
22
+ export { buildChatTargetRef, extractChatIdFromChatRef, extractChatTargetRef, extractChatThreadRef, extractThreadIdFromThreadRef, resolveThreadChatId, toTimestamp, } from './chat.utils.js';
23
+ export { buildModelResourceId, buildModelResourceIri, buildModelResourceIriForDatabase, resolveModelResourceIri, resolveModelResourceIriForDatabase, } from './resource-refs.js';
25
24
  export { ThreadStatus, threadResource, threadTable, } from './thread.schema.js';
26
25
  export { threadRepository } from './thread.repository.js';
27
26
  export { MessageRole, MessageStatus, messageResource, messageTable, } from './message.schema.js';
28
27
  export { messageRepository } from './message.repository.js';
29
- export { TaskStatus, TaskTriggerKind, taskResource, taskTable, } from './task.schema.js';
30
- export { MatrixMembership, MatrixRoomVisibility, matrixAccountResource, matrixAccountTable, matrixRoomResource, matrixRoomTable, matrixEventResource, matrixEventTable, } from './matrix.schema.js';
31
- export { matrixAccountRepository, matrixRoomRepository, matrixEventRepository, } from './matrix.repository.js';
28
+ export { TaskStatus, taskResource, taskTable, } from './task.schema.js';
29
+ export { ScheduleKind, ScheduleStatus, scheduleResource, scheduleTable, } from './schedule.schema.js';
30
+ export { AutomationRuleKind, AutomationRuleStatus, automationRuleResource, automationRuleTable, } from './automation-rule.schema.js';
31
+ export { DeliveryKind, DeliveryStatus, deliveryResource, deliveryTable, } from './delivery.schema.js';
32
+ export { EvidenceKind, evidenceResource, } from './evidence.schema.js';
33
+ export { ReportKind, ReportOutcome, ReportStatus, reportResource, } from './report.schema.js';
32
34
  export { RunStatus, RunStepType, runResource, runStepResource, runTable, runStepTable, } from './run.schema.js';
33
- export { chatResourceId, commandKindFromResourceId, dateParts, messageResourceId, matrixAccountResourceId, matrixEventResourceId, matrixRoomResourceId, parentDir, resourceKey, runResourceId, runStepResourceId, surfaceIdFromCommandResourceId, taskResourceId, threadResourceId, } from './resource-id-defaults.js';
35
+ export { dateParts, parentDir, resourceKey, } from './resource-id-defaults.js';
34
36
  // Issue - user-facing work item that can be inspected through chat/thread
37
+ export { ideaResource, } from './idea.schema.js';
35
38
  export { issueResource, issueTable, } from './issue.schema.js';
36
39
  export { issueRepository } from './issue.repository.js';
37
40
  // Message Block - 消息块类型系统 (Block-based Message System)
38
41
  export { MessageBlockType, MessageBlockStatus, createMessageBlock, isBlockType, parseMessageBlocks, serializeMessageBlocks, } from './types/message-block.js';
39
42
  // Wave A CP0: fixtures for downstream parallel development
40
43
  export * from "./fixtures/contracts-chat-contact.js";
41
- // File - 文件管理
42
- export { fileResource, fileTable, } from './file/index.js';
43
44
  // Favorite - 收藏
44
45
  export { favoriteResource, favoriteTable,
45
46
  // Starred Sync Hook
@@ -49,36 +50,37 @@ export { settingsResource, settingsTable, SETTING_KEYS, } from './settings/index
49
50
  // Agent - AI 助手配置
50
51
  export { agentResource, agentTable, } from './agent.schema.js';
51
52
  export { agentRepository } from './agent.repository.js';
53
+ export { skillResource, skillTable, } from './skill.schema.js';
52
54
  export { DEFAULT_AGENT_PROVIDERS, } from './agent.providers.js';
53
55
  // ============================================
54
56
  // 其他模型
55
57
  // ============================================
56
58
  // Session - 会话管理
57
- export { sessionResource, sessionTable, buildSessionResourceId, buildSessionSubjectPath, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, } from './session/index.js';
59
+ export { sessionResource, sessionTable, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, } from './session/index.js';
58
60
  export { sessionRepository } from './session.repository.js';
59
61
  // Approval / Audit / Grant / Inbox Notification
60
- export { approvalResource, approvalTable, buildApprovalSubjectPath, extractApprovalIdFromApprovalRef, } from './approval.schema.js';
61
- export { auditResource, auditTable, buildAuditSubjectPath, extractAuditIdFromAuditRef, } from './audit.schema.js';
62
+ export { approvalResource, approvalTable, extractApprovalIdFromApprovalRef, } from './approval.schema.js';
63
+ export { auditResource, auditTable, extractAuditIdFromAuditRef, } from './audit.schema.js';
62
64
  export { buildAuditDetailRecord, buildAuditPresentation, createResolvedAuthTimestampsIndex, formatAuditActorRole, formatInboxStatusLabel, } from './audit.presentation.js';
63
- export { grantResource, grantTable, buildGrantSubjectPath, } from './grant.schema.js';
65
+ export { grantResource, grantTable, } from './grant.schema.js';
64
66
  export { inboxNotificationResource, inboxNotificationTable, } from './inbox-notification.schema.js';
65
67
  // Sidecar vocab + runtime contracts
66
- export { ApprovalVocab, AuditVocab, GrantVocab, InboxNotificationVocab } from './vocab/sidecar.vocab.js';
68
+ export { ApprovalVocab, AuditVocab, GrantVocab, GrantReadVocab, LegacyGrantVocab, InboxNotificationVocab } from './vocab/sidecar.vocab.js';
67
69
  export * from './sidecar/sidecar-events.js';
68
70
  export * from './sidecar/persistence-mapping.js';
69
71
  // Knowledge Folder - 知识库文件夹
70
72
  export { knowledgeFolderSchema } from './knowledge/index.js';
71
73
  // Extension - 扩展
72
74
  export { extensionSchema } from './extension/index.js';
73
- // xpod AI schema
75
+ // AI/Credential shared schema
74
76
  export { apiKeyCredentialResource, apiKeyCredentialTable, credentialResource, credentialTable, oauthCredentialResource, oauthCredentialTable, } from "./credential.schema.js";
75
77
  export { aiProviderResource, aiProviderTable, } from "./ai-provider.schema.js";
76
78
  export { aiModelResource, aiModelTable, } from "./ai-model.schema.js";
77
79
  export { agentStatusResource, agentStatusTable, aiConfigResource, aiConfigTable, indexedFileResource, indexedFileTable, vectorStoreResource, vectorStoreTable, } from './ai-runtime.schema.js';
78
- export { aiConfigModelRef, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, getAIConfigDefaultBaseUrl, getAIConfigProviderCatalog, getAIConfigProviderFamilyIds, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, normalizeAIConfigProviderId, normalizeAIConfigModelId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, } from './ai-config/index.js';
80
+ export { aiConfigModelRef, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, aiConfigRepository, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, getAIConfigDefaultBaseUrl, getAIConfigProviderCatalog, getAIConfigProviderFamilyIds, getAIConfigProviderIdsForBackend, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, normalizeAIConfigProviderId, normalizeAIConfigModelId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, selectAIConfigCredentialForBackend, } from './ai-config/index.js';
79
81
  export { applySolidComunicaPatches, } from './comunica-patches.js';
80
82
  export { credentialDescriptor, createPodModelDescriptorRegistry, createPodSchema, createPodStorage, officialPodModelDescriptors, podSchema, } from './pod-storage-descriptor.js';
81
- export { createRepositoryDescriptor, definePodRepository, initSolidResources, initSolidTables, } from './repository.js';
83
+ export { createResourceRepositoryDescriptor, createRepositoryDescriptor, definePodRepository, initSolidResources, initSolidTables, } from './repository.js';
82
84
  // Import Job - 导入任务
83
85
  export { importJobSchema } from './import/index.js';
84
86
  // ============================================
@@ -2,7 +2,7 @@ import { definePodRepository } from './repository.js';
2
2
  import { issueResource } from './issue.schema.js';
3
3
  export const issueRepository = definePodRepository({
4
4
  namespace: 'issue',
5
- table: issueResource,
5
+ resource: issueResource,
6
6
  searchableFields: ['title', 'description'],
7
7
  defaultSort: { field: 'updatedAt', direction: 'desc' },
8
8
  });
@@ -10,7 +10,7 @@ import { threadResource } from './thread.schema.js';
10
10
  * The visible process remains Chat/Thread/Message through chat/thread links.
11
11
  */
12
12
  export const issueResource = podTable('issue', {
13
- id: id('id'),
13
+ id: id('id').default('{key}.ttl'),
14
14
  title: string('title').predicate(DCTerms.title).notNull(),
15
15
  description: text('description').predicate(DCTerms.description),
16
16
  status: string('status').predicate(UDFS.status).notNull().default('open'),
@@ -31,7 +31,6 @@ export const issueResource = podTable('issue', {
31
31
  sparqlEndpoint: '/.data/issues/-/sparql',
32
32
  type: UDFS.Issue,
33
33
  namespace: UDFS,
34
- subjectTemplate: '{id}.ttl',
35
34
  });
36
35
  // Compatibility alias. New model code should prefer `issueResource`.
37
36
  export const issueTable = issueResource;
@@ -1,7 +1,7 @@
1
1
  export type KnowledgeFolderScope = "read" | "contribute";
2
2
  export declare const knowledgeFolderSchema: {
3
3
  folderId: string;
4
- ownerWebId: string;
4
+ owner: string;
5
5
  storageType: string[];
6
6
  defaultKnowledgeScope: BooleanConstructor;
7
7
  };
@@ -1,6 +1,6 @@
1
1
  export const knowledgeFolderSchema = {
2
2
  folderId: "uuid",
3
- ownerWebId: "uri",
3
+ owner: "uri",
4
4
  storageType: ["solid-pod", "client-local"],
5
5
  defaultKnowledgeScope: Boolean
6
6
  };
@@ -1,7 +1,6 @@
1
1
  export declare const messageRepository: import("@undefineds.co/drizzle-solid/dist/core/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
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
4
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
3
+ scope: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
5
4
  chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
6
5
  thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
7
6
  maker: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
@@ -19,14 +18,13 @@ export declare const messageRepository: import("@undefineds.co/drizzle-solid/dis
19
18
  mentions: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
20
19
  replyTo: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
21
20
  routedBy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
22
- routeTargetAgentId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
21
+ routeTargetAgent: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
23
22
  coordinationId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
24
23
  createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
25
24
  updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
26
25
  }>>, {
27
26
  id: string;
28
- commandKind: string;
29
- surfaceId: string;
27
+ scope: string;
30
28
  chat: string;
31
29
  thread: string;
32
30
  maker: string;
@@ -44,15 +42,14 @@ export declare const messageRepository: import("@undefineds.co/drizzle-solid/dis
44
42
  mentions: string[];
45
43
  replyTo: string;
46
44
  routedBy: string;
47
- routeTargetAgentId: string;
45
+ routeTargetAgent: string;
48
46
  coordinationId: string;
49
47
  createdAt: Date;
50
48
  updatedAt: Date;
51
49
  }, {
52
50
  content: string;
53
51
  id?: string | undefined;
54
- commandKind?: string | undefined;
55
- surfaceId?: string | undefined;
52
+ scope?: string | undefined;
56
53
  chat?: string | undefined;
57
54
  thread?: string | undefined;
58
55
  maker?: string | undefined;
@@ -69,14 +66,13 @@ export declare const messageRepository: import("@undefineds.co/drizzle-solid/dis
69
66
  mentions?: string[] | undefined;
70
67
  replyTo?: string | undefined;
71
68
  routedBy?: string | undefined;
72
- routeTargetAgentId?: string | undefined;
69
+ routeTargetAgent?: string | undefined;
73
70
  coordinationId?: string | undefined;
74
71
  createdAt?: Date | undefined;
75
72
  updatedAt?: Date | undefined;
76
73
  }, {
77
74
  id?: string | null | undefined;
78
- commandKind?: string | undefined;
79
- surfaceId?: string | undefined;
75
+ scope?: string | null | undefined;
80
76
  chat?: string | null | undefined;
81
77
  thread?: string | null | undefined;
82
78
  maker?: string | null | undefined;
@@ -94,7 +90,7 @@ export declare const messageRepository: import("@undefineds.co/drizzle-solid/dis
94
90
  mentions?: string[] | null | undefined;
95
91
  replyTo?: string | null | undefined;
96
92
  routedBy?: string | null | undefined;
97
- routeTargetAgentId?: string | null | undefined;
93
+ routeTargetAgent?: string | null | undefined;
98
94
  coordinationId?: string | null | undefined;
99
95
  createdAt?: Date | undefined;
100
96
  updatedAt?: Date | null | undefined;
@@ -2,7 +2,7 @@ import { definePodRepository } from './repository.js';
2
2
  import { messageResource } from './message.schema.js';
3
3
  export const messageRepository = definePodRepository({
4
4
  namespace: 'message',
5
- table: messageResource,
5
+ resource: messageResource,
6
6
  searchableFields: ['content'],
7
7
  defaultSort: { field: 'createdAt', direction: 'asc' },
8
8
  });
@@ -15,9 +15,13 @@ export declare const MessageStatus: {
15
15
  * Message resource (aligned with xpod).
16
16
  *
17
17
  * Product semantics:
18
- * - Message belongs to both a Chat counterpart and a concrete Thread timeline.
19
- * - Chat answers "who/what is this conversation with".
20
- * - Thread answers "which run/timeline/place does this message belong to".
18
+ * - Message belongs to a neutral product scope: usually a Chat, sometimes a
19
+ * Task/thread execution timeline.
20
+ * - Chat remains the Solid Chat compatibility relation. When present, the
21
+ * message is written under the Chat message bucket and projected through
22
+ * wf:message.
23
+ * - Thread is optional and appears when a message participates in an explicit
24
+ * AI/task/branch timeline.
21
25
  *
22
26
  * Storage structure:
23
27
  * - Location: /.data/chat/{chat|id}/{yyyy}/{MM}/{dd}/messages.ttl#{id}
@@ -26,8 +30,7 @@ export declare const MessageStatus: {
26
30
  */
27
31
  export declare const messageResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
28
32
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
29
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
30
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
33
+ scope: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
31
34
  chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
32
35
  thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
33
36
  maker: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
@@ -45,15 +48,14 @@ export declare const messageResource: import("@undefineds.co/drizzle-solid/dist/
45
48
  mentions: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
46
49
  replyTo: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
47
50
  routedBy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
48
- routeTargetAgentId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
51
+ routeTargetAgent: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
49
52
  coordinationId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
50
53
  createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
51
54
  updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
52
55
  }>>;
53
56
  export declare const messageTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
54
57
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
55
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
56
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
58
+ scope: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
57
59
  chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
58
60
  thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
59
61
  maker: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
@@ -71,7 +73,7 @@ export declare const messageTable: import("@undefineds.co/drizzle-solid/dist/cor
71
73
  mentions: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
72
74
  replyTo: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
73
75
  routedBy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
74
- routeTargetAgentId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
76
+ routeTargetAgent: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
75
77
  coordinationId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
76
78
  createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
77
79
  updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
@@ -1,8 +1,8 @@
1
- import { object, podTable, uri, string, text, timestamp, id } from '@undefineds.co/drizzle-solid';
1
+ import { object, podTable, uri, string, text, timestamp, id, renderDefaultIdTemplate } from '@undefineds.co/drizzle-solid';
2
2
  import { UDFS, DCTerms, FOAF, MEETING, SCHEMA, SIOC, WF } from './namespaces.js';
3
3
  import { chatResource } from './chat.schema.js';
4
4
  import { threadResource } from './thread.schema.js';
5
- import { messageResourceId } from './resource-id-defaults.js';
5
+ import { resourceKey } from './resource-id-defaults.js';
6
6
  export const MessageRole = {
7
7
  USER: 'user',
8
8
  ASSISTANT: 'assistant',
@@ -18,9 +18,13 @@ export const MessageStatus = {
18
18
  * Message resource (aligned with xpod).
19
19
  *
20
20
  * Product semantics:
21
- * - Message belongs to both a Chat counterpart and a concrete Thread timeline.
22
- * - Chat answers "who/what is this conversation with".
23
- * - Thread answers "which run/timeline/place does this message belong to".
21
+ * - Message belongs to a neutral product scope: usually a Chat, sometimes a
22
+ * Task/thread execution timeline.
23
+ * - Chat remains the Solid Chat compatibility relation. When present, the
24
+ * message is written under the Chat message bucket and projected through
25
+ * wf:message.
26
+ * - Thread is optional and appears when a message participates in an explicit
27
+ * AI/task/branch timeline.
24
28
  *
25
29
  * Storage structure:
26
30
  * - Location: /.data/chat/{chat|id}/{yyyy}/{MM}/{dd}/messages.ttl#{id}
@@ -28,16 +32,27 @@ export const MessageStatus = {
28
32
  * - chat/thread are RDF URI relations. Short ids remain accepted at API/query call sites via ORM URI template resolution.
29
33
  */
30
34
  export const messageResource = podTable('chat_message', {
31
- id: id('id').default(messageResourceId),
32
- commandKind: string('commandKind').predicate(UDFS.commandKind).notNull().default('chat'),
33
- surfaceId: string('surfaceId').predicate(UDFS.surfaceId).notNull().default('default'),
34
- // Chat relation. In RDF this is an inverse Solid Chat link: <chat> wf:message <message>.
35
+ id: id('id').default((key, row) => (renderDefaultIdTemplate(row?.chat
36
+ ? 'chat/{chat.key}/{yyyy}/{MM}/{dd}/messages.ttl#{key}'
37
+ : row?.thread
38
+ ? '{thread.dir}/{yyyy}/{MM}/{dd}/messages.ttl#{key}'
39
+ : '{scope.dir}/{yyyy}/{MM}/{dd}/messages.ttl#{key}', {
40
+ key: resourceKey(key, 'msg'),
41
+ row,
42
+ links: {
43
+ chat: chatResource,
44
+ thread: threadResource,
45
+ },
46
+ }))),
47
+ // Canonical product owner scope. The object can be a Chat, Task, Thread, or future command surface.
48
+ scope: uri('scope').predicate(UDFS.inScope),
49
+ // Solid Chat compatibility relation. In RDF this is an inverse link: <chat> wf:message <message>.
35
50
  chat: uri('chat').predicate(WF.message).inverse().link(chatResource),
36
- // Thread relation. In RDF this is an inverse Solid Chat/SIOC link: <thread> sioc:has_member <message>.
37
- thread: uri('thread').predicate(SIOC.hasContainer).link(threadResource),
51
+ // Optional Thread relation. In RDF this is an inverse Solid Chat/SIOC link: <thread> sioc:has_member <message>.
52
+ thread: uri('thread').predicate(SIOC.has_member).inverse().link(threadResource),
38
53
  // maker is the entity URI of the message author:
39
54
  // - User: their WebID (https://user.pod/profile/card#me)
40
- // - AI: Agent URI (/.data/agents/{id}.ttl#this)
55
+ // - AI: Agent URI (/agents/{id}/)
41
56
  // - External: Contact URI (/.data/contacts/{id}.ttl#this)
42
57
  // No reference() constraint - accepts any valid URI.
43
58
  maker: uri('maker').predicate(FOAF.maker),
@@ -47,6 +62,7 @@ export const messageResource = podTable('chat_message', {
47
62
  status: string('status').predicate(UDFS.messageStatus).notNull().default(MessageStatus.COMPLETED),
48
63
  toolName: string('toolName').predicate(UDFS.toolName),
49
64
  toolCallId: string('toolCallId').predicate(UDFS.toolCallId),
65
+ // Opaque protocol/local/UI metadata only. Shared relations must be explicit URI fields.
50
66
  metadata: object('metadata').predicate(UDFS.metadata),
51
67
  replacedBy: string('replacedBy').predicate(DCTerms.isReplacedBy),
52
68
  deletedAt: timestamp('deletedAt').predicate(SCHEMA.dateDeleted),
@@ -57,7 +73,7 @@ export const messageResource = podTable('chat_message', {
57
73
  replyTo: uri('replyTo').predicate(UDFS.replyTo),
58
74
  // Multi-AI routing
59
75
  routedBy: uri('routedBy').predicate(UDFS.routedBy),
60
- routeTargetAgentId: string('routeTargetAgentId').predicate(UDFS.routeTargetAgentId),
76
+ routeTargetAgent: uri('routeTargetAgent').predicate(UDFS.routeTargetAgent),
61
77
  coordinationId: string('coordinationId').predicate(UDFS.coordinationId),
62
78
  createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
63
79
  updatedAt: timestamp('updatedAt').predicate(DCTerms.modified),
@@ -171,5 +171,3 @@ export declare const WF: NamespaceObject;
171
171
  export declare const AS: NamespaceObject;
172
172
  export declare const UDFS: NamespaceObject;
173
173
  export declare const UDFS_NAMESPACE: string;
174
- export declare const XPOD_CREDENTIAL: NamespaceObject;
175
- export declare const XPOD_AI: NamespaceObject;