@yolk-sdk/knowledge 0.1.0-canary.13 → 0.1.0-canary.130

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 (97) hide show
  1. package/README.md +160 -80
  2. package/dist/agent.d.mts +118 -19
  3. package/dist/agent.d.mts.map +1 -1
  4. package/dist/agent.mjs +256 -34
  5. package/dist/agent.mjs.map +1 -1
  6. package/dist/chunking.d.mts +13 -16
  7. package/dist/chunking.d.mts.map +1 -1
  8. package/dist/chunking.mjs +4 -4
  9. package/dist/chunking.mjs.map +1 -1
  10. package/dist/context.d.mts +4 -13
  11. package/dist/context.d.mts.map +1 -1
  12. package/dist/context.mjs +17 -13
  13. package/dist/context.mjs.map +1 -1
  14. package/dist/documents.d.mts +128 -78
  15. package/dist/documents.d.mts.map +1 -1
  16. package/dist/documents.mjs +89 -61
  17. package/dist/documents.mjs.map +1 -1
  18. package/dist/embeddings.d.mts +4 -7
  19. package/dist/embeddings.d.mts.map +1 -1
  20. package/dist/embeddings.mjs +1 -2
  21. package/dist/embeddings.mjs.map +1 -1
  22. package/dist/errors.d.mts +19 -22
  23. package/dist/errors.d.mts.map +1 -1
  24. package/dist/errors.mjs +12 -13
  25. package/dist/errors.mjs.map +1 -1
  26. package/dist/extraction.d.mts +4 -7
  27. package/dist/extraction.d.mts.map +1 -1
  28. package/dist/extraction.mjs +1 -2
  29. package/dist/extraction.mjs.map +1 -1
  30. package/dist/files.d.mts +19 -0
  31. package/dist/files.d.mts.map +1 -0
  32. package/dist/files.mjs +6 -0
  33. package/dist/files.mjs.map +1 -0
  34. package/dist/index.d.mts +4 -4
  35. package/dist/index.mjs +4 -4
  36. package/dist/ingestion.d.mts +21 -23
  37. package/dist/ingestion.d.mts.map +1 -1
  38. package/dist/ingestion.mjs +12 -17
  39. package/dist/ingestion.mjs.map +1 -1
  40. package/dist/search.d.mts +13 -17
  41. package/dist/search.d.mts.map +1 -1
  42. package/dist/search.mjs +9 -12
  43. package/dist/search.mjs.map +1 -1
  44. package/dist/store.d.mts +92 -29
  45. package/dist/store.d.mts.map +1 -1
  46. package/dist/store.mjs +3 -3
  47. package/dist/store.mjs.map +1 -1
  48. package/dist/summarization.d.mts +6 -9
  49. package/dist/summarization.d.mts.map +1 -1
  50. package/dist/summarization.mjs +1 -2
  51. package/dist/summarization.mjs.map +1 -1
  52. package/package.json +11 -41
  53. package/src/agent.ts +393 -65
  54. package/src/chunking.ts +27 -8
  55. package/src/context.ts +21 -16
  56. package/src/documents.ts +140 -71
  57. package/src/errors.ts +4 -4
  58. package/src/extraction.ts +4 -3
  59. package/src/files.ts +24 -0
  60. package/src/index.ts +6 -3
  61. package/src/ingestion.ts +46 -27
  62. package/src/search.ts +90 -62
  63. package/src/store.ts +139 -25
  64. package/src/summarization.ts +4 -3
  65. package/dist/artifacts.d.mts +0 -37
  66. package/dist/artifacts.d.mts.map +0 -1
  67. package/dist/artifacts.mjs +0 -28
  68. package/dist/artifacts.mjs.map +0 -1
  69. package/dist/links.d.mts +0 -17
  70. package/dist/links.d.mts.map +0 -1
  71. package/dist/links.mjs +0 -24
  72. package/dist/links.mjs.map +0 -1
  73. package/dist/provenance.d.mts +0 -20
  74. package/dist/provenance.d.mts.map +0 -1
  75. package/dist/provenance.mjs +0 -26
  76. package/dist/provenance.mjs.map +0 -1
  77. package/dist/records.d.mts +0 -59
  78. package/dist/records.d.mts.map +0 -1
  79. package/dist/records.mjs +0 -64
  80. package/dist/records.mjs.map +0 -1
  81. package/dist/representations.d.mts +0 -36
  82. package/dist/representations.d.mts.map +0 -1
  83. package/dist/representations.mjs +0 -44
  84. package/dist/representations.mjs.map +0 -1
  85. package/dist/search-store.d.mts +0 -77
  86. package/dist/search-store.d.mts.map +0 -1
  87. package/dist/search-store.mjs +0 -7
  88. package/dist/search-store.mjs.map +0 -1
  89. package/dist/vector-store.d.mts +0 -3
  90. package/dist/vector-store.mjs +0 -2
  91. package/src/artifacts.ts +0 -48
  92. package/src/links.ts +0 -23
  93. package/src/provenance.ts +0 -25
  94. package/src/records.ts +0 -76
  95. package/src/representations.ts +0 -51
  96. package/src/search-store.ts +0 -98
  97. package/src/vector-store.ts +0 -6
