Skip to content

Regenerate the JS SDK, which had fallen behind the routes - #68

Closed
flxkm522 wants to merge 1 commit into
developfrom
feature/regenerate-js-sdk
Closed

flxkm522 wants to merge 1 commit into
developfrom
feature/regenerate-js-sdk

Conversation

@flxkm522

@flxkm522 flxkm522 commented Oct 9, 2026

Copy link
Copy Markdown

What this changes

Regenerates the JS SDK (packages/sdk/js/src/v2/gen) from the current routes, which it had fallen behind. CI doesn't check this SDK, unlike packages/client, so nothing reported the drift.

New in the SDK: the browser-request routes:

  • GET /api/browser/request
  • GET /api/session/{sessionID}/browser
  • POST /api/session/{sessionID}/browser/{requestID}/reply
  • POST /api/session/{sessionID}/browser/{requestID}/refuse

Also new: their events, and the icon and autoInject fields on SkillV2Info.

The regeneration surfaced a type mismatch, fixed here. The SDK's generated types spell arrays mutable (Array<string>), but core's schema spells them readonly. With autoInject.keywords now in the SDK, two places stopped typechecking:

  • src/plugin/host.ts skill.list, which now uses the mutable() helper the file already uses for the agent and provider lists;
  • src/plugin/skill.ts, which registers the built-in skills and now casts with DeepMutable, since the host decodes the source anyway.

Two core tests that hand core services straight to the plugin host are typed against the plugin API.

Why

Split out of #67, so this catch-up isn't hidden in an unrelated change. It's cut from develop, so it does not include #67's /api/insights/sessions. Whichever PR merges second regenerates once more.

How it was verified

  • bun ./packages/sdk/js/script/build.ts: exit 0.
  • bun typecheck --force (no turbo cache): exit 0, 18/18 tasks.
    • Before the fixes, @redrob-code/tui and @redrob-code/core failed. A plain bun typecheck hid this, because turbo replayed cached results.
  • bun test test/config/skill.test.ts test/plugin/skill.test.ts (packages/core): 2 pass.
  • bun test (packages/core): exit 1, 1033 pass, 3 fail. The 3 also fail on develop here, because this sandbox runs as root (util.flock and util.effect-flock "unwritable lock roots", and ProjectV2.resolve ssh/https remotes).

Anything a reviewer should be wary of

  • The SDK is published (publish-sdk.yml), so SDK users get the new methods and the two new skill fields. Nothing is removed.
  • A longer-term fix would be generating readonly arrays, but that would change every generated type.

flxkm522 added a commit that referenced this pull request Oct 12, 2026
…tored

Squash of the redrob-code ENGINE work that was spread across seven open PRs into a single change on develop. The Electron/desktop app and the build-off/Quality-Lab stack move to the alpha/desktop branch separately and are not part of this.

Rolled up:
- #67 insights route + /v1/chat/completions (serve the OpenAI face for real, forward x-redrob-session to the Console).
- #68 regenerate the JS SDK that had fallen behind the routes.
- #69-#74 the media tools and endpoints: image_generate (edit / reference images), speech_generate (mp3), POST /redrob/speech and POST /redrob/transcribe, all on the engine own Redrob credential.
- #79 the shared on-device labellers (route-labeller, work-labeller) as source workspace packages, consumed downstream by Cowork/Office/Design.

Integration fix found by combining the PRs:
- packages/server/src/routes.ts: the chat-completion handler reads LLMClient inside the request, so it was a per-request requirement of the embedded API that Layer.provide(serviceLayer) did not discharge, leaking as a residual requirement and flipping the web.handler signature so the untouched sdk-next caller stopped type-checking. LLMClient is a global service, so it is now provided once via HttpRouter.provideRequest inside makeRoutes.

Review + lean/documentation pass (behaviour-preserving):
- image_generate / speech_generate: size-limit messages derive from their constants instead of hand-kept 10 MB / 50 MB literals (drift-proof).
- speech_generate: characters() uses [...text].length (idiomatic code-point count).
- core/insights.ts: tightened the ErrorEnvelope describe() union guard (identical runtime behaviour).
- plugin/host.ts: removed a misleading comment on skill.list; it matches the uniform mutable() pattern now.
- docs/LOCAL-ENGINE-API.md: documented the shipped /redrob/speech and /redrob/transcribe endpoints (sections 1c, 1d).

Verified: bun turbo typecheck 20/20; bun install --frozen-lockfile clean; engine tool/server tests 42/42; core 6/6; work-labeller 77/77.
@flxkm522

Copy link
Copy Markdown
Author

Superseded by #80, which consolidates all redrob-code engine PRs into a single squashed PR on develop (reviewed + refactored for lean code and docs). Closing this; its content is included there.

@flxkm522 flxkm522 closed this Oct 12, 2026
flxkm522 added a commit that referenced this pull request Oct 12, 2026
…tored

