@alexkroman1/aai 1.6.1 → 1.7.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.
Files changed (78) hide show
  1. package/.turbo/turbo-build.log +22 -18
  2. package/CHANGELOG.md +16 -0
  3. package/dist/{_internal-types-DFL07G3f.js → _internal-types-CrnTi9Ew.js} +8 -2
  4. package/dist/host/memory-vector.d.ts +17 -0
  5. package/dist/host/pinecone-vector.d.ts +19 -0
  6. package/dist/host/providers/resolve-kv.d.ts +10 -0
  7. package/dist/host/providers/resolve-vector.d.ts +11 -0
  8. package/dist/host/providers/resolve.d.ts +6 -0
  9. package/dist/host/runtime-barrel.d.ts +5 -0
  10. package/dist/host/runtime-barrel.js +399 -89
  11. package/dist/host/runtime.d.ts +6 -0
  12. package/dist/host/server.d.ts +2 -0
  13. package/dist/host/tool-executor.d.ts +2 -0
  14. package/dist/pinecone-CeJ69aRs.js +19 -0
  15. package/dist/{cartesia-BfQPOQ7Y.js → rime-58p9mDR8.js} +19 -19
  16. package/dist/s3-BtCMvCod.js +37 -0
  17. package/dist/sdk/_internal-types.d.ts +11 -1
  18. package/dist/sdk/define.d.ts +5 -1
  19. package/dist/sdk/manifest-barrel.js +1 -1
  20. package/dist/sdk/manifest.d.ts +5 -1
  21. package/dist/sdk/protocol.d.ts +36 -0
  22. package/dist/sdk/protocol.js +26 -1
  23. package/dist/sdk/providers/kv/fs.d.ts +12 -0
  24. package/dist/sdk/providers/kv/memory.d.ts +9 -0
  25. package/dist/sdk/providers/kv/redis.d.ts +17 -0
  26. package/dist/sdk/providers/kv/s3.d.ts +25 -0
  27. package/dist/sdk/providers/kv-barrel.d.ts +13 -0
  28. package/dist/sdk/providers/kv-barrel.js +2 -0
  29. package/dist/sdk/providers/llm-barrel.js +1 -1
  30. package/dist/sdk/providers/stt-barrel.js +1 -1
  31. package/dist/sdk/providers/tts-barrel.js +1 -1
  32. package/dist/sdk/providers/vector/in-memory.d.ts +15 -0
  33. package/dist/sdk/providers/vector/pinecone.d.ts +19 -0
  34. package/dist/sdk/providers/vector-barrel.d.ts +11 -0
  35. package/dist/sdk/providers/vector-barrel.js +2 -0
  36. package/dist/sdk/providers.d.ts +4 -0
  37. package/dist/sdk/types.d.ts +8 -1
  38. package/dist/sdk/vector.d.ts +29 -0
  39. package/dist/{soniox-DCQ3GqJq.js → soniox-BQdL0mB5.js} +13 -13
  40. package/host/_runtime-conformance.ts +21 -0
  41. package/host/_test-utils.ts +1 -0
  42. package/host/memory-vector.test.ts +87 -0
  43. package/host/memory-vector.ts +108 -0
  44. package/host/pinecone-vector.test.ts +79 -0
  45. package/host/pinecone-vector.ts +79 -0
  46. package/host/providers/resolve-kv.test.ts +48 -0
  47. package/host/providers/resolve-kv.ts +128 -0
  48. package/host/providers/resolve-vector.test.ts +26 -0
  49. package/host/providers/resolve-vector.ts +42 -0
  50. package/host/providers/resolve.ts +26 -0
  51. package/host/runtime-barrel.ts +5 -0
  52. package/host/runtime-config.ts +1 -1
  53. package/host/runtime.ts +28 -2
  54. package/host/s2s.ts +1 -4
  55. package/host/server.ts +57 -1
  56. package/host/tool-executor.ts +7 -1
  57. package/package.json +20 -1
  58. package/sdk/__snapshots__/exports.test.ts.snap +8 -0
  59. package/sdk/__snapshots__/schema-shapes.test.ts.snap +2 -0
  60. package/sdk/_internal-types.ts +8 -0
  61. package/sdk/define.ts +11 -1
  62. package/sdk/manifest.test.ts +20 -0
  63. package/sdk/manifest.ts +10 -0
  64. package/sdk/protocol-snapshot.test.ts +53 -0
  65. package/sdk/protocol.test.ts +54 -0
  66. package/sdk/protocol.ts +32 -0
  67. package/sdk/providers/kv/fs.ts +20 -0
  68. package/sdk/providers/kv/memory.ts +17 -0
  69. package/sdk/providers/kv/redis.ts +25 -0
  70. package/sdk/providers/kv/s3.ts +33 -0
  71. package/sdk/providers/kv-barrel.ts +19 -0
  72. package/sdk/providers/vector/in-memory.ts +23 -0
  73. package/sdk/providers/vector/pinecone.ts +27 -0
  74. package/sdk/providers/vector-barrel.ts +15 -0
  75. package/sdk/providers.ts +6 -0
  76. package/sdk/types.ts +14 -1
  77. package/sdk/vector.ts +32 -0
  78. /package/dist/{xai-jfQsxxPZ.js → xai-BDI61Y2M.js} +0 -0
