@workglow/ai 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +19 -5
- package/dist/browser.js.map +3 -3
- package/dist/bun.js +19 -5
- package/dist/bun.js.map +3 -3
- package/dist/node.js +19 -5
- package/dist/node.js.map +3 -3
- package/dist/task/DocumentUpsertTask.d.ts +27 -3
- package/dist/task/DocumentUpsertTask.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/bun.js
CHANGED
|
@@ -3429,6 +3429,7 @@ Workflow14.prototype.documentEnricher = CreateWorkflow14(DocumentEnricherTask);
|
|
|
3429
3429
|
|
|
3430
3430
|
// src/task/DocumentUpsertTask.ts
|
|
3431
3431
|
import { Document, TypeKnowledgeBase as TypeKnowledgeBase5 } from "@workglow/knowledge-base";
|
|
3432
|
+
import { DocumentMetadataSchema } from "@workglow/knowledge-base";
|
|
3432
3433
|
import { CreateWorkflow as CreateWorkflow15, Task as Task10, Workflow as Workflow15 } from "@workglow/task-graph";
|
|
3433
3434
|
var inputSchema8 = {
|
|
3434
3435
|
type: "object",
|
|
@@ -3449,10 +3450,16 @@ var inputSchema8 = {
|
|
|
3449
3450
|
title: {
|
|
3450
3451
|
type: "string",
|
|
3451
3452
|
title: "Title",
|
|
3452
|
-
description: "
|
|
3453
|
+
description: "Optional human-readable title. If provided, overrides metadata.title. " + "Either this or metadata.title must be supplied."
|
|
3454
|
+
},
|
|
3455
|
+
metadata: {
|
|
3456
|
+
...DocumentMetadataSchema,
|
|
3457
|
+
required: [],
|
|
3458
|
+
title: "Metadata",
|
|
3459
|
+
description: "Optional document metadata. May contain `title` (unless the top-level " + "`title` input is also provided), `sourceUri`, `createdAt`, and any " + "additional caller-defined fields (the schema is open)."
|
|
3453
3460
|
}
|
|
3454
3461
|
},
|
|
3455
|
-
required: ["knowledgeBase", "doc_id", "documentTree"
|
|
3462
|
+
required: ["knowledgeBase", "doc_id", "documentTree"],
|
|
3456
3463
|
additionalProperties: false
|
|
3457
3464
|
};
|
|
3458
3465
|
var outputSchema8 = {
|
|
@@ -3481,10 +3488,17 @@ class DocumentUpsertTask extends Task10 {
|
|
|
3481
3488
|
return outputSchema8;
|
|
3482
3489
|
}
|
|
3483
3490
|
async execute(input, context) {
|
|
3484
|
-
const { knowledgeBase, doc_id, documentTree, title } = input;
|
|
3491
|
+
const { knowledgeBase, doc_id, documentTree, title, metadata } = input;
|
|
3485
3492
|
const kb = knowledgeBase;
|
|
3493
|
+
const merged = {
|
|
3494
|
+
...metadata ?? {},
|
|
3495
|
+
...title !== undefined ? { title } : {}
|
|
3496
|
+
};
|
|
3497
|
+
if (!merged.title) {
|
|
3498
|
+
throw new Error("DocumentUpsertTask: title is required \u2014 provide it via the 'title' input or 'metadata.title'");
|
|
3499
|
+
}
|
|
3486
3500
|
await context.updateProgress(1, "Upserting document");
|
|
3487
|
-
const document = new Document(documentTree,
|
|
3501
|
+
const document = new Document(documentTree, merged, [], doc_id);
|
|
3488
3502
|
const stored = await kb.upsertDocument(document);
|
|
3489
3503
|
return {
|
|
3490
3504
|
doc_id: stored.doc_id ?? doc_id
|
|
@@ -7650,4 +7664,4 @@ export {
|
|
|
7650
7664
|
AgentInputSchema
|
|
7651
7665
|
};
|
|
7652
7666
|
|
|
7653
|
-
//# debugId=
|
|
7667
|
+
//# debugId=CAF73EE543E79D8664756E2164756E21
|