@fidesbuild/sub 0.2.0 → 0.2.1

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
@@ -2,6 +2,18 @@
2
2
 
3
3
  FIDES is a Transaction Builder for autonomous agents. SUB-FIDES is scoped agent-to-agent delegation: an agent working under a FIDES hands part of its authority to another agent, and the contract makes sure the child can never exceed the parent.
4
4
 
5
+ ## Get started
6
+
7
+ The fastest way to try it is the guided tour, which includes SUB-FIDES:
8
+
9
+ ```bash
10
+ npm install @fidesbuild/sdk viem
11
+ npx @fidesbuild/sdk init
12
+ npm run delegate
13
+ ```
14
+
15
+ `npx @fidesbuild/sub` prints this guide. In your own code:
16
+
5
17
  ```bash
6
18
  npm install @fidesbuild/sub @fidesbuild/sdk viem
7
19
  ```
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/guide.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ // npx @fidesbuild/sub — what SUB-FIDES is, and the fastest way to try it.
3
+ const say = (s = '') => console.log(s);
4
+ say(`
5
+ SUB-FIDES: agents hiring agents, inside limits none of them can break.
6
+
7
+ An agent working under a FIDES hands another agent a slice of it: its own budget, contracts and expiry.
8
+ The child can never go past its slice, everything it spends also counts against the parent, and the
9
+ owner or the parent agent can revoke it at any time.
10
+
11
+ Try it, guided, in one folder:
12
+
13
+ npm install @fidesbuild/sdk viem
14
+ npx @fidesbuild/sdk init
15
+ npm start the tour: sign, fund, then every example, including
16
+ npm run delegate this agent hands a second agent a slice, and it spends inside it
17
+
18
+ In your own code:
19
+
20
+ import { createSubClient, SubFidesKit, SubAgent } from "@fidesbuild/sub"
21
+
22
+ const client = createSubClient({ chainId: 4663, rpc }) // V2 accounts, which can delegate
23
+ const sub = await SubFidesKit.sign(
24
+ SubFidesKit.create(parentFides, { agent: childAddress, spend: [{ asset: USDG, amount }], expiry }),
25
+ parentAgent, client, parentFides)
26
+ await SubFidesKit.register("https://api.fidesbuilder.xyz", parentFides, sub) // the child finds it by address
27
+
28
+ const child = new SubAgent({ client, parent: parentFides, sub, agent: childKey, api: "https://api.fidesbuilder.xyz" })
29
+ await child.execute(await child.plan(actions)) // no gas: the relayer pays
30
+
31
+ Also in the app (tick "Allow this agent to hand out SUB-FIDES") and in Claude ("give 0x… 0.1 USDG for 30 minutes").
32
+ Docs: https://fidesbuilder.xyz/docs/#/sub
33
+ `);
34
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fidesbuild/sub",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "FIDES SUB-FIDES: scoped agent-to-agent delegation. An agent hands part of its FIDES to another agent, who can never exceed it.",
5
5
  "keywords": [
6
6
  "fides",
@@ -20,6 +20,9 @@
20
20
  "default": "./dist/index.js"
21
21
  }
22
22
  },
23
+ "bin": {
24
+ "fides-sub": "./dist/guide.js"
25
+ },
23
26
  "files": [
24
27
  "dist",
25
28
  "!dist/*.tsbuildinfo",