@alexkroman1/aai 1.6.1 → 1.7.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/.turbo/turbo-build.log +22 -18
- package/CHANGELOG.md +10 -0
- package/dist/{_internal-types-DFL07G3f.js → _internal-types-CrnTi9Ew.js} +8 -2
- package/dist/host/memory-vector.d.ts +17 -0
- package/dist/host/pinecone-vector.d.ts +19 -0
- package/dist/host/providers/resolve-kv.d.ts +10 -0
- package/dist/host/providers/resolve-vector.d.ts +11 -0
- package/dist/host/providers/resolve.d.ts +6 -0
- package/dist/host/runtime-barrel.d.ts +5 -0
- package/dist/host/runtime-barrel.js +406 -93
- package/dist/host/runtime.d.ts +6 -0
- package/dist/host/server.d.ts +2 -0
- package/dist/host/tool-executor.d.ts +2 -0
- package/dist/pinecone-CeJ69aRs.js +19 -0
- package/dist/{cartesia-BfQPOQ7Y.js → rime-58p9mDR8.js} +19 -19
- package/dist/s3-BtCMvCod.js +37 -0
- package/dist/sdk/_internal-types.d.ts +11 -1
- package/dist/sdk/define.d.ts +5 -1
- package/dist/sdk/manifest-barrel.js +1 -1
- package/dist/sdk/manifest.d.ts +5 -1
- package/dist/sdk/protocol.d.ts +36 -0
- package/dist/sdk/protocol.js +26 -1
- package/dist/sdk/providers/kv/fs.d.ts +12 -0
- package/dist/sdk/providers/kv/memory.d.ts +9 -0
- package/dist/sdk/providers/kv/redis.d.ts +17 -0
- package/dist/sdk/providers/kv/s3.d.ts +25 -0
- package/dist/sdk/providers/kv-barrel.d.ts +13 -0
- package/dist/sdk/providers/kv-barrel.js +2 -0
- package/dist/sdk/providers/llm-barrel.js +1 -1
- package/dist/sdk/providers/stt-barrel.js +1 -1
- package/dist/sdk/providers/tts-barrel.js +1 -1
- package/dist/sdk/providers/vector/in-memory.d.ts +15 -0
- package/dist/sdk/providers/vector/pinecone.d.ts +19 -0
- package/dist/sdk/providers/vector-barrel.d.ts +11 -0
- package/dist/sdk/providers/vector-barrel.js +2 -0
- package/dist/sdk/providers.d.ts +4 -0
- package/dist/sdk/types.d.ts +8 -1
- package/dist/sdk/vector.d.ts +29 -0
- package/dist/{soniox-DCQ3GqJq.js → soniox-BQdL0mB5.js} +13 -13
- package/host/_runtime-conformance.ts +21 -0
- package/host/_test-utils.ts +1 -0
- package/host/memory-vector.test.ts +87 -0
- package/host/memory-vector.ts +108 -0
- package/host/pinecone-vector.test.ts +79 -0
- package/host/pinecone-vector.ts +79 -0
- package/host/providers/resolve-kv.test.ts +48 -0
- package/host/providers/resolve-kv.ts +128 -0
- package/host/providers/resolve-vector.test.ts +26 -0
- package/host/providers/resolve-vector.ts +42 -0
- package/host/providers/resolve.ts +26 -0
- package/host/runtime-barrel.ts +5 -0
- package/host/runtime-config.ts +1 -1
- package/host/runtime.ts +28 -2
- package/host/server.ts +57 -1
- package/host/tool-executor.ts +7 -1
- package/package.json +20 -1
- package/sdk/__snapshots__/exports.test.ts.snap +8 -0
- package/sdk/__snapshots__/schema-shapes.test.ts.snap +2 -0
- package/sdk/_internal-types.ts +8 -0
- package/sdk/define.ts +11 -1
- package/sdk/manifest.test.ts +20 -0
- package/sdk/manifest.ts +10 -0
- package/sdk/protocol-snapshot.test.ts +53 -0
- package/sdk/protocol.test.ts +54 -0
- package/sdk/protocol.ts +32 -0
- package/sdk/providers/kv/fs.ts +20 -0
- package/sdk/providers/kv/memory.ts +17 -0
- package/sdk/providers/kv/redis.ts +25 -0
- package/sdk/providers/kv/s3.ts +33 -0
- package/sdk/providers/kv-barrel.ts +19 -0
- package/sdk/providers/vector/in-memory.ts +23 -0
- package/sdk/providers/vector/pinecone.ts +27 -0
- package/sdk/providers/vector-barrel.ts +15 -0
- package/sdk/providers.ts +6 -0
- package/sdk/types.ts +14 -1
- package/sdk/vector.ts +32 -0
- /package/dist/{xai-jfQsxxPZ.js → xai-BDI61Y2M.js} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* S3-compatible KV descriptor.
|
|
4
|
+
*
|
|
5
|
+
* Resolves to unstorage's `s3` driver — works with AWS S3, Tigris,
|
|
6
|
+
* Cloudflare R2, and other S3-protocol stores. Credentials are
|
|
7
|
+
* pulled from the agent env at session start (the descriptor stays
|
|
8
|
+
* secret-free).
|
|
9
|
+
*
|
|
10
|
+
* Required agent env: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`.
|
|
11
|
+
* Optional: `AWS_SESSION_TOKEN` (for temporary credentials).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { KvProvider } from "../../providers.ts";
|
|
15
|
+
|
|
16
|
+
export const S3_KV_KIND = "s3" as const;
|
|
17
|
+
|
|
18
|
+
export interface S3KvOptions {
|
|
19
|
+
bucket: string;
|
|
20
|
+
/** Custom endpoint URL — required for non-AWS providers (Tigris, R2). */
|
|
21
|
+
endpoint?: string;
|
|
22
|
+
/** Region. Defaults to `"auto"`. */
|
|
23
|
+
region?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type S3KvProvider = KvProvider & {
|
|
27
|
+
readonly kind: typeof S3_KV_KIND;
|
|
28
|
+
readonly options: S3KvOptions;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function s3Kv(opts: S3KvOptions): S3KvProvider {
|
|
32
|
+
return { kind: S3_KV_KIND, options: { ...opts } };
|
|
33
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* `@alexkroman1/aai/kv` subpath barrel.
|
|
4
|
+
*
|
|
5
|
+
* Re-exports KV descriptor factories. Importing this barrel does
|
|
6
|
+
* not pull in any unstorage driver — the host resolver handles that
|
|
7
|
+
* at session start.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type { Kv } from "../kv.ts";
|
|
11
|
+
export type { KvProvider } from "../providers.ts";
|
|
12
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
13
|
+
export * from "./kv/fs.ts";
|
|
14
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
15
|
+
export * from "./kv/memory.ts";
|
|
16
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
17
|
+
export * from "./kv/redis.ts";
|
|
18
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
19
|
+
export * from "./kv/s3.ts";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* In-memory Vector descriptor.
|
|
4
|
+
*
|
|
5
|
+
* Resolves to a process-local store with deterministic hash-based
|
|
6
|
+
* pseudo-embeddings. Quality is intentionally bad — the purpose is
|
|
7
|
+
* proving tool wiring during `aai dev`, not retrieval ranking.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { VectorProvider } from "../../providers.ts";
|
|
11
|
+
|
|
12
|
+
export const IN_MEMORY_VECTOR_KIND = "in-memory" as const;
|
|
13
|
+
|
|
14
|
+
export type InMemoryVectorOptions = Record<string, never>;
|
|
15
|
+
|
|
16
|
+
export type InMemoryVectorProvider = VectorProvider & {
|
|
17
|
+
readonly kind: typeof IN_MEMORY_VECTOR_KIND;
|
|
18
|
+
readonly options: InMemoryVectorOptions;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function inMemoryVector(): InMemoryVectorProvider {
|
|
22
|
+
return { kind: IN_MEMORY_VECTOR_KIND, options: {} };
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* Pinecone Vector descriptor.
|
|
4
|
+
*
|
|
5
|
+
* The descriptor flows through bundle → server → runtime without
|
|
6
|
+
* importing `@pinecone-database/pinecone`. The host-side resolver in
|
|
7
|
+
* `host/providers/resolve-vector.ts` constructs a real client during
|
|
8
|
+
* `createRuntime`, using `PINECONE_API_KEY` from the agent's env.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { VectorProvider } from "../../providers.ts";
|
|
12
|
+
|
|
13
|
+
export const PINECONE_VECTOR_KIND = "pinecone" as const;
|
|
14
|
+
|
|
15
|
+
export interface PineconeOptions {
|
|
16
|
+
/** Pinecone index name. The index must be created with integrated-inference embed config. */
|
|
17
|
+
index: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type PineconeProvider = VectorProvider & {
|
|
21
|
+
readonly kind: typeof PINECONE_VECTOR_KIND;
|
|
22
|
+
readonly options: PineconeOptions;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function pinecone(opts: PineconeOptions): PineconeProvider {
|
|
26
|
+
return { kind: PINECONE_VECTOR_KIND, options: { ...opts } };
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* `@alexkroman1/aai/vector` subpath barrel.
|
|
4
|
+
*
|
|
5
|
+
* Re-exports descriptor factories. Importing this barrel does not
|
|
6
|
+
* pull in `@pinecone-database/pinecone` — the host resolver handles
|
|
7
|
+
* that at session start.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type { VectorProvider } from "../providers.ts";
|
|
11
|
+
export type { Vector, VectorMatch, VectorQueryOptions } from "../vector.ts";
|
|
12
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
13
|
+
export * from "./vector/in-memory.ts";
|
|
14
|
+
// biome-ignore lint/performance/noReExportAll: subpath barrel
|
|
15
|
+
export * from "./vector/pinecone.ts";
|
package/sdk/providers.ts
CHANGED
|
@@ -48,6 +48,12 @@ export type LlmProvider = ProviderDescriptor<string, Record<string, unknown>>;
|
|
|
48
48
|
/** Descriptor for a TTS provider. Returned by factories like `cartesia(...)`. */
|
|
49
49
|
export type TtsProvider = ProviderDescriptor<string, Record<string, unknown>>;
|
|
50
50
|
|
|
51
|
+
/** Descriptor for a KV backend. Returned by factories like `redisKv()`. */
|
|
52
|
+
export type KvProvider = ProviderDescriptor<string, Record<string, unknown>>;
|
|
53
|
+
|
|
54
|
+
/** Descriptor for a Vector backend. Returned by factories like `pinecone(...)`. */
|
|
55
|
+
export type VectorProvider = ProviderDescriptor<string, Record<string, unknown>>;
|
|
56
|
+
|
|
51
57
|
/**
|
|
52
58
|
* Session mode derived from which provider triple is set.
|
|
53
59
|
*
|
package/sdk/types.ts
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import type { Kv } from "./kv.ts";
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
KvProvider,
|
|
10
|
+
LlmProvider,
|
|
11
|
+
SttProvider,
|
|
12
|
+
TtsProvider,
|
|
13
|
+
VectorProvider,
|
|
14
|
+
} from "./providers.ts";
|
|
15
|
+
import type { Vector } from "./vector.ts";
|
|
9
16
|
|
|
10
17
|
/**
|
|
11
18
|
* Identifier for a built-in server-side tool.
|
|
@@ -80,6 +87,8 @@ export type ToolContext<S = Record<string, unknown>> = {
|
|
|
80
87
|
state: S;
|
|
81
88
|
/** Key-value store scoped to this agent deployment. */
|
|
82
89
|
kv: Kv;
|
|
90
|
+
/** Vector store scoped to this agent deployment. */
|
|
91
|
+
vector: Vector;
|
|
83
92
|
/** Read-only snapshot of conversation messages so far. */
|
|
84
93
|
messages: readonly Message[];
|
|
85
94
|
/** Unique identifier for the current session. Useful for correlating logs across concurrent sessions. */
|
|
@@ -233,6 +242,10 @@ export type AgentDef<S = Record<string, unknown>> = {
|
|
|
233
242
|
* pipeline mode.
|
|
234
243
|
*/
|
|
235
244
|
tts?: TtsProvider;
|
|
245
|
+
/** Pluggable KV backend. Falls back to platform default when omitted. */
|
|
246
|
+
kv?: KvProvider;
|
|
247
|
+
/** Pluggable Vector backend. Falls back to platform default when omitted. */
|
|
248
|
+
vector?: VectorProvider;
|
|
236
249
|
};
|
|
237
250
|
|
|
238
251
|
// ─── Zod schemas ────────────────────────────────────────────────────────────
|
package/sdk/vector.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* Vector storage interface used by agents.
|
|
4
|
+
*
|
|
5
|
+
* Agents access the store via `ctx.vector`. Backends embed text on
|
|
6
|
+
* write and run similarity search on read; the interface is text-in,
|
|
7
|
+
* matches-out so users never deal with embedding vectors directly.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export type VectorMatch = {
|
|
12
|
+
id: string;
|
|
13
|
+
score: number;
|
|
14
|
+
text: string;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @public */
|
|
19
|
+
export type VectorQueryOptions = {
|
|
20
|
+
/** Number of results to return. Default 5, max 100. */
|
|
21
|
+
topK?: number;
|
|
22
|
+
/** Backend-specific filter (Pinecone uses MongoDB-like operators). */
|
|
23
|
+
filter?: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
export type Vector = {
|
|
28
|
+
upsert(id: string, text: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
29
|
+
query(text: string, opts?: VectorQueryOptions): Promise<VectorMatch[]>;
|
|
30
|
+
delete(ids: string | string[]): Promise<void>;
|
|
31
|
+
close?(): void;
|
|
32
|
+
};
|
|
File without changes
|