feat: DSTsx v2 — complete all planned features + MCP integration#3
Merged
Conversation
Co-authored-by: Psyborgs-git <49641518+Psyborgs-git@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Build library and document all APIs for v1.0
docs: v1.0 API documentation + V2 roadmap
Mar 4, 2026
- TypedPredictor/TypedChainOfThought: JSON-parsing LM wrapper with optional schema validation and retry logic - majority: reducer that picks the most-frequent Prediction field value - Parallel: runs multiple modules concurrently with optional timeout - Refine: iterative self-critique loop with a critic Predict module - BootstrapFewShotWithOptuna: TPE-based demo subset optimizer extending BootstrapFewShot - DiskCache: disk-persistent LM response cache (SHA-256 keyed, TTL, LRU eviction) integrated into LM as second-level cache - MCP integration: MCPToolAdapter wraps MCP tools as DSTsx Tools; DSTsxMCPServer exposes modules as MCP tool definitions Update all barrel index files and add MCP SDK ambient declarations to peer-deps.d.ts. Add 26 new tests; total passes go from 160 to 185. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- TypedPredictor + TypedChainOfThought: structured JSON output with optional schema validation, markdown fence stripping, retry logic - majority() helper: picks most-frequent Prediction by field value - Parallel module: runs multiple modules in parallel via Promise.all - Refine module: self-critique / iterative refinement loop - BootstrapFewShotWithOptuna: Bayesian TPE optimizer (pure TS) - DiskCache: disk-persistent JSON cache with TTL/LRU, integrated into LM as optional second-level cache via cacheDir option - MCP integration: MCPToolAdapter + DSTsxMCPServer for Model Context Protocol interoperability Tests: 185 pass (up from 160 baseline) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…a, DiskCache, MCP integration Co-authored-by: Psyborgs-git <49641518+Psyborgs-git@users.noreply.github.com>
Copilot
AI
changed the title
docs: v1.0 API documentation + V2 roadmap
feat: DSTsx v2 — TypedPredictor, Parallel, Refine, majority, Optuna optimizer, DiskCache, MCP integration
Mar 4, 2026
…izers, tracking, worker sandbox) - Add StreamChunk interface and LM.stream() base method with fallback to single-chunk - Add OpenAI.stream() and Anthropic.stream() with real provider streaming - Add Predict.stream() for token-by-token streaming from modules - Add NativeReAct module using provider-native tool/function calling - Add Image primitive with fromURL/fromBase64/fromFile factories and OpenAI/Anthropic serialization - Add BootstrapFinetune optimizer that exports JSONL fine-tuning data - Add GRPO optimizer (Group Relative Policy Optimization) - Add SIMBA optimizer (Stochastic Introspective Mini-Batch Ascent) - Add AvatarOptimizer for persona/role prefix optimization - Add experiment tracking module with Tracker, ConsoleTracker, JsonFileTracker - Add sandbox='worker' option to ProgramOfThought for worker-thread execution - Add GitHub Actions CI and publish workflows - Add typedoc.json configuration - Add 33 new tests covering all new features (218 total, up from 185) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set contents: read on both CI and publish jobs to limit GITHUB_TOKEN scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… I/O in JsonFileTracker, Fisher-Yates shuffle in SIMBA - NativeReAct: parse output field name from signature string instead of hardcoding 'answer' - JsonFileTracker.flush(): use async appendFile from fs/promises instead of blocking appendFileSync - SIMBA: replace sort-based shuffle with proper O(n) Fisher-Yates algorithm Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ReAct, Image, GRPO, SIMBA, AvatarOptimizer, BootstrapFinetune, tracking, worker sandbox, CI/CD Co-authored-by: Psyborgs-git <49641518+Psyborgs-git@users.noreply.github.com>
Copilot
AI
changed the title
feat: DSTsx v2 — TypedPredictor, Parallel, Refine, majority, Optuna optimizer, DiskCache, MCP integration
feat: DSTsx v2 — complete all planned features + MCP integration
Mar 4, 2026
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.
Implements the full v2 roadmap for DSTsx (TypeScript port of DSPy), adding all planned features from scratch. 218 tests pass across 46 test files (up from 160/29 in v1).
New Modules
TypedPredictor<T>/TypedChainOfThought<T>— JSON output with optional Zod schema validation, markdown fence stripping, configurable retry; returnsTypedPrediction<T>with.typedParallel—Promise.allfan-out;run()→Prediction[],forward()→ first result for Module compatRefine— self-critique loop: inner module → built-in critic predictor → re-run with feedbackNativeReAct— OpenAI tools API / Anthropic tool_use based ReAct; parsestool_callsfrom raw responseNew Primitives & Helpers
Image—fromURL / fromBase64 / fromFile;toOpenAIContentPart()/toAnthropicContentBlock()serializers for multi-modal LM callsmajority(field)— voting reducer acrossPrediction[]; drop-inreduceFuncforBestOfN/EnsembleStreamChunktype +LM.stream()fallback + real streaming inOpenAIandAnthropicadapters +Predict.stream(inputs)New Optimizers
BootstrapFewShotWithOptuna— pure-TS TPE (Tree-structured Parzen Estimator) Bayesian demo subset searchBootstrapFinetune— collects traces, exports JSONL in"openai"or"generic"format for fine-tuningGRPO— Group Relative Policy Optimization; each step generatesgroupSizeinstruction variants, ranks by relative advantage(score − mean) / stdSIMBA— stochastic mini-batch ascent with Fisher-Yates sampling; accepts candidates that improve on random batchesAvatarOptimizer— per-predictor persona search; proposesnumAvatarsrole descriptions via LM, keeps best-scoringExperiment Tracking
Abstract
Tracker+TrackerEvent; concreteConsoleTrackerandJsonFileTracker(async JSONL append). Custom trackers extendTracker:Infrastructure
DiskCache— SHA-256 keyed JSON files, TTL + LRU eviction;LMacceptscacheDirfor two-level cachingProgramOfThoughtsandbox — newsandbox: "worker" | "function" | "none"option;"worker"usesnode:worker_threadswith true cancellation on timeoutMCPToolAdapter(MCP server tools → DSTsxToolfor ReAct) +DSTsxMCPServer(DSTsx modules → MCP tool definitions)ci.yml(typecheck + test + build on push/PR) +publish.yml(npm publish on release)typedoc.json— enablesnpm run docsUsage snapshot
Original prompt
Created from VS Code.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.