7 Commits

Author SHA1 Message Date
zzAllenn 8e93c67a33 fix(installer): avoid PromptScript failure for DSH (#97)
## Summary

- install the AgentKey Skill through the Skills CLI universal target for
DSH-only installs
- avoid passing either dsh or the unsupported global PromptScript target
while preserving explicit mixed-agent targets
- update Bash, PowerShell, English/Chinese setup guidance, retry
instructions, and release-asset source docs
- add Bash mixed-target coverage and a Windows PowerShell invocation
regression

## Root cause

skills@1.5.23 -g -y adds PromptScript to its universal target set even
though PromptScript has no global install directory. The canonical
AgentKey Skill still installs, but the command prints Failed to install
1. Explicitly targeting universal writes the same
~/.agents/skills/agentkey copy without selecting PromptScript.

## Validation

- bats tests/ — 42/42
- bash -n scripts/install.sh
- bash -n scripts/uninstall.sh
- bash -n scripts/build-release-assets.sh
- scripts/build-release-assets.sh with an isolated output directory
- workflow YAML parse
- git diff --check
- Windows behavior regression added to the windows-latest Scripts tests
job

## Deployment follow-up

Merging/releasing this PR does not automatically update
agentkey.app/install.sh. After release, publish the current
Bash/PowerShell install and uninstall scripts to the website origin and
purge the CDN; the live endpoints were serving stale pre-DSH content
during verification.

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-25 00:55:26 +08:00
zzAllenn 97e3ab2fde feat: add DeepSeek Harness and Kimi MCP routing (#96)
## What changed

- teach the one-line macOS/Linux and Windows installers to detect DSH,
install the AgentKey skill globally, and invoke the DSH device-code MCP
writer without passing `dsh` to `skills add -a`
- remove only top-level AgentKey managed blocks during uninstall while
preserving marker-prefix collisions, YAML block scalars, malformed
blocks, and unrelated patches
- add a DSH-specific Skill setup branch explaining why DSH rc.7 must use
device-code Bearer authentication instead of generic MCP OAuth
- document the home-level patch, safe legacy migration, symlink-profile
behavior, HMR limits, tool-policy limits, and actual readiness checks in
English and Chinese
- route the Kimi plugin through the client-attributed
`https://api.agentkey.app/kimi/v1/mcp` alias while keeping its native
OAuth flow and the same AgentKey MCP surface
- add macOS/Linux Bats coverage, an attributed endpoint contract, and a
Windows PowerShell marker regression gate

## Why

DSH users need one global AgentKey integration across current and future
profiles without selecting an AgentKey preset. DSH 0.1.0-rc.7 cannot
complete the generic header-free MCP OAuth flow, so the public setup and
self-repair guidance must consistently route DSH through `@agentkey/cli
--auth-login --only dsh`.

Kimi uses a client-attributed MCP path so Server telemetry and routing
can identify the originating client without changing Kimi's OAuth or
tool behavior.

## User impact

After the Server and CLI dependency are released, DSH users can run the
normal one-line installer or the documented two-step flow. They verify
success by checking the `agentkey` Loader row and then calling
`find_tools`, `describe_tool`, and `execute_tool`; Mounted/active alone
is not treated as a successful MCP connection.

Kimi plugin users continue to authenticate with the existing native
OAuth command; only the remote path changes to the attributed alias.

## Validation

- `bats tests/` (41/41)
- `bash -n scripts/install.sh`
- `bash -n scripts/uninstall.sh`
- Windows marker regression is configured on `windows-latest`
- `git diff --check`

## Release dependency

- Server/CLI implementation:
https://github.com/chainbase-labs/AgentKey-Server/pull/241
- deploy and verify the Server routes first
- publish and canary `@agentkey/cli@1.0.4` second
- release these installers, Skill changes, Kimi route, and public
documentation last

This is a CLI-managed DSH MCP integration, not a native installable DSH
plugin.

---------

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-23 04:04:57 +08:00
zzAllenn efc2809691 fix(claude): restore native MCP OAuth login (#95)
## Summary

- remove the Claude Code plugin API-key `userConfig` prompt and static
`Authorization` header
- let Claude Code follow the AgentKey server's 401/RFC 9728 metadata
into native MCP OAuth
- document both the `/mcp` **Authenticate** action and `claude mcp login
plugin:agentkey:agentkey`
- add Claude-specific regression coverage and include the Claude MCP
files in the scripts test workflow paths

## Root cause

Claude Code treats any configured `Authorization` header as an explicit
choice of header authentication. When the interpolated API key is empty,
the server returns 401, but Claude Code does not offer or fall back to
OAuth because the header is present. Removing the header and its
`userConfig` source restores native MCP OAuth discovery.

## Impact

The runtime authentication change is limited to the Claude Code plugin
path (`.claude-plugin/plugin.json` + root `.mcp.json`). The Skills
CLI/API-key setup path and the Codex, Cursor, Kimi, Gemini, and
Antigravity MCP configurations are unchanged.

Shared documentation and CI path filters are updated to describe and
protect this Claude-specific behavior.

## Validation

- `bats tests/` — 29 tests passed
- `claude plugin validate --strict .` — passed
- isolated Claude Code 2.1.228 plugin load reported `Needs
authentication`
- `claude mcp login plugin:agentkey:agentkey --no-browser` generated the
AgentKey OAuth authorization URL
- `git diff --check origin/main...fork/codex/fix-claude-code-oauth` —
passed

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-14 02:24:36 +08:00
zzAllenn fbec683e87 fix(plugins): package Gemini releases and improve OAuth (#94)
## Summary

- preserve the existing `agentkey.skill` GitHub Release asset and add
platform-named Gemini extension archives for macOS, Linux, and Windows
- opt the Gemini extension into native first-connect OAuth with
`oauth.enabled`, while keeping `/mcp auth agentkey` as the manual retry
path
- add explicit Gemini, Antigravity 2.0, and Antigravity CLI
authentication and connection-verification guidance
- explain Gemini's user-Skill precedence warning and avoid duplicate MCP
registrations when an extension or plugin already owns the server entry
- add regression coverage and trigger the scripts test workflow when
authentication guidance or release packaging changes

## Root causes

Gemini CLI treats a lone generic GitHub Release asset as the extension
archive. AgentKey releases currently publish only `agentkey.skill`, but
Gemini CLI extracts only `.tar.gz` and `.zip` extension archives. After
that extraction failure, Gemini retries Git clone in the same non-empty
temporary directory and fails again.

Separately, the Gemini manifest omitted `oauth.enabled`. Gemini
discovered that AgentKey required OAuth, but only reported `/mcp auth
agentkey` instead of starting the browser flow automatically. A
pre-existing user Skill at `~/.agents/skills/agentkey` can also override
the extension-bundled Skill, hiding new setup guidance even though the
extension MCP entry is active.

## Authentication design

- Gemini uses `httpUrl` plus `oauth.enabled: true`; OAuth endpoints and
client registration remain dynamically discovered.
- Antigravity keeps the documented credential-free `serverUrl`
configuration and uses DCR through its native Authenticate controls.
- No static access token, Authorization header, OAuth client secret, or
hard-coded authorization endpoint is added to either package.

## Validation

- Bats suite: 27/27 passing
- `gemini extensions validate .`
- built and inspected `agentkey.skill`, `darwin.agentkey.tar.gz`,
`linux.agentkey.tar.gz`, and `win32.agentkey.zip`
- verified both Gemini platform archive formats contain `oauth.enabled:
true`, `gemini-extension.json`, and `skills/agentkey/SKILL.md`
- validated workflow YAML, shell syntax, archive roots, manifest
invariants, and `git diff --check`
- verified the live AgentKey endpoint advertises protected-resource
metadata, PKCE, and a dynamic client registration endpoint

## Release coordination

Merge this fix before release PR #92 so the first Gemini-enabled release
publishes compatible archives and the corrected first-connect OAuth
behavior.

---------

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-11 16:30:22 +08:00
zzAllenn 49a015b408 feat: add Cursor, Gemini CLI, and Antigravity plugin support (#91)
## Summary
- add the Cursor-native plugin manifest and marketplace metadata with
inline AgentKey MCP OAuth
- add the root Gemini CLI extension manifest using Streamable HTTP and
native OAuth discovery
- add one root Antigravity plugin package for both Antigravity 2.0 and
Antigravity CLI
- configure Antigravity remote MCP with the required `serverUrl` field
and automatic OAuth discovery
- reuse the existing `skills/agentkey/` package across Gemini and
Antigravity without duplication
- keep endpoint and release/version synchronization across every client
- document Cursor, Gemini, Antigravity 2.0, and Antigravity CLI
onboarding in English and Chinese

## Validation
- `npx -y bats@1.12.0 tests/` (20/20 passing)
- `npx -y @google/gemini-cli@0.54.4 extensions validate .`
- verified all eight version values match `1.13.1`
- verified Claude, Codex, Cursor, Kimi, Gemini, and Antigravity MCP
endpoints remain synchronized
- verified the AgentKey endpoint advertises OAuth protected-resource
metadata
- verified the branch merges cleanly with `chainbase-labs/main`

## Antigravity validation boundary
The `agy` binary is not installed in the current environment, so a live
CLI install was not run. The plugin layout, manifest fields,
`serverUrl`, OAuth configuration, and shared Skill discovery are covered
by automated assertions against the current Antigravity documentation.
The documentation-prescribed `$schema` URL currently returns HTTP 404;
the manifest retains the prescribed value while tests enforce the
published schema locally.

---------

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-11 02:28:26 +08:00
zzAllenn db38a59d7b feat: improve Kimi plugin onboarding (#86)
## Summary

- add a Kimi Code plugin manifest with an inline AgentKey MCP server
definition
- use Kimi's native MCP OAuth flow while keeping browser login explicit
through `/mcp-config login plugin-agentkey:agentkey`
- document the required `/reload`, browser authorization, local-plugin
update flow, and legacy global MCP cleanup
- include the Kimi manifest in release-please and version-sync checks
- add regression coverage for the Kimi manifest shape and OAuth
configuration

## Why

Kimi requires `mcpServers` to be declared inline in the plugin manifest.
The previous path-based configuration was not loaded as a plugin MCP
server, so installation did not produce the expected MCP-aware reload
guidance. With the corrected manifest, Kimi recognizes the MCP server
during installation and shows its standard `/new` or `/reload` prompt.
After reloading, the user completes Kimi's native browser OAuth flow
explicitly with `/mcp-config login plugin-agentkey:agentkey`.

## User impact

After installing the plugin, users receive the reload guidance from
Kimi. They run `/reload`, follow Kimi's OAuth prompt with `/mcp-config
login plugin-agentkey:agentkey`, approve the browser authorization, and
can then use AgentKey normally.

## Validation

- installed the local plugin with Kimi Code CLI 0.31.1 and confirmed the
success screen reports one MCP server plus `Run /new or /reload to apply
plugin changes.`
- verified the managed Kimi plugin copy matches the repository manifest
- validated the Kimi manifest shape and native-OAuth constraints
- verified all six release version values remain synchronized at 1.12.1
- parsed the modified GitHub Actions workflows as YAML
- ran `git diff --check`

The repository CI runs the full Bats suite on Ubuntu and macOS.

---------

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-05 16:23:59 +08:00
lxcong f830f2947d feat: agent install telemetry (skill side, spec §8.1) (#31)
## Summary

Skill-side half of the agent-install telemetry rollout (spec §8.1).
`check-update.sh` emits `TELEMETRY ...` lines on stdout, SKILL.md parses
them and dispatches via MCP. Adds 3-layer opt-out (file / env /
installer flag — file path checked here), 24h client-side dedup, and a
bats test harness.

- `skills/agentkey/scripts/check-update.sh` — `emit_telemetry()` +
`auto_upgrade_flag()` helpers, opt-out checks, 7 emit calls at 5 exit
points, 24h heartbeat dedup keyed by `LOCAL_VERSION`. Includes Linux
`stat` order fix (`-c %Y` first, `-f %m` second — `-f` on Linux means
filesystem mountpoint, not mtime)
- `skills/agentkey/SKILL.md` — Step 0 instructions for parsing
`TELEMETRY` lines and dispatching via
`execute_tool(\"agentkey_internal\", {path:\"telemetry/event\", ...})`;
upgrade-flow each branch dispatches `upgrade_decision` /
`upgrade_result` with mapped choice values
- `tests/check-update.bats` + `tests/helpers.bash` — 10 contract tests
with isolated `\$HOME` / `\$TMPDIR` / mocked curl
- `.github/workflows/scripts-test.yml` — bats CI on ubuntu + macos
- `README.md` + `docs/README_zh.md` — FAQ replacement for the old
\"nothing to collect\" sentence, new FAQ entry \"How do I opt out of
telemetry?\" / \"我如何关闭遥测?\"
- `scripts/uninstall.sh` — adds Step 7b to clean `~/.config/agentkey/`
(telemetry-disabled, update-disabled, snooze state)

## Blocked on

**AgentKey-Server PR** that registers the
`agentkey_internal/telemetry/event` MCP tool (must be filtered out of
`list_tools` / `find_tools` so the LLM doesn't accidentally call it).
SKILL.md falls back silently when the tool doesn't exist, so this PR is
safe to merge first — but the telemetry signal isn't recorded until the
server side lands.

Spec §11 mandates server-first merge order to keep the agent-side debug
log clean.

## Test plan

- [x] `bats tests/check-update.bats` — 10/10 passing locally
- [x] E2E smoke (skill-side plan Task 8 steps 1-3, 5):
  - Default emit on `up_to_date`
- `~/.config/agentkey/telemetry-disabled` early-return (no TELEMETRY
line)
  - `AGENTKEY_TELEMETRY=0` env override
  - 24h heartbeat dedup (2nd invocation within window does not re-emit)
  - `uninstall.sh` Step 7b cleans `~/.config/agentkey/`
- [ ] **Manual** — open Claude Code, ask an AgentKey-routed query.
Verify SKILL.md silently swallows the missing `agentkey_internal` tool
error (server not shipped yet) and the actual query still completes
- [ ] Verify bats CI runs green on ubuntu + macos matrix

## Pre-existing bug surfaced during testing (not in this PR)

`check-update.sh` line 130-ish cache fast-path uses the same wrong `stat
-f %m ... || stat -c %Y` order. Same Linux bug as the one fixed here in
`emit_telemetry`. Worth a separate one-line fix PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: lxcong <lxcong@chainbase.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 16:41:35 +08:00