Skip to content

feat(ai): finalize IBackendsTransport — add list/uninstall, widen opts, tighten JSDoc (PR #526 follow-up)#527

Merged
sroussey merged 4 commits into
claude/elegant-knuth-0SiYxfrom
claude/sweet-edison-NSph2-interface-drift
May 22, 2026
Merged

feat(ai): finalize IBackendsTransport — add list/uninstall, widen opts, tighten JSDoc (PR #526 follow-up)#527
sroussey merged 4 commits into
claude/elegant-knuth-0SiYxfrom
claude/sweet-edison-NSph2-interface-drift

Conversation

@sroussey
Copy link
Copy Markdown
Collaborator

Fixes 2 HIGH-priority interface-drift findings on top of #526.

Summary

  • Adds list() and uninstall(backend) to IBackendsTransport so the libs interface matches what builder PR Webhook Notification Tasks #241's MessagePortBackendsTransport already implements and the renderer UI requires.
  • Widens IEnsureRunningRequest.opts from { ctx: number } to Readonly<Record<string, unknown>> so non-llamacpp backends (sd-cpp, future MLX/whisper) don't have to lie with ctx: 0.
  • Tightens JSDoc on release() (resolves on post, not broker-ack) and subscribeStatus() (idempotent unsubscribe, dedup of double-subscribe).

Coordination

builder PR #241 has a paired follow-up PR (claude/peaceful-albattani-NSph2-interface-drift) that deletes its local copy of IBackendsTransport and imports from @workglow/ai/provider-utils. That PR's typecheck depends on this one — merge order is libs → builder.

Test plan

  • New tests/provider-utils/IBackendsTransport.types.test.ts — compile-time conformance.
  • Existing provider tests pass (StableDiffusionCppProvider updated to pass opts: {}).

Generated by Claude Code

…s, tighten JSDoc

Adds list() and uninstall(backend) to IBackendsTransport so the libs interface
matches what builder's MessagePortBackendsTransport already implements and the
renderer UI requires.

Widens IEnsureRunningRequest.opts from { ctx: number } to
Readonly<Record<string, unknown>> so non-llamacpp backends (sd-cpp, future
MLX/whisper) don't have to lie with ctx: 0. Updates StableDiffusionCppProvider
to pass opts: {} accordingly.

Tightens JSDoc on release() (resolves on post, not broker-ack) and
subscribeStatus() (idempotent unsubscribe, dedup of double-subscribe).
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

Open in StackBlitz

@workglow/cli

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/cli@527

@workglow/ai

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/ai@527

@workglow/browser-control

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/browser-control@527

@workglow/indexeddb

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/indexeddb@527

@workglow/javascript

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/javascript@527

@workglow/job-queue

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/job-queue@527

@workglow/knowledge-base

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/knowledge-base@527

@workglow/mcp

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/mcp@527

@workglow/storage

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/storage@527

@workglow/task-graph

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/task-graph@527

@workglow/tasks

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/tasks@527

@workglow/util

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/util@527

workglow

npm i https://pkg.pr.new/workglow-dev/libs/workglow@527

@workglow/anthropic

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/anthropic@527

@workglow/bun-webview

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/bun-webview@527

@workglow/chrome-ai

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/chrome-ai@527

@workglow/electron

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/electron@527

@workglow/google-gemini

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/google-gemini@527

@workglow/huggingface-inference

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/huggingface-inference@527

@workglow/huggingface-transformers

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/huggingface-transformers@527

@workglow/llamacpp-server

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/llamacpp-server@527

@workglow/mlx

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/mlx@527

@workglow/node-llama-cpp

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/node-llama-cpp@527

@workglow/ollama

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/ollama@527

@workglow/openai

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/openai@527

@workglow/playwright

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/playwright@527

@workglow/postgres

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/postgres@527

@workglow/sqlite

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/sqlite@527

@workglow/stable-diffusion-cpp

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/stable-diffusion-cpp@527

@workglow/supabase

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/supabase@527

@workglow/tf-mediapipe

npm i https://pkg.pr.new/workglow-dev/libs/@workglow/tf-mediapipe@527

commit: 911c165

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Follow-up to PR #526 to reduce interface drift between provider packages and the builder-side backends broker transport, while widening backend runtime options to support non-llamacpp backends.

Changes:

  • Extended IBackendsTransport with list() and uninstall(backend) and updated related JSDoc semantics.
  • Widened IEnsureRunningRequest.opts to Readonly<Record<string, unknown>> and updated Stable Diffusion CPP provider call site to pass an empty opts object.
  • Added a new “type-only conformance” Vitest file intended to assert compile-time compatibility of the transport interface.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
providers/stable-diffusion-cpp/src/ai/StableDiffusionCppProvider.ts Updates ensureRunning() call to pass opts: {} under the widened opts type.
packages/ai/tests/provider-utils/IBackendsTransport.types.test.ts Adds a new conformance test file (currently not picked up by the repo’s main test harness).
packages/ai/src/provider-utils/IBackendsTransport.ts Updates transport interface: widens opts, adds list()/uninstall(), and tightens JSDoc semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +29
* llamacpp uses `{ ctx: number }`; sd-cpp omits it; future backends define
* their own schema.
Comment on lines +7 to +54
// ────────────────────────────────────────────────────────────────────────────
// Compile-time conformance tests for IBackendsTransport.
//
// These tests run via the test runner but their value is in `tsc` accepting
// (or rejecting) the declarations below. No runtime assertions: if the file
// compiles, the contract holds.
// ────────────────────────────────────────────────────────────────────────────

import type { IBackendsTransport, IEnsureRunningRequest } from "../../src/provider-utils";

// opts is now open — accepts the historic llamacpp shape …
const _checkOptsWithCtx: IEnsureRunningRequest["opts"] = { ctx: 4096 };
// … the empty shape for backends like sd-cpp that have no per-run opts …
const _checkOptsEmpty: IEnsureRunningRequest["opts"] = {};
// … and arbitrary shapes for future backends (MLX, whisper, etc.).
const _checkOptsArbitrary: IEnsureRunningRequest["opts"] = { foo: "bar", n: 42 };

// Interface exposes `list` and `uninstall` alongside the existing methods.
type _Methods = keyof IBackendsTransport;
const _hasList: _Methods = "list";
const _hasUninstall: _Methods = "uninstall";

// Structural-conformance dummy — any breaking change to the interface will
// fail typecheck on this assignment.
const _conforms: IBackendsTransport = {
ensureRunning: async () => ({ url: "http://localhost", release: async () => {} }),
subscribeStatus: () => () => {},
install: async () => {},
list: async () => {},
uninstall: async () => {},
};

// Reference each binding so eslint's `no-unused-vars` and `noUnusedLocals`
// don't trip even though these assertions are purely compile-time.
void _checkOptsWithCtx;
void _checkOptsEmpty;
void _checkOptsArbitrary;
void _hasList;
void _hasUninstall;
void _conforms;

// Provide a single trivial runtime assertion so test runners that require at
// least one `test`/`it` block don't choke on this file.
import { describe, it, expect } from "vitest";
describe("IBackendsTransport (type-only conformance)", () => {
it("compiles", () => {
expect(true).toBe(true);
});
Comment on lines +32 to +36
ensureRunning: async () => ({ url: "http://localhost", release: async () => {} }),
subscribeStatus: () => () => {},
install: async () => {},
list: async () => {},
uninstall: async () => {},
sroussey added 3 commits May 22, 2026 08:25
…iscovery

The repo's test runner (scripts/test.ts) only collects Vitest files from
packages/test/src/test, so this file was never executed in CI. Removing
the old location; the file is recreated under packages/test/src/test/ai
in the following commit (also strengthens the structural conformance
assertion with explicit parameter signatures).
…ures

Recreates the type-conformance test at packages/test/src/test/ai/ (the
location scripts/test.ts discovers) and replaces the zero-arg dummy
implementations with explicit parameter signatures drawn from the
interface. TypeScript happily assigns `() => X` to `(arg) => X`, so the
previous form did not catch parameter-list drift; the new form fails
typecheck on any rename, type change, or return-type change to a method
of `IBackendsTransport`.

Imports come from `@workglow/ai/provider-utils` (the public subpath
export) instead of the previous relative path into packages/ai/src.
@github-actions
Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 62.35% 23273 / 37322
🔵 Statements 62.22% 24086 / 38709
🔵 Functions 63.35% 4411 / 6962
🔵 Branches 50.79% 11329 / 22304
File CoverageNo changed files found.
Generated in workflow #2380 for commit 911c165 by the Vitest Coverage Report Action

@sroussey sroussey merged commit bb77cd6 into claude/elegant-knuth-0SiYx May 22, 2026
12 checks passed
@sroussey sroussey deleted the claude/sweet-edison-NSph2-interface-drift branch May 22, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants