feat: mid-sized structured asset creator workflow#118
Open
droarty wants to merge 4 commits into
Open
Conversation
Adds a configurable workflow for importing structured data from PDFs via
multi-turn chat with Claude. Users upload a PDF, negotiate a schema
through conversation, and Claude extracts all records. Versioning detects
name/category conflicts immediately after schema proposal, prompting the
user to replace, increment version, or rename before extraction begins.
- New `StructuredAsset` MongoDB model with compound unique index on
{name, category, assetVersion}
- New `file-chat` and `file-extract` AI step types in WorkflowEngine
backed by Anthropic Files API (SDK beta namespace)
- `FileExtractService` wraps multi-turn file chat and one-shot extraction
- HTTP upload route `POST /api/documents/channel/:channelId/upload`
handles Files API upload + initial AI analysis + version check
- `ChatUploadPanel` and `JsonViewer` layout components registered in
layoutRegistry for use in any workflow config
- Workflow JSON drives the full state machine: idle → upload → schema
discussion → version-check → confirm → extract → review → persist
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MongoDB ObjectIds don't serialize to plain strings through structuredClone + msgpack, so doc._id arrived on the client as an object — React coerced it to '[object Object]', causing a duplicate-key warning whenever 2+ documents were in the list. Fix at both layers: serialize _id in QueryExecutor for all document queries, and add String() in DocumentList as a defensive fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…results structuredClone preserves ObjectIds as binary data which msgpack delivers to the client as plain objects — their toString() returns '[object Object]', causing duplicate React keys in DocumentList. JSON.parse/stringify calls ObjectId.toJSON() (returns the hex string) recursively on the whole doc, fixing _id fields at all nesting levels including state.documents[*]._id. Also keys DocumentList on currentChannelId (always a UUID string) as a defensive fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The worker thread (EventProcessorWorker) uses a raw MongoClient and never calls mongoose.connect(). Importing StructuredAssetModel (Mongoose) caused all executeQuery calls to throw silently, so initializeState and defaultView responses were never sent — producing a permanent "Loading…" screen. Replace check-asset-exists and persist-structured-asset with raw MongoDB collection calls to match the rest of QueryExecutor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #117. See issue for full plan.