ff9d3a6446a2b6213d2759a6119ffa8a97656db9
17
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a313a00306 |
zcode 0.1.56: the Start Plan goes three at a time and re-asks a cap twice, as ZCode's client does
Users of other agent apps on the ZCode plugin saw "rate limited 5 times in a minute" (star21321321124 on Discord). That is the plugin's own 3-minute busy hold (0.1.54, #801), which trips after ZCode refuses five requests in a minute as over its in-flight cap (429 3008/3009). The plugin drove those refusals itself: - It sent every request magpie passed it. magpie's lane is 3 per account, but nothing in the plugin held the Start Plan to that. - It re-asked a capped request up to six times over about 10s (BUSY_WAITS 250..4000, from #395). That kept slots taken and drew more caps. - It counted every capped request toward the hold, including ones the next re-ask got past. ZCode 3.17.2, read from its bundle: wqo = {3008, 3009, 3010} and kqo = [1e3, 2e3]. So a busy cap is re-asked at most twice, after 1s and 2s, Start Plan only. There is no hold, and one main turn runs per session. What changes: - BUSY_WAITS is [1000, 2000], with no jitter, and 3010 counts as busy. This applies to every plan, since the coding plan goes through the same askBusy. - startGate: on the Start Plan, an account has at most 3 requests in flight (#395 measured about 3: 3 of 12 and 4 of 12 served). The account is keyed by uid, then accountId, then key. Further requests wait in a FIFO queue in the plugin and are not sent. A slot is freed when the upstream body ends, the agent cancels, or its signal aborts (the body is pumped eagerly so an unread reply cannot hold a slot). After 2 minutes of waiting, the plugin answers 429 rate_limit_error with Retry-After 5: "ZCode's free Start Plan serves this account 3 requests at a time; this one waited 120s behind the others and was not sent. Run fewer agents or subagents on ZCode at once, or try again". The coding plan stays ungated. Its cap follows the tier (the #395 review), and magpie's lane covers it. - Free first skips the gift while its account's gate is full, so the plain model goes to the coding plan rather than queueing. - The hold counts a request only when ZCode refuses it again at the 1s re-ask. N=5, the 60s window and the 3-minute hold are unchanged, as is the rule that an in-flight or queued request stops once the hold is armed. Its message now says what happened and what to do: "ZCode turned away 5 requests in the last minute as too many requests at once, each again when asked a second later. So that ZCode's firewall does not block this network, magpie sends no free Start Plan requests for the next Ns. Wait, run fewer agents or subagents on ZCode at once, or use a GLM Coding Plan model". The words avoid "plan"+"limit" after "exceeded", which magpie's usedUpWords would read as spent. History checked: #395 (0.1.32) added the long waits and had an in-plugin gate removed in review, because it held Max coding-plan accounts to 3 and was keyed on the jwt. This gate is Start Plan only (one tier) and keyed per account. #801 (0.1.54) added the hold from the logs of 11-05 23:06 and 11-06 06:23: about 16 to 18 req/min, 7 to 10 in flight, and the first 405 after 205 to 517s. The hold still trips on sustained refusals: the replay below has the account saturated elsewhere, and the hold arms within the replayed minute with nothing sent after it. Run on mote, HOME=$(mktemp -d), at the rebased head, Bun 1.4.2: - bun test packages/zcode: 235 pass, 0 fail. - New inflight.test.mjs: 13 pass. It covers re-ask count and timing (3 asks, gaps of about 1s and 2s), 3010, at most 3 in flight of 12 sent at once, per-account slots, a slot held across re-asks, the queue wait running out (nothing sent, plain 429), abort while queued, a cancelled stream freeing its slot, the coding plan ungated, a cap the 1s re-ask got past not counting, and the hold message. It also replays #801's two days at 20x speed against a fake that refuses past 3 in flight: 0 refusals, peak 3, no hold, all served. A second replay with the account saturated elsewhere arms the hold within a minute. - bun scripts/check.mjs zcode: ok (registry.json, zcode). Repo bun test: 6780 pass, 0 fail, 20 skip, 491 files. Broken by hand: inflight.test.mjs against 0.1.55's index.mjs gives 11 of 13 red. 0.1.55 made 7 asks, had 12 in flight, drew 24 refusals in the replay, and armed the hold on caps a re-ask got past. Two pass on both, as expected: the coding plan stays ungated, and the saturated replay still holds. Not tried: real ZCode Start Plan accounts, live; the replay is synthetic from the #801 figures, as the raw logs are not in the repo. Not copied from ZCode's client: its "no re-ask on a session's first turn" rule, since the plugin cannot tell a first turn reliably. Reported-by: star21321321124 |
||
|
|
ea9904d54c |
zcode 0.1.55: no claim while ZCode asks its security check; the desktop's X-Title and a per-turn x-query-id
young02036 (Discord, 11-07): on an account with a GLM Coding Plan, the
GLM-5.3-Flash-Trial gift answers 405 code 3012 ("blocked due to unusual
activity") while the paid models work, and the plugin's daily check-in
gets a captcha every day while the app shows none.
Diffed against the official ZCode 3.17.2 (zip sha512 matched its
manifest; glm/zcode.cjs and app.asar's host and renderer code):
- The claim. The app's claimManualPlan posts the claim with
X-Aliyun-Captcha-Verify-Param/Region, and its renderer always runs the
traceless captcha first. client/configs says captcha.enabled true
(testdata/client-configs-1107.json, the real reply cut down). The plugin
can't make that proof, so each day's claim was one more refused claim.
Now claimDaily reads client/configs (cached ten minutes, a failed read
not kept) before posting: while captcha.enabled is not false nothing is
posted and each plan answers captcha, "claim it in the ZCode app"; a
config that doesn't read is failed, nothing posted. The captcha is not
got past.
- X-Title. The desktop's model requests say "Z Code@electron"
(sourceTitle from zcode-protocol-entrypoint); the plugin said
"Z Code@cli".
- x-query-id. ZCode sends one per user query (query_<uuid>, prefix
stripped). The Start Plan path now sends a UUID made from the session
and the count of user text messages: the same through a turn's tool
results, new with the next user message.
The 3012 itself: on the owner's account (no gift, so code 1005 "exceed
quota limit" means risk control let it through) every shape answered
200 code 1005: adaptive thinking with effort max and max_tokens 64000, a
1.6 MB body, max_tokens 200000, thinking enabled with budget 1024, and
X-Title electron. So the request's shape is not what trips 3012; the
reporter's account looks blocked by risk control as a whole, which only
ZCode support lifts. That the daily captcha-less claims fed it is a
guess.
Run (mote): HOME=$(mktemp -d) bun test in packages/zcode, 222 pass 0
fail; bun scripts/check.mjs zcode ok.
Broken by hand, each red, then restored (cmp ok): the claim gate removed
(2 fail), a config read failure taken as no captcha (1), x-query-id not
set (2), user turns counted wrong (1), the title back to cli (3).
Not tried: a real claim or a real 3012 account (the reporter's); the new
headers against an account that has a gift; Windows and Linux.
Reported-by: young02036
|
||
|
|
09a27bef01 |
zcode 0.1.54: a busy hold also stops requests already in flight (#801)
When five Start Plan requests in 60s get ZCode's 3008 "busy", magpie holds zcode.z.ai off, so that the counting firewall doesn't escalate to its 405 block. While the hold is on, a Start Plan request is answered locally with a 429 carrying Retry-After, and it is not counted. A request that was already retrying when the hold armed now stops too: askBusy checks the hold after counting a cap and again after each wait. The coding plan and free first's replay pass no onCap, so the hold never touches them. When the edge (405) hold and the busy hold are both on, the edge hold's answer wins. Run at the reviewed head 19f7e9019ca22a3bad97c974bdf796b88ec8e3e3 (Bun 1.4.2, HOME=$(mktemp -d)): - macOS (mote): bun test packages/zcode 217 pass 0 fail; bun scripts/check.mjs zcode ok; repo-root bun test 6580 pass, 20 skip, 0 fail (475 files). - Linux (WSL2 Ubuntu 24.04): bun test packages/zcode 217 pass 0 fail; check ok. Broken by hand (full zcode suite each): - post-sleep hold check removed: red, 16 asks instead of 12; - busyCap's in-hold return removed: red, hits 2 instead of 0. - The post-cap check removed, or onCap keying dropped: still green. These are latency and coding-plan scoping, left for a follow-up test. npm had 0.1.51 to 0.1.53 at review time, so 0.1.54 is free. Not tried: a real ZCode 3008 storm, the firewall's real 405, magpie's fallback on the hold's 429 in a real gateway run, Windows. |
||
|
|
8163be365f |
zcode: test the system shape zcode.z.ai lets through (plugins#348)
XinOrigin's matrix on plugins#348 (11-04) says zcode.z.ai serves a Start Plan request only when its system is an array of two or three text blocks, ZCode's first byte for byte and its second as ZCode's begins; a string, no system, the first block alone, the first with a block of the caller's, or a fourth block answers 405/3012. The new test sends Claude Code's shape (billing-header block, prompt, CLAUDE.md block, with thinking adaptive, context_management and output_config), Codex's string instructions, no system, and ZCode's first block alone, and checks each goes out as the passing row: three text blocks, ZCode's first two unchanged, the agent's text after ZCode's own sections in the third, the top-level fields kept. No code change: 0.1.51 already sends this shape (0.1.21 for #343, 0.1.48 for the 3.17.2 texts). Live, on the owner's ZCode account (11-06 15:48 UTC, a GLM Coding Plan account with no Start Plan gift), one request each to zcode.z.ai/api/v1/zcode-plan/anthropic/v1/messages with 0.1.51's startHeaders and dress: - Claude Code-style system: 200 {"code":1005,"msg":"exceed quota limit"} - the same with a 30KB agent system: 200, 1005 - Codex-style string system: 200, 1005 - Claude Code's top-level fields and a tool: 200, 1005 - control, ZCode's first block alone, not dressed: 405 code 3012 (logid 20261106154826f91ddad38c8bfdefae1d) So the system check runs before the quota check, and 0.1.51's dressing gets past it. Not tried: a request on an account with a live gift (the owner's has none), and a burst of requests. Run on mote: bun test in packages/zcode, 201 pass, 0 fail, 12 runs in a row; one earlier run had 5 reds in userid.test.mjs (expect(got.length) .toBe(1)), not seen again in those 12 runs. bun scripts/check.mjs zcode ok. Broken by hand: dress sending the agent's text as a fourth block and more turns the new test red (Expected 3, Received 6); restored, green. |
||
|
|
7e3713233f |
zcode 0.1.47: the Start Plan's prompt texts are ZCode 3.17.2's
zcode.z.ai turns every dressed Start Plan (gift) request away again
with 405 "request has been blocked due to unusual activity", code 3012,
since the evening of 11-03: every account with a live gift, while the
ZCode app's own gift requests go through on the same machine and the
same accounts (five gift-holding accounts probed, all 405 through the
plugin, the four without a gift taking the plugin's own 400). The plan
path (api.z.ai, open.bigmodel.cn) is unaffected — only the dressed
requests to zcode.z.ai are refused, so it is the dressing, not the
accounts and not the address.
0.1.46 raised APP_VERSION to 3.17.2 (
|
||
|
|
8fc12a38b3 |
zcode 0.1.46: sign in as ZCode 3.17.2 and take a Start Plan that starts later
Three changes, each matching the client's source at zai-org/ZCode@a9fe401 (v3.17.2): - Every call goes out as 3.17.2: the sign-in, the Start Plan balance, the config, the requests, and (as in #678) the feed and the claim. ZCode gates by the version. #678 found the feed answers empty to 3.16.3, and the balance "judges capability by the real app_version" (zaiStartPlanBilling.ts). MARKETING_VERSION folds into APP_VERSION. - A sign-in whose only Start Plan starts later is taken, not refused with "has ended or was never started". ZCode's resolveStartPlanBalanceAvailability counts such a plan ("pending") as the account's. startPlan takes it only when the sign-in asks (coming); requests and the card are unchanged, and the card already names its start. - X-Client-Language on the feed is zh-CN or en-US only, as marketingTouchService's localeSchema sends it. Before, it was the computer's locale as it was (zh-Hans-CN, en-GB, ...). Run at this tree on mote: - bun test packages/zcode: 191 pass, 0 fail. - bun scripts/check.mjs: clean. Broken by hand: - APP_VERSION back to 3.16.3: 7 red, among them the two new sign-in tests through their balance app_version check. - The sign-in without coming: those 2 red. - The old locale: the language test red. Not tried: a live sign-in, balance or feed. No ZCode account was in a sandbox. Whether the balance answered sliyrainbow's account with no plan under 3.16.3 or with one that starts later is not known; this fix covers both. Reported by jinpy666 (#676) and sliyrainbow (Discord). |
||
|
|
036fb6ed43 |
zcode 0.1.43: a block page holds zcode.z.ai off three minutes, for every account (#649, frank6com)
frank6com's 405 ("the provider's network firewall blocked requests from
this IP") is Aliyun's edge firewall in front of zcode.z.ai answering
POST /api/v1/zcode-plan/anthropic/v1/messages (the Start Plan) with its
405 HTML page. It is the address, not the method nor the account: ZCode's
own app got the same 405. Two Start Plan accounts and three sessions with
subagents (up to 6 requests at once from one IP), and every request after
the block went on knocking on the firewall, from both accounts, since the
gateway falls back but rests nothing for an edge block.
Now a block page sets a process-wide hold (edge.until, EDGE_HOLD three
minutes): while it lasts, a Start Plan request and a picked -Trial entry
are answered here with the same 405, permission_error and
provider.BlockedHint word for word, plus until when, so magpie's
EdgeBlocked and retryable still send the request to the group's next
provider. Free first leaves the gift and keeps a dual account on its
coding plan (api.z.ai, another host). A 3012 or a bare 405 is the
account's and holds nothing. The first request after the hold asks again.
Run, at this head, on mote:
- packages/zcode: bun test, 189 pass, 0 fail.
- bun scripts/check.mjs zcode: ok.
- Broken by hand: without the line that sets the hold, both new tests
are red (65 pass, 2 fail in start + dual); without !edgeHeld() in free
first, the dual test is red (66 pass, 1 fail).
Not tried: a real zcode.z.ai request. Reproducing needs the address
blocked, and asking until it is would block the owner's network. The page
the tests use is the one plugins#425 recorded.
|
||
|
|
2b56b3bc4f |
zcode: name the conversation in x-session-id as a bare UUID, so BigModel's prompt cache hits (#388)
ZCode's client names every request's conversation in x-session-id: a bare UUID, the same on each turn (3.14.3 xst/Tst). BigModel keeps a prompt's cache for the requests that name the same session. The plugin sent none, so a long conversation seldom hit the cache (#387). Every zcode request, on the Start Plan and on Coding Plan or team seats alike, now carries it: - the agent's session (chat.headers' sessionID, which magpie fills) goes as it is when it is a UUID, lower-cased; - any other id (magpie-<hex>, ses_..., sess_...) goes as a stable UUID made from its sha256; - with no session, a UUID made from the device. metadata.user_id's session_id is the same UUID, in dress() and marked(). Reviewed at 48013c0, which addresses all four points of the earlier review (UUID shape, session_id in user_id, rebase onto 0.1.30, no "Closes #387"): - TMPDIR=<scratch> HOME=$(mktemp -d) bun test in packages/zcode: 125 pass, 0 fail. bun scripts/check.mjs zcode passes. Merges cleanly onto main. - With main's index.mjs and the PR's tests: 17 fail (all 7 new session tests, plus the start, userid and dual assertions on the header). - Probe through the plugin's chat.headers and loader fetch, as magpie's host calls them (host.js passes sessionID and sets out.headers before the fetch): magpie-<hex> twice gives the same UUID in the header and in user_id.session_id, and ses_other gives a different UUID. None contains magpie, ses_ or sess_. Not tried: a real BigModel request (the author's hit-rate numbers are the evidence: 3/12 before, 24/24 after through magpie). |
||
|
|
57598ad410 |
zcode 0.1.30: a coding plan's requests name the device in metadata.user_id, as ZCode's do (#387)
wendyeq measured BigModel's GLM Coding Plan through magpie hitting the
prompt cache 1 time in 19 without metadata.user_id and 13 in 16 with it;
the official ZCode on the same account reads 95-98% of input from cache.
The plugin only put user_id on the Start Plan's dressed body; a coding
plan or team request went as the agent sent it, and Pi sends none.
ZCode 3.14.3 (glm/zcode.cjs) sets it on every Anthropic-format request,
not only the Start Plan's: Pst() returns MLs({deviceMid, sessionId}) for
any providerKind "anthropic", and vWr() puts it in
providerOptions.anthropic.metadata.userId for both generateText and
streamText. The value is {"device_id":<machine id>,"account_uuid":"",
"session_id":...}.
Now a coding plan or team request to .../v1/messages gets
metadata.user_id = {"device_id":<sign-in's saved device>,
"account_uuid":"","session_id":""}, the same value dress() puts on the
Start Plan's, when the agent sent no user_id of its own; other metadata
is kept and content-length dropped when the body changed. count_tokens
and non-Messages bodies go as they were. An account known only by a key
(a pasted API key, or a saved state with no device) gets a device id
hashed from the key, so it is the same on every start rather than
anyDevice, which was new per process.
Differences from ZCode, kept on purpose: ZCode overwrites any user_id
and fills session_id with its session (sess_ prefix stripped); this
keeps an agent's own user_id and sends session_id "" as dress() does,
one stable value per account.
Tests: userid.test.mjs (new, 6 tests; 5 red on origin/main's index.mjs,
the count_tokens one passes there as it should). start, toolsearch and
dual tests that pinned coding plan bodies byte for byte now expect the
agent's body plus the device's user_id.
Run at this tree: HOME=$(mktemp -d) bun test -> 2672 pass, 1 skip,
0 fail across 229 files; bun scripts/check.mjs ok.
Not tried: a real BigModel or Z.ai coding plan request, so the cache
hit rate after the change is the reporter's measurement, not mine.
|
||
|
|
2d59003f8e |
zcode: the team seat's request test uses a key of its own
start.test.mjs's "a team seat's request goes as the agent sent it" used
key "team.secret", the same as team-gift.test.mjs. In one bun test
process the two files share index.mjs's routes cache (key + jwt), and
when both jwts were built in the same second the seat test read
team-gift's cached route, skipped the billing/balance read and saw 1
request where it expects 2. That kept publish.yml red since
|
||
|
|
935ddb5b45 |
zcode: a team seat lists the person's gift plans and their -Trial models (#359, #371)
A team seat's ZCode session also reads the person's own gift plans (#359): plansOf no longer returns {start:false, gift:null} for every team seat. A team seat stays on its team plan (its personal plan list is not read), its <model>-Trial entries are listed, its card shows the gift buckets beside the team's windows, and a team seat with no or an expired ZCode session gets the "ZCode gift plans (-Trial models) need ZCode's sign-in" line. Plain models spend the team key; -Trial models go to zcode.z.ai with the ZCode session and no team key or organization header.
Reviewed at 4778e0d (on main
|
||
|
|
28f9cbb3b2 |
zcode 0.1.27: the Start Plan's 405 code 3012 says ZCode's risk control blocked the account, not a network block (#348)
zcode.z.ai answers {"code":3012,"msg":"request has been blocked due to
unusual activity."} with 405. Since 10-24 many accounts get it on every
request, and on several of them ZCode's own app (3.16.3) gets the same 405;
ZCode's support bot calls 3012 platform risk control on the account. The
plugin used to put "though magpie sends it as the ZCode app does; it can
be a network block of this IP" after it, and read that JSON as the edge
firewall's page (EDGE_BLOCKED matched "request has been blocked"), so
ZCode's own words and code were dropped.
Now: ZCode's words with the status and code, then provider
ZCodeRestrictedHint word for word ("ZCode's risk control blocked this
account for unusual activity (code 3012); it rests, and the group's other
providers are used. ..."), which magpie's gateway reads as the account
restricted (2h rest, next member asked) from the next magpie release on.
Only an HTML / errors.aliyun.com block page says the network's address
(provider.BlockedHint's words).
Compared with ZCode 3.16.3's glm/zcode.cjs (downloaded from
cdn-zcode.z.ai, the latest on zcode.z.ai): the Start Plan is sent
unsigned there too (requiresClientRequestSigning is false for
zhipu-account start-plan, off-peak and highspeed; X-Client-Sig/Pow apply
to coding-plan keys on the paas origin), and the headers plugins#348's
curl shows are the plugin's set. No request difference was found that
explains 3012; not tried against a real blocked account.
Run: packages/zcode, Bun 1.4.2, sandbox HOME: 102 pass, 0 fail. The new
start.test.mjs case is red on 0.1.26's index.mjs (1 fail, the 3012
message). bun scripts/check.mjs ok.
|
||
|
|
57ec655a24 |
zcode 0.1.22: a Start Plan request goes with ZCode 3.16.3's headers alone, never the agent's, and without ?beta=true
01huadalang (Discord) gets 405 / "ZCode's Start Plan still turned this request away" again on 0.1.21. #343's check was a curl request to magpie, which carries no agent headers. What reached zcode.z.ai: startHeaders set ZCode's headers on top of the ones it was given and removed only x-api-key, authorization and X-Device-Mid. A plugin provider has no account of its own in magpie's gateway, so a request from Claude Code goes to the plugin with Claude Code's own headers (anthropic-beta claude-code-20250219,..., x-app: cli, x-stainless-*, anthropic-dangerous-direct-browser-access, x-claude-code-session-id) and ?beta=true on the URL (gateway.go claudeCodeHeader, #179). All of that went on to the Start Plan. The retired built-in deleted anthropic-beta, and its accounts never got the Claude Code pass-through. ZCode sends none of these on the Start Plan: its only beta, advanced-tool-use, is for coding plans. Now startHeaders builds a new header set: the body's content-type and ZCode's headers, as ZCode.app 3.16.3 (the current stable, 10-23) sends them in glm/zcode.cjs: - buildZCodeSourceHeadersFromContext: X-Os-Version is os.release() alone (it was "darwin 25.2.0 arm64"), and X-Client-Timezone is "unknown" when there is none. - createModelRequestAttributionHeaders: the new x-zcode-query-source: main_turn. - APP_VERSION goes to 3.16.3 (User-Agent, X-ZCode-App-Version and the app_version query). The Start Plan URL loses its query. Prompt texts, the Start Plan provider entry and ai-sdk/anthropic 3.0.81 are the same in 3.14.3 and 3.16.3 (checked against both bundles). The GLM Coding Plan and team paths are unchanged, and a new test holds that they keep the agent's query and headers. Not established: which header (if any) zcode.z.ai keys on. No Start Plan account was used. A network block of the user's IP is still possible, and the error still says so. Run: bun test in packages/zcode under a temp HOME, 90 pass. The two start.test.mjs header tests fail on 0.1.21's index.mjs (Claude Code's x-app/x-stainless-*/anthropic-beta and the query reach the fake). |
||
|
|
44036e2fcc |
zcode 0.1.21: a Start Plan request sends the agent's system prompt at the end of ZCode's third system block, not as a fourth (#343)
fordlyn's report: on a Start Plan account zcode.z.ai now answers every
request whose system has more than three blocks with 405
{"code":3012,"msg":"request has been blocked due to unusual activity."}.
dress() put ZCode's three cached blocks first and then the agent's own
system texts as blocks 4, 5, ..., so every agent (all of them send a
system prompt) was turned away; only a system-less request passed.
What ZCode does, read from ZCode.app 3.14.3's glm/zcode.cjs
(ContextBuilder.assembleSystemMessages): it sends at most three system
messages, the cli_prefix section, the stable sections, and every dynamic
system section joined with "\n\n" into a third block that starts with
"\n\n". A section added to the builder (addSection) is dynamic by
default, so ZCode's own extra system text lands in the third block.
dress() now does the same: the agent's non-blank text blocks are joined
with "\n\n" after afterEnvironment in the third block, which keeps its
cache mark. The first two blocks stay byte for byte ZCode's, as the
issue's bisect requires. GLM Coding Plan and team requests are not
dressed and are unchanged.
Run: TMPDIR=<scratch> HOME=<scratch>/home bun test (2341 pass, 0 fail);
bun scripts/check.mjs (all ok). The new #343 test in start.test.mjs and
four updated layout tests are red on the old index.mjs (5 of 12 fail).
Not tried against the real API: no Start Plan account at hand. The
reporter's own harness got 200 for this shape (system "x", system plus
tools, 32 KB system, multi-turn).
|
||
|
|
09f946b5e6 |
zcode 0.1.19: a GLM Coding Plan's own resets show on the card, each with its end, a team's say so, and a Start Plan refusal says what to do, as the built-in did
What changed, for parity with magpie's built-in ZCode before it retires:
- Personal resets. The built-in's zcodeQuota read
/api/biz/customer-package-reset/list?targetType=PERSONAL with the plan's
key (zhipuPersonalResets, yetone/magpie#1191) and showed the count, by
window, and each reset's end. The plugin read only the team's list.
codingUsage now reads the personal list alongside the subscription list,
so a Coding Plan card (and a dual gift + Coding Plan card, built on it)
carries resets: {count, byWindow, fiveHour, weekly, until, each}.
- Team resets now carry team: true and each, as zhipuTeamResets set Team.
Both lists are read by one resetsOf: only available ones count, each
{until?, window} sorted soonest first with an endless one last
(sortResetCards), nothing on a failed read or none left.
- Start Plan refusal. A Start Plan answer that is a 405, the block page
("request has been blocked" / errors.aliyun.com) or code 3012 / "unusual
activity" now comes back, same status, as {type:"error", error:{message:
"<vendor's words, or the status for a block page> — <hint>"}}, the hint
word for word magpie's provider.ZCodeStartBlockedHint, as the built-in's
zcodeStartExplain / Provider.Explain put it. The block page's own words
are left out, so magpie's APIError no longer reads it as a network
firewall's (BlockedHint). Coding Plan and team answers are untouched.
- README: the resets and the Start Plan's hint.
What was run:
- usage.test.mjs: a new test with #1191's literal reset list (the
built-in's zhipuResetList) fails on 0.1.18 (no resets); the team test,
now expecting team and each, fails on 0.1.18 too.
- start.test.mjs: the new refusal test fails with the startBlocked line
disabled by hand (block page passed through), passes with it.
- Every packages/zcode test file under a scratch HOME: dual 25, gift 20,
models 1, moved 1, own 6, signin 3, start 11, usage 16 (83 pass).
- bun scripts/check.mjs zcode passes.
Not tried: a real account's reset list or a real Start Plan refusal.
`team` and `each` reach magpie's card from its next release; older magpie
ignores them.
|
||
|
|
baa788b1e4 |
zcode 0.1.15: a Start Plan request says the agent's folder, not magpie's, and leaves out what it doesn't know (#86, Hipple)
The plugin runs in magpie's plugin host, so process.cwd() is magpie's own folder (C:\Users\<user>\.config\magpie on Windows). The Start Plan's "# Environment" section said it as "Primary working directory", with a constant "Is a git repository: no" and magpie's shell, and the model went looking in magpie's folder. Now the folder and the git state are the agent's, as magpie tells the plugin's fetch in x-magpie-work-dir (percent-encoded) and x-magpie-work-git (yes/no) (yetone/magpie, provider.WorkDirHeader). Each line is left out when magpie doesn't tell it (an older magpie, an agent that names no folder, a folder not on this computer). The Shell line is gone: the agent's shell isn't known here. Platform and OS Version stay; they are this computer's, as the X-Os-* headers already say. The headers are taken off before anything is sent, on the coding plan too. Run: bun test in packages/zcode (77 pass), bun scripts/check.mjs zcode. With the old index.mjs the new tests fail (6 fail). One real request through the plugin with the owner's z.ai account (coding plan; its Start Plan balance is empty, so the dressed Start Plan path was not tried against the real service): 200. |
||
|
|
cc57432d16 |
zcode: Start Plan requests go as ZCode's own, with its headers and system prompt (0.1.7) (#5)
ARNO on Discord: the plugin's Start Plan requests were answered 405 / 3012 "blocked due to unusual activity" while his own plugin (Freeflow, provider zcode-start) worked from the same machine. zcode.z.ai serves the plan only to what looks like ZCode's own request: a Start Plan request now carries ZCode's headers and its body is dressed as ZCode's (three cached system blocks, the environment section, the date reminder as the first turn, one cache mark on the last block, metadata.user_id naming the sign-in's device). The prompt texts are magpie's (901fd87e), each matching ARNO's plugin's hash. Coding Plan and team requests are unchanged. The Start Plan is advertised again. |