Commit graph

132 commits

Author SHA1 Message Date
Darkatse
9ad3d138ab feat(agent): bundle read-only application knowledge skills
Expose bundled application documentation through the existing Skill repository and Session workspace. Materialize versioned resources across platforms, keep built-ins out of installed-skill management and writes, and preserve user Skill macros and saved visibility choices.

Include the maintained knowledge packages and deterministic documentation checks. New assistant profiles enable knowledge reading by default.

Validation: pnpm run check; Android aarch64 check; macOS dev and packaged application checks.
2026-10-22 04:46:02 -04:00
Darkatse
48aa5c7242 refactor(agent): remove round and tool call budgets
Remove the profile limits, runtime counters, quota errors, and extra-round resume flow. Keep tool authorization stateless and give protocol drift recovery its own 20-attempt limit, reset on resume.

Migrate profiles to schema 5 and discard retired fields at the existing profile, draft, and checkpoint decoding boundaries. Route shared Session profile migration and persistence through AgentProfileService.

Validation: pnpm run check; focused profile and runtime tests; macOS profile migration, JSON save, export dialog, and old checkpoint reads.
2026-10-22 01:48:30 -04:00
Darkatse
1c6cd23ac5 refactor(agent): simplify image and capture handling
Use resource identity for thumbnail state and distinguish stale refs from unexpected errors. Append image diagnostics before deciding whether MCP results are empty, and reuse shared role, media and workspace helpers.

Use the capture filter's geometry consistently, share mobile plugin transport, and remove redundant state, error variants and test assertions. Update the API and architecture documentation to match.

Validation: pnpm run check; focused frontend, Gemini, MCP, image and byte-stream tests; Android debug APK build.
2026-10-22 00:57:47 -04:00
Darkatse
974c1e0028 fix(agent): unify tool image storage and result projection
Store incoming images and rejection notes through one entry point, then project MCP results without duplicating structured text or describing image-only results as empty. Centralize stored image formats and file paths, reuse workspace text reads, and remove superseded identity checks.

Preserve Claude tool images and original text with or without current tool definitions. Route OpenAI-compatible tool media once and reject unsupported Gemini tool audio/video. Document capability, normalization and retention at their owning topics.

Validation: payload, gateway, runtime, MCP, image and Shell focused tests; Rust crate boundaries; pnpm run check.
2026-10-22 00:25:40 -04:00
Darkatse
ae78d3cb0d feat(host): capture the content viewport natively
Expose native content viewport PNG bytes through api.layout.capture(). Use ScreenCaptureKit for the macOS WebView's own process window, WK snapshot on iOS, CapturePreview on Windows, WebKitGTK on Linux, PixelCopy on Android and the existing window-layout bridge on OpenHarmony. Keep geometry and image processing with callers and propagate native failures.

Tauri and wry expose native WebViews but no capture API. Declare the already-locked WebView2/Windows and WebKitGTK/Cairo packages directly for those platform calls; no new package versions are introduced.

Validation: pnpm run check; Rust crate boundaries; standard macOS, iOS simulator and Android emulator dev builds; native/system pixel comparisons and timing on all three; Web Host Unsupported response; diff check. Windows, Linux and OpenHarmony runtime validation remains for their native environments.
2026-10-21 23:38:54 -04:00
Darkatse
0f52bf8dac feat(in-app-agent): show tool result images in the Transcript
Read tool image files through a bounded binary workspace API that shares path handling with text reads. Load thumbnails only while tool details are expanded, use the recorded MIME type, and release object URLs on unmount.

Validation: assistant UI tests 10/10 and Agent API contracts 28/28 passed; TypeScript, frontend guardrails, lint, crate boundary and diff checks passed. Shared Rust read path compiled with host MCP contracts.
2026-10-21 22:24:37 -04:00
Darkatse
79124be136 feat(mcp): pass image content from MCP tools to the model
Keep MCP image blocks separate from text and structured results, then route Agent calls through the shared tool image normalization and hydration path. Preserve the existing unsupported-image diagnostics for Manager test calls and Legacy chat without exposing image bytes in their DTOs.