Squash of the redrob-code ENGINE work that was spread across seven open PRs into a single change on develop. The Electron/desktop app and the build-off/Quality-Lab stack move to the alpha/desktop branch separately and are not part of this.

Rolled up:
- #67 insights route + /v1/chat/completions (serve the OpenAI face for real, forward x-redrob-session to the Console).
- #68 regenerate the JS SDK that had fallen behind the routes.
- #69-#74 the media tools and endpoints: image_generate (edit / reference images), speech_generate (mp3), POST /redrob/speech and POST /redrob/transcribe, all on the engine own Redrob credential.
- #79 the shared on-device labellers (route-labeller, work-labeller) as source workspace packages, consumed downstream by Cowork/Office/Design.

Integration fix found by combining the PRs:
- packages/server/src/routes.ts: the chat-completion handler reads LLMClient inside the request, so it was a per-request requirement of the embedded API that Layer.provide(serviceLayer) did not discharge, leaking as a residual requirement and flipping the web.handler signature so the untouched sdk-next caller stopped type-checking. LLMClient is a global service, so it is now provided once via HttpRouter.provideRequest inside makeRoutes.

Review + lean/documentation pass (behaviour-preserving):
- image_generate / speech_generate: size-limit messages derive from their constants instead of hand-kept 10 MB / 50 MB literals (drift-proof).
- speech_generate: characters() uses [...text].length (idiomatic code-point count).
- core/insights.ts: tightened the ErrorEnvelope describe() union guard (identical runtime behaviour).
- plugin/host.ts: removed a misleading comment on skill.list; it matches the uniform mutable() pattern now.
- docs/LOCAL-ENGINE-API.md: documented the shipped /redrob/speech and /redrob/transcribe endpoints (sections 1c, 1d).

Verified: bun turbo typecheck 20/20; bun install --frozen-lockfile clean; engine tool/server tests 42/42; core 6/6; work-labeller 77/77.
flxkm522 added a commit that referenced this pull request Oct 12, 2026
…cs and compat tests

One change on develop that both consolidates the redrob-code ENGINE work and
documents + pins the on-device labelling it introduces. The Electron/desktop app
and the build-off / Quality-Lab stack are the separate alpha/desktop drafts and are
NOT part of this.

== Engine consolidation (was seven PRs) ==
- #67 insights route + /v1/chat/completions (serve the OpenAI face for real; forward
  x-redrob-session to the Console).
- #68 regenerate the JS SDK that had fallen behind the routes.
- #69-#74 the media tools and endpoints: image_generate (edit / reference images),
  speech_generate (mp3), POST /redrob/speech and POST /redrob/transcribe, all on the
  engine own Redrob credential.
- #79 the shared on-device labellers (route-labeller, work-labeller) as source
  workspace packages, consumed downstream by Cowork/Office/Design.

Integration fix: the chat-completion handler reads LLMClient inside the request, so it
was a per-request requirement of the embedded API that Layer.provide(serviceLayer) did
not discharge, leaking as a residual requirement and breaking the untouched sdk-next
caller. LLMClient is a global service, so it is now provided once via
HttpRouter.provideRequest inside makeRoutes (packages/server/src/routes.ts).

Lean/doc pass (behaviour-preserving): size-limit messages derive from their constants;
speech_generate characters() uses [...text].length; the insights describe() union guard
is tightened; a misleading plugin/host comment removed; /redrob/speech + /redrob/transcribe
documented in LOCAL-ENGINE-API.md; and the httpapi route-coverage harness gained scenarios
for the two /redrob/* routes.

== On-device labelling: docs + compatibility (answering the CTO review) ==
- docs/ON-DEVICE-LABELLING.md (new): the single reference for WHY there is encoder code
  (we wrap pinned off-the-shelf models -- distiluse, multilingual-e5-base -- not our own
  encoders, for on-device privacy + one implementation across products), WHERE the tensors
  live (only the small trained layers are ours and in git: work-head.json 159KB,
  prototypes.json 232KB; base weights are hash-pinned downloads), the model-free-CI vs
  opt-in-eval story, and the backwards-compat model for third-party clients. Includes the
  pending checklist to move the e5 release asset from redrob-cowork to redrob-code (SHA
  pins unchanged; the url is not flipped now because a not-yet-uploaded release would 404).
- httpapi-chat-completion.test.ts: two new v1-contract cases -- the newer optional fields
  (max_completion_tokens, reasoning_effort, user) stay accepted, and unknown request fields
  (a Console-style redrob block, a bogus key) are IGNORED not rejected. The second pins the
  exact forward/third-party-compat guarantee and fails CI if the schema rejects excess props.
- test.yml: the labellers job comment now spells out that the unit suites are model-free and
  CI-safe, and the real ~140MB/~278MB encoders are needed ONLY by the opt-in eval/model dev
  commands, which stay off the PR path.

Verified: bun turbo typecheck 20/20; bun install --frozen-lockfile clean; engine tool/server
tests + the 7 chat-completion contract cases pass; core 6/6; work-labeller 77/77.
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