picoclaw/pkg
Tong Niu d6e88da8ba
fix(pkg):do regex precompile insteadd on the fly (#911)
* fix(pkg/providers):do regex precompile insteadd on the fly

* fix(providers): replace HTTP-specific regex with standalone status code matcher

The precompiled HTTP regex used uppercase "HTTP" which never matched
because ClassifyError lowercases the input. Replace it with a
case-insensitive word-boundary pattern that matches any standalone
3-digit status code (300-599), which also subsumes the HTTP/x.x case.

Add test case for standalone status code extraction.

* fix(providers): restore http regex and add standalone status code matcher

Restore the http-prefixed regex (without unnecessary (?i) flag since
input is already lowercased by ClassifyError) as a mid-priority pattern
to reduce false positives. Add a standalone word-boundary matcher as a
fallback for bare status codes like "429". Fix test to use lowercased
input matching the actual calling convention.

* perf(tools): move path regex compilation from per-call to package init

The path regex in guardCommand was compiled on every call. Hoist it
to a package-level var (absolutePathPattern) alongside defaultDenyPatterns
in a single var block, so it is compiled once at init time.

* style(tools): move inline comment to fix golines formatting error
2026-03-01 23:06:31 +11:00
..
agent Merge pull request #861 from p3ddd/refactor/modernize 2026-03-01 15:38:59 +08:00
auth feat: add picoclaw-launcher with web UI for configuration and gateway management (#904) 2026-02-28 18:38:38 +08:00
bus chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
channels Merge pull request #861 from p3ddd/refactor/modernize 2026-03-01 15:38:59 +08:00
config chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
constants refactor: replace bool map with set-style map for internal channels (#472) 2026-02-19 11:48:17 +01:00
cron style: fix gci import grouping in config, cron, and skills installer 2026-02-26 20:38:11 +08:00
devices refactor: cleanup dead code and turn on dead code detection in CI (#515) 2026-02-24 21:52:25 +08:00
fileutil refactor(pkg): move atomic file write to dedicated fileutil package 2026-02-24 23:57:13 +08:00
health chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
heartbeat Merge branch 'sipeed:main' into reasoning-chnl 2026-02-27 14:50:14 +05:30
identity feat(identity): add unified user identity with canonical platform:id format 2026-02-23 06:56:48 +08:00
logger enable prealloc 2026-02-25 21:31:07 +11:00
media chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
migrate Feat/update migrate (#910) 2026-02-28 19:59:17 +08:00
providers fix(pkg):do regex precompile insteadd on the fly (#911) 2026-03-01 23:06:31 +11:00
routing chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
session feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
skills Merge pull request #861 from p3ddd/refactor/modernize 2026-03-01 15:38:59 +08:00
state refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
tools fix(pkg):do regex precompile insteadd on the fly (#911) 2026-03-01 23:06:31 +11:00
utils fix(tools): close resp.Body on retry cancel and cache http.Client instances (#940) 2026-03-01 16:55:46 +11:00
voice feat(linter): Fix govet linter 2026-02-20 22:35:16 +02:00