Validation: MCP adapter 14/14, application MCP 14/14 and host Agent MCP contracts 2/2 passed; crate boundary and diff checks passed.
2026-10-21 22:23:18 -04:00
Darkatse
8cba66db41 feat(agent): let tool results carry images
Normalize extension tool images once into workspace files, keep only references in history, and hydrate a request copy before model retries. Carry the admitted image capability through invocation binding and Session compaction, count retained images, and encode tool images in each provider format. Consolidate tool result construction and redact inline media by structure.

Validation: extension runtime contracts 4/4; agent tools 18/18; tool results 5/5; provider image encoding 4/4; HTTP classification and log redaction focused tests; extension JS contracts 3/3; TypeScript, frontend guards, lint and crate boundaries passed.
2026-10-21 22:21:05 -04:00
Darkatse
793dcdc757 feat(in-app-agent): add manual compaction and context usage meter
Let idle Sessions compact through the existing runtime flow without adding a user message or requesting a reply. Publish runtime context measurements in Run events and show their share of the compaction point in the composer, with an action to compact immediately.

Share Session admission and observation between sending and compaction, retain observed runs that write no message, and update API contracts, translations and behavioral coverage.

Validation: pnpm run check.
2026-10-21 20:57:37 -04:00
Darkatse
bc084ea3c7 fix(agent): converge Review-2 admission, bridges and provider errors
Address Review-2. Admit a prompt snapshot once and carry the parsed request
forward; the host round trip builds its own scope. Active Runs report the seq
their activation starts after, so restored bridges skip a resumed Run's earlier
terminal event. Session prepare returns its assembly request directly, start
always records the generation intent, and one builder serves every assembly.

Count tool calls with the encoder's alias rule, pair the compaction trigger
with its count, and rename the limits errors after contextLimits. Classify only
the provider's error value, including the nested error of a Responses
WebSocket event. Claude reports every non-refusal stop. Drop frontend Session
counting, repeated guards and fallbacks on values that are always present, and
document each fact once at its owner.

Validation: pnpm run check (browser 78, contracts 429, UI, Rust, clippy).
2026-10-21 20:24:42 -04:00
Darkatse
b35609380d refactor(agent): centralize context counting and prompt snapshot construction
Address Review-1 §2. Keep Session counting in Rust and pass each round's count
into compaction. Separate retained-group selection, summary generation and the
recording flow; reuse the decoded response text and avoid cloning Session state.
Group root invocation startup inputs and drop a redundant transport reset.

Build canonical snapshot metadata once as contextLimits. Share current-prompt
payload preparation while retaining the live extension event before conversion.
Localize the compaction row and use the application's locale and entry animation.

Validation: 43 host Agent contracts; frontend types; 28 API tests; 2 browser suites; 9 assistant UI tests; frontend guardrails/lint; crate boundaries.
2026-10-21 19:06:13 -04:00
Darkatse
c654cc6082 feat(agent): compact a Session's context into a summary the model writes
Use preset token budgets and provider usage to compact Session context at the
point or once after a context overflow. Append the summary to canonical history,
retain whole recent groups, and rebuild through the frozen PromptManager request
before continuing the original round. Keep full history for macros and the UI.

Restore active Session assembly bridges from bootstrap after APP_READY, so page
reloads resume pending assembly and Web Host startup makes no native Session call.
Show compaction progress and a folded summary in the assistant transcript.

Validation: pnpm run check; focused Session/storage/provider tests; Web Host startup tests; real Gemini compaction on desktop, Android and iOS; desktop reload, prompt layout/macros, next-send context and context_full checks.
2026-10-21 18:24:05 -04:00
Darkatse
7830065445 fix(assistant): time a Session run from its creation
The assistant read a Run's start from a `run_started` event that the
backend never emits; it records `run_created`. The status strip therefore
never showed elapsed time, and the transcript fell back to the first
loaded message, which is late once a long run spans several pages.

