@workglow/ai 0.2.4 → 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 CHANGED
@@ -3428,6 +3428,7 @@ Workflow14.prototype.documentEnricher = CreateWorkflow14(DocumentEnricherTask);
3428
3428
 
3429
3429
  // src/task/DocumentUpsertTask.ts
3430
3430
  import { Document, TypeKnowledgeBase as TypeKnowledgeBase5 } from "@workglow/knowledge-base";
3431
+ import { DocumentMetadataSchema } from "@workglow/knowledge-base";
3431
3432
  import { CreateWorkflow as CreateWorkflow15, Task as Task10, Workflow as Workflow15 } from "@workglow/task-graph";
3432
3433
  var inputSchema8 = {
3433
3434
  type: "object",
@@ -3448,10 +3449,16 @@ var inputSchema8 = {
3448
3449
  title: {
3449
3450
  type: "string",
3450
3451
  title: "Title",
3451
- description: "Human-readable title stored in the document metadata"
3452
+ description: "Optional human-readable title. If provided, overrides metadata.title. " + "Either this or metadata.title must be supplied."
3453
+ },
3454
+ metadata: {
3455
+ ...DocumentMetadataSchema,
3456
+ required: [],
3457
+ title: "Metadata",
3458
+ 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)."
3452
3459
  }
3453
3460
  },
3454
- required: ["knowledgeBase", "doc_id", "documentTree", "title"],
3461
+ required: ["knowledgeBase", "doc_id", "documentTree"],
3455
3462
  additionalProperties: false
3456
3463
  };
3457
3464
  var outputSchema8 = {
@@ -3480,10 +3487,17 @@ class DocumentUpsertTask extends Task10 {
3480
3487
  return outputSchema8;
3481
3488
  }
3482
3489
  async execute(input, context) {
3483
- const { knowledgeBase, doc_id, documentTree, title } = input;
3490
+ const { knowledgeBase, doc_id, documentTree, title, metadata } = input;
3484
3491
  const kb = knowledgeBase;
3492
+ const merged = {
3493
+ ...metadata ?? {},
3494
+ ...title !== undefined ? { title } : {}
3495
+ };
3496
+ if (!merged.title) {
3497
+ throw new Error("DocumentUpsertTask: title is required — provide it via the 'title' input or 'metadata.title'");
3498
+ }
3485
3499
  await context.updateProgress(1, "Upserting document");
3486
- const document = new Document(documentTree, { title }, [], doc_id);
3500
+ const document = new Document(documentTree, merged, [], doc_id);
3487
3501
  const stored = await kb.upsertDocument(document);
3488
3502
  return {
3489
3503
  doc_id: stored.doc_id ?? doc_id
@@ -7649,4 +7663,4 @@ export {
7649
7663
  AgentInputSchema
7650
7664
  };
7651
7665
 
7652
- //# debugId=9A5FD1928919CAEE64756E2164756E21
7666
+ //# debugId=762A0403C66F620464756E2164756E21