@silverprotocol/google-adk 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +35 -13
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,32 +1,54 @@
1
1
  # @silverprotocol/google-adk
2
2
 
3
3
  AgJSON normalizer for the Google Agent Development Kit (ADK `Event` / Gemini
4
- `Content.parts[]` → `AgEvent[]`) — fixture-tested.
4
+ `Content.parts[]` → `AgEvent[]`) — fixture-tested. It **sits on top of your ADK
5
+ runner** and translates the events it yields into framework-neutral AgJSON; it
6
+ doesn't replace the SDK you already use.
5
7
 
6
8
  ## Install
7
9
 
8
10
  ```sh
9
- npm install @silverprotocol/google-adk
11
+ npm install @silverprotocol/google-adk @iqai/adk
10
12
  ```
11
13
 
12
- `@silverprotocol/core` is a required peer (installed automatically as a
13
- dependency). `@iqai/adk` is an OPTIONAL peer — only needed if you want its
14
- native ADK `Event` types; it is not required at import time.
14
+ `@silverprotocol/core` is a required peer (pulled in automatically). `@iqai/adk`
15
+ is the ADK-TS runtime itself — you need it to *produce* the events. (The
16
+ normalizer handles ADK `Event`s structurally, so if you only feed it
17
+ already-captured events it's just a type-level peer.)
15
18
 
16
19
  ## Usage
17
20
 
18
21
  ```ts
22
+ import { AgentBuilder } from "@iqai/adk";
19
23
  import { createAdkNormalizer } from "@silverprotocol/google-adk";
20
24
 
25
+ // Build your ADK agent as usual — this package normalizes what it emits.
26
+ const { runner, session } = await AgentBuilder.create("assistant")
27
+ .withModel("gemini-2.5-flash")
28
+ .withInstruction("Use the echo tool.")
29
+ .build();
30
+
21
31
  const n = createAdkNormalizer();
22
- const events = [];
23
- for (const native of stream) events.push(...n.push(native));
24
- events.push(...n.flush());
32
+ const agEvents = [];
33
+
34
+ for await (const native of runner.runAsync({
35
+ userId: "user-1",
36
+ sessionId: session.id,
37
+ newMessage: { parts: [{ text: "call the echo tool" }] },
38
+ })) {
39
+ agEvents.push(...n.push(native)); // one ADK Event → 0+ AgEvents
40
+ }
41
+ agEvents.push(...n.flush()); // seal anything still open
25
42
  ```
26
43
 
27
- `stream` is whatever async/sync iterable of native ADK `Event`s your agent
28
- run yields. `push()` returns the `AgEvent[]` synthesized from that native
29
- event; `flush()` drains any buffered end-of-stream state.
44
+ `push()` returns the `AgEvent[]` synthesized from each native ADK `Event`;
45
+ `flush()` drains buffered end-of-stream state. Any async/sync iterable of ADK
46
+ `Event`s works — a live `runAsync()` run, or events you captured earlier.
47
+
48
+ Then fold the resulting `AgEvent`s into messages and turns with
49
+ `@silverprotocol/core`'s `reduce()` — the same client code regardless of which
50
+ framework produced the stream.
30
51
 
31
- Spec: `SPEC.md` at the repo root of [silverprotocol/typescript-sdk](https://github.com/silverprotocol/typescript-sdk) (published with the first
32
- release); wire version `1.0.0-draft.1`.
52
+ Spec: [silverprotocol.io/AgJSON](https://silverprotocol.io/AgJSON) — canonical
53
+ in [silverprotocol/AgJSON](https://github.com/silverprotocol/AgJSON); wire
54
+ version `1.0.0-draft.1`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silverprotocol/google-adk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AgJSON normalizer for the Google Agent Development Kit (ADK Event / Gemini Content.parts[] → AgEvent[]) — fixture-tested.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "!dist/**/*.test.*"
32
32
  ],
33
33
  "dependencies": {
34
- "@silverprotocol/core": "0.2.0"
34
+ "@silverprotocol/core": "0.2.2"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@iqai/adk": "^0.1.0"