@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
@@ -1,3 +1,4 @@
1
+ import { normalizePodDataResourceId } from '@undefineds.co/drizzle-solid';
1
2
  export function dateParts(value) {
2
3
  const date = value instanceof Date
3
4
  ? value
@@ -16,6 +17,15 @@ export function resourceKey(key, prefix) {
16
17
  ? key
17
18
  : `${prefix}_${Math.random().toString(36).slice(2, 12)}`;
18
19
  }
20
+ export function workflowOwnerDir(row) {
21
+ return taskDir(row)
22
+ ?? runDir(row)
23
+ ?? deliveryDir(row)
24
+ ?? issueDir(row)
25
+ ?? threadDir(row)
26
+ ?? chatDir(row)
27
+ ?? aboutDir(row);
28
+ }
19
29
  export function parentDir(id) {
20
30
  if (!id)
21
31
  return null;
@@ -25,84 +35,67 @@ export function parentDir(id) {
25
35
  return null;
26
36
  return parts.slice(0, -1).join('/');
27
37
  }
28
- export function surfaceIdFromCommandResourceId(id) {
29
- if (!id)
38
+ function chatDir(row) {
39
+ const chat = typeof row?.chat === 'string' ? row.chat : undefined;
40
+ if (!chat)
30
41
  return null;
31
- const match = id.match(/^(chat|task)\/([^/]+)\//);
32
- return match ? decodeURIComponent(match[2]) : null;
42
+ const resourceId = normalizePodDataResourceId(chat);
43
+ const match = resourceId.match(/^chat\/(.+)\/index\.ttl#this$/);
44
+ return match?.[1] ? `chat/${match[1]}` : null;
33
45
  }
34
- export function commandKindFromResourceId(id) {
35
- if (!id)
46
+ function threadDir(row) {
47
+ const thread = typeof row?.thread === 'string' ? row.thread : undefined;
48
+ if (!thread)
36
49
  return null;
37
- const match = id.match(/^(chat|task)\//);
38
- return match?.[1] === 'task' ? 'task' : match?.[1] === 'chat' ? 'chat' : null;
39
- }
40
- export function chatResourceId(key) {
41
- return `${resourceKey(key, 'chat')}/index.ttl#this`;
42
- }
43
- export function taskResourceId(key) {
44
- return `index.ttl#${resourceKey(key, 'task')}`;
45
- }
46
- export function threadResourceId(key, row) {
47
- const localKey = resourceKey(key, 'thread');
48
- const commandKind = row?.commandKind === 'task' ? 'task' : 'chat';
49
- const surfaceId = typeof row?.surfaceId === 'string' && row.surfaceId.length > 0
50
- ? row.surfaceId
51
- : surfaceIdFromCommandResourceId(typeof row?.id === 'string' ? row.id : undefined) ?? 'default';
52
- return `${commandKind}/${surfaceId}/index.ttl#${localKey}`;
53
- }
54
- export function messageResourceId(key, row) {
55
- const localKey = resourceKey(key, 'msg');
56
- const commandKind = row?.commandKind === 'task' ? 'task' : 'chat';
57
- const surfaceId = typeof row?.surfaceId === 'string' && row.surfaceId.length > 0
58
- ? row.surfaceId
59
- : surfaceIdFromCommandResourceId(typeof row?.thread === 'string' ? row.thread : undefined) ?? 'default';
60
- const { yyyy, MM, dd } = dateParts(row?.createdAt);
61
- return `${commandKind}/${surfaceId}/${yyyy}/${MM}/${dd}/messages.ttl#${localKey}`;
50
+ const resourceId = normalizePodDataResourceId(thread);
51
+ const match = resourceId.match(/^((?:chat|task)\/.+)\/index\.ttl#[^#/]+$/);
52
+ return match?.[1] ?? null;
62
53
  }
63
- export function runResourceId(key, row) {
64
- const localKey = resourceKey(key, 'run');
65
- const commandKind = row?.commandKind === 'task' ? 'task' : 'chat';
66
- const surfaceId = typeof row?.surfaceId === 'string' && row.surfaceId.length > 0
67
- ? row.surfaceId
68
- : surfaceIdFromCommandResourceId(typeof row?.thread === 'string' ? row.thread : undefined) ?? 'default';
69
- const { yyyy, MM, dd } = dateParts(row?.createdAt);
70
- return `${commandKind}/${surfaceId}/${yyyy}/${MM}/${dd}/runs.ttl#${localKey}`;
71
- }
72
- export function runStepResourceId(key, row) {
73
- const localKey = resourceKey(key, 'run-step');
74
- const runId = typeof row?.runId === 'string' ? row.runId : undefined;
75
- if (runId && /^(chat|task)\/[^/]+\/\d{4}\/\d{2}\/\d{2}\/runs\.ttl#[^#/]+$/.test(runId)) {
76
- return `${runId.slice(0, runId.lastIndexOf('#') + 1)}${localKey}`;
77
- }
78
- const commandKind = row?.commandKind === 'task' ? 'task' : 'chat';
79
- const surfaceId = typeof row?.surfaceId === 'string' && row.surfaceId.length > 0
80
- ? row.surfaceId
81
- : 'default';
82
- const { yyyy, MM, dd } = dateParts(row?.createdAt);
83
- return `${commandKind}/${surfaceId}/${yyyy}/${MM}/${dd}/runs.ttl#${localKey}`;
54
+ function taskDir(row) {
55
+ const task = typeof row?.task === 'string' ? row.task : undefined;
56
+ if (!task)
57
+ return null;
58
+ const resourceId = normalizePodDataResourceId(task);
59
+ if (resourceId === 'task/index.ttl#this')
60
+ return 'task';
61
+ const legacyIndexMatch = resourceId.match(/^task\/index\.ttl#([^#/]+)$/);
62
+ if (legacyIndexMatch?.[1])
63
+ return `task/${legacyIndexMatch[1]}`;
64
+ const match = resourceId.match(/^task\/(.+)\.ttl(?:#[^#/]+)?$/);
65
+ return match?.[1] ? `task/${match[1]}` : null;
84
66
  }
85
- function sanitizePathSlot(value, fallback) {
86
- const raw = value && value.length > 0 ? value : resourceKey(undefined, fallback);
87
- return encodeURIComponent(raw)
88
- .replace(/[!'()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`)
89
- .replace(/%/g, '~');
67
+ function issueDir(row) {
68
+ const issue = typeof row?.issue === 'string' ? row.issue : undefined;
69
+ if (!issue)
70
+ return null;
71
+ const resourceId = normalizePodDataResourceId(issue);
72
+ const match = resourceId.match(/^issues\/(.+)\.ttl(?:#[^#/]+)?$/);
73
+ return match?.[1] ? `issues/${match[1]}` : null;
90
74
  }
91
- export function matrixAccountResourceId(key, row) {
92
- const matrixUserId = typeof row?.matrixUserId === 'string' ? row.matrixUserId : undefined;
93
- const localKey = sanitizePathSlot(key ?? matrixUserId, 'matrix-user');
94
- return `accounts/${localKey}.ttl#this`;
75
+ function deliveryDir(row) {
76
+ const delivery = typeof row?.delivery === 'string' ? row.delivery : undefined;
77
+ if (!delivery)
78
+ return null;
79
+ const resourceId = normalizePodDataResourceId(delivery);
80
+ const match = resourceId.match(/^(.+)\/\d{4}\/\d{2}\/\d{2}\/deliveries\.ttl#[^#/]+$/);
81
+ return match?.[1] ?? null;
95
82
  }
96
- export function matrixRoomResourceId(key, row) {
97
- const matrixRoomId = typeof row?.matrixRoomId === 'string' ? row.matrixRoomId : undefined;
98
- const localKey = sanitizePathSlot(key ?? matrixRoomId, 'matrix-room');
99
- return `rooms/${localKey}/index.ttl#this`;
83
+ function runDir(row) {
84
+ const run = typeof row?.run === 'string' ? row.run : undefined;
85
+ if (!run)
86
+ return null;
87
+ const resourceId = normalizePodDataResourceId(run);
88
+ const match = resourceId.match(/^(.+)\/\d{4}\/\d{2}\/\d{2}\/runs\.ttl#[^#/]+$/);
89
+ return match?.[1] ?? null;
100
90
  }
101
- export function matrixEventResourceId(key, row) {
102
- const matrixEventId = typeof row?.matrixEventId === 'string' ? row.matrixEventId : undefined;
103
- const matrixRoomId = typeof row?.matrixRoomId === 'string' ? row.matrixRoomId : undefined;
104
- const localKey = sanitizePathSlot(key ?? matrixEventId, 'matrix-event');
105
- const roomSlot = sanitizePathSlot(matrixRoomId, 'matrix-room');
106
- const { yyyy, MM, dd } = dateParts(row?.createdAt ?? row?.originServerTs);
107
- return `rooms/${roomSlot}/${yyyy}/${MM}/${dd}/events.ttl#${localKey}`;
91
+ function aboutDir(row) {
92
+ const about = typeof row?.about === 'string' ? row.about : undefined;
93
+ if (!about)
94
+ return null;
95
+ return runDir({ run: about })
96
+ ?? deliveryDir({ delivery: about })
97
+ ?? taskDir({ task: about })
98
+ ?? issueDir({ issue: about })
99
+ ?? threadDir({ thread: about })
100
+ ?? chatDir({ chat: about });
108
101
  }
@@ -0,0 +1,25 @@
1
+ import type { PodResource, PodResourceTarget } from '@undefineds.co/drizzle-solid';
2
+ type ModelResource = PodResource<any>;
3
+ export type ModelResourceTarget = PodResourceTarget;
4
+ /**
5
+ * @deprecated New code should call `resource.buildId(target)` directly.
6
+ */
7
+ export declare function buildModelResourceId(resource: ModelResource, target: ModelResourceTarget): string;
8
+ /**
9
+ * @deprecated New code should call `resource.buildIri(webIdOrPodUrl, target)` directly.
10
+ */
11
+ export declare function buildModelResourceIri(webIdOrPodUrl: string, resource: ModelResource, target: ModelResourceTarget): string;
12
+ /**
13
+ * @deprecated New code should call `resource.buildIriForDatabase(database, target)` directly.
14
+ */
15
+ export declare function buildModelResourceIriForDatabase(database: unknown, resource: ModelResource, target: ModelResourceTarget): string;
16
+ /**
17
+ * @deprecated New code should call `resource.buildIri(...)` and catch only when
18
+ * a nullable result is part of the business contract.
19
+ */
20
+ export declare function resolveModelResourceIri(webIdOrPodUrl: string, resource: ModelResource, target: ModelResourceTarget | null | undefined): string | null;
21
+ /**
22
+ * @deprecated New code should call `resource.resolveIriForDatabase(database, target)`.
23
+ */
24
+ export declare function resolveModelResourceIriForDatabase(database: unknown, resource: ModelResource, target: ModelResourceTarget | null | undefined): string | null;
25
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @deprecated New code should call `resource.buildId(target)` directly.
3
+ */
4
+ export function buildModelResourceId(resource, target) {
5
+ return resource.buildId(target);
6
+ }
7
+ /**
8
+ * @deprecated New code should call `resource.buildIri(webIdOrPodUrl, target)` directly.
9
+ */
10
+ export function buildModelResourceIri(webIdOrPodUrl, resource, target) {
11
+ return resource.buildIri(webIdOrPodUrl, target);
12
+ }
13
+ /**
14
+ * @deprecated New code should call `resource.buildIriForDatabase(database, target)` directly.
15
+ */
16
+ export function buildModelResourceIriForDatabase(database, resource, target) {
17
+ return resource.buildIriForDatabase(database, target);
18
+ }
19
+ /**
20
+ * @deprecated New code should call `resource.buildIri(...)` and catch only when
21
+ * a nullable result is part of the business contract.
22
+ */
23
+ export function resolveModelResourceIri(webIdOrPodUrl, resource, target) {
24
+ if (!target)
25
+ return null;
26
+ try {
27
+ return buildModelResourceIri(webIdOrPodUrl, resource, target);
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ /**
34
+ * @deprecated New code should call `resource.resolveIriForDatabase(database, target)`.
35
+ */
36
+ export function resolveModelResourceIriForDatabase(database, resource, target) {
37
+ if (!target)
38
+ return null;
39
+ try {
40
+ return buildModelResourceIriForDatabase(database, resource, target);
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
@@ -33,9 +33,10 @@ export type RunStepTypeValue = (typeof RunStepType)[keyof typeof RunStepType];
33
33
  */
34
34
  export declare const runResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
35
35
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
36
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
37
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
38
36
  task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
37
+ delivery: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
38
+ trigger: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
39
+ input: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
39
40
  thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
40
41
  workspace: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
41
42
  status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
@@ -56,26 +57,24 @@ export declare const runResource: import("@undefineds.co/drizzle-solid/dist/core
56
57
  /**
57
58
  * RunStep resource.
58
59
  *
59
- * Append-only execution facts emitted while a Run executes. `runId` is a
60
- * denormalized base-relative id for fast lookup; `run` is the semantic RDF
61
- * relation to the Run.
60
+ * Append-only execution facts emitted while a Run executes. `run` is the
61
+ * semantic RDF relation to the Run; storage colocation is derived from that
62
+ * relation by the id default helper.
62
63
  */
63
64
  export declare const runStepResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
64
65
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
65
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
66
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
67
- runId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
68
66
  run: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
69
- type: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
67
+ stepType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
70
68
  message: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
71
- data: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
69
+ payload: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
72
70
  createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
73
71
  }>>;
74
72
  export declare const runTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
75
73
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
76
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
77
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
78
74
  task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
75
+ delivery: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
76
+ trigger: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
77
+ input: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
79
78
  thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
80
79
  workspace: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
81
80
  status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
@@ -95,13 +94,10 @@ export declare const runTable: import("@undefineds.co/drizzle-solid/dist/core/sc
95
94
  }>>;
96
95
  export declare const runStepTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
97
96
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
98
- commandKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
99
- surfaceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
100
- runId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
101
97
  run: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
102
- type: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
98
+ stepType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
103
99
  message: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
104
- data: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
100
+ payload: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
105
101
  createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
106
102
  }>>;
107
103
  export type RunRow = typeof runResource.$inferSelect;
@@ -1,8 +1,8 @@
1
1
  import { id, object, podTable, string, timestamp, uri } from '@undefineds.co/drizzle-solid';
2
2
  import { DCTerms, UDFS } from './namespaces.js';
3
+ import { deliveryResource } from './delivery.schema.js';
3
4
  import { taskResource } from './task.schema.js';
4
5
  import { threadResource } from './thread.schema.js';
5
- import { runResourceId, runStepResourceId } from './resource-id-defaults.js';
6
6
  export const RunStatus = {
7
7
  QUEUED: 'queued',
8
8
  RUNNING: 'running',
@@ -35,10 +35,11 @@ export const RunStepType = {
35
35
  * Task describe command shape; Run describes the concrete runtime execution.
36
36
  */
37
37
  export const runResource = podTable('run', {
38
- id: id('id').default(runResourceId),
39
- commandKind: string('commandKind').predicate(UDFS.commandKind).notNull().default('chat'),
40
- surfaceId: string('surfaceId').predicate(UDFS.surfaceId).notNull().default('default'),
38
+ id: id('id').default('{thread.dir}/{yyyy}/{MM}/{dd}/runs.ttl#{key}'),
41
39
  task: uri('task').predicate(UDFS.task).link(taskResource),
40
+ delivery: uri('delivery').predicate(UDFS.delivery).link(deliveryResource),
41
+ trigger: uri('trigger').predicate(UDFS.trigger),
42
+ input: uri('input').predicate(UDFS.input),
42
43
  thread: uri('thread').predicate(UDFS.inThread).notNull().link(threadResource),
43
44
  workspace: uri('workspace').predicate(UDFS.workspace).notNull(),
44
45
  status: string('status').predicate(UDFS.status).notNull().default(RunStatus.QUEUED),
@@ -50,6 +51,7 @@ export const runResource = podTable('run', {
50
51
  heartbeatAt: timestamp('heartbeatAt').predicate(UDFS.heartbeatAt),
51
52
  cancelRequestedAt: timestamp('cancelRequestedAt').predicate(UDFS.cancelRequestedAt),
52
53
  error: string('error').predicate(UDFS.error),
54
+ // Opaque protocol/local/UI metadata only. Shared relations must be explicit URI fields.
53
55
  metadata: object('metadata').predicate(UDFS.metadata),
54
56
  createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
55
57
  startedAt: timestamp('startedAt').predicate(UDFS.startedAt),
@@ -64,19 +66,16 @@ export const runResource = podTable('run', {
64
66
  /**
65
67
  * RunStep resource.
66
68
  *
67
- * Append-only execution facts emitted while a Run executes. `runId` is a
68
- * denormalized base-relative id for fast lookup; `run` is the semantic RDF
69
- * relation to the Run.
69
+ * Append-only execution facts emitted while a Run executes. `run` is the
70
+ * semantic RDF relation to the Run; storage colocation is derived from that
71
+ * relation by the id default helper.
70
72
  */
71
73
  export const runStepResource = podTable('run_step', {
72
- id: id('id').default(runStepResourceId),
73
- commandKind: string('commandKind').predicate(UDFS.commandKind).notNull().default('chat'),
74
- surfaceId: string('surfaceId').predicate(UDFS.surfaceId).notNull().default('default'),
75
- runId: string('runId').predicate(UDFS.runId).notNull(),
74
+ id: id('id').default('{run.doc}#{key}'),
76
75
  run: uri('run').predicate(UDFS.run).notNull().link(runResource),
77
- type: string('type').predicate(UDFS.status).notNull(),
76
+ stepType: string('stepType').predicate(UDFS.stepType).notNull(),
78
77
  message: string('message').predicate(DCTerms.description),
79
- data: object('data').predicate(UDFS.metadata),
78
+ payload: object('payload').predicate(UDFS.payload),
80
79
  createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
81
80
  }, {
82
81
  base: '/.data/',
@@ -0,0 +1,56 @@
1
+ export type ScheduleStatusType = 'active' | 'paused' | 'completed' | 'failed' | 'cancelled';
2
+ export type ScheduleKindType = 'once' | 'interval' | 'cron';
3
+ export declare const ScheduleStatus: {
4
+ readonly ACTIVE: "active";
5
+ readonly PAUSED: "paused";
6
+ readonly COMPLETED: "completed";
7
+ readonly FAILED: "failed";
8
+ readonly CANCELLED: "cancelled";
9
+ };
10
+ export declare const ScheduleKind: {
11
+ readonly ONCE: "once";
12
+ readonly INTERVAL: "interval";
13
+ readonly CRON: "cron";
14
+ };
15
+ /**
16
+ * Schedule resource.
17
+ *
18
+ * Schedule owns time-based triggering for a Task. It intentionally does not
19
+ * select a runner or record a concrete execution attempt; those belong to Run.
20
+ *
21
+ * The id template is intentionally left unset. Callers must provide an exact
22
+ * base-relative id until the durable storage path is designed.
23
+ */
24
+ export declare const scheduleResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
25
+ id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
26
+ task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
27
+ status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
28
+ scheduleKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
29
+ cron: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
30
+ intervalSeconds: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, false>;
31
+ timezone: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
32
+ startsAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
33
+ nextRunAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
34
+ lastRunAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
35
+ metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
36
+ createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
37
+ updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
38
+ }>>;
39
+ export declare const scheduleTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
40
+ id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
41
+ task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
42
+ status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
43
+ scheduleKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
44
+ cron: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
45
+ intervalSeconds: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, false>;
46
+ timezone: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
47
+ startsAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
48
+ nextRunAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
49
+ lastRunAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
50
+ metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
51
+ createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
52
+ updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
53
+ }>>;
54
+ export type ScheduleRow = typeof scheduleResource.$inferSelect;
55
+ export type ScheduleInsert = typeof scheduleResource.$inferInsert;
56
+ export type ScheduleUpdate = typeof scheduleResource.$inferUpdate;
@@ -0,0 +1,46 @@
1
+ import { id, integer, object, podTable, string, timestamp, uri } from '@undefineds.co/drizzle-solid';
2
+ import { DCTerms, UDFS } from './namespaces.js';
3
+ import { taskResource } from './task.schema.js';
4
+ export const ScheduleStatus = {
5
+ ACTIVE: 'active',
6
+ PAUSED: 'paused',
7
+ COMPLETED: 'completed',
8
+ FAILED: 'failed',
9
+ CANCELLED: 'cancelled',
10
+ };
11
+ export const ScheduleKind = {
12
+ ONCE: 'once',
13
+ INTERVAL: 'interval',
14
+ CRON: 'cron',
15
+ };
16
+ /**
17
+ * Schedule resource.
18
+ *
19
+ * Schedule owns time-based triggering for a Task. It intentionally does not
20
+ * select a runner or record a concrete execution attempt; those belong to Run.
21
+ *
22
+ * The id template is intentionally left unset. Callers must provide an exact
23
+ * base-relative id until the durable storage path is designed.
24
+ */
25
+ export const scheduleResource = podTable('schedule', {
26
+ id: id('id'),
27
+ task: uri('task').predicate(UDFS.task).notNull().link(taskResource),
28
+ status: string('status').predicate(UDFS.status).notNull().default(ScheduleStatus.ACTIVE),
29
+ scheduleKind: string('scheduleKind').predicate(UDFS.scheduleKind).notNull().default(ScheduleKind.ONCE),
30
+ cron: string('cron').predicate(UDFS.cron),
31
+ intervalSeconds: integer('intervalSeconds').predicate(UDFS.intervalSeconds),
32
+ timezone: string('timezone').predicate(UDFS.timezone),
33
+ startsAt: timestamp('startsAt').predicate(UDFS.startsAt),
34
+ nextRunAt: timestamp('nextRunAt').predicate(UDFS.nextRunAt),
35
+ lastRunAt: timestamp('lastRunAt').predicate(UDFS.lastRunAt),
36
+ metadata: object('metadata').predicate(UDFS.metadata),
37
+ createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
38
+ updatedAt: timestamp('updatedAt').predicate(DCTerms.modified).notNull().defaultNow(),
39
+ }, {
40
+ base: '/.data/',
41
+ sparqlEndpoint: '/.data/-/sparql',
42
+ type: UDFS.Schedule,
43
+ namespace: UDFS,
44
+ });
45
+ // Compatibility alias. New model code should prefer `scheduleResource`.
46
+ export const scheduleTable = scheduleResource;