@@ -1,26 +1,30 @@
1
1
 
2
- > @alexkroman1/aai@1.6.1 build /home/runner/work/agent/agent/packages/aai
2
+ > @alexkroman1/aai@1.7.1 build /home/runner/work/agent/agent/packages/aai
3
3
  > tsdown && tsc -p tsconfig.build.json
4
4
 
5
5
  ℹ tsdown v0.21.7 powered by rolldown v1.0.0-rc.12
6
6
  ℹ config file: /home/runner/work/agent/agent/packages/aai/tsdown.config.ts
7
- ℹ entry: index.ts, sdk/protocol.ts, host/runtime-barrel.ts, sdk/manifest-barrel.ts, sdk/providers/stt-barrel.ts, sdk/providers/tts-barrel.ts, sdk/providers/llm-barrel.ts
7
+ ℹ entry: index.ts, sdk/protocol.ts, host/runtime-barrel.ts, sdk/manifest-barrel.ts, sdk/providers/stt-barrel.ts, sdk/providers/tts-barrel.ts, sdk/providers/llm-barrel.ts, sdk/providers/vector-barrel.ts, sdk/providers/kv-barrel.ts
8
8
  ℹ target: node22
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ dist/host/runtime-barrel.js 102.24 kB │ gzip: 28.92 kB
12
- ℹ dist/sdk/protocol.js  4.75 kB │ gzip: 1.76 kB
13
- ℹ dist/index.js  2.88 kB │ gzip: 1.24 kB
14
- ℹ dist/sdk/manifest-barrel.js  0.36 kB │ gzip: 0.20 kB
15
- ℹ dist/sdk/providers/llm-barrel.js  0.36 kB │ gzip: 0.21 kB
16
- ℹ dist/sdk/providers/stt-barrel.js  0.30 kB │ gzip: 0.20 kB
17
- ℹ dist/sdk/providers/tts-barrel.js  0.26 kB │ gzip: 0.16 kB
18
- ℹ dist/_internal-types-DFL07G3f.js  5.66 kB │ gzip: 2.10 kB
19
- ℹ dist/types-KUgezM6u.js  5.64 kB │ gzip: 2.39 kB
20
- ℹ dist/constants-C2nirZUI.js  3.10 kB │ gzip: 1.38 kB
21
- ℹ dist/soniox-DCQ3GqJq.js  2.03 kB │ gzip: 0.54 kB
22
- ℹ dist/xai-jfQsxxPZ.js  1.18 kB │ gzip: 0.35 kB
23
- ℹ dist/ws-upgrade-BeOQ7fXL.js  1.14 kB │ gzip: 0.54 kB
24
- ℹ dist/cartesia-BfQPOQ7Y.js  1.08 kB │ gzip: 0.50 kB
25
- ℹ 14 files, total: 130.99 kB
26
- ✔ Build complete in 50ms
11
+ ℹ dist/host/runtime-barrel.js 113.03 kB │ gzip: 32.35 kB
12
+ ℹ dist/sdk/protocol.js  5.70 kB │ gzip: 1.92 kB
13
+ ℹ dist/index.js  2.88 kB │ gzip: 1.24 kB
14
+ ℹ dist/sdk/manifest-barrel.js  0.36 kB │ gzip: 0.20 kB
15
+ ℹ dist/sdk/providers/llm-barrel.js  0.36 kB │ gzip: 0.22 kB
16
+ ℹ dist/sdk/providers/stt-barrel.js  0.30 kB │ gzip: 0.19 kB
17
+ ℹ dist/sdk/providers/kv-barrel.js  0.26 kB │ gzip: 0.17 kB
18
+ ℹ dist/sdk/providers/tts-barrel.js  0.25 kB │ gzip: 0.16 kB
19
+ ℹ dist/sdk/providers/vector-barrel.js  0.22 kB │ gzip: 0.15 kB
20
+ ℹ dist/_internal-types-CrnTi9Ew.js  5.93 kB │ gzip: 2.13 kB
21
+ ℹ dist/types-KUgezM6u.js  5.64 kB │ gzip: 2.39 kB
22
+ ℹ dist/constants-C2nirZUI.js  3.10 kB │ gzip: 1.38 kB
23
+ ℹ dist/soniox-BQdL0mB5.js  2.03 kB │ gzip: 0.54 kB
24
+ ℹ dist/xai-BDI61Y2M.js  1.18 kB │ gzip: 0.35 kB
25
+ ℹ dist/ws-upgrade-BeOQ7fXL.js  1.14 kB │ gzip: 0.54 kB
26
+ ℹ dist/rime-58p9mDR8.js  1.08 kB │ gzip: 0.51 kB
27
+ ℹ dist/s3-BtCMvCod.js  0.76 kB │ gzip: 0.29 kB
28
+ ℹ dist/pinecone-CeJ69aRs.js  0.48 kB │ gzip: 0.24 kB
29
+ ℹ 18 files, total: 144.72 kB
30
+ ✔ Build complete in 54ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @alexkroman1/aai
2
2
 
