Releases: portel-dev/photon-core
Releases · portel-dev/photon-core
v2.25.0
Added
- New imperative primitives on the
Photonbase class:this.sample()for MCP sampling,this.confirm()for yes/no prompts, andthis.elicit()for structured input requests. Complements the existing async-generatoryield-based elicitation flow and lets plain async methods request input without switching to a generator. Available on all loaded photons via capability injection.
Fixed
this.schedule.cancel()now fires the registered unschedule hook so the in-memory cron registration is evicted from the daemon when the backing task file is unlinked. Prior behavior left ghost timers firing forever against a deleted task record.- Unschedule-hook failures now surface to the caller instead of being silently swallowed. Cancel operations that fail to evict are visible so the caller can react.
detectCapabilities()now recognizes typed-access patterns with function-type parens like((this as any).foo)(). Prior regex missed this shape and skipped capability injection for affected photons.
v2.24.0
[2.24.0] — 2026-04-21
Added
detectCapabilities()now recognizes typed-access patterns like(this as any).call(...),(this as SomeClass).memory,(<T>this).emit(...), and double casts. Previously the regex only matched literalthis.Xtokens, so plain-class photons using a TypeScript workaround silently missed capability injection at runtime. Covers all nine capabilities (emit/memory/call/mcp/lock/instanceMeta/allInstances/caller/render). 32 regression tests intests/detect-capabilities.test.ts.- Stat-gate in
Photon.executeTool()— the base class now checks source mtime before dispatch when a photon was loaded without a daemon. Mirrors the daemon-side gate sophoton cli foo barrun immediately after ased -isees the new code on the first call. - Tool descriptions are sanitized at parse time —
sanitizeDescription()strips HTML, collapses whitespace, and caps length viaMAX_DESCRIPTION_LENGTH. New exports:sanitizeDescription,MAX_DESCRIPTION_LENGTH,SanitizerWarning,SanitizeResult. @maskand@maxResponseBytesmiddleware guards — post-execution masking for PII-sensitive fields and hard byte caps on tool responses.- Per-parameter JSDoc descriptions extracted by the schema extractor.
@format a2uirecognized as a validOutputFormatvalue; Photon can now declare@format a2uion methods that return A2UI v0.9 surfaces.
Fixed
this.memorybaseDir is now pinned on the Photon instance at construction so memory reads survive daemon restarts. PreviouslyMemoryProviderfell back togetDefaultContext()and could drift between cwd-derived locations.- Same root cause:
ScheduleProvidernow pinsbaseDirso schedule files follow the photon'sworkingDirinstead of the resolving process's default.
Tests
tests/memory-namespace-stability.test.ts— 3 cases covering the kith namespace-orphan regression that prompted the memory/schedule baseDir fixes.tests/detect-capabilities.test.ts— 32 cases covering literal + typed-access + type-cast + whitespace patterns and negative cases.tests/description-sanitizer.test.ts— 9 cases for the new description sanitizer.tests/mask-maxbytes-middleware.test.ts— 9 cases for the post-execution guards.