main
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0135b7b0ea |
agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.
What changed:
- packages/agy-cli/index.mjs:
- The offered-model probe now starts in listAgyModels' .then, as soon as
a non-empty list arrives and a caller asked for probeOffered. It no
longer waits for the next models() call. A hung or failed `agy models`
still never spawns the probe.
- probeSignedIn reuses the `agy models` stdout it already has. The same
parser (parseAgyModels, split out of listAgyModels) fills
cachedModelCatalog, and the probe starts. Sign-in waits for the probe
for at most 3s.
- The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
in-flight probe) is forgotten when agyPath changes and after a new
sign-in finishes. A generation counter drops the answer of a probe
that started before the reset.
- provider.warming() returns a promise while a list or probe is still
running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
packages/*/opencode2.mjs: after the first background refresh, the
adapter awaits hooks.provider.warming() once, for at most 60s, and then
refreshes once more. It does not loop. Plugins without warming() behave
as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.
Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.
Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.
Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.
Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
copy-identity check.
Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.
Reported-by: hiee3
|
||
|
|
84ee9b88cc |
sap-aicore: the token deadline test fires the exchange's deadline once fetch is entered (#984)
"token deadline bounds fetch that ignores abort" rewrote every 15000ms timer to 20ms. The credential read and the token exchange each arm their own 15000ms deadline through bounded(), so the read's deadline was cut to 20ms too. When the read took longer than that on a loaded machine, it timed out with the same "token acquisition timed out" message before fetch was ever called, and `upstream.aborted` threw on undefined. The test now keeps both timers at 15000ms, records each deadline's callback, and fires the exchange's (the second) from inside the fake fetch. It checks that two deadlines were armed and that fetch was entered before it checks the abort. The source is unchanged: a separate 15s bound on the read is intended. Run (wsl-run, magpie-desktop, Bun 1.4.2, HOME=$(mktemp -d)): - bun test packages/sap-aicore: 343 pass, 0 fail. - bun scripts/check.mjs: exit 0. Injected by hand: - A 50ms wait at the start of readCredentials' operation. The old test failed with "TypeError: undefined is not an object (evaluating 'upstream.aborted')" at 28ms, the issue's case. The new test passes with the same wait. - The exchange run without bounded() (no deadline). The new test fails. Not tried: the full root bun test run under load where it first failed. |
||
|
|
b228cc6a68 |
sap-aicore 0.3.2: accept session metadata, forward context_management with its beta (caikn, #851)
sap-aicore 0.3.1 refused two top-level Messages fields that real agents send:
- `metadata` (omp sends `metadata.user_id` on every request): now accepted and
dropped in `bedrockBody`, the one builder both /invoke and
/invoke-with-response-stream use, so it never reaches Bedrock.
- `context_management` (omp and Claude Code with thinking on send
`{"edits":[{"type":"clear_thinking_20251015","keep":"all"}]}`), with
`anthropic_beta`: both are accepted as opaque native fields and forwarded
unchanged. When `context_management` comes without `anthropic_beta`, the body
gets `anthropic_beta:["context-management-2025-06-27"]`, which SAP/Bedrock
needs (without it SAP answers 400 "Extra inputs are not permitted"). An
explicit `anthropic_beta` (including [] or null) is sent as given. SAP judges
unknown edits and betas; its 400 surfaces once, redacted, with no retry. The
author verified the literal directive against live SAP deployments (Opus 4.8,
Opus 4.6, Sonnet 4.6, whole replies and streaming). Closes #864.
The test for #812 ("late failure does not delete a newer candidate") now waits
for the first token fetch to start instead of a 10ms sleep, and checks r1
failed, r2 succeeded and two fetches ran. Closes #812.
Version 0.3.1 -> 0.3.2 (the dist branch has 0.3.1; the package is not on npm).
Run at 76e1bfef2 (base 966cf717; origin/main
|
||
|
|
087c36123d |
inkstone 0.1.3: image-caps preflight, a zero-prompt browser sign-in, key calls on the session cookie (#832)
inkstone 0.1.3 (#832, yunwang2442-creator): - Image requests are prechecked before they leave: 8 images, 10MB each, 40MB in all. - A request over a cap gets a local 400 shape refusal, so magpie asks the next account and rests none. - The plan's invalid_media / media_fetch_failed / unsupported_media_type errors become the same kind of refusal. - The body rewrite strips the reasoning fields and sets image detail to auto. - A zero-prompt browser sign-in comes first, and a second browser method reuses a pasted key. - Neither browser method is offered when no Chromium-family browser is found (#825). - The /keys calls ride the session cookie, without the pagination query. Key creation retries the console's -15100 "refresh page and retry". - The #826 metadata token read is kept, and its test is back. - The fake browser is built once per user and source hash (#824), and the title wait reads only on Windows. - maxConcurrency is 4. - The doubled comment line is dropped from every opencode2.mjs copy, agy-cli's included. Reviewed at 88e66bde, on mote (macOS, Bun 1.4.2) with a temp HOME: - full bun test: 6853 pass / 0 fail; both checks exit 0 - bun scripts/check.mjs and bun scripts/check.mjs inkstone: exit 0 - 21 hand breaks: 20 red, 1 not caught (the /keys pagination test calls protocol.listKeys directly; follow-up filed) Not tried: a real InkStone account or sign-in, Windows and Linux runs. |
||
|
|
589fb12334 |
sap-aicore 0.3.1: image content in tool results (#830)
sap-aicore can now take images in tool results: a `tool_result` on Messages, and a `function_call_output` array on Responses. Images still need an image-capable model, and pass the same URL and detail checks as user attachments. Text-only models still refuse them locally, but magpie's gateway already describes or drops tool images before the plugin sees them. Bumped to 0.3.1. Run at b44bb706 on mote (HOME=$(mktemp -d)): - the package's tests: 335 pass, 0 fail - bun scripts/check.mjs sap-aicore: ok - the whole repo's bun test: 5882 pass, 0 fail Each of the five guards, broken by hand, turned a test red. Bedrock's docs and Azure's v1 spec both accept these shapes. CI is green at 92e19bf9 (the bump only). Not tried: a live SAP AI Core request. Co-authored-by: caikn <caikn@users.noreply.github.com> |
||
|
|
e7004d9354 |
inkstone 0.1.0: Intern InkStone (书生·端砚) Token Plan, browser sign-in, credit card and ink-* key chat (#775)
New package @magpie-community/opencode-inkstone-auth 0.1.0 for Intern InkStone (书生·端砚, Shanghai AI Lab) Token Plan, provider id `intern-inkstone`. Community package by yunwang2442-creator. What it does: - Browser sign-in (Edge/Chrome, its own profile under $XDG_CONFIG_HOME or ~/.config/magpie/inkstone-browser, or %LOCALAPPDATA%\magpie\inkstone-browser). The login window has no debugging port. A headless CDP read takes the uaa-token cookie, and the same read renews it silently later. - Usage card: ink-credit balance, 5-hour and 7-day windows, credit packs. - Chat: a pasted ink-* API key, or one the sign-in creates, named ink-<host4>-<acct4>-<rand4> (18 of the console's 20 characters). An idempotency clash (-15109) retries with a fresh name, up to three times. Pruning is on by default. It only touches this machine's and account's prefix, keeps the newest two and the key this sign-in created, and never deletes manual keys or keys of unknown age. - Closing on Unix: SIGTERM, then SIGKILL only after a 15s grace. Leftover browsers are matched by --user-data-dir=<escaped profile>, and Windows uses .Contains(). - The login wait comes from an injected waitForLogin in tests. No env hook is left in production code. - Hosts: discovery.intern-ai.org.cn, discovery-api.intern-ai.org.cn, 127.0.0.1 (CDP). Outside the package: scripts/opencode2.mjs lets a prompt with `required: false` stay optional (`p.required !== false`). Every package's copy is synced byte for byte, so all 39 copies in the merged tree are blob |
||
|
|
0daf0c7421 |
sap-aicore 0.3.0: a new provider for SAP AI Core's GPT Responses and Claude Messages deployments (caikn, #651)
A new provider package, @magpie-community/opencode-sap-aicore-auth 0.3.0
(packages/sap-aicore). It signs in from a local SAP AI Core client-secret
credential file, discovers the account's running GPT (Responses) and Claude
(Messages, Bedrock) deployments per resource group, and sends requests only to
https://*.authentication.*.hana.ondemand.com (token) and
https://api.ai.*.hana.ondemand.com (inference). Image input is gated per model
on the catalog's inputTypes. Also: the root README row, a registry.json entry,
.DS_Store in .gitignore, and scripts/check.mjs accepts an empty static model
list for a package whose provider.models hook is a function with the same id
(npm and the loader are still required).
Reviewed at head b44b3e1b68889c2a12bcaa37ad5d546a398bdde0, with main
|