Commit Graph

21 Commits

Author SHA1 Message Date
ywkj 39ef2f59b6 fix: go.mod 降级到 1.22,CI 加 GOTOOLCHAIN=local
Build and Release auth-rt / release (push) Successful in 1m42s Details
避免 CI 里 Go 1.22 尝试下载 1.25.7 toolchain。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 21:24:22 +08:00
ywkj 48a03f3376 fix: CI 用 node 替代 jq 解析 JSON
Build and Release auth-rt / release (push) Failing after 51s Details
node:20-bookworm 没有 jq,改用 node -e 解析 API 响应。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 21:21:42 +08:00
ywkj 9fd284e556 fix: CI 去掉 golang container,在 node:20-bookworm 里直接装 Go
Build and Release auth-rt / release (push) Failing after 2m25s Details
避免拉 golang 镜像的网络延迟,直接下载 Go tarball 编译。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 21:17:45 +08:00
ywkj f03e09dca2 fix: CI 改用 Forgejo API 上传 release(不依赖 upload-artifact)
Build and Release auth-rt / release (push) Has been cancelled Details
Forgejo 不支持 actions/upload-artifact@v4,改为单 job 交叉编译
+ curl 调用 Forgejo release API 上传二进制。
同时维护 latest release 供 install.sh --download 使用。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 21:03:32 +08:00
ywkj dabcddb05e feat: Go 重写 auth-rt CLI,真正的零依赖二进制
Build and Release auth-rt / build (amd64, darwin) (push) Failing after 2m53s Details
Build and Release auth-rt / build (amd64, linux) (push) Failing after 1m16s Details
Build and Release auth-rt / build (arm64, darwin) (push) Failing after 1m9s Details
Build and Release auth-rt / build (arm64, linux) (push) Failing after 1m15s Details
Build and Release auth-rt / release (push) Has been skipped Details
- cli/ 目录:完整的 Go 实现(env/cache/auth/http/retry)
- install.sh:支持本地编译和 --download 从 release 下载
- .forgejo/workflows/release.yml:CI 交叉编译 darwin/linux × amd64/arm64
- auth-cli.ts:改为调用 auth-rt 二进制(不再需要 bun/node)
- 分发策略:skill install.sh 优先从 release 下载,失败则 clone + go build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 20:51:45 +08:00
ivanberry e5944a75a2 fix: env.ts 实时读取 ~/.openclaw/.env,不缓存
- 移除 loaded 标志,每次都从文件读取
- 移除 loadedKeys 追踪
- 直接覆盖 process.env,不判断是否已存在
- 确保文件值永远是最新的
2026-03-20 20:15:17 +08:00
ywkj 06cd08d833 chore: 默认安装路径改为 ~/.local/bin/auth-rt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 18:35:27 +08:00
ywkj ff8e74e0aa fix: 改用 shell wrapper 代替 bun compile(bun 1.x compile 有 bug)
install.sh 生成 shell wrapper 脚本 exec bun run cli.ts,
而非 bun build --compile(生成空文件)。
auth-cli.ts 修复 HOME 环境变量缺失时 homedir() 返回空的问题。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 18:30:56 +08:00
ywkj f079b68559 feat: 编译为独立 auth-rt 二进制,安装到 ~/.openclaw/bin/
- bun build --compile 生成独立可执行文件
- install.sh 编译并安装到 ~/.openclaw/bin/auth-rt
- auth-cli.ts 改为调用 auth-rt 二进制(不再需要 bun run cli.ts)
- skill 不再需要 clone auth-runtime 源码

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 18:26:20 +08:00
ywkj 97a8fd9c7b feat: add auth-cli.ts template for skills to use CLI via subprocess
Skills copy this file into their src/ and import from it instead of
npm-depending on @clawd/auth-runtime. Uses process.execPath for bun
resolution and AUTH_RUNTIME_DIR env for path override.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 14:35:15 +08:00
ywkj da16552ad1 revert: remove notify-dependents CI workflow
Auth-runtime is infrastructure — cascading updates to all clients x
all skills is a business-system concern, not a CI job. Dependent
skills will pick up latest auth-runtime next time they are deployed
via their install.sh (which always does fresh npm install).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 07:09:46 +08:00
ywkj 62fadf30ce ci: add notify-dependents workflow
When auth-runtime is pushed to main, CI notifies the skill-update
webhook to reinstall all dependent skills (1688-product-master,
client-finder, email-content-compose), ensuring they pick up the
latest auth-runtime via their install.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 07:04:23 +08:00
ywkj a22aefd695 fix: createEnvConfig() now calls loadGlobalEnv() + export functional API
Root cause: 1688-product-master uses the functional API (createEnvConfig,
getAccessToken, requestApi) which never loaded ~/.openclaw/.env, so
CLIENT_KEY was always empty at runtime.

- auth.ts: createEnvConfig() now calls loadGlobalEnv() first
- index.ts: export all functional API + requestApi from main entry
- Bump version to 1.1.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:42:07 +08:00
ywkj 0906ea5d52 fix: rebuild dist with SkillClient + env reload logic
dist/ was stale — missing loadGlobalEnv in client.js, causing bundled
skills to never read ~/.openclaw/.env at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:38:01 +08:00
ywkj 466a4303b2 fix: restore cache + add .env reload on auth failure
Correct retry logic:
1. Use cached token
2. Token rejected → refresh session with current CLIENT_KEY
3. Still failing → reloadGlobalEnv() to pick up updated .env, rebuild
   config with new CLIENT_KEY, retry

env.ts now tracks which keys it loaded from .env so reloadGlobalEnv()
can overwrite them without touching externally-set env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:24:52 +08:00
ywkj 153b05414e refactor: remove all token caching — always fetch fresh session
Every call now hits /auth/skill-credit/session directly.
Deletes cache.ts, removes CachedTokenData type, strips cacheDir/minTtlSec options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:19:16 +08:00
ywkj f7f385321f feat: add CLI entry point for Python skills to call via subprocess
Adds src/cli.ts with commands: token, session, client-config, request.
Python auth-runtime-py will call this via `bun run cli.ts` instead of
reimplementing auth logic in Python.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 08:31:49 +08:00
ywkj 22bc6f7438 feat: auto-load ~/.openclaw/.env in buildConfig
Skills no longer need to manually export env vars. auth-runtime
reads the global config file automatically on first client creation.
Won't overwrite explicitly set environment variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 07:51:38 +08:00
ywkj b05363e8f0 feat: add clientConfig() method for querying client metadata
hookUrl/hookToken are now resolved via /auth/skill-credit/client-config
endpoint instead of key binding. Added ClientConfig type and extraHeaders
support in requestApi.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 07:37:56 +08:00
ywkj 69051a3479 feat: add SkillClient — single entry point for authenticated API calls
Skills no longer need to manage config, tokens, or retry logic.
Just `createSkillClient()` and call `client.post(path, body)`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 08:17:46 +08:00
ivanberry 70cf86889e feat: initial auth-runtime module 2026-03-12 07:33:43 +08:00