killswitch-agentkit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,41 @@
1
- # Temporary Holding Version
1
+ # killswitch-agentkit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Killswitch for [Coinbase AgentKit](https://github.com/coinbase/agentkit): give an AgentKit agent a wallet it can only spend inside the owner's on-chain limits, with a guardian that reviews every payment and a kill switch the owner holds.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install killswitch-agentkit @coinbase/agentkit zod@3
9
+ ```
10
+
11
+ ## Use
12
+
13
+ Create an agent in the [Killswitch web app](https://usekillswitch.xyz/app/) and copy its settings into the environment:
14
+
15
+ | Variable | Value |
16
+ |---|---|
17
+ | `KS_RELAY` | The Killswitch relay (default `https://usekillswitch.xyz`) |
18
+ | `KS_ACCOUNT` | The protected wallet |
19
+ | `KS_AGENT_ID` | The agent's id |
20
+ | `KS_SESSION_KEY` | The agent's key. It can only act inside its limits; keep it private all the same |
21
+
22
+ ```ts
23
+ import { AgentKit } from "@coinbase/agentkit";
24
+ import { killswitchActionProvider, killswitchConfigFromEnv, killswitchWalletProvider } from "killswitch-agentkit";
25
+
26
+ const killswitch = killswitchConfigFromEnv();
27
+ const agentkit = await AgentKit.from({
28
+ walletProvider: await killswitchWalletProvider(killswitch), // or keep your own wallet provider
29
+ actionProviders: [killswitchActionProvider(killswitch)],
30
+ });
31
+ ```
32
+
33
+ The agent gets four actions: `wallet_status`, `wallet_send`, `wallet_swap` and `wallet_pay_x402` (pay a site or API that answers HTTP 402). Each runs through the Killswitch relay and guardian, and the wallet contract enforces the caps; a blocked or held action comes back in plain words, with the instruction not to retry it.
34
+
35
+ `killswitchWalletProvider` builds AgentKit's wallet from the agent key, so no Coinbase Developer Platform account is needed. It holds no funds and sends none of AgentKit's start-up analytics.
36
+
37
+ Docs: https://usekillswitch.xyz/docs/agentkit
38
+
39
+ ## License
40
+
41
+ MIT
@@ -0,0 +1,34 @@
1
+ // Types for killswitch-agentkit (the build copies this file to dist/index.d.ts).
2
+ import { ActionProvider, ViemWalletProvider, type Action, type Network, type WalletProvider } from "@coinbase/agentkit";
3
+
4
+ /** The agent's settings, as the Killswitch dashboard shows them when the agent is created. */
5
+ export type KillswitchConfig = {
6
+ /** The Killswitch relay, e.g. https://usekillswitch.xyz */
7
+ relayUrl: string;
8
+ /** The protected wallet (the Killswitch account contract). */
9
+ account: `0x${string}`;
10
+ /** The agent's id on that wallet. */
11
+ agentId: `0x${string}`;
12
+ /** The agent's own key. It can only act inside the limits the owner set; keep it private all the same. */
13
+ sessionKey: `0x${string}`;
14
+ /** How long a held x402 payment waits for the owner's decision (default 90 s). */
15
+ waitForApprovalMs?: number;
16
+ };
17
+
18
+ /** The settings from the environment: KS_RELAY (default the hosted relay), KS_ACCOUNT, KS_AGENT_ID, KS_SESSION_KEY. */
19
+ export declare function killswitchConfigFromEnv(env?: Record<string, string | undefined>): KillswitchConfig;
20
+
21
+ /** The four Killswitch actions: wallet_status, wallet_send, wallet_swap, wallet_pay_x402. */
22
+ export declare class KillswitchActionProvider extends ActionProvider<WalletProvider> {
23
+ constructor(config: KillswitchConfig);
24
+ getActions(walletProvider?: WalletProvider): Action[];
25
+ supportsNetwork(network: Network): boolean;
26
+ }
27
+
28
+ export declare const killswitchActionProvider: (config: KillswitchConfig) => KillswitchActionProvider;
29
+
30
+ /**
31
+ * A wallet provider for AgentKit made from the agent key itself, on the Killswitch wallet's chain, so an agent needs no
32
+ * Coinbase Developer Platform account. It holds no funds and sends no start-up analytics.
33
+ */
34
+ export declare function killswitchWalletProvider(config: KillswitchConfig): Promise<ViemWalletProvider>;