@lunora/agent 1.0.0-alpha.184 → 1.0.0-alpha.186

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.
@@ -1,4 +1,6 @@
1
- import { SchemaExtension } from '@lunora/server';
1
+ import { TableDefinition, SchemaExtension } from '@lunora/server';
2
+ /** The schema-extension key the agent tables merge under (`agent_*` physical names). */
3
+ declare const AGENT_EXTENSION_KEY: "agent";
2
4
  /**
3
5
  * Loose structural view of a registered Lunora function — wide enough for any
4
6
  * concrete `RegisteredMutation`/`RegisteredQuery` (whose precise validator-map
@@ -11,6 +13,36 @@ interface AgentRegisteredFunction {
11
13
  readonly kind: "mutation" | "query";
12
14
  readonly visibility?: "internal" | "public";
13
15
  }
16
+ /**
17
+ * The episodic-memory table, spread into the `agent` schema extension by
18
+ * `component.ts`. Owner-scoped (keyed by `owner`, not thread), so a run in one
19
+ * conversation recalls the timeline of the user's earlier runs across every
20
+ * thread. `.public()` + RLS-exempt like the thread/graph tables (package code,
21
+ * access-controlled inside the dispatched functions).
22
+ *
23
+ * Explicitly typed as a `Record` of `TableDefinition` values for the same
24
+ * `--isolatedDeclarations` reason as `graphTables` (an exported const with a
25
+ * computed key can't be inferred; see graph-component.ts).
26
+ */
27
+ declare const episodeTables: Record<"episodes", TableDefinition>;
28
+ /** Bare table names — auto-prefixed with the extension key at merge time. */
29
+ declare const ENTITIES_BARE_TABLE = "entities";
30
+ declare const EDGES_BARE_TABLE = "edges";
31
+ /**
32
+ * The graph-memory tables, spread into the `agent` schema extension by
33
+ * `component.ts`. Owner-scoped (keyed by `owner`, not thread) so knowledge
34
+ * extracted in one conversation is traversable in the next, and `.public()` +
35
+ * RLS-exempt like the thread tables (package code, access-controlled inside the
36
+ * dispatched functions).
37
+ *
38
+ * Explicitly typed as a `Record` of `TableDefinition` values over its bare names
39
+ * because it is an EXPORTED const with computed (`[BARE]`) keys — under
40
+ * `--isolatedDeclarations` (packem's `.d.ts` emit) a bare exported object literal
41
+ * with computed keys can't have its type inferred (TS9038). The names stay
42
+ * literal so `.extend(agentExtension)` adds exact table names; row types come
43
+ * from codegen.
44
+ */
45
+ declare const graphTables: Record<typeof EDGES_BARE_TABLE | typeof ENTITIES_BARE_TABLE, TableDefinition>;
14
46
  /**
15
47
  * The per-owner dedup key for an entity name: trim, collapse internal
16
48
  * whitespace, lowercase. Deterministic (no locale) so a workflow replay or
@@ -47,6 +79,10 @@ interface SandboxComponent {
47
79
  * @experimental
48
80
  */
49
81
  declare const sandboxComponent: () => SandboxComponent;
82
+ /** Bare table names — auto-prefixed with the extension key at merge time. */
83
+ declare const THREADS_BARE_TABLE = "threads";
84
+ declare const MESSAGES_BARE_TABLE = "messages";
85
+ declare const RUN_QUEUE_BARE_TABLE = "run_queue";
50
86
  /**
51
87
  * The agent thread tables, shipped as a schema extension so an app merges
52
88
  * them with one call and they can never collide with app tables:
@@ -63,7 +99,7 @@ declare const sandboxComponent: () => SandboxComponent;
63
99
  * message is a no-op instead of a duplicate.
64
100
  * @experimental
65
101
  */