@@ -1,59 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
-
3
- //#region src/records.d.ts
4
- declare const NonEmptyTrimmedString: Schema.Trimmed;
5
- declare const NonNegativeInteger: Schema.Int;
6
- declare const PositiveInteger: Schema.Int;
7
- declare const KnowledgeMetadataSchema: Schema.$Record<Schema.String, Schema.Unknown>;
8
- type KnowledgeMetadata = Schema.Schema.Type<typeof KnowledgeMetadataSchema>;
9
- declare const KnowledgeRecordRoleSchema: Schema.Literals<readonly ["source", "note", "operating_protocol", "knowledge_map", "compiled_truth", "decision"]>;
10
- type KnowledgeRecordRole = Schema.Schema.Type<typeof KnowledgeRecordRoleSchema>;
11
- declare const KnowledgeContextPolicySchema: Schema.Literals<readonly ["pinned", "routable", "searchable", "archived"]>;
12
- type KnowledgeContextPolicy = Schema.Schema.Type<typeof KnowledgeContextPolicySchema>;
13
- declare const KnowledgeLifecycleStatusSchema: Schema.Literals<readonly ["draft", "processing", "ready", "error", "archived", "deleted"]>;
14
- type KnowledgeLifecycleStatus = Schema.Schema.Type<typeof KnowledgeLifecycleStatusSchema>;
15
- declare const KnowledgeScopeSchema: Schema.Struct<{
16
- readonly id: Schema.Trimmed;
17
- readonly kind: Schema.optional<Schema.Trimmed>;
18
- }>;
19
- type KnowledgeScope = Schema.Schema.Type<typeof KnowledgeScopeSchema>;
20
- declare const KnowledgeRecordSchema: Schema.Struct<{
21
- readonly id: Schema.Trimmed;
22
- readonly role: Schema.Literals<readonly ["source", "note", "operating_protocol", "knowledge_map", "compiled_truth", "decision"]>;
23
- readonly title: Schema.Trimmed;
24
- readonly status: Schema.Literals<readonly ["draft", "processing", "ready", "error", "archived", "deleted"]>;
25
- readonly contextPolicy: Schema.Literals<readonly ["pinned", "routable", "searchable", "archived"]>;
26
- readonly summary: Schema.optional<Schema.String>;
27
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
28
- readonly createdAt: Schema.DateTimeUtc;
29
- readonly updatedAt: Schema.DateTimeUtc;
30
- }>;
31
- type KnowledgeRecord = Schema.Schema.Type<typeof KnowledgeRecordSchema>;
32
- declare const CreateKnowledgeRecordInputSchema: Schema.Struct<{
33
- readonly scope: Schema.Struct<{
34
- readonly id: Schema.Trimmed;
35
- readonly kind: Schema.optional<Schema.Trimmed>;
36
- }>;
37
- readonly role: Schema.Literals<readonly ["source", "note", "operating_protocol", "knowledge_map", "compiled_truth", "decision"]>;
38
- readonly title: Schema.Trimmed;
39
- readonly contextPolicy: Schema.Literals<readonly ["pinned", "routable", "searchable", "archived"]>;
40
- readonly summary: Schema.optional<Schema.String>;
41
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
42
- }>;
43
- type CreateKnowledgeRecordInput = Schema.Schema.Type<typeof CreateKnowledgeRecordInputSchema>;
44
- declare const UpdateKnowledgeRecordInputSchema: Schema.Struct<{
45
- readonly scope: Schema.Struct<{
46
- readonly id: Schema.Trimmed;
47
- readonly kind: Schema.optional<Schema.Trimmed>;
48
- }>;
49
- readonly id: Schema.Trimmed;
50
- readonly title: Schema.optional<Schema.Trimmed>;
51
- readonly status: Schema.optional<Schema.Literals<readonly ["draft", "processing", "ready", "error", "archived", "deleted"]>>;
52
- readonly contextPolicy: Schema.optional<Schema.Literals<readonly ["pinned", "routable", "searchable", "archived"]>>;
53
- readonly summary: Schema.optional<Schema.String>;
54
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
55
- }>;
56
- type UpdateKnowledgeRecordInput = Schema.Schema.Type<typeof UpdateKnowledgeRecordInputSchema>;
57
- //#endregion
58
- export { CreateKnowledgeRecordInput, CreateKnowledgeRecordInputSchema, KnowledgeContextPolicy, KnowledgeContextPolicySchema, KnowledgeLifecycleStatus, KnowledgeLifecycleStatusSchema, KnowledgeMetadata, KnowledgeMetadataSchema, KnowledgeRecord, KnowledgeRecordRole, KnowledgeRecordRoleSchema, KnowledgeRecordSchema, KnowledgeScope, KnowledgeScopeSchema, NonEmptyTrimmedString, NonNegativeInteger, PositiveInteger, UpdateKnowledgeRecordInput, UpdateKnowledgeRecordInputSchema };
59
- //# sourceMappingURL=records.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"records.d.mts","names":[],"sources":["../src/records.ts"],"mappings":";;;cAEa,qBAAA,EAAqB,MAAA,CAAA,OAAyD;AAAA,cAC9E,kBAAA,EAAkB,MAAA,CAAA,GAAkE;AAAA,cACpF,eAAA,EAAe,MAAA,CAAA,GAAyD;AAAA,cAExE,uBAAA,EAAuB,MAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,EAAA,MAAA,CAAA,OAAA;AAAA,KACxB,iBAAA,GAAoB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,uBAAA;AAAA,cAE7C,yBAAA,EAAyB,MAAA,CAAA,QAAA;AAAA,KAQ1B,mBAAA,GAAsB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,yBAAA;AAAA,cAE/C,4BAAA,EAA4B,MAAA,CAAA,QAAA;AAAA,KAM7B,sBAAA,GAAyB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,4BAAA;AAAA,cAElD,8BAAA,EAA8B,MAAA,CAAA,QAAA;AAAA,KAQ/B,wBAAA,GAA2B,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,8BAAA;AAAA,cAEpD,oBAAA,EAAoB,MAAA,CAAA,MAAA;EAAA;;;KAIrB,cAAA,GAAiB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,oBAAA;AAAA,cAE1C,qBAAA,EAAqB,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;KAWtB,eAAA,GAAkB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,qBAAA;AAAA,cAE3C,gCAAA,EAAgC,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;KAQjC,0BAAA,GAA6B,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,gCAAA;AAAA,cAEtD,gCAAA,EAAgC,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;KASjC,0BAAA,GAA6B,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,gCAAA"}
package/dist/records.mjs DELETED
@@ -1,64 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- //#region src/records.ts
3
- const NonEmptyTrimmedString = Schema.Trimmed.pipe(Schema.check(Schema.isNonEmpty()));
4
- const NonNegativeInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0)));
5
- const PositiveInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0)));
6
- const KnowledgeMetadataSchema = Schema.Record(Schema.String, Schema.Unknown);
7
- const KnowledgeRecordRoleSchema = Schema.Literals([
8
- "source",
9
- "note",
10
- "operating_protocol",
11
- "knowledge_map",
12
- "compiled_truth",
13
- "decision"
14
- ]);
15
- const KnowledgeContextPolicySchema = Schema.Literals([
16
- "pinned",
17
- "routable",
18
- "searchable",
19
- "archived"
20
- ]);
21
- const KnowledgeLifecycleStatusSchema = Schema.Literals([
22
- "draft",
23
- "processing",
24
- "ready",
25
- "error",
26
- "archived",
27
- "deleted"
28
- ]);
29
- const KnowledgeScopeSchema = Schema.Struct({
30
- id: NonEmptyTrimmedString,
31
- kind: Schema.optional(NonEmptyTrimmedString)
32
- });
33
- const KnowledgeRecordSchema = Schema.Struct({
34
- id: NonEmptyTrimmedString,
35
- role: KnowledgeRecordRoleSchema,
36
- title: NonEmptyTrimmedString,
37
- status: KnowledgeLifecycleStatusSchema,
38
- contextPolicy: KnowledgeContextPolicySchema,
39
- summary: Schema.optional(Schema.String),
40
- metadata: Schema.optional(KnowledgeMetadataSchema),
41
- createdAt: Schema.DateTimeUtc,
42
- updatedAt: Schema.DateTimeUtc
43
- });
44
- const CreateKnowledgeRecordInputSchema = Schema.Struct({
45
- scope: KnowledgeScopeSchema,
46
- role: KnowledgeRecordRoleSchema,
47
- title: NonEmptyTrimmedString,
48
- contextPolicy: KnowledgeContextPolicySchema,
49
- summary: Schema.optional(Schema.String),
50
- metadata: Schema.optional(KnowledgeMetadataSchema)
51
- });
52
- const UpdateKnowledgeRecordInputSchema = Schema.Struct({
53
- scope: KnowledgeScopeSchema,
54
- id: NonEmptyTrimmedString,
55
- title: Schema.optional(NonEmptyTrimmedString),
56
- status: Schema.optional(KnowledgeLifecycleStatusSchema),
57
- contextPolicy: Schema.optional(KnowledgeContextPolicySchema),
58
- summary: Schema.optional(Schema.String),
59
- metadata: Schema.optional(KnowledgeMetadataSchema)
60
- });
61
- //#endregion
62
- export { CreateKnowledgeRecordInputSchema, KnowledgeContextPolicySchema, KnowledgeLifecycleStatusSchema, KnowledgeMetadataSchema, KnowledgeRecordRoleSchema, KnowledgeRecordSchema, KnowledgeScopeSchema, NonEmptyTrimmedString, NonNegativeInteger, PositiveInteger, UpdateKnowledgeRecordInputSchema };
63
-
64
- //# sourceMappingURL=records.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"records.mjs","names":[],"sources":["../src/records.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\n\nexport const NonEmptyTrimmedString = Schema.Trimmed.pipe(Schema.check(Schema.isNonEmpty()))\nexport const NonNegativeInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0)))\nexport const PositiveInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0)))\n\nexport const KnowledgeMetadataSchema = Schema.Record(Schema.String, Schema.Unknown)\nexport type KnowledgeMetadata = Schema.Schema.Type<typeof KnowledgeMetadataSchema>\n\nexport const KnowledgeRecordRoleSchema = Schema.Literals([\n 'source',\n 'note',\n 'operating_protocol',\n 'knowledge_map',\n 'compiled_truth',\n 'decision'\n])\nexport type KnowledgeRecordRole = Schema.Schema.Type<typeof KnowledgeRecordRoleSchema>\n\nexport const KnowledgeContextPolicySchema = Schema.Literals([\n 'pinned',\n 'routable',\n 'searchable',\n 'archived'\n])\nexport type KnowledgeContextPolicy = Schema.Schema.Type<typeof KnowledgeContextPolicySchema>\n\nexport const KnowledgeLifecycleStatusSchema = Schema.Literals([\n 'draft',\n 'processing',\n 'ready',\n 'error',\n 'archived',\n 'deleted'\n])\nexport type KnowledgeLifecycleStatus = Schema.Schema.Type<typeof KnowledgeLifecycleStatusSchema>\n\nexport const KnowledgeScopeSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n kind: Schema.optional(NonEmptyTrimmedString)\n})\nexport type KnowledgeScope = Schema.Schema.Type<typeof KnowledgeScopeSchema>\n\nexport const KnowledgeRecordSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n role: KnowledgeRecordRoleSchema,\n title: NonEmptyTrimmedString,\n status: KnowledgeLifecycleStatusSchema,\n contextPolicy: KnowledgeContextPolicySchema,\n summary: Schema.optional(Schema.String),\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc,\n updatedAt: Schema.DateTimeUtc\n})\nexport type KnowledgeRecord = Schema.Schema.Type<typeof KnowledgeRecordSchema>\n\nexport const CreateKnowledgeRecordInputSchema = Schema.Struct({\n scope: KnowledgeScopeSchema,\n role: KnowledgeRecordRoleSchema,\n title: NonEmptyTrimmedString,\n contextPolicy: KnowledgeContextPolicySchema,\n summary: Schema.optional(Schema.String),\n metadata: Schema.optional(KnowledgeMetadataSchema)\n})\nexport type CreateKnowledgeRecordInput = Schema.Schema.Type<typeof CreateKnowledgeRecordInputSchema>\n\nexport const UpdateKnowledgeRecordInputSchema = Schema.Struct({\n scope: KnowledgeScopeSchema,\n id: NonEmptyTrimmedString,\n title: Schema.optional(NonEmptyTrimmedString),\n status: Schema.optional(KnowledgeLifecycleStatusSchema),\n contextPolicy: Schema.optional(KnowledgeContextPolicySchema),\n summary: Schema.optional(Schema.String),\n metadata: Schema.optional(KnowledgeMetadataSchema)\n})\nexport type UpdateKnowledgeRecordInput = Schema.Schema.Type<typeof UpdateKnowledgeRecordInputSchema>\n"],"mappings":";;AAEA,MAAa,wBAAwB,OAAO,QAAQ,KAAK,OAAO,MAAM,OAAO,WAAW,CAAC,CAAC;AAC1F,MAAa,qBAAqB,OAAO,IAAI,KAAK,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAChG,MAAa,kBAAkB,OAAO,IAAI,KAAK,OAAO,MAAM,OAAO,cAAc,CAAC,CAAC,CAAC;AAEpF,MAAa,0BAA0B,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAGlF,MAAa,4BAA4B,OAAO,SAAS;CACvD;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,+BAA+B,OAAO,SAAS;CAC1D;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,iCAAiC,OAAO,SAAS;CAC5D;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,uBAAuB,OAAO,OAAO;CAChD,IAAI;CACJ,MAAM,OAAO,SAAS,qBAAqB;AAC7C,CAAC;AAGD,MAAa,wBAAwB,OAAO,OAAO;CACjD,IAAI;CACJ,MAAM;CACN,OAAO;CACP,QAAQ;CACR,eAAe;CACf,SAAS,OAAO,SAAS,OAAO,MAAM;CACtC,UAAU,OAAO,SAAS,uBAAuB;CACjD,WAAW,OAAO;CAClB,WAAW,OAAO;AACpB,CAAC;AAGD,MAAa,mCAAmC,OAAO,OAAO;CAC5D,OAAO;CACP,MAAM;CACN,OAAO;CACP,eAAe;CACf,SAAS,OAAO,SAAS,OAAO,MAAM;CACtC,UAAU,OAAO,SAAS,uBAAuB;AACnD,CAAC;AAGD,MAAa,mCAAmC,OAAO,OAAO;CAC5D,OAAO;CACP,IAAI;CACJ,OAAO,OAAO,SAAS,qBAAqB;CAC5C,QAAQ,OAAO,SAAS,8BAA8B;CACtD,eAAe,OAAO,SAAS,4BAA4B;CAC3D,SAAS,OAAO,SAAS,OAAO,MAAM;CACtC,UAAU,OAAO,SAAS,uBAAuB;AACnD,CAAC"}
@@ -1,36 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
-
3
- //#region src/representations.d.ts
4
- declare const KnowledgeRepresentationModalitySchema: Schema.Literals<readonly ["text", "image", "audio", "video", "table"]>;
5
- type KnowledgeRepresentationModality = Schema.Schema.Type<typeof KnowledgeRepresentationModalitySchema>;
6
- declare const KnowledgeRepresentationStatusSchema: Schema.Literals<readonly ["pending", "processing", "ready", "error"]>;
7
- type KnowledgeRepresentationStatus = Schema.Schema.Type<typeof KnowledgeRepresentationStatusSchema>;
8
- declare const KnowledgeRepresentationSchema: Schema.Struct<{
9
- readonly id: Schema.Trimmed;
10
- readonly recordId: Schema.Trimmed;
11
- readonly artifactId: Schema.optional<Schema.Trimmed>;
12
- readonly modality: Schema.Literals<readonly ["text", "image", "audio", "video", "table"]>;
13
- readonly status: Schema.Literals<readonly ["pending", "processing", "ready", "error"]>;
14
- readonly contentText: Schema.optional<Schema.String>;
15
- readonly summary: Schema.optional<Schema.String>;
16
- readonly model: Schema.optional<Schema.Trimmed>;
17
- readonly errorMessage: Schema.optional<Schema.String>;
18
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
19
- readonly createdAt: Schema.DateTimeUtc;
20
- readonly updatedAt: Schema.DateTimeUtc;
21
- }>;
22
- type KnowledgeRepresentation = Schema.Schema.Type<typeof KnowledgeRepresentationSchema>;
23
- declare const KnowledgeRepresentationChunkSchema: Schema.Struct<{
24
- readonly id: Schema.Trimmed;
25
- readonly recordId: Schema.Trimmed;
26
- readonly representationId: Schema.Trimmed;
27
- readonly content: Schema.Trimmed;
28
- readonly position: Schema.Int;
29
- readonly tokenCount: Schema.Int;
30
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
31
- readonly createdAt: Schema.DateTimeUtc;
32
- }>;
33
- type KnowledgeRepresentationChunk = Schema.Schema.Type<typeof KnowledgeRepresentationChunkSchema>;
34
- //#endregion
35
- export { KnowledgeRepresentation, KnowledgeRepresentationChunk, KnowledgeRepresentationChunkSchema, KnowledgeRepresentationModality, KnowledgeRepresentationModalitySchema, KnowledgeRepresentationSchema, KnowledgeRepresentationStatus, KnowledgeRepresentationStatusSchema };
36
- //# sourceMappingURL=representations.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"representations.d.mts","names":[],"sources":["../src/representations.ts"],"mappings":";;;cAOa,qCAAA,EAAqC,MAAA,CAAA,QAAA;AAAA,KAOtC,+BAAA,GAAkC,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,qCAAA;AAAA,cAE3D,mCAAA,EAAmC,MAAA,CAAA,QAAA;AAAA,KAMpC,6BAAA,GAAgC,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,mCAAA;AAAA,cAEzD,6BAAA,EAA6B,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;;;KAc9B,uBAAA,GAA0B,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,6BAAA;AAAA,cAEnD,kCAAA,EAAkC,MAAA,CAAA,MAAA;EAAA;;;;;;;;;KAUnC,4BAAA,GAA+B,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,kCAAA"}
@@ -1,44 +0,0 @@
1
- import { KnowledgeMetadataSchema, NonEmptyTrimmedString, NonNegativeInteger } from "./records.mjs";
2
- import * as Schema from "effect/Schema";
3
- //#region src/representations.ts
4
- const KnowledgeRepresentationModalitySchema = Schema.Literals([
5
- "text",
6
- "image",
7
- "audio",
8
- "video",
9
- "table"
10
- ]);
11
- const KnowledgeRepresentationStatusSchema = Schema.Literals([
12
- "pending",
13
- "processing",
14
- "ready",
15
- "error"
16
- ]);
17
- const KnowledgeRepresentationSchema = Schema.Struct({
18
- id: NonEmptyTrimmedString,
19
- recordId: NonEmptyTrimmedString,
20
- artifactId: Schema.optional(NonEmptyTrimmedString),
21
- modality: KnowledgeRepresentationModalitySchema,
22
- status: KnowledgeRepresentationStatusSchema,
23
- contentText: Schema.optional(Schema.String),
24
- summary: Schema.optional(Schema.String),
25
- model: Schema.optional(NonEmptyTrimmedString),
26
- errorMessage: Schema.optional(Schema.String),
27
- metadata: Schema.optional(KnowledgeMetadataSchema),
28
- createdAt: Schema.DateTimeUtc,
29
- updatedAt: Schema.DateTimeUtc
30
- });
31
- const KnowledgeRepresentationChunkSchema = Schema.Struct({
32
- id: NonEmptyTrimmedString,
33
- recordId: NonEmptyTrimmedString,
34
- representationId: NonEmptyTrimmedString,
35
- content: NonEmptyTrimmedString,
36
- position: NonNegativeInteger,
37
- tokenCount: NonNegativeInteger,
38
- metadata: Schema.optional(KnowledgeMetadataSchema),
39
- createdAt: Schema.DateTimeUtc
40
- });
41
- //#endregion
42
- export { KnowledgeRepresentationChunkSchema, KnowledgeRepresentationModalitySchema, KnowledgeRepresentationSchema, KnowledgeRepresentationStatusSchema };
43
-
44
- //# sourceMappingURL=representations.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"representations.mjs","names":[],"sources":["../src/representations.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\nimport {\n KnowledgeMetadataSchema,\n NonEmptyTrimmedString,\n NonNegativeInteger\n} from './records.ts'\n\nexport const KnowledgeRepresentationModalitySchema = Schema.Literals([\n 'text',\n 'image',\n 'audio',\n 'video',\n 'table'\n])\nexport type KnowledgeRepresentationModality = Schema.Schema.Type<typeof KnowledgeRepresentationModalitySchema>\n\nexport const KnowledgeRepresentationStatusSchema = Schema.Literals([\n 'pending',\n 'processing',\n 'ready',\n 'error'\n])\nexport type KnowledgeRepresentationStatus = Schema.Schema.Type<typeof KnowledgeRepresentationStatusSchema>\n\nexport const KnowledgeRepresentationSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n recordId: NonEmptyTrimmedString,\n artifactId: Schema.optional(NonEmptyTrimmedString),\n modality: KnowledgeRepresentationModalitySchema,\n status: KnowledgeRepresentationStatusSchema,\n contentText: Schema.optional(Schema.String),\n summary: Schema.optional(Schema.String),\n model: Schema.optional(NonEmptyTrimmedString),\n errorMessage: Schema.optional(Schema.String),\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc,\n updatedAt: Schema.DateTimeUtc\n})\nexport type KnowledgeRepresentation = Schema.Schema.Type<typeof KnowledgeRepresentationSchema>\n\nexport const KnowledgeRepresentationChunkSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n recordId: NonEmptyTrimmedString,\n representationId: NonEmptyTrimmedString,\n content: NonEmptyTrimmedString,\n position: NonNegativeInteger,\n tokenCount: NonNegativeInteger,\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc\n})\nexport type KnowledgeRepresentationChunk = Schema.Schema.Type<typeof KnowledgeRepresentationChunkSchema>\n"],"mappings":";;;AAOA,MAAa,wCAAwC,OAAO,SAAS;CACnE;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,sCAAsC,OAAO,SAAS;CACjE;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,gCAAgC,OAAO,OAAO;CACzD,IAAI;CACJ,UAAU;CACV,YAAY,OAAO,SAAS,qBAAqB;CACjD,UAAU;CACV,QAAQ;CACR,aAAa,OAAO,SAAS,OAAO,MAAM;CAC1C,SAAS,OAAO,SAAS,OAAO,MAAM;CACtC,OAAO,OAAO,SAAS,qBAAqB;CAC5C,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,UAAU,OAAO,SAAS,uBAAuB;CACjD,WAAW,OAAO;CAClB,WAAW,OAAO;AACpB,CAAC;AAGD,MAAa,qCAAqC,OAAO,OAAO;CAC9D,IAAI;CACJ,UAAU;CACV,kBAAkB;CAClB,SAAS;CACT,UAAU;CACV,YAAY;CACZ,UAAU,OAAO,SAAS,uBAAuB;CACjD,WAAW,OAAO;AACpB,CAAC"}
@@ -1,77 +0,0 @@
1
- import { KnowledgeChunk, KnowledgeCollection, KnowledgeDocument, KnowledgeSearchScope } from "./documents.mjs";
2
- import { SearchIndexStoreError } from "./errors.mjs";
3
- import { KnowledgeEmbedding } from "./embeddings.mjs";
4
- import { Context, Effect } from "effect";
5
-
6
- //#region src/search-store.d.ts
7
- type UpsertKnowledgeDocumentInput = {
8
- readonly document: KnowledgeDocument;
9
- };
10
- type ReplaceKnowledgeDocumentChunksInput = {
11
- readonly collectionId: string;
12
- readonly documentId: string;
13
- readonly chunks: ReadonlyArray<{
14
- readonly chunk: KnowledgeChunk;
15
- readonly embedding: KnowledgeEmbedding;
16
- }>;
17
- };
18
- type MarkKnowledgeDocumentReadyInput = {
19
- readonly collectionId: string;
20
- readonly documentId: string;
21
- readonly title?: string;
22
- readonly summary?: string;
23
- readonly contentHash?: string;
24
- readonly tokenCount: number;
25
- readonly chunkCount: number;
26
- };
27
- type MarkKnowledgeDocumentErrorInput = {
28
- readonly collectionId: string;
29
- readonly documentId: string;
30
- readonly message: string;
31
- };
32
- type KnowledgeChunkSearchInput = {
33
- readonly scope: KnowledgeSearchScope;
34
- readonly embedding: KnowledgeEmbedding;
35
- readonly limit: number;
36
- readonly minScore?: number;
37
- };
38
- type KnowledgeChunkTextSearchInput = {
39
- readonly scope: KnowledgeSearchScope;
40
- readonly query: string;
41
- readonly limit: number;
42
- };
43
- type KnowledgeChunkSearchResult = {
44
- readonly chunk: KnowledgeChunk;
45
- readonly score: number;
46
- readonly document: KnowledgeDocument;
47
- };
48
- type KnowledgeSearchContextChunksInput = {
49
- readonly collectionId: string;
50
- readonly documentId: string;
51
- readonly position: number;
52
- readonly contextChunks: number;
53
- };
54
- type SearchIndexStoreApi = {
55
- readonly upsertSet: (set: KnowledgeCollection) => Effect.Effect<KnowledgeCollection, SearchIndexStoreError>;
56
- readonly getSet: (id: string) => Effect.Effect<KnowledgeCollection, SearchIndexStoreError>;
57
- readonly upsertDocument: (input: UpsertKnowledgeDocumentInput) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>;
58
- readonly markDocumentProcessing: (input: {
59
- readonly collectionId: string;
60
- readonly documentId: string;
61
- }) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>;
62
- readonly replaceDocumentChunks: (input: ReplaceKnowledgeDocumentChunksInput) => Effect.Effect<void, SearchIndexStoreError>;
63
- readonly markDocumentReady: (input: MarkKnowledgeDocumentReadyInput) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>;
64
- readonly markDocumentError: (input: MarkKnowledgeDocumentErrorInput) => Effect.Effect<void, SearchIndexStoreError>;
65
- readonly deleteDocument: (input: {
66
- readonly collectionId: string;
67
- readonly documentId: string;
68
- }) => Effect.Effect<void, SearchIndexStoreError>;
69
- readonly searchChunks: (input: KnowledgeChunkSearchInput) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>;
70
- readonly searchChunksByText: (input: KnowledgeChunkTextSearchInput) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>;
71
- readonly getContextChunks: (input: KnowledgeSearchContextChunksInput) => Effect.Effect<ReadonlyArray<KnowledgeChunk>, SearchIndexStoreError>;
72
- };
73
- declare const SearchIndexStore_base: Context.ServiceClass<SearchIndexStore, "@yolk-sdk/knowledge/SearchIndexStore", SearchIndexStoreApi>;
74
- declare class SearchIndexStore extends SearchIndexStore_base {}
75
- //#endregion
76
- export { KnowledgeChunkSearchInput, KnowledgeChunkSearchResult, KnowledgeChunkTextSearchInput, KnowledgeSearchContextChunksInput, MarkKnowledgeDocumentErrorInput, MarkKnowledgeDocumentReadyInput, ReplaceKnowledgeDocumentChunksInput, SearchIndexStore, SearchIndexStoreApi, UpsertKnowledgeDocumentInput };
77
- //# sourceMappingURL=search-store.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-store.d.mts","names":[],"sources":["../src/search-store.ts"],"mappings":";;;;;;KAMY,4BAAA;EAAA,SACD,QAAA,EAAU,iBAAiB;AAAA;AAAA,KAG1B,mCAAA;EAAA,SACD,YAAA;EAAA,SACA,UAAA;EAAA,SACA,MAAA,EAAQ,aAAA;IAAA,SACN,KAAA,EAAO,cAAA;IAAA,SACP,SAAA,EAAW,kBAAA;EAAA;AAAA;AAAA,KAIZ,+BAAA;EAAA,SACD,YAAA;EAAA,SACA,UAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGC,+BAAA;EAAA,SACD,YAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;AAAA;AAAA,KAGC,yBAAA;EAAA,SACD,KAAA,EAAO,oBAAA;EAAA,SACP,SAAA,EAAW,kBAAkB;EAAA,SAC7B,KAAA;EAAA,SACA,QAAA;AAAA;AAAA,KAGC,6BAAA;EAAA,SACD,KAAA,EAAO,oBAAoB;EAAA,SAC3B,KAAA;EAAA,SACA,KAAA;AAAA;AAAA,KAGC,0BAAA;EAAA,SACD,KAAA,EAAO,cAAA;EAAA,SACP,KAAA;EAAA,SACA,QAAA,EAAU,iBAAiB;AAAA;AAAA,KAG1B,iCAAA;EAAA,SACD,YAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA;EAAA,SACA,aAAA;AAAA;AAAA,KAGC,mBAAA;EAAA,SACD,SAAA,GAAY,GAAA,EAAK,mBAAA,KAAwB,MAAA,CAAO,MAAA,CAAO,mBAAA,EAAqB,qBAAA;EAAA,SAC5E,MAAA,GAAS,EAAA,aAAe,MAAA,CAAO,MAAA,CAAO,mBAAA,EAAqB,qBAAA;EAAA,SAC3D,cAAA,GACP,KAAA,EAAO,4BAAA,KACJ,MAAA,CAAO,MAAA,CAAO,iBAAA,EAAmB,qBAAA;EAAA,SAC7B,sBAAA,GAAyB,KAAA;IAAA,SACvB,YAAA;IAAA,SACA,UAAA;EAAA,MACL,MAAA,CAAO,MAAA,CAAO,iBAAA,EAAmB,qBAAA;EAAA,SAC9B,qBAAA,GACP,KAAA,EAAO,mCAAA,KACJ,MAAA,CAAO,MAAA,OAAa,qBAAA;EAAA,SAChB,iBAAA,GACP,KAAA,EAAO,+BAAA,KACJ,MAAA,CAAO,MAAA,CAAO,iBAAA,EAAmB,qBAAA;EAAA,SAC7B,iBAAA,GACP,KAAA,EAAO,+BAAA,KACJ,MAAA,CAAO,MAAA,OAAa,qBAAA;EAAA,SAChB,cAAA,GAAiB,KAAA;IAAA,SACf,YAAA;IAAA,SACA,UAAA;EAAA,MACL,MAAA,CAAO,MAAA,OAAa,qBAAA;EAAA,SACjB,YAAA,GACP,KAAA,EAAO,yBAAA,KACJ,MAAA,CAAO,MAAA,CAAO,aAAA,CAAc,0BAAA,GAA6B,qBAAA;EAAA,SACrD,kBAAA,GACP,KAAA,EAAO,6BAAA,KACJ,MAAA,CAAO,MAAA,CAAO,aAAA,CAAc,0BAAA,GAA6B,qBAAA;EAAA,SACrD,gBAAA,GACP,KAAA,EAAO,iCAAA,KACJ,MAAA,CAAO,MAAA,CAAO,aAAA,CAAc,cAAA,GAAiB,qBAAA;AAAA;AAAA,cACnD,qBAAA;cAEY,gBAAA,SAAyB,qBAErC"}
@@ -1,7 +0,0 @@
1
- import { Context } from "effect";
2
- //#region src/search-store.ts
3
- var SearchIndexStore = class extends Context.Service()("@yolk-sdk/knowledge/SearchIndexStore") {};
4
- //#endregion
5
- export { SearchIndexStore };
6
-
7
- //# sourceMappingURL=search-store.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-store.mjs","names":[],"sources":["../src/search-store.ts"],"sourcesContent":["import { Context } from 'effect'\nimport type { Effect } from 'effect'\nimport type { KnowledgeChunk, KnowledgeDocument, KnowledgeSearchScope, KnowledgeCollection } from './documents.ts'\nimport type { KnowledgeEmbedding } from './embeddings.ts'\nimport type { SearchIndexStoreError } from './errors.ts'\n\nexport type UpsertKnowledgeDocumentInput = {\n readonly document: KnowledgeDocument\n}\n\nexport type ReplaceKnowledgeDocumentChunksInput = {\n readonly collectionId: string\n readonly documentId: string\n readonly chunks: ReadonlyArray<{\n readonly chunk: KnowledgeChunk\n readonly embedding: KnowledgeEmbedding\n }>\n}\n\nexport type MarkKnowledgeDocumentReadyInput = {\n readonly collectionId: string\n readonly documentId: string\n readonly title?: string\n readonly summary?: string\n readonly contentHash?: string\n readonly tokenCount: number\n readonly chunkCount: number\n}\n\nexport type MarkKnowledgeDocumentErrorInput = {\n readonly collectionId: string\n readonly documentId: string\n readonly message: string\n}\n\nexport type KnowledgeChunkSearchInput = {\n readonly scope: KnowledgeSearchScope\n readonly embedding: KnowledgeEmbedding\n readonly limit: number\n readonly minScore?: number\n}\n\nexport type KnowledgeChunkTextSearchInput = {\n readonly scope: KnowledgeSearchScope\n readonly query: string\n readonly limit: number\n}\n\nexport type KnowledgeChunkSearchResult = {\n readonly chunk: KnowledgeChunk\n readonly score: number\n readonly document: KnowledgeDocument\n}\n\nexport type KnowledgeSearchContextChunksInput = {\n readonly collectionId: string\n readonly documentId: string\n readonly position: number\n readonly contextChunks: number\n}\n\nexport type SearchIndexStoreApi = {\n readonly upsertSet: (set: KnowledgeCollection) => Effect.Effect<KnowledgeCollection, SearchIndexStoreError>\n readonly getSet: (id: string) => Effect.Effect<KnowledgeCollection, SearchIndexStoreError>\n readonly upsertDocument: (\n input: UpsertKnowledgeDocumentInput\n ) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>\n readonly markDocumentProcessing: (input: {\n readonly collectionId: string\n readonly documentId: string\n }) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>\n readonly replaceDocumentChunks: (\n input: ReplaceKnowledgeDocumentChunksInput\n ) => Effect.Effect<void, SearchIndexStoreError>\n readonly markDocumentReady: (\n input: MarkKnowledgeDocumentReadyInput\n ) => Effect.Effect<KnowledgeDocument, SearchIndexStoreError>\n readonly markDocumentError: (\n input: MarkKnowledgeDocumentErrorInput\n ) => Effect.Effect<void, SearchIndexStoreError>\n readonly deleteDocument: (input: {\n readonly collectionId: string\n readonly documentId: string\n }) => Effect.Effect<void, SearchIndexStoreError>\n readonly searchChunks: (\n input: KnowledgeChunkSearchInput\n ) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>\n readonly searchChunksByText: (\n input: KnowledgeChunkTextSearchInput\n ) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>\n readonly getContextChunks: (\n input: KnowledgeSearchContextChunksInput\n ) => Effect.Effect<ReadonlyArray<KnowledgeChunk>, SearchIndexStoreError>\n}\n\nexport class SearchIndexStore extends Context.Service<SearchIndexStore, SearchIndexStoreApi>()(\n '@yolk-sdk/knowledge/SearchIndexStore'\n) {}\n"],"mappings":";;AA+FA,IAAa,mBAAb,cAAsC,QAAQ,QAA+C,EAC3F,sCACF,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- import { SearchIndexStoreError } from "./errors.mjs";
2
- import { KnowledgeChunkSearchInput, KnowledgeChunkSearchResult, ReplaceKnowledgeDocumentChunksInput } from "./search-store.mjs";
3
- export { type ReplaceKnowledgeDocumentChunksInput as VectorRecord, type KnowledgeChunkSearchInput as VectorSearchQuery, type KnowledgeChunkSearchResult as VectorSearchResult, SearchIndexStoreError as VectorStoreError };
@@ -1,2 +0,0 @@
1
- import { SearchIndexStoreError } from "./errors.mjs";
2
- export { SearchIndexStoreError as VectorStoreError };
package/src/artifacts.ts DELETED
@@ -1,48 +0,0 @@
1
- import { Context } from 'effect'
2
- import type { Effect } from 'effect'
3
- import * as Schema from 'effect/Schema'
4
- import type { KnowledgeArtifactError } from './errors.ts'
5
- import { KnowledgeMetadataSchema, NonEmptyTrimmedString, NonNegativeInteger } from './records.ts'
6
-
7
- export const KnowledgeArtifactKindSchema = Schema.Literals([
8
- 'original',
9
- 'extracted_text',
10
- 'thumbnail',
11
- 'transcript',
12
- 'caption',
13
- 'structured'
14
- ])
15
- export type KnowledgeArtifactKind = Schema.Schema.Type<typeof KnowledgeArtifactKindSchema>
16
-
17
- export const KnowledgeArtifactSchema = Schema.Struct({
18
- id: NonEmptyTrimmedString,
19
- recordId: NonEmptyTrimmedString,
20
- kind: KnowledgeArtifactKindSchema,
21
- storageKey: NonEmptyTrimmedString,
22
- mediaType: Schema.optional(NonEmptyTrimmedString),
23
- byteSize: Schema.optional(NonNegativeInteger),
24
- checksum: Schema.optional(NonEmptyTrimmedString),
25
- metadata: Schema.optional(KnowledgeMetadataSchema),
26
- createdAt: Schema.DateTimeUtc
27
- })
28
- export type KnowledgeArtifact = Schema.Schema.Type<typeof KnowledgeArtifactSchema>
29
-
30
- export type PutKnowledgeArtifactInput = {
31
- readonly storageKey: string
32
- readonly mediaType?: string
33
- readonly bytes: Uint8Array
34
- }
35
-
36
- export type GetKnowledgeArtifactInput = {
37
- readonly storageKey: string
38
- }
39
-
40
- export type KnowledgeArtifactStoreApi = {
41
- readonly putArtifact: (input: PutKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>
42
- readonly getArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<Uint8Array, KnowledgeArtifactError>
43
- readonly deleteArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>
44
- }
45
-
46
- export class KnowledgeArtifactStore extends Context.Service<KnowledgeArtifactStore, KnowledgeArtifactStoreApi>()(
47
- '@yolk-sdk/knowledge/KnowledgeArtifactStore'
48
- ) {}
package/src/links.ts DELETED
@@ -1,23 +0,0 @@
1
- import * as Schema from 'effect/Schema'
2
- import { KnowledgeMetadataSchema, NonEmptyTrimmedString } from './records.ts'
3
-
4
- export const KnowledgeLinkTypeSchema = Schema.Literals([
5
- 'cites',
6
- 'supports',
7
- 'contradicts',
8
- 'supersedes',
9
- 'mentions',
10
- 'derived_from',
11
- 'related_to'
12
- ])
13
- export type KnowledgeLinkType = Schema.Schema.Type<typeof KnowledgeLinkTypeSchema>
14
-
15
- export const KnowledgeLinkSchema = Schema.Struct({
16
- id: NonEmptyTrimmedString,
17
- fromRecordId: NonEmptyTrimmedString,
18
- toRecordId: NonEmptyTrimmedString,
19
- type: KnowledgeLinkTypeSchema,
20
- metadata: Schema.optional(KnowledgeMetadataSchema),
21
- createdAt: Schema.DateTimeUtc
22
- })
23
- export type KnowledgeLink = Schema.Schema.Type<typeof KnowledgeLinkSchema>
package/src/provenance.ts DELETED
@@ -1,25 +0,0 @@
1
- import * as Schema from 'effect/Schema'
2
- import { KnowledgeMetadataSchema, NonEmptyTrimmedString } from './records.ts'
3
-
4
- export const KnowledgeProvenanceSourceKindSchema = Schema.Literals([
5
- 'upload',
6
- 'user_statement',
7
- 'url',
8
- 'generated',
9
- 'imported',
10
- 'external_api'
11
- ])
12
- export type KnowledgeProvenanceSourceKind = Schema.Schema.Type<typeof KnowledgeProvenanceSourceKindSchema>
13
-
14
- export const KnowledgeProvenanceSchema = Schema.Struct({
15
- id: NonEmptyTrimmedString,
16
- recordId: NonEmptyTrimmedString,
17
- artifactId: Schema.optional(NonEmptyTrimmedString),
18
- sourceKind: KnowledgeProvenanceSourceKindSchema,
19
- sourceLabel: NonEmptyTrimmedString,
20
- sourceUrl: Schema.optional(NonEmptyTrimmedString),
21
- observedAt: Schema.optional(Schema.DateTimeUtc),
22
- metadata: Schema.optional(KnowledgeMetadataSchema),
23
- createdAt: Schema.DateTimeUtc
24
- })
25
- export type KnowledgeProvenance = Schema.Schema.Type<typeof KnowledgeProvenanceSchema>
package/src/records.ts DELETED
@@ -1,76 +0,0 @@
1
- import * as Schema from 'effect/Schema'
2
-
3
- export const NonEmptyTrimmedString = Schema.Trimmed.pipe(Schema.check(Schema.isNonEmpty()))
4
- export const NonNegativeInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0)))
5
- export const PositiveInteger = Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0)))
6
-
7
- export const KnowledgeMetadataSchema = Schema.Record(Schema.String, Schema.Unknown)
8
- export type KnowledgeMetadata = Schema.Schema.Type<typeof KnowledgeMetadataSchema>
9
-
10
- export const KnowledgeRecordRoleSchema = Schema.Literals([
11
- 'source',
12
- 'note',
13
- 'operating_protocol',
14
- 'knowledge_map',
15
- 'compiled_truth',
16
- 'decision'
17
- ])
18
- export type KnowledgeRecordRole = Schema.Schema.Type<typeof KnowledgeRecordRoleSchema>
19
-
20
- export const KnowledgeContextPolicySchema = Schema.Literals([
21
- 'pinned',
22
- 'routable',
23
- 'searchable',
24
- 'archived'
25
- ])
26
- export type KnowledgeContextPolicy = Schema.Schema.Type<typeof KnowledgeContextPolicySchema>
27
-
28
- export const KnowledgeLifecycleStatusSchema = Schema.Literals([
29
- 'draft',
30
- 'processing',
31
- 'ready',
32
- 'error',
33
- 'archived',
34
- 'deleted'
35
- ])
36
- export type KnowledgeLifecycleStatus = Schema.Schema.Type<typeof KnowledgeLifecycleStatusSchema>
37
-
38
- export const KnowledgeScopeSchema = Schema.Struct({
39
- id: NonEmptyTrimmedString,
40
- kind: Schema.optional(NonEmptyTrimmedString)
41
- })
42
- export type KnowledgeScope = Schema.Schema.Type<typeof KnowledgeScopeSchema>
43
-
44
- export const KnowledgeRecordSchema = Schema.Struct({
45
- id: NonEmptyTrimmedString,
46
- role: KnowledgeRecordRoleSchema,
47
- title: NonEmptyTrimmedString,
48
- status: KnowledgeLifecycleStatusSchema,
49
- contextPolicy: KnowledgeContextPolicySchema,
50
- summary: Schema.optional(Schema.String),
51
- metadata: Schema.optional(KnowledgeMetadataSchema),
52
- createdAt: Schema.DateTimeUtc,
53
- updatedAt: Schema.DateTimeUtc
54
- })
55
- export type KnowledgeRecord = Schema.Schema.Type<typeof KnowledgeRecordSchema>
56
-
57
- export const CreateKnowledgeRecordInputSchema = Schema.Struct({
58
- scope: KnowledgeScopeSchema,
59
- role: KnowledgeRecordRoleSchema,
60
- title: NonEmptyTrimmedString,
61
- contextPolicy: KnowledgeContextPolicySchema,
62
- summary: Schema.optional(Schema.String),
63
- metadata: Schema.optional(KnowledgeMetadataSchema)
64
- })
65
- export type CreateKnowledgeRecordInput = Schema.Schema.Type<typeof CreateKnowledgeRecordInputSchema>
66
-
67
- export const UpdateKnowledgeRecordInputSchema = Schema.Struct({
68
- scope: KnowledgeScopeSchema,
69
- id: NonEmptyTrimmedString,
70
- title: Schema.optional(NonEmptyTrimmedString),
71
- status: Schema.optional(KnowledgeLifecycleStatusSchema),
72
- contextPolicy: Schema.optional(KnowledgeContextPolicySchema),
73
- summary: Schema.optional(Schema.String),
74
- metadata: Schema.optional(KnowledgeMetadataSchema)
75
- })
76
- export type UpdateKnowledgeRecordInput = Schema.Schema.Type<typeof UpdateKnowledgeRecordInputSchema>
@@ -1,51 +0,0 @@
1
- import * as Schema from 'effect/Schema'
2
- import {
3
- KnowledgeMetadataSchema,
4
- NonEmptyTrimmedString,
5
- NonNegativeInteger
6
- } from './records.ts'
7
-
8
- export const KnowledgeRepresentationModalitySchema = Schema.Literals([
9
- 'text',
10
- 'image',
11
- 'audio',
12
- 'video',
13
- 'table'
14
- ])
15
- export type KnowledgeRepresentationModality = Schema.Schema.Type<typeof KnowledgeRepresentationModalitySchema>
16
-
17
- export const KnowledgeRepresentationStatusSchema = Schema.Literals([
18
- 'pending',
19
- 'processing',
20
- 'ready',
21
- 'error'
22
- ])
23
- export type KnowledgeRepresentationStatus = Schema.Schema.Type<typeof KnowledgeRepresentationStatusSchema>
24
-
25
- export const KnowledgeRepresentationSchema = Schema.Struct({
26
- id: NonEmptyTrimmedString,
27
- recordId: NonEmptyTrimmedString,
28
- artifactId: Schema.optional(NonEmptyTrimmedString),
29
- modality: KnowledgeRepresentationModalitySchema,
30
- status: KnowledgeRepresentationStatusSchema,
31
- contentText: Schema.optional(Schema.String),
32
- summary: Schema.optional(Schema.String),
33
- model: Schema.optional(NonEmptyTrimmedString),
34
- errorMessage: Schema.optional(Schema.String),
35
- metadata: Schema.optional(KnowledgeMetadataSchema),
36
- createdAt: Schema.DateTimeUtc,
37
- updatedAt: Schema.DateTimeUtc
38
- })
39
- export type KnowledgeRepresentation = Schema.Schema.Type<typeof KnowledgeRepresentationSchema>
40
-
41
- export const KnowledgeRepresentationChunkSchema = Schema.Struct({
42
- id: NonEmptyTrimmedString,
43
- recordId: NonEmptyTrimmedString,
44
- representationId: NonEmptyTrimmedString,
45
- content: NonEmptyTrimmedString,
46
- position: NonNegativeInteger,
47
- tokenCount: NonNegativeInteger,
48
- metadata: Schema.optional(KnowledgeMetadataSchema),
49
- createdAt: Schema.DateTimeUtc
50
- })
51
- export type KnowledgeRepresentationChunk = Schema.Schema.Type<typeof KnowledgeRepresentationChunkSchema>