Session run handles now carry the run record's `createdAt`. The status
strip and the current run's bar use it, and the controller keeps it for
the same run after the terminal refresh drops the handle. Runs that ended
before the page opened still use their loaded messages. The event journal
docs now name `run_created`.

Validation: pnpm run check; in-app-agent tests after the terminal-refresh
follow-up.
2026-10-19 02:05:56 -04:00
Darkatse
0ee1233a47 fix(agent): assemble every invocation from the run input
Sub-agents and handoff targets bound to the current chat preset skipped
PromptManager: they received only their instructions and the task, and
inherited the root's sampling, model and Skill scope. The run input was
also trimmed by the root profile before it was frozen, so their own
context policy could not apply.

Generate() now collects unprojected material before the live assembly
and seals it after the hooks (frozen input schemaVersion 2), keeping
World Info, examples and Author's Note additions by source. A single
projection applies each profile's history window and World Info choice;
the live root uses it too and writes its World Info injections back for
{{outlet}}. The World Info scan no longer rewrites the global Author's
Note; Generate() composes it.

Every delegated invocation now requests host assembly through one preset
resolver: the current preset comes from the capture, a named preset from
the repository. Only a root bound to the current preset reuses its live
generation. The run's preset Skill scope is the captured chat preset,
and legacy `none` bindings read as currentPromptSnapshot.

Fixes #328.

Validation: pnpm run check.
2026-10-14 20:58:35 -04:00
Darkatse
2d446c9237 feat(ohos): adopt the native window layout contract
Bring OpenHarmony onto the contract Android and iOS already follow.
ArkUI lays the Web out in the safe area, ArkWeb's RESIZE_CONTENT
shrinks the layout viewport by the docked keyboard's overlap, and an
app-owned window-layout plugin publishes window snapshots and draws
wallpaper strips behind the system bars.

- Share the window-layout plugin transport between Android and OHOS.
- Drop the remaining OHOS branches in Rust and the frontend.
- Rotate with the sensor, within the system rotation lock.

The ability and plugins-workspace pins point at the Darkatse forks
until LeenHawk/openharmony-ability#1 and LeenHawk/plugins-workspace#1
merge.
2026-10-05 19:53:38 -04:00
Darkatse
f4e48eccc5 refactor(layout): move mobile viewport ownership into native hosts
Consume system bars, cutouts and docked keyboards in Android and iOS,
then let web content use the resulting viewport. Publish window wallpaper
strips through one shared background path.

Remove the old CSS and IME compensation layers, update layout ABI v2,
and keep the matching documentation and behavior tests together.
2026-10-05 05:50:20 -04:00
Darkatse
9329278c6d refactor(files): unify native file selection and delivery
Centralize file picking, staging and delivery across platforms, with explicit cancellation outcomes and source ownership.

Remove superseded platform bridges and redundant tests, and document the shared contract and platform differences.

Validation: pnpm run check; Android aarch64 cargo check; 117 host tests.
2026-10-04 16:28:48 -04:00
Darkatse
07f8247cca refactor(platform): centralize native host identity
Derive platform and shell kind in Rust and inject them before WebView scripts.
Replace frontend UA guesses and pass host facts and IPC budgets to adapters.

Keep chat width in the frontend, preserve iOS policy initialization, and
restore the mobile third-party resource limit. Align docs and test fixtures.
2026-10-03 22:50:26 -04:00
Darkatse
18ca21ba85 refactor(mcp): converge transport on rmcp 3.5
- Bump rmcp to 3.5 and migrate ClientInfo to ClientConfig.
- Use RMCP's built-in reqwest backend instead of the custom bounded client,
  which shadowed upstream discover fallback for sessionless 4xx rejections.
- Map protocol preferences through one lifecycle table and reject a
  negotiated version outside the preference's accepted set.