3
+ ## 1.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3c711da: Stop per-frame debug log spam when S2S socket is closed; sendAudio now silently drops frames matching sendAudioRaw and pipeline/STT behavior. Closure is still logged once via the WebSocket close event.
8
+
9
+ ## 1.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 07b4263: Pluggable KV and Vector backends. New subpath exports @alexkroman1/aai/kv and @alexkroman1/aai/vector. New ctx.vector tool context field. Pinecone (integrated inference) and Redis/S3/fs/memory backends ship out of the box.
14
+
15
+ ### Patch Changes
16
+
17
+ - b79855d: Change S2S/agent API base URL to wss://agents.assemblyai.com/v1/ws
18
+
3
19
  ## 1.6.1
4
20
 
5
21
  ### Patch Changes
@@ -65,7 +65,9 @@ z.object({
65
65
  }),
66
66
  stt: ProviderDescriptorSchema.optional(),
67
67
  llm: ProviderDescriptorSchema.optional(),
68
- tts: ProviderDescriptorSchema.optional()
68
+ tts: ProviderDescriptorSchema.optional(),
69
+ kv: ProviderDescriptorSchema.optional(),
70
+ vector: ProviderDescriptorSchema.optional()
69
71
  });
70
72
  //#endregion
71
73
  //#region sdk/_internal-types.ts
@@ -87,7 +89,9 @@ const AgentConfigSchema = z.object({
87
89
  stt: ProviderDescriptorSchema.optional(),
88
90
  llm: ProviderDescriptorSchema.optional(),
89
91
  tts: ProviderDescriptorSchema.optional(),
90
- mode: z.enum(["s2s", "pipeline"]).optional()
92
+ mode: z.enum(["s2s", "pipeline"]).optional(),
93
+ kv: ProviderDescriptorSchema.optional(),
94
+ vector: ProviderDescriptorSchema.optional()
91
95
  });
