feat(typescript-client): add AbortSignal support to all HindsightClient methods#1198
Merged
nicoloboschi merged 3 commits intovectorize-io:mainfrom May 4, 2026
Conversation
5 tasks
623b1d1 to
0a67289
Compare
harryplusplus
added a commit
to harryplusplus/hindsight
that referenced
this pull request
Apr 28, 2026
…nt methods (vectorize-io#1198) * Add signal?: AbortSignal to every public method's options bag so callers can cancel in-flight requests without dropping down to the raw SDK. * Methods with optional options (retain, recall, reflect, listMemories, createDirective, listDirectives, createMentalModel, listMentalModels, listDocuments): signal is an optional field inside the existing options. * Methods with required options (createBank, updateBankConfig, updateDirective, updateMentalModel, updateDocument): signal added as an optional field alongside the required fields. * Methods that previously took no options (getBankProfile, getBankConfig, resetBankConfig, deleteBank, getDirective, deleteDirective, getMentalModel, refreshMentalModel, deleteMentalModel, getMentalModelHistory, getDocument, deleteDocument): accept an optional options?: { signal?: AbortSignal }. * Add TestAbortSignal suite with 3 unit tests that mock the generated SDK and verify signal is passed through on retain, recall, and getBankProfile.
9ab1bc9 to
0a67289
Compare
…nt methods (vectorize-io#1198) * Add signal?: AbortSignal to every public method's options bag so callers can cancel in-flight requests without dropping down to the raw SDK. * Methods with optional options (retain, recall, reflect, listMemories, createDirective, listDirectives, createMentalModel, listMentalModels, listDocuments): signal is an optional field inside the existing options. * Methods with required options (createBank, updateBankConfig, updateDirective, updateMentalModel, updateDocument): signal added as an optional field alongside the required fields. * Methods that previously took no options (getBankProfile, getBankConfig, resetBankConfig, deleteBank, getDirective, deleteDirective, getMentalModel, refreshMentalModel, deleteMentalModel, getMentalModelHistory, getDocument, deleteDocument): accept an optional options?: { signal?: AbortSignal }. * Add TestAbortSignal suite with 3 unit tests that mock the generated SDK and verify signal is passed through on retain, recall, and getBankProfile.
0a67289 to
4f8a218
Compare
harryplusplus
added a commit
to harryplusplus/hindsight
that referenced
this pull request
May 2, 2026
4f8a218 to
11d6883
Compare
11d6883 to
8843995
Compare
liling
pushed a commit
to liling/hindsight
that referenced
this pull request
May 5, 2026
…nt methods (vectorize-io#1198) * feat(typescript-client): add AbortSignal support to all HindsightClient methods (vectorize-io#1198) * Add signal?: AbortSignal to every public method's options bag so callers can cancel in-flight requests without dropping down to the raw SDK. * Methods with optional options (retain, recall, reflect, listMemories, createDirective, listDirectives, createMentalModel, listMentalModels, listDocuments): signal is an optional field inside the existing options. * Methods with required options (createBank, updateBankConfig, updateDirective, updateMentalModel, updateDocument): signal added as an optional field alongside the required fields. * Methods that previously took no options (getBankProfile, getBankConfig, resetBankConfig, deleteBank, getDirective, deleteDirective, getMentalModel, refreshMentalModel, deleteMentalModel, getMentalModelHistory, getDocument, deleteDocument): accept an optional options?: { signal?: AbortSignal }. * Add TestAbortSignal suite with 3 unit tests that mock the generated SDK and verify signal is passed through on retain, recall, and getBankProfile. * chore(skills): regenerate hindsight-docs skill files * chore(self-driving-agents): apply prettier formatting
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
Expose per-request
AbortSignalsupport on every public method of the TypeScriptHindsightClient. The generated@hey-api/openapi-tsSDK already acceptssignalon each request call (itsRequestOptionstype extendsRequestInit), but the high-levelHindsightClientwrapper did not surface it to callers.Motivation
In an agent harness, Hindsight calls (retain, recall, reflect) run under a time budget — best-effort before the next LLM invocation. When a call exceeds the budget, the caller drops the promise and moves on — but without an explicit
AbortSignal, the server has no way to know that. It keeps running the full pipeline (fact extraction, embedding, consolidation) for a result no one is waiting for. PassingAbortSignalgives the server the chance to stop when the client is done waiting. Without this change, the only way to pass anAbortSignalis to drop down to the low-level generatedsdknamespace.Changes
hindsight-clients/typescript/src/index.tsAdded
signal?: AbortSignalto the options bag of all public methods and forwarded it to the underlying generated SDK call. Formatted with the root.prettierrc.json(trailingComma: es5,printWidth: 100) per the lint.sh that now covers the TypeScript client.Methods grouped by how they expose the option:
retain,retainBatch,retainFiles,recall,reflect,listMemories,createDirective,listDirectives,createMentalModel,listMentalModels,listDocuments):signalis an optional field inside the existing options bag.createBank,updateBankConfig,updateDirective,updateMentalModel,updateDocument):signaladded as an optional field alongside the required fields — no breaking change.setMission,getBankProfile,getBankConfig,resetBankConfig,deleteBank,getDirective,deleteDirective,getMentalModel,refreshMentalModel,deleteMentalModel,getMentalModelHistory,getDocument,deleteDocument): accept a new optionaloptions?: { signal?: AbortSignal }parameter — backwards-compatible since it's optional.hindsight-clients/typescript/tests/main_operations.test.tsAdded
TestAbortSignalsuite with 3 unit tests that mock the generated SDK and verify thesignalis passed through:retain passes abort signal to SDKrecall passes abort signal to SDKgetBankProfile passes abort signal to SDKThese tests do not require a running Hindsight API server.
skills/hindsight-docs/Regenerated docs skill files via
./scripts/generate-docs-skill.shto sync with latestmainchanges (Oracle storage docs, Pydantic Logfire monitoring link). Theverify-generated-filesCI job requires these generated files to be up to date.hindsight-tools/self-driving-agents/src/cli.tsApplied prettier formatting to fix a multi-line template literal that was inconsistent with the root
.prettierrc.jsonconfig. Caught bylint.shin CI where$CItriggersLINT_TOOLS_ALL=1.Usage Example
Checklist
main(v0.5.6)npm run buildpasses./scripts/hooks/lint.shpasses (root.prettierrc.json)tsc --noEmitpassessrc/index.ts)./scripts/generate-docs-skill.shproduces no diff (skills files up to date)./scripts/hooks/lint.shproduces no diff in CI (all tools formatted)