- Keep a single Auto retry for RMCP treating startup SSE errors as a closed
  connection; drop the dead -32000 arm.
- Update the MCP boundary docs.
2026-10-03 17:20:15 -04:00
Darkatse
90440961b3 feat(extension-store): stream JSON and blob persistence 2026-10-02 02:29:35 -04:00
Darkatse
c9b380aa70 refactor(chat): unify payload and metadata commit sessions
Route full saves and metadata updates through one bounded commit protocol,
with session-owned staging and atomic publication that preserves message bytes.
Simplify behavioral coverage and keep documentation focused on core contracts.
2026-10-01 00:53:02 -04:00
sun19970908
84807b53d4
fix(storage): stream chat summary index snapshots to bound peak memory (#305)
* fix(storage): stream chat summary index snapshots to bound peak memory

The chat summary index buffered the whole metadata-heavy snapshot in memory: flushing deep-cloned every cached ChatSearchResult (including unbounded chat_metadata Value trees) and serialized it into a single Vec<u8>, so the original tree, the clone and the serialized bytes were alive at the same time. On Android, a 118 MB index file made this flush allocate gigabytes within seconds and abort in a tokio worker (memory allocation failed, SIGABRT, no panic visible to users). Related to #215.

The snapshot is now a streamed JSONL document (schema v4): reading parses line by line, writing encodes each entry by reference into a bounded chunk written asynchronously, and the index is published via the standard sync + atomic rename helper. Peak memory is bounded by a single cached entry. Incompatible or corrupt index files are dropped and rebuilt from cold scans, as before.

* fix(storage): keep chat metadata out of summary caches

Cache lightweight directory projections and load full metadata only on request.
Unify header metadata and identity reads, and publish versioned index snapshots
without cloning payloads.

Validation: pnpm run check; native large-metadata allocation measurements.

---------

Co-authored-by: Darkatse <39111369+Darkatse@users.noreply.github.com>
2026-09-30 22:48:53 -04:00
Darkatse
5013efde87 chore(sync): finalize SillyTavern 1.19 compatibility
Sync secret inputs, info block animations, and remaining locale and help links.
Declare 1.19.0 compatibility and align architecture docs and localized READMEs.

Validation: pnpm run check; git diff --check.
Packaging and device tests skipped as requested.
2026-09-27 23:17:48 -04:00
Darkatse
ac8c38a04f feat(formatting): unify message formatting and reasoning refresh 2026-09-27 20:19:53 -04:00
Darkatse
32bd1cbb05 feat(macros): unify contextual evaluation and parameter templates
Capture Agent inputs after extension hooks and share MacroEnv across prompt and request templates. Remove frozen macro emulation while preserving live extension behavior.

Simplify live data reads and browser test discovery; document the public context APIs.

Validation: pnpm run check.
2026-09-27 18:25:44 -04:00
Darkatse
a9240512ec fix(agent): continue after extension tool timeouts
Return timeouts as tool errors so the model can inspect state and continue. Retain cooperative cancellation and warn that the operation may still be running.
2026-09-23 20:21:20 -04:00
Darkatse
cbda79fa23 feat(agent): manage persistent sessions and their lifecycle 2026-09-22 13:40:05 -04:00
Darkatse
9ee758579c fix(skill): coordinate import ownership across views
Hold one import lease through source selection, preview, installation and cleanup. Move Skill Manager onto the shared lifecycle so another view cannot discard active import resources.
2026-09-22 04:24:45 -04:00
Darkatse
b102f57139 feat(agent): stream replies with canonical session origins
Carry assistant text and reasoning through the shared live projection and persist session invocation/round identity for preview reconciliation. Update writing consumers and suppress in-flight event delivery after unsubscribe.
2026-09-22 04:24:31 -04:00
Darkatse
4260e7293e feat(agent): support extension tools across chat and sessions
Register WebView tools through a dedicated provider with shared tool selection, naming, and result handling. Keep extension availability independent from saved profile selections.

Clarify model-facing feedback and consolidate behavioral tests and architecture documentation.
2026-09-22 00:55:32 -04:00
Darkatse
3c4d7db117 feat(agent): add persistent session runtime
Add standalone sessions with a shared profile, continuous JSONL history, and persistent work/tmp directories. Reuse frontend preset assembly and the existing model/tool loop with explicit Chat and Session targets.

Validation: pnpm run check
2026-09-21 22:18:25 -04:00
Darkatse
8d12ac646c docs(agent): describe unified workspace capabilities
Document skill mounts, prompt catalogs and migration boundaries. Retain the JavaScript capability and kit references while removing obsolete executor details.
2026-09-20 19:59:31 -04:00
Darkatse
4c98ff642d feat(sync): include TriviumDB databases in sync scope 2026-09-18 20:15:38 -04:00
Darkatse
c899f6405d refactor(database): integrate TriviumDB through a native adapter
Move database ownership, blocking IO and TQL binding into tt-adapter-triviumdb
and upgrade the native engine to 0.8.8. Preserve the plugin API capabilities
with awaited open, numeric IDs and explicit shared-namespace lifecycle.

Coordinate archive IO with database maintenance and restore each namespace
as a complete file group. Keep behavior tests for persistence, parameter
binding, transactions and recovery instead of per-method forwarding tests.

Validated with pnpm run check and tauri-pilot against the macOS app using
the real data root; temporary test namespaces were removed afterward.
2026-09-18 01:42:56 -04:00
Darkatse
8abb2b3bc7 docs(skills): streamline import guidance and cleanup contract
Keep recursive discovery and batch cleanup responsibilities in the existing Skill documentation. Remove duplicated workflow and implementation details.
2026-09-15 20:25:22 -04:00
xnshf
db4186da1e fix(skills): discover nested imports in folders and archives 2026-09-13 22:51:10 +08:00
Darkatse
0a58a87128 feat(settings): expose opt-in cold swipe loading
Add a disabled-by-default setting with reload semantics and localized help. Document the cold representation, ownership, and save compatibility contracts.
2026-09-13 04:53:10 -04:00
Darkatse
b6d0bbe5ee feat(agent): add slash command for output revisions
Route /fix through the existing resume lifecycle and revise the last reply's selected swipe from its current saved text. Preserve manual edits, support command cancellation, and keep persistent metadata on the bound message.
2026-09-08 03:09:22 -04:00
Darkatse
2a52de78f1 feat(agent): resume chats and retry presentation saves 2026-09-08 01:45:04 -04:00
Darkatse
8e3f51a7c4 feat(agent): stream reasoning in the run timeline 2026-09-06 22:05:03 -04:00
Darkatse
a996402de7 docs(agent): simplify and consolidate framework documentation 2026-09-06 20:53:05 -04:00
Darkatse
bc02ea96c3 fix(agent): support reverse proxy presets in model targets 2026-09-06 19:15:15 -04:00
Darkatse
f16ad7bff0 feat(agent): show structured delegation and handoff details 2026-09-06 19:14:53 -04:00
Darkatse
14d0f10a15 fix(agent): hide automatic commits from timeline 2026-09-06 17:18:33 -04:00
Darkatse
bcf68539aa feat(chat): add cached async content preprocessing hooks 2026-09-06 00:48:25 -04:00
Darkatse
1318f50c69 fix(extensions): preserve required renderer activation errors #227 2026-09-05 22:30:54 -04:00
Darkatse
402ef9bd75 fix(agent): preserve persistent state across chat forks (#216) 2026-09-04 20:11:37 -04:00
Darkatse
76b8b72a84 feat(agent): stream OpenAI Responses tool calls 2026-08-28 18:55:23 -04:00
Darkatse
c8d88663e2 feat(agent): support OpenAI-compatible tool-call streaming 2026-08-28 04:01:27 -04:00
Darkatse
a0bfd3a6b4 docs(agent): document live tool-call streaming 2026-08-28 02:35:43 -04:00