92
96
  /**
93
97
  * Extract the serializable {@link AgentConfig} subset from a source object.
@@ -113,6 +117,8 @@ function toAgentConfig(src) {
113
117
  config.llm = src.llm;
114
118
  config.tts = src.tts;
115
119
  }
120
+ if (src.kv !== void 0) config.kv = src.kv;
121
+ if (src.vector !== void 0) config.vector = src.vector;
116
122
  return config;
117
123
  }
118
124
  /**
@@ -0,0 +1,17 @@
1
+ /**
2
+ * In-memory Vector implementation.
3
+ *
4
+ * INTENTIONALLY BAD QUALITY. Pseudo-embedding hashes the text into a
5
+ * 64-dim Float32Array of values in [-1, ~0.99], then L2-normalizes
6
+ * the result. Because both stored and probe vectors are unit-length,
7
+ * cosine similarity reduces to a plain dot product — that's what
8
+ * `cosine()` computes. Used only for `aai dev` and tests — the goal
9
+ * is proving tool wiring, not retrieval ranking.
10
+ */
11
+ import type { Vector } from "../sdk/vector.ts";
12
+ export type MemoryVectorOptions = {
13
+ namespace: string;
14
+ };
15
+ export declare function createMemoryVector(opts: MemoryVectorOptions): Vector;
16
+ /** Test-only: clear all in-memory state. Not exported from the package. */
17
+ export declare function _resetMemoryVectorForTests(): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Pinecone Vector implementation using integrated inference.
3
+ *
4
+ * The Pinecone index must be created with an embed config (e.g.
5
+ * `multilingual-e5-large`); we never see the embedding vectors.
6
+ *
7
+ * `@pinecone-database/pinecone` is loaded lazily via `createRequire`
8
+ * so the package becomes a true *optional* peer dependency: if a
9
+ * deployment doesn't use Pinecone, the missing package is never
10
+ * imported.
11
+ */
12
+ import type { Vector } from "../sdk/vector.ts";
13
+ export type PineconeVectorOptions = {
14
+ apiKey: string;
15
+ index: string;
16
+ /** Per-tenant namespace — set by the server to the agent slug. */
17
+ namespace: string;
18
+ };
19
+ export declare function createPineconeVector(opts: PineconeVectorOptions): Vector;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Descriptor → concrete `Kv` resolver. Mirror of `resolveLlm` /
3
+ * `resolveVector`. Always wraps the produced unstorage Storage in
4
+ * `createUnstorageKv` with the provided per-tenant prefix so namespace
5
+ * isolation is enforced regardless of backend choice.
6
+ */
7
+ import type { Kv } from "../../sdk/kv.ts";
8
+ import type { KvProvider } from "../../sdk/providers.ts";
9
+ /** Resolve a {@link KvProvider} descriptor into a {@link Kv}. */
10
+ export declare function resolveKv(descriptor: KvProvider, env: Record<string, string>, prefix: string): Kv;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Descriptor → concrete `Vector` resolver. Mirror of `resolveLlm`.
3
+ *
4
+ * Pulls API keys from the agent env so descriptors stay
5
+ * secret-free. Lazy-loads provider SDKs via `createRequire` so
6
+ * unused providers never enter the bundle.
7
+ */
8
+ import type { VectorProvider } from "../../sdk/providers.ts";
9
+ import type { Vector } from "../../sdk/vector.ts";
10
+ /** Resolve a {@link VectorProvider} descriptor into a {@link Vector}. */
11
+ export declare function resolveVector(descriptor: VectorProvider, env: Record<string, string>, namespace: string): Vector;
@@ -32,3 +32,9 @@ export declare function resolveTts(descriptor: TtsProvider): TtsOpener;
32
32
  * `streamText` call otherwise, and the error is clearer at construction.
33
33
  */
34
34
  export declare function resolveLlm(descriptor: LlmProvider, env: Record<string, string>): LanguageModel;
35
+ /**
36
+ * Lazy-load a package via createRequire so the package is a true optional
37
+ * peer dependency — if it's not installed the error surfaces only when the
38
+ * provider is actually used, not at module load time.
39
+ */
40
+ export declare function loadProviderPackage<T>(name: string, label: string): T;
@@ -3,7 +3,12 @@
3
3
  *
4
4
  * Used by aai-server (sandbox) and aai-cli (dev server).
5
5
  */
6
+ export type { Vector, VectorMatch, VectorQueryOptions } from "../sdk/vector.ts";
6
7
  export * from "./builtin-tools.ts";
8
+ export { createMemoryVector, type MemoryVectorOptions } from "./memory-vector.ts";
9
+ export * from "./pinecone-vector.ts";
10
+ export * from "./providers/resolve-kv.ts";
11
+ export * from "./providers/resolve-vector.ts";
7
12
  export * from "./runtime.ts";
8
13
  export * from "./runtime-config.ts";
9
14
  export * from "./server.ts";