66
- declare const agentExtension: SchemaExtension;
102
+ declare const agentExtension: SchemaExtension<Record<keyof typeof episodeTables | keyof typeof graphTables | typeof MESSAGES_BARE_TABLE | typeof RUN_QUEUE_BARE_TABLE | typeof THREADS_BARE_TABLE, TableDefinition>, typeof AGENT_EXTENSION_KEY>;
67
103
  /**
68
104
  * `AgentComponent` is part of the experimental `@lunora/agent` API and may change without a major version bump.
69
105
  * @experimental
@@ -1,4 +1,6 @@
1
- import { SchemaExtension } from '@lunora/server';
1
+ import { TableDefinition, SchemaExtension } from '@lunora/server';
2
+ /** The schema-extension key the agent tables merge under (`agent_*` physical names). */
3
+ declare const AGENT_EXTENSION_KEY: "agent";
2
4
  /**
3
5
  * Loose structural view of a registered Lunora function — wide enough for any
4
6
  * concrete `RegisteredMutation`/`RegisteredQuery` (whose precise validator-map
@@ -11,6 +13,36 @@ interface AgentRegisteredFunction {
11
13
  readonly kind: "mutation" | "query";
12
14
  readonly visibility?: "internal" | "public";
13
15
  }
16
+ /**
17
+ * The episodic-memory table, spread into the `agent` schema extension by
18
+ * `component.ts`. Owner-scoped (keyed by `owner`, not thread), so a run in one
19
+ * conversation recalls the timeline of the user's earlier runs across every
20
+ * thread. `.public()` + RLS-exempt like the thread/graph tables (package code,
21
+ * access-controlled inside the dispatched functions).
22
+ *
23
+ * Explicitly typed as a `Record` of `TableDefinition` values for the same
24
+ * `--isolatedDeclarations` reason as `graphTables` (an exported const with a
25
+ * computed key can't be inferred; see graph-component.ts).
26
+ */
27
+ declare const episodeTables: Record<"episodes", TableDefinition>;
28
+ /** Bare table names — auto-prefixed with the extension key at merge time. */
29
+ declare const ENTITIES_BARE_TABLE = "entities";
30
+ declare const EDGES_BARE_TABLE = "edges";
31
+ /**
32
+ * The graph-memory tables, spread into the `agent` schema extension by
33
+ * `component.ts`. Owner-scoped (keyed by `owner`, not thread) so knowledge
34
+ * extracted in one conversation is traversable in the next, and `.public()` +
35
+ * RLS-exempt like the thread tables (package code, access-controlled inside the
36
+ * dispatched functions).
37
+ *
38
+ * Explicitly typed as a `Record` of `TableDefinition` values over its bare names
39
+ * because it is an EXPORTED const with computed (`[BARE]`) keys — under
40
+ * `--isolatedDeclarations` (packem's `.d.ts` emit) a bare exported object literal
41
+ * with computed keys can't have its type inferred (TS9038). The names stay
42
+ * literal so `.extend(agentExtension)` adds exact table names; row types come
43
+ * from codegen.
44
+ */
45
+ declare const graphTables: Record<typeof EDGES_BARE_TABLE | typeof ENTITIES_BARE_TABLE, TableDefinition>;
14
46
  /**
15
47
  * The per-owner dedup key for an entity name: trim, collapse internal
16
48
  * whitespace, lowercase. Deterministic (no locale) so a workflow replay or
@@ -47,6 +79,10 @@ interface SandboxComponent {
47
79
  * @experimental
48
80
  */
49
81
  declare const sandboxComponent: () => SandboxComponent;
82
+ /** Bare table names — auto-prefixed with the extension key at merge time. */
83
+ declare const THREADS_BARE_TABLE = "threads";
84
+ declare const MESSAGES_BARE_TABLE = "messages";
85
+ declare const RUN_QUEUE_BARE_TABLE = "run_queue";
50
86
  /**
51
87
  * The agent thread tables, shipped as a schema extension so an app merges
52
88
  * them with one call and they can never collide with app tables:
@@ -63,7 +99,7 @@ declare const sandboxComponent: () => SandboxComponent;
63
99
  * message is a no-op instead of a duplicate.
64
100
  * @experimental
65
101
  */
66
- declare const agentExtension: SchemaExtension;
102
+ declare const agentExtension: SchemaExtension<Record<keyof typeof episodeTables | keyof typeof graphTables | typeof MESSAGES_BARE_TABLE | typeof RUN_QUEUE_BARE_TABLE | typeof THREADS_BARE_TABLE, TableDefinition>, typeof AGENT_EXTENSION_KEY>;
67
103
  /**
68
104
  * `AgentComponent` is part of the experimental `@lunora/agent` API and may change without a major version bump.
69
105
  * @experimental
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/agent",
3
- "version": "1.0.0-alpha.184",
3
+ "version": "1.0.0-alpha.186",
4
4
  "description": "Durable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions",
5
5
  "keywords": [
6
6
  "agent",
@@ -87,7 +87,7 @@
87
87
  "@lunora/ai": "1.0.0-alpha.118",
88
88
  "@lunora/errors": "1.0.0-alpha.50",
89
89
  "@lunora/mail": "1.0.0-alpha.100",
90
- "@lunora/server": "1.0.0-alpha.183",
90
+ "@lunora/server": "1.0.0-alpha.185",
91
91
  "@lunora/values": "1.0.0-alpha.60",
92
92
  "@lunora/workflow": "1.0.0-alpha.71",
93
93
  "@modelcontextprotocol/sdk": "^1.32.0",