TypeScript feature parity: relations, activities, graph traversal, utility tools#21
Merged
Conversation
…ility tools
Bring the TypeScript library to full feature parity with Python:
- Add reverse relationship index (relations.ts): load, save, update,
remove, rebuild, queryReverse with atomic writes
- Add activity tracking (activity.ts): ACTIVITY_ENTITY_DEF, getActivitySchema,
bundled activity.schema.json
- Add schema functions: hydrateDefaults, validateSchemaChange,
buildEntityOutputSchema, buildListOutputSchema
- Add entity enhancements: schema hydration on get/list/update,
onRelationshipsChanged callbacks on create/update/delete
- Add UpjackApp methods: queryByRelationship, getRelated, getComposite,
logActivity, getActivities, reloadSchema, prefix resolution
- Add MCP server tools: 3 relationship tools per entity, log_activity,
get_activities, seed_data, add_field, rebuild_index
- Add output schemas to all MCP tools
- Add response envelopes ({entities, count}) for list/search tools
- Add utility_tools manifest filter support
- Add indexDir/indexPath to paths module
272 tests passing (was 233), make check clean.
…d data
- Replace empty catch {} blocks in graph traversal with targeted error
handling — only catch "Entity not found" and "Unknown prefix", re-throw
unexpected errors
- Add Relationship interface to replace unsafe `as unknown as` type casts
on entity relationships throughout entity.ts and app.ts
- Use destructuring to strip $schema/$id in buildEntityOutputSchema so
keys are truly absent (not set to undefined)
- Atomic write for add_field tool (temp file + rename) to prevent
corrupt schema files from concurrent calls
- Seed data now preserves relationships and tags (only strips metadata
fields), matching Python lib behavior
- Add 8 server-level tests for add_field tool covering success path,
field usability, and validation error cases
- Tighten buildEntityOutputSchema test to assert key absence
Match Python create_entity behavior: if data contains a valid prefixed ID matching the entity prefix, use it instead of generating a new one. This allows seed data with stable IDs and cross-references to work correctly.
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.
Summary
Brings the TypeScript library to full feature parity with the Python library. Adds 6 missing subsystems:
relations.ts): write-time index at_index/relations.jsonwith atomic saves, auto-rebuild, and queryReverseactivity.ts): built-in activity entity, logActivity/getActivities, opt-in viaactivities: truein manifesthydrateDefaults(fill missing fields from defaults),validateSchemaChange(detect breaking changes), output schema buildersqueryByRelationship,getRelated(forward/reverse),getComposite(entity + all related in one call){entities, count}response envelopesonRelationshipsChangedon create/update/delete, schema hydration on get/list/updateBreaking change
list_*andsearch_*MCP tools now return{ entities: [...], count: N }envelopes instead of bare arrays. This aligns with the Python library behavior.Files
relations.ts,activity.ts,activity.schema.json,relations.test.ts,graph.test.ts,activity.test.tsschema.ts,entity.ts,app.ts,server.ts,paths.ts,index.ts+ test updatesTest plan
make checkclean (format + lint + typecheck + tests)