Skip to content

chore(fork): sync current upstream before Claude recovery - #5

Closed
q1 wants to merge 320 commits into
forkfrom
sync/20260906T212712Z
Closed

chore(fork): sync current upstream before Claude recovery#5
q1 wants to merge 320 commits into
forkfrom
sync/20260906T212712Z

Conversation

@q1

@q1 q1 commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Rebase the maintained series from upstream 2fb99a7a6 onto ea646c083 before the Claude failed-turn recovery work. The main mirror is updated; this PR does not promote fork or deploy a release.

All 86 existing commits were replayed. Manual resolutions preserve the current dependency patch hash, private CLI helper and branded command suggestions, npm/pnpm installation fallback with verified release tarballs, and both Projects and Prism routes. Upstream's pooled usage view now reads source labels directly, so the obsolete Prism label override was removed. The Prism adapter now forwards the new compaction descriptor. SwiftUI's Environment property wrapper is qualified to avoid the connection-model name collision.

Validation:

  • 40 focused CLI, pinned-runtime, and usage-source tests; 8 Prism routing tests passed.
  • Server, web, client-runtime, and core package typechecks passed.
  • Sync seam check passed: 39 files against the 40-file budget.
  • The combined sync/recovery branch builds the SwiftUI app and test bundle for arm64 Simulator. Native UI validation is left to the maintainer.
  • GitHub Fork CI is running; inspect its final result before promotion.

This sync required manual resolutions, so it is left for human review under the fork-sync policy. Rollback tag: snap/20260906T212712Z. The detailed sync log is fork/docs/sync-log/20260906T212712Z.md.

Model: GPT-6. Harness: Codex.

juliusmarminge and others added 30 commits September 5, 2026 00:42
…9938)

Co-authored-by: Claude Code <noreply@anthropic.com>
q1 and others added 26 commits September 6, 2026 15:05
Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`fork.json` `prism.usageSource` (default true) says whether Prism publishes
its pooled accounts to the Limits view through upstream's usage-limit
source machinery. `PrismStatus.usageSource` reports it and
`PUT /api/fork/prism/usage-source` (`access:write`) changes it, with the
matching `setPrismUsageSource` client function.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Upstream now polls "CLIProxyAPI hub" entries from settings.usageLimitSources
and shows their pooled accounts on Usage -> Limits. Prism already knows its
gateway URL and management secret, so with the flag on it should be one of
those sources without the user re-entering it as a hub.

The process-wide PrismEndpoint now carries the management secret (server
only) and the prism.usageSource toggle. PrismEnvironment derives the
`prism` cliproxy entry from it, appends it to the configured sources unless
a user hub already targets the same origin (or reuses the id), and emits on
a PubSub whenever the entry appears, moves, or disappears. UsageLimitSources
gets three marked seam lines: the import, the wrapped entries, and a refresh
subscription. With the flag off the helper returns the same array instance,
so the upstream path is unchanged.

PrismService publishes the secret and toggle with the endpoint, reports
`usageSource` in its status, and gains `reloadUsageSource`, which the new
`PUT usage-source` handler calls after writing prism.usageSource through
ForkFlagsService.update (503 flag-off, 403 without access:write, 500 on a
failed write).

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With the server publishing Prism as a usage-limit source, the web app has
to say so where upstream shows hubs, without asking the user to add the
proxy as a hub by hand.

Settings -> Providers -> Usage providers renders a fork-owned Prism row
first when that environment's prism flag is on: "Managed by q1code", the
base URL, and whether the pooled accounts reach Usage -> Limits, with a link
to the Prism tab. It is not removable there; the empty-state row yields to
it and renders upstream's text otherwise. Usage -> Limits labels the source
with id `prism` as "Prism" instead of "CLI Proxy". Both are three-line
marked seams.

The Prism tab's Status section gains the switch "Show pooled accounts on
Usage -> Limits" bound to setPrismUsageSource (optimistic, rolls back with a
toast on failure) with a line linking to /usage. The tab's own API-key
usage section and the per-account quota tooltip are gone: the Limits view
owns quota now. The "Requests" counters stay. getPrismUsage stays in the
client runtime for the CLI. Search entry prism-usage-source, "Show on
Usage -> Limits". usePrismApi can bind to any environment for the row.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The registry entry for prism gains the phase 4 summary (behaviour, the
prism.usageSource toggle, the same-origin dedupe rule, flag-off parity, the
tests), the config key, and the three new seam files. fork/SEAMS.md is
regenerated: 39 of 40 files.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Mic's fleet monitor needs one command that answers "is this host's Prism
gateway up, and how many accounts does it pool" without a running server.
`q1code prism status --json` reads fork.json and the secret store from the
state directory, resolves the gateway like PrismService does (sidecar
loopback port or the external origin, default or configured management
secret name), probes /v0/management/latest-version with a 5 s timeout, then
counts /auth-files and reads /routing/strategy. It prints exactly
{mode, baseUrl, reachable, accounts, disabled, strategy, error?} and exits 0
only when the flag is on, the secret is stored, and every call answered;
otherwise it still prints the object with `error` (never the secret) and
exits 1. `prism accounts [--json]` lists id, provider, disabled, weight.

The HTTP layer is a reference (Fetch by default) so the tests drive the
whole CLI over a scripted client and TestClock. `runWithSecretStore` is
exported from secret.ts and its callback may use Path. bin.ts gains one
`// fork: prism` seam line (import plus subcommand entry) next to the
`base` one.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Limits view can show Prism's pooled accounts, and the server exposes
that as `PrismStatus.usageSource` with `PUT usage-source`. Mobile had no
way to see or change it.

The Status section now carries a "Show pooled accounts on Usage → Limits"
switch. It reads `status.usageSource` (absent means on), flips at once,
ignores a stale status poll while the save is in flight, and rolls back
with an inline error when `setPrismUsageSource` fails. The state machine
is the pure `reducePrismUsageSource` in prismSettings.logic.ts with tests;
usePrismApi binds `setUsageSource`.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Registry entry for prism: the `q1code prism status|accounts` bullet (exit
codes, JSON keys, no server needed), the bin.ts seam in the seams list,
the mobile switch sentence, and the new CLI test file plus the usage-source
reducer cases in the tests list.

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… summary

Fork-Feature: prism
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…he sync

The rebase resolution of the release-manifest commit left the workspace
dependency listed under both dependencies and devDependencies; pnpm then
rewrote the lockfile on every install. Back to the single devDependency
entry the pack step relies on.

Fork-Feature: base
Upstream: no
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Verified the Linux amd64 release against checksums.txt and exercised its authenticated management API with isolated temporary state.

Fork-Feature: prism
Upstream: no
Use authenticated routing state for readiness and reuse that response in CLI status. A failed GitHub version check no longer marks a working gateway unavailable.

Fork-Feature: prism
Upstream: no
Fork-Feature: prism

Upstream: no
Fork-Feature: base

Upstream: no
Fork-Feature: base

Upstream: no
@q1
q1 force-pushed the sync/20260906T212712Z branch from 0b4924a to db595e1 Compare September 6, 2026 22:09
q1 pushed a commit that referenced this pull request Sep 8, 2026
Retain the manual fix reviewed in sync PR #5: the app also defines an Environment model, so qualify the SwiftUI property wrapper explicitly. The Prism feature expansion had restored the unqualified spelling.

Fork-Feature: prism
Fork-Feature: swift-ios
Upstream: no
@q1 q1 closed this Sep 8, 2026
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.