Commit Graph
3 Commits
Author SHA1 Message Date
yetone 9a00bfed14 deps: moejs v0.1.0
moejs v0.1.0 is out (Ion_Mio_ on X): less memory, about 3x faster than
alpha.11 on V8's benchmark, 2.9x C QuickJS on a 100K-token agent request.
It pulls in github.com/MoeForge/moego (MIT) for base64.

THIRD_PARTY_NOTICES names v0.1.0; sections 1 to 4 of moejs's notices are
the same as at alpha.11 (diffed). go mod tidy also marks gen2brain/h265
and santhosh-tekuri/jsonschema direct, which internal/gateway imports.

Run at 608c1543e plus this change (the rebase onto 93bbcc8bf adds only
that gateway commit):
- mote (macOS): GOOS=windows go vet ./... ok; go test -timeout 45m ./...
  88 packages ok, internal/gui red on TestGatewayModeStatsNameTheGatewaySessions
  alone, 3 of 3 on origin/main b475004d5 too (#5690, first hour of a local
  day; mote ran at 00:37 PST).
- magpie-desktop (Linux): go vet -tags gtk3 ./... ok; agentplug,
  middleware, plugin ok.
Not tried: a real plugin in a running magpie.
2026-11-09 16:57:15 +08:00
yetone eb6d1d8d97 redact: a colour or an ordinary word is no personal name (黄绿色, 关键词)
hh05928822 on X after v0.1.1850: names were found in ordinary Chinese,
"黄绿色" the worst, with 边••, 应••, 关••, 尚• in the screenshot.
wangjunxiao128: "关键词" taken for a name.

Both ways a Chinese name is found (the model's PERSON spans in
modelSpans, and the cue rules in zhNameSpans) now go through one check,
zhWordNotName: a span that is an ordinary word is no name, unless a role
before it or a title after it says a person is meant (客户方圆, 江山老师).
A word is (zhWordShaped):
- a colour: Han colour characters alone, or anything ending in 色
  (黄绿色, 红色, 金黄色, 浅蓝色);
- a two-character word starting with a surname, from zhWords or the new
  zhDict (边界, 应该, 尚可, 关心);
- such a word with a noun ending after it (关键词, 关键字, 应用层,
  毛利率, 时间戳, 文件名).
zhDict is zhdict.txt, embedded: ~1,550 two-character words from jieba
v0.42.1's dict.txt (MIT, in THIRD_PARTY_NOTICES), the first character a
surname, frequency >= 100, tag not nr/nrt/nrfg, and a list left out by
hand (陆游, 关露, 欧阳, 司徒...) in its header. The surname list keeps
黄, 关, 边: they are real surnames, so 黄晓明, 关羽 and 毛利兰 are still
masked. modelTakes' own zhWords check moved into the shared one.

Run on mote at 761e0e010 + this change:
- go test -timeout 45m ./internal/redact/... ./internal/pii/...
  ./internal/masking/... ./internal/maskrec/...: all ok
- go test -run TestNotices . : ok
- go test -run "Mask|Redact|Privacy|Person|Name|Known" ./internal/gateway: ok
- gofmt -l internal/redact: clean
- GOOS=linux and GOOS=windows go vet of redact, pii, masking: ok

Broken by hand, each red:
- zhWordNotName returning false (at 761e0e010 too):
  TestChineseWordsAreNoNames, TestModelWordsAreNoNames,
  TestModelNamesBesideWords.
- The colour rule, zhDict and the noun-ending rule each turned off:
  TestModelWordsAreNoNames and TestModelNamesBesideWords.
- The role/title exception removed: TestModelNamesBesideWords.
- The old model.go and zhname.go with the new tests: both new tests red
  (the cue rules alone masked 请黄绿, 发给黄绿, 张伟和黄绿).

The real AstrLink Guard model on mote (MAGPIE_GUARD_DIR) found 黄晓明,
关羽, 张飞, 毛利兰 and 工藤新一 with this change, and flagged none of
long agent-style prompts with 黄绿色, 关键词, 边界线, 边距, 应用层, 尚可,
on the old code or the new.

Not tried: the reporters' own texts (not in the reports), so their
exact false positive was not reproduced with the real model; Privacy
Filter; the GUI. 高峰期 is still masked: jieba tags 高峰 as a name.
2026-10-28 17:01:49 +08:00
yetone 60520ddb3b moejs: v0.1.0-alpha.11, at its new module path github.com/MoeForge/moejs
Gateway middleware and agent plugins run on moejs. alpha.11 moves the
module to github.com/MoeForge/moejs; every other API change since
alpha.4 is an addition. What magpie gets: faster calls, loops, property
lookups and JSON.parse, allocation-free await, a bytecode verifier, a
correct default.pgo, and Intl / toLocaleString in plugin code.

Checked against both tags' source: every name magpie uses (NewRuntime,
Options, Compile, Link, Hook, Value, Arg, Undefined, NativeFunc,
Referrer, the Promise results, Exception) has the same signature, and
Options' defaults (shared frozen builtins, no timers) are unchanged.
fetch, Streams, URL, node:fs and node:buffer live in the separate
webapi and node packages, installed only on request; magpie installs
neither, so a plugin still reaches no network or file.

Intl's CLDR, Unicode, ICU and V8 material is compiled into every build,
and moejs asks a program that includes it to carry sections 1 to 4 of
its notices. THIRD_PARTY_NOTICES holds them verbatim. Release archives
ship no LICENSE today either; that is not changed here.

Doc and site links (docs/, site/public/docs/{,zh/,ja/}plugins.html)
point at the new repo.

Run on mote at this tree: gofmt; go build -trimpath -s -w (60,670,658
bytes on origin/main 58fb3a778, 62,329,250 now, +1.66MB); go vet of
middleware, jsmod, agentplug for darwin, linux and windows; go test
./internal/middleware/... ./internal/jsmod/... ./internal/agentplug/...
ok; go test -run 'Middleware|Strateg|OnUsage|JSPlugin|Agentplug|AgentPlug'
./internal/gateway ./internal/provider ./internal/plugin ./internal/gui
ok.
Not run: the full suite, the GUI suite, a real request through a
middleware in a running gateway.
2026-10-28 14:36:17 +08:00