mirror of
https://github.com/kennethnym/aris.git
synced 2026-06-16 12:31:17 +01:00
feat: add agent query API (#130)
This commit is contained in:
@@ -181,4 +181,19 @@ describe("Context", () => {
|
||||
expect(ctx.size).toBe(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe("entries", () => {
|
||||
test("returns serializable key-value entries", () => {
|
||||
const ctx = new Context()
|
||||
ctx.set([
|
||||
[WeatherKey, { temperature: 20 }],
|
||||
[NextEventKey, { title: "Standup" }],
|
||||
])
|
||||
|
||||
expect(ctx.entries()).toEqual([
|
||||
{ key: WeatherKey, value: { temperature: 20 } },
|
||||
{ key: NextEventKey, value: { title: "Standup" } },
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -125,4 +125,12 @@ export class Context {
|
||||
get size(): number {
|
||||
return this.store.size
|
||||
}
|
||||
|
||||
/** Returns all context entries for serialization and diagnostics. */
|
||||
entries(): Array<{ key: readonly ContextKeyPart[]; value: unknown }> {
|
||||
return Array.from(this.store.values()).map((entry) => ({
|
||||
key: entry.key,
|
||||
value: entry.value,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user