stitchkit 0.68.7 → 0.68.9
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/README.md +5 -0
- package/dist/agent-runtime/sqlite.d.ts +32 -0
- package/dist/agent-runtime/sqlite.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-bun.d.ts +11 -0
- package/dist/agent-runtime-sqlite-bun.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-bun.js +40 -0
- package/dist/agent-runtime-sqlite-node.d.ts +11 -0
- package/dist/agent-runtime-sqlite-node.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-node.js +42 -0
- package/dist/agent-runtime.js +26 -898
- package/dist/index-8vpzxg55.js +403 -0
- package/dist/index-hqza5nde.js +914 -0
- package/llms-full.txt +183 -4
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ import { createServer, createHandler, implement } from 'stitchkit/server'
|
|
|
87
87
|
import { createSocketIOServer, createAuthHook } from 'stitchkit/server'
|
|
88
88
|
import { createMcpHandler, mountAgent } from 'stitchkit/tools'
|
|
89
89
|
import { createAgentRuntime, defineAgentProtocol } from 'stitchkit/agent-runtime'
|
|
90
|
+
import { createBunSqliteAgentRuntimeStore } from 'stitchkit/agent-runtime/sqlite/bun'
|
|
90
91
|
import { createApplication, defineManagedResource } from 'stitchkit/application'
|
|
91
92
|
import { implementRemote } from 'stitchkit/remote'
|
|
92
93
|
```
|
|
@@ -99,6 +100,9 @@ adapters are isolated further; importing `stitchkit/application` never resolves
|
|
|
99
100
|
grammY or OpenTelemetry. Browser code that shares agent records imports
|
|
100
101
|
`stitchkit/agent-runtime/browser`; it contains the canonical schemas and event
|
|
101
102
|
cursor but no execution, persistence or sink graph.
|
|
103
|
+
Durable embedded storage is isolated behind
|
|
104
|
+
`stitchkit/agent-runtime/sqlite/bun` and `stitchkit/agent-runtime/sqlite/node`;
|
|
105
|
+
neither runtime-specific built-in leaks into the neutral or browser entrypoint.
|
|
102
106
|
|
|
103
107
|
## Managed application kernel
|
|
104
108
|
|
|
@@ -423,6 +427,7 @@ peer — an install pulls in only what the project actually uses.
|
|
|
423
427
|
| `@modelcontextprotocol/ext-apps` | peer, optional | Only MCP Apps (`ui://` resources and UI metadata). |
|
|
424
428
|
| `ai` | peer, optional | `stitchkit/tools` agent tools and the optional server-only `stitchkit/agent-runtime`. |
|
|
425
429
|
| `@openrouter/ai-sdk-provider` | peer, optional | Only `stitchkit/agent-runtime/openrouter`; neutral runtime imports do not resolve it. |
|
|
430
|
+
| SQLite | runtime built-in, optional | `bun:sqlite` through `stitchkit/agent-runtime/sqlite/bun`, or `node:sqlite` on Node ≥ 22.5 through the Node leaf. |
|
|
426
431
|
| `grammy` | peer, optional | Only `stitchkit/application/grammy`; the neutral application kernel does not resolve it. |
|
|
427
432
|
| `@opentelemetry/api` | peer, optional | Type-only boundary for `stitchkit/application/opentelemetry`; the adapter has no runtime import and owns no SDK/exporter. |
|
|
428
433
|
| `@tanstack/react-query` + `react-query-kit` | peer, optional | Only `stitchkit/react` — `createCursorQuery`, `createCacheBridge`. |
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createAgentRuntimeStore } from './store-driver.js';
|
|
2
|
+
export type AgentRuntimeSqliteValue = string | number | bigint | null | Uint8Array;
|
|
3
|
+
export interface AgentRuntimeSqliteStatement {
|
|
4
|
+
get(...parameters: AgentRuntimeSqliteValue[]): unknown;
|
|
5
|
+
all(...parameters: AgentRuntimeSqliteValue[]): readonly unknown[];
|
|
6
|
+
run(...parameters: AgentRuntimeSqliteValue[]): {
|
|
7
|
+
changes: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** Minimal synchronous SQLite boundary implemented by the Bun and Node leaf entrypoints. */
|
|
11
|
+
export interface AgentRuntimeSqliteDatabase {
|
|
12
|
+
exec(sql: string): void;
|
|
13
|
+
prepare(sql: string): AgentRuntimeSqliteStatement;
|
|
14
|
+
close(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface SqliteAgentRuntimeStoreConfig {
|
|
17
|
+
database: AgentRuntimeSqliteDatabase;
|
|
18
|
+
/** Create or validate Stitchkit's namespaced schema. Default true. */
|
|
19
|
+
initialize?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SqliteAgentRuntimeStore {
|
|
22
|
+
store: ReturnType<typeof createAgentRuntimeStore<AgentRuntimeSqliteDatabase>>;
|
|
23
|
+
/** Refuse new work, wait for queued operations, then close the owned connection. */
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create Stitchkit's schema without claiming an application's tables or SQLite user_version.
|
|
28
|
+
* An orphaned partial Stitchkit schema is refused rather than destructively repaired.
|
|
29
|
+
*/
|
|
30
|
+
export declare function initializeAgentRuntimeSqlite(database: AgentRuntimeSqliteDatabase): void;
|
|
31
|
+
export declare function createSqliteAgentRuntimeStore(config: SqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
|
|
32
|
+
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sqlite.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,UAAU,CAAC;AAEnF,MAAM,WAAW,2BAA2B;IAC1C,GAAG,CAAC,GAAG,UAAU,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC;IACvD,GAAG,CAAC,GAAG,UAAU,EAAE,uBAAuB,EAAE,GAAG,SAAS,OAAO,EAAE,CAAC;IAClE,GAAG,CAAC,GAAG,UAAU,EAAE,uBAAuB,EAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,4FAA4F;AAC5F,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,CAAC;IAClD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,0BAA0B,CAAC;IACrC,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAC9E,oFAAoF;IACpF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAuED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,CAsFvF;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,6BAA6B,GACpC,uBAAuB,CAyUzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SqliteAgentRuntimeStore } from './agent-runtime/sqlite.js';
|
|
2
|
+
export interface BunSqliteAgentRuntimeStoreConfig {
|
|
3
|
+
filename: string;
|
|
4
|
+
create?: boolean;
|
|
5
|
+
initialize?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Bun `bun:sqlite` binding with non-blocking lock refusal on same-thread contention. */
|
|
8
|
+
export declare function createBunSqliteAgentRuntimeStore(config: BunSqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
|
|
9
|
+
export type { AgentRuntimeSqliteDatabase, AgentRuntimeSqliteStatement, AgentRuntimeSqliteValue, SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, } from './agent-runtime/sqlite.js';
|
|
10
|
+
export { createSqliteAgentRuntimeStore, initializeAgentRuntimeSqlite, } from './agent-runtime/sqlite.js';
|
|
11
|
+
//# sourceMappingURL=agent-runtime-sqlite-bun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-sqlite-bun.d.ts","sourceRoot":"","sources":["../src/agent-runtime-sqlite-bun.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,yFAAyF;AACzF,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,gCAAgC,GACvC,uBAAuB,CAyBzB;AAED,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSqliteAgentRuntimeStore,
|
|
3
|
+
initializeAgentRuntimeSqlite
|
|
4
|
+
} from "./index-8vpzxg55.js";
|
|
5
|
+
import"./index-hqza5nde.js";
|
|
6
|
+
import"./index-ysphyxax.js";
|
|
7
|
+
|
|
8
|
+
// src/agent-runtime-sqlite-bun.ts
|
|
9
|
+
import { Database } from "bun:sqlite";
|
|
10
|
+
function createBunSqliteAgentRuntimeStore(config) {
|
|
11
|
+
const database = new Database(config.filename, {
|
|
12
|
+
create: config.create ?? true,
|
|
13
|
+
readwrite: true
|
|
14
|
+
});
|
|
15
|
+
database.exec("PRAGMA busy_timeout = 0; PRAGMA foreign_keys = ON;");
|
|
16
|
+
const boundary = {
|
|
17
|
+
exec: (sql) => database.exec(sql),
|
|
18
|
+
prepare(sql) {
|
|
19
|
+
const statement = database.query(sql);
|
|
20
|
+
return {
|
|
21
|
+
get: (...parameters) => statement.get(...parameters),
|
|
22
|
+
all: (...parameters) => statement.all(...parameters),
|
|
23
|
+
run: (...parameters) => {
|
|
24
|
+
const result = statement.run(...parameters);
|
|
25
|
+
return { changes: result.changes };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
close: () => database.close()
|
|
30
|
+
};
|
|
31
|
+
return createSqliteAgentRuntimeStore({
|
|
32
|
+
database: boundary,
|
|
33
|
+
initialize: config.initialize
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
createBunSqliteAgentRuntimeStore,
|
|
38
|
+
createSqliteAgentRuntimeStore,
|
|
39
|
+
initializeAgentRuntimeSqlite
|
|
40
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SqliteAgentRuntimeStore } from './agent-runtime/sqlite.js';
|
|
2
|
+
export interface NodeSqliteAgentRuntimeStoreConfig {
|
|
3
|
+
filename: string;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
initialize?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Node built-in `node:sqlite` binding with non-blocking lock refusal on contention. */
|
|
8
|
+
export declare function createNodeSqliteAgentRuntimeStore(config: NodeSqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
|
|
9
|
+
export type { AgentRuntimeSqliteDatabase, AgentRuntimeSqliteStatement, AgentRuntimeSqliteValue, SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, } from './agent-runtime/sqlite.js';
|
|
10
|
+
export { createSqliteAgentRuntimeStore, initializeAgentRuntimeSqlite, } from './agent-runtime/sqlite.js';
|
|
11
|
+
//# sourceMappingURL=agent-runtime-sqlite-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-sqlite-node.d.ts","sourceRoot":"","sources":["../src/agent-runtime-sqlite-node.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wFAAwF;AACxF,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,iCAAiC,GACxC,uBAAuB,CA2BzB;AAED,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSqliteAgentRuntimeStore,
|
|
3
|
+
initializeAgentRuntimeSqlite
|
|
4
|
+
} from "./index-8vpzxg55.js";
|
|
5
|
+
import"./index-hqza5nde.js";
|
|
6
|
+
import"./index-ysphyxax.js";
|
|
7
|
+
|
|
8
|
+
// src/agent-runtime-sqlite-node.ts
|
|
9
|
+
import { DatabaseSync } from "node:sqlite";
|
|
10
|
+
function createNodeSqliteAgentRuntimeStore(config) {
|
|
11
|
+
if (config.readOnly && config.initialize !== false) {
|
|
12
|
+
throw new TypeError("A read-only SQLite agent-runtime store requires initialize: false");
|
|
13
|
+
}
|
|
14
|
+
const database = new DatabaseSync(config.filename, {
|
|
15
|
+
readOnly: config.readOnly ?? false
|
|
16
|
+
});
|
|
17
|
+
database.exec("PRAGMA busy_timeout = 0; PRAGMA foreign_keys = ON;");
|
|
18
|
+
const boundary = {
|
|
19
|
+
exec: (sql) => database.exec(sql),
|
|
20
|
+
prepare(sql) {
|
|
21
|
+
const statement = database.prepare(sql);
|
|
22
|
+
return {
|
|
23
|
+
get: (...parameters) => statement.get(...parameters),
|
|
24
|
+
all: (...parameters) => statement.all(...parameters),
|
|
25
|
+
run: (...parameters) => {
|
|
26
|
+
const result = statement.run(...parameters);
|
|
27
|
+
return { changes: Number(result.changes) };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
close: () => database.close()
|
|
32
|
+
};
|
|
33
|
+
return createSqliteAgentRuntimeStore({
|
|
34
|
+
database: boundary,
|
|
35
|
+
initialize: config.initialize
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
createNodeSqliteAgentRuntimeStore,
|
|
40
|
+
createSqliteAgentRuntimeStore,
|
|
41
|
+
initializeAgentRuntimeSqlite
|
|
42
|
+
};
|