stitchkit 0.74.1 → 0.75.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 (75) hide show
  1. package/dist/agent-runtime/sqlite-purge.d.ts +3 -3
  2. package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
  3. package/dist/agent-runtime/sqlite.d.ts +5 -17
  4. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  5. package/dist/agent-runtime-coding-tools.js +2 -1
  6. package/dist/agent-runtime-harness.js +5 -4
  7. package/dist/agent-runtime-sqlite-bun.d.ts +1 -1
  8. package/dist/agent-runtime-sqlite-bun.d.ts.map +1 -1
  9. package/dist/agent-runtime-sqlite-node.d.ts +1 -1
  10. package/dist/agent-runtime-sqlite-node.d.ts.map +1 -1
  11. package/dist/agent-runtime.js +8 -7
  12. package/dist/application/keyspace-sqlite.d.ts +31 -0
  13. package/dist/application/keyspace-sqlite.d.ts.map +1 -0
  14. package/dist/application/keyspace.d.ts +142 -0
  15. package/dist/application/keyspace.d.ts.map +1 -0
  16. package/dist/application/watch-hub.d.ts +125 -0
  17. package/dist/application/watch-hub.d.ts.map +1 -0
  18. package/dist/application.d.ts +4 -0
  19. package/dist/application.d.ts.map +1 -1
  20. package/dist/application.js +455 -0
  21. package/dist/cli.js +7 -6
  22. package/dist/contract/index.js +2 -1
  23. package/dist/{index-aczggrty.js → index-28jsdwt1.js} +1 -1
  24. package/dist/index-35z5h2ty.js +594 -0
  25. package/dist/{index-f6n5n7nz.js → index-4kp4fxvp.js} +4 -18
  26. package/dist/{index-118v0z41.js → index-52400rdd.js} +8 -3
  27. package/dist/{index-da1aqnhb.js → index-65kathdm.js} +6 -4
  28. package/dist/{index-jqtsc9mj.js → index-6wr9f6qm.js} +2 -2
  29. package/dist/{index-7qy2ex0m.js → index-885chjxq.js} +1 -1
  30. package/dist/{index-k2zczx1g.js → index-9c5dbr5q.js} +1 -1
  31. package/dist/{index-s2rchahr.js → index-9my2n66s.js} +4 -4
  32. package/dist/{index-nemjkxjp.js → index-e0a57ymn.js} +1 -1
  33. package/dist/{index-vbf2p6me.js → index-endzd8sj.js} +1 -1
  34. package/dist/{index-vj3vvpaa.js → index-hsz2mmk0.js} +1 -17
  35. package/dist/{index-s4c8wy8m.js → index-k68e5jz0.js} +2 -2
  36. package/dist/index-rxfy4cq7.js +17 -0
  37. package/dist/{index-58jzmnn4.js → index-v5dm4bwq.js} +1 -1
  38. package/dist/{index-m668wzyc.js → index-v7xjfy10.js} +1 -1
  39. package/dist/index-vdvmcy7r.js +22 -0
  40. package/dist/{index-ezmn6ac6.js → index-xgahrwdf.js} +3 -3
  41. package/dist/index.js +26 -611
  42. package/dist/internal/sqlite.d.ts +27 -0
  43. package/dist/internal/sqlite.d.ts.map +1 -0
  44. package/dist/internal/stable-digest.d.ts +24 -0
  45. package/dist/internal/stable-digest.d.ts.map +1 -0
  46. package/dist/live/events.d.ts +155 -0
  47. package/dist/live/events.d.ts.map +1 -0
  48. package/dist/live/watch-client.d.ts +66 -0
  49. package/dist/live/watch-client.d.ts.map +1 -0
  50. package/dist/live/watch-contract.d.ts +157 -0
  51. package/dist/live/watch-contract.d.ts.map +1 -0
  52. package/dist/live.d.ts +18 -0
  53. package/dist/live.d.ts.map +1 -0
  54. package/dist/live.js +284 -0
  55. package/dist/node.js +5 -4
  56. package/dist/observability/index.js +4 -3
  57. package/dist/primitives.js +2 -1
  58. package/dist/remote.js +3 -2
  59. package/dist/server/create.d.ts.map +1 -1
  60. package/dist/server/event-bus.d.ts +49 -1
  61. package/dist/server/event-bus.d.ts.map +1 -1
  62. package/dist/server/index.d.ts +2 -1
  63. package/dist/server/index.d.ts.map +1 -1
  64. package/dist/server/index.js +224 -12
  65. package/dist/server/middleware/trust-fence.d.ts +116 -0
  66. package/dist/server/middleware/trust-fence.d.ts.map +1 -0
  67. package/dist/server/types.d.ts +16 -1
  68. package/dist/server/types.d.ts.map +1 -1
  69. package/dist/testing.js +3 -2
  70. package/dist/tool-invoker.js +6 -5
  71. package/dist/tools/mcp-round.d.ts.map +1 -1
  72. package/dist/tools.js +15 -30
  73. package/llms-full.txt +426 -4
  74. package/llms.txt +1 -0
  75. package/package.json +6 -2
@@ -1,7 +1,7 @@
1
- import type { AgentRuntimeSqliteDatabase } from './sqlite.js';
1
+ import type { SqliteDatabase } from './sqlite.js';
2
2
  import type { AgentConversationPurgeDriver } from './store-purge.js';
3
3
  /** Additive v1 feature; install inside the schema initialization transaction. */
4
- export declare function initializeSqliteConversationPurge(database: AgentRuntimeSqliteDatabase): void;
4
+ export declare function initializeSqliteConversationPurge(database: SqliteDatabase): void;
5
5
  /** Uninitialized v1/read-only connections remain readable without claiming purge support. */
6
- export declare function sqliteConversationPurge(database: AgentRuntimeSqliteDatabase): AgentConversationPurgeDriver<AgentRuntimeSqliteDatabase> | undefined;
6
+ export declare function sqliteConversationPurge(database: SqliteDatabase): AgentConversationPurgeDriver<SqliteDatabase> | undefined;
7
7
  //# sourceMappingURL=sqlite-purge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-purge.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sqlite-purge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AASlE,iFAAiF;AACjF,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,CAoB5F;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,0BAA0B,GACnC,4BAA4B,CAAC,0BAA0B,CAAC,GAAG,SAAS,CA2BtE"}
1
+ {"version":3,"file":"sqlite-purge.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sqlite-purge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AASlE,iFAAiF;AACjF,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAoBhF;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,GACvB,4BAA4B,CAAC,cAAc,CAAC,GAAG,SAAS,CA2B1D"}
@@ -1,26 +1,14 @@
1
+ import type { SqliteDatabase } from '../internal/sqlite.js';
1
2
  import { type AgentConversationReader } from './conversations.js';
2
3
  import { createAgentRuntimeStore } from './store-driver.js';
3
- export type AgentRuntimeSqliteValue = string | number | bigint | null | Uint8Array;
4
- export interface AgentRuntimeSqliteStatement {
5
- get(...parameters: AgentRuntimeSqliteValue[]): unknown;
6
- all(...parameters: AgentRuntimeSqliteValue[]): readonly unknown[];
7
- run(...parameters: AgentRuntimeSqliteValue[]): {
8
- changes: number;
9
- };
10
- }
11
- /** Minimal synchronous SQLite boundary implemented by the Bun and Node leaf entrypoints. */
12
- export interface AgentRuntimeSqliteDatabase {
13
- exec(sql: string): void;
14
- prepare(sql: string): AgentRuntimeSqliteStatement;
15
- close(): void;
16
- }
4
+ export type { SqliteDatabase, SqliteStatement, SqliteValue } from '../internal/sqlite.js';
17
5
  export interface SqliteAgentRuntimeStoreConfig {
18
- database: AgentRuntimeSqliteDatabase;
6
+ database: SqliteDatabase;
19
7
  /** Create or validate Stitchkit's namespaced schema. Default true. */
20
8
  initialize?: boolean;
21
9
  }
22
10
  export interface SqliteAgentRuntimeStore {
23
- store: ReturnType<typeof createAgentRuntimeStore<AgentRuntimeSqliteDatabase>>;
11
+ store: ReturnType<typeof createAgentRuntimeStore<SqliteDatabase>>;
24
12
  conversations: AgentConversationReader;
25
13
  /** Refuse new work, wait for queued operations, then close the owned connection. */
26
14
  close(): Promise<void>;
@@ -29,6 +17,6 @@ export interface SqliteAgentRuntimeStore {
29
17
  * Create Stitchkit's schema without claiming an application's tables or SQLite user_version.
30
18
  * An orphaned partial Stitchkit schema is refused rather than destructively repaired.
31
19
  */
32
- export declare function initializeAgentRuntimeSqlite(database: AgentRuntimeSqliteDatabase): void;
20
+ export declare function initializeAgentRuntimeSqlite(database: SqliteDatabase): void;
33
21
  export declare function createSqliteAgentRuntimeStore(config: SqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
34
22
  //# sourceMappingURL=sqlite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAML,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,aAAa,EAAE,uBAAuB,CAAC;IACvC,oFAAoF;IACpF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAqGD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,CAwFvF;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,6BAA6B,GACpC,uBAAuB,CA0azB"}
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAML,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEvF,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,cAAc,CAAC;IACzB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,cAAc,CAAC,CAAC,CAAC;IAClE,aAAa,EAAE,uBAAuB,CAAC;IACvC,oFAAoF;IACpF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAqGD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAwF3E;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,6BAA6B,GACpC,uBAAuB,CA0azB"}
@@ -16,7 +16,8 @@ import {
16
16
  } from "./index-wwst0td5.js";
17
17
  import"./index-22by16v6.js";
18
18
  import"./index-cby4ar3v.js";
19
- import"./index-vj3vvpaa.js";
19
+ import"./index-hsz2mmk0.js";
20
+ import"./index-rxfy4cq7.js";
20
21
  import {
21
22
  AppError,
22
23
  conflict,
@@ -3,7 +3,7 @@ import {
3
3
  composeAgentPrompt,
4
4
  createAgentRuntime,
5
5
  createAgentRuntimeEventSink
6
- } from "./index-m668wzyc.js";
6
+ } from "./index-v7xjfy10.js";
7
7
  import {
8
8
  walkContainedFiles
9
9
  } from "./index-rqpdar1e.js";
@@ -16,8 +16,8 @@ import"./index-3xnq72rz.js";
16
16
  import {
17
17
  defineRuntimeTool
18
18
  } from "./index-wwst0td5.js";
19
- import"./index-s4c8wy8m.js";
20
- import"./index-nemjkxjp.js";
19
+ import"./index-k68e5jz0.js";
20
+ import"./index-e0a57ymn.js";
21
21
  import {
22
22
  AgentMessagePartSchema,
23
23
  AgentSnapshotSchema
@@ -25,7 +25,8 @@ import {
25
25
  import"./index-22by16v6.js";
26
26
  import"./index-cby4ar3v.js";
27
27
  import"./index-nt1mp8km.js";
28
- import"./index-vj3vvpaa.js";
28
+ import"./index-hsz2mmk0.js";
29
+ import"./index-rxfy4cq7.js";
29
30
  import"./index-0w9abg87.js";
30
31
  import"./index-qyrqwr4c.js";
31
32
  import"./index-6k1937bx.js";
@@ -6,6 +6,6 @@ export interface BunSqliteAgentRuntimeStoreConfig {
6
6
  }
7
7
  /** Bun `bun:sqlite` binding with non-blocking lock refusal on same-thread contention. */
8
8
  export declare function createBunSqliteAgentRuntimeStore(config: BunSqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
9
- export type { AgentRuntimeSqliteDatabase, AgentRuntimeSqliteStatement, AgentRuntimeSqliteValue, SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, } from './agent-runtime/sqlite.js';
9
+ export type { SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, SqliteDatabase, SqliteStatement, SqliteValue, } from './agent-runtime/sqlite.js';
10
10
  export { createSqliteAgentRuntimeStore, initializeAgentRuntimeSqlite, } from './agent-runtime/sqlite.js';
11
11
  //# sourceMappingURL=agent-runtime-sqlite-bun.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"agent-runtime-sqlite-bun.d.ts","sourceRoot":"","sources":["../src/agent-runtime-sqlite-bun.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAG7B,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,uBAAuB,EACvB,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
@@ -6,6 +6,6 @@ export interface NodeSqliteAgentRuntimeStoreConfig {
6
6
  }
7
7
  /** Node built-in `node:sqlite` binding with non-blocking lock refusal on contention. */
8
8
  export declare function createNodeSqliteAgentRuntimeStore(config: NodeSqliteAgentRuntimeStoreConfig): SqliteAgentRuntimeStore;
9
- export type { AgentRuntimeSqliteDatabase, AgentRuntimeSqliteStatement, AgentRuntimeSqliteValue, SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, } from './agent-runtime/sqlite.js';
9
+ export type { SqliteAgentRuntimeStore, SqliteAgentRuntimeStoreConfig, SqliteDatabase, SqliteStatement, SqliteValue, } from './agent-runtime/sqlite.js';
10
10
  export { createSqliteAgentRuntimeStore, initializeAgentRuntimeSqlite, } from './agent-runtime/sqlite.js';
11
11
  //# sourceMappingURL=agent-runtime-sqlite-node.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"agent-runtime-sqlite-node.d.ts","sourceRoot":"","sources":["../src/agent-runtime-sqlite-node.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAG7B,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,uBAAuB,EACvB,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
@@ -27,7 +27,7 @@ import {
27
27
  registerDeferredToolRepair,
28
28
  repairedSearchCall,
29
29
  selectAgentHistory
30
- } from "./index-m668wzyc.js";
30
+ } from "./index-v7xjfy10.js";
31
31
  import {
32
32
  AgentModelCapabilitySchema,
33
33
  AgentModelCatalogEntrySchema,
@@ -86,15 +86,15 @@ import {
86
86
  import {
87
87
  buildToolManifest,
88
88
  mountAgent
89
- } from "./index-ezmn6ac6.js";
89
+ } from "./index-xgahrwdf.js";
90
90
  import"./index-3xnq72rz.js";
91
- import"./index-k2zczx1g.js";
91
+ import"./index-9c5dbr5q.js";
92
92
  import {
93
93
  defineRuntimeTool
94
94
  } from "./index-wwst0td5.js";
95
- import"./index-7qy2ex0m.js";
96
- import"./index-s4c8wy8m.js";
97
- import"./index-nemjkxjp.js";
95
+ import"./index-885chjxq.js";
96
+ import"./index-k68e5jz0.js";
97
+ import"./index-e0a57ymn.js";
98
98
  import {
99
99
  AgentAssistantPlaceholderSchema,
100
100
  AgentControlPartSchema,
@@ -134,7 +134,8 @@ import {
134
134
  childSpan,
135
135
  createTraceContext
136
136
  } from "./index-nt1mp8km.js";
137
- import"./index-vj3vvpaa.js";
137
+ import"./index-hsz2mmk0.js";
138
+ import"./index-rxfy4cq7.js";
138
139
  import"./index-0w9abg87.js";
139
140
  import {
140
141
  executableAgentRuntimeTools,
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A SQLite backend for a keyspace: one table, a key and a JSON payload.
3
+ *
4
+ * Typed against the minimal `exec`/`prepare`/`close` boundary the framework
5
+ * already uses, which `bun:sqlite`'s `Database` and a thin `node:sqlite` wrapper
6
+ * both satisfy structurally — so the caller passes the handle it already has and
7
+ * adopts no driver of ours.
8
+ */
9
+ import type { SqliteDatabase } from '../internal/sqlite.js';
10
+ import type { KeyspaceBackend, KeyspaceDeclaration } from './keyspace.js';
11
+ export interface SqliteKeyspaceBackendConfig {
12
+ readonly database: SqliteDatabase;
13
+ /**
14
+ * The table to use. Defaults to `stitchkit_keyspace_<name>`.
15
+ *
16
+ * Must be a bare identifier — letters, digits and underscore. A table name
17
+ * reaches SQLite as text inside DDL that no placeholder can carry, so this is
18
+ * the one string here that cannot be parameterised, and an unchecked one would
19
+ * make a keyspace name an injection point.
20
+ */
21
+ readonly table?: string;
22
+ /**
23
+ * Create the table when it is missing. Default true.
24
+ *
25
+ * Turn it off where migrations are owned elsewhere — then a missing table is
26
+ * that owner's failure to hear about, not something this backend papers over.
27
+ */
28
+ readonly initialize?: boolean;
29
+ }
30
+ export declare function sqliteKeyspaceBackend<TValue>(declaration: KeyspaceDeclaration<TValue>, config: SqliteKeyspaceBackendConfig): KeyspaceBackend;
31
+ //# sourceMappingURL=keyspace-sqlite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyspace-sqlite.d.ts","sourceRoot":"","sources":["../../src/application/keyspace-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAC1C,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC,EACxC,MAAM,EAAE,2BAA2B,GAClC,eAAe,CA2CjB"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * A keyspace: authoritative memory in front of a durable backend.
3
+ *
4
+ * The shape an application writes by hand the second time it needs a cache it
5
+ * can trust — declared once with a schema and a key, read synchronously from
6
+ * memory, written through one serialised chain to a backend, and announced only
7
+ * after the backend said yes. Written twice in one process it is two subtly
8
+ * different orderings; written a third time it is a defect nobody can see,
9
+ * because a cache that is *usually* right looks exactly like one that is right.
10
+ *
11
+ * ## The order, and why it is that order
12
+ *
13
+ * `put` reaches the backend first and memory second. That costs a round trip on
14
+ * every write and buys the one property that makes the memory authoritative: a
15
+ * reader can never observe a value that did not survive. The reverse order —
16
+ * memory first, backend after — makes writes feel instant and makes every
17
+ * rejected write a lie already read by somebody.
18
+ *
19
+ * The change event is last, after memory. A subscriber woken by it and reading
20
+ * immediately must find the new value, and an event emitted before the memory
21
+ * update is a wake-up to the old one.
22
+ *
23
+ * ## What "durable" means here, exactly
24
+ *
25
+ * It means *the backend's `put` resolved*. It does not mean `fsync`, and this
26
+ * boundary cannot make it mean that: with SQLite in WAL mode and
27
+ * `synchronous = NORMAL` a successful write has not necessarily reached the
28
+ * disk. What the backend's acknowledgement is worth is the backend's to state —
29
+ * and the owner's to configure. Saying "durable" without saying whose durability
30
+ * would be the more comfortable lie.
31
+ *
32
+ * ## It is a resource, not a global
33
+ *
34
+ * A keyspace is opened as a {@link ManagedResource} and its handle is read with
35
+ * `context.use(...)`. That is not ceremony: the application kernel resolves its
36
+ * resource graph in the constructor and has no way to register one later, so a
37
+ * keyspace opened by a bare function call inside another resource's `start`
38
+ * would never be drained, closed, or ordered against its writers. Declared as a
39
+ * resource it closes after everything that writes to it, because a writer that
40
+ * depends on it is stopped first.
41
+ *
42
+ * → ADR 0152.
43
+ */
44
+ import type { z } from 'zod';
45
+ import type { ManagedResource } from './resource.js';
46
+ export interface KeyspaceDeclaration<TValue> {
47
+ readonly name: string;
48
+ readonly schema: z.ZodType<TValue>;
49
+ /** The key of a value. Must be pure and stable — it is the identity of a record. */
50
+ readonly key: (value: TValue) => string;
51
+ }
52
+ /**
53
+ * Where a keyspace's records survive a restart.
54
+ *
55
+ * Deliberately not a SQL boundary. A keyspace needs durability and nothing else,
56
+ * and typing it against statements would make SQLite the only backend anyone
57
+ * could actually write — everyone else would be forging a `prepare()`. Four
58
+ * methods, all of them things a file, a table, a bucket or a remote store can
59
+ * answer.
60
+ */
61
+ export interface KeyspaceBackend {
62
+ /** Every stored record. Called once, at start. */
63
+ load(): Promise<readonly unknown[]>;
64
+ /** Store one record under its key. Resolving means stored. */
65
+ put(key: string, value: unknown): Promise<void>;
66
+ /** Remove one key. Removing a key that is not there is not an error. */
67
+ delete(key: string): Promise<void>;
68
+ /** Release whatever the backend owns. The keyspace calls it once, on close. */
69
+ close?(): Promise<void>;
70
+ }
71
+ export interface OpenKeyspace<TValue> {
72
+ /** From memory, synchronously. Never a promise, never a read-through. */
73
+ get(key: string): TValue | undefined;
74
+ /** Every record, from memory, in insertion order. */
75
+ list(): readonly TValue[];
76
+ readonly size: number;
77
+ /**
78
+ * Store a record: backend first, then memory, then the change event.
79
+ *
80
+ * Rejects with the backend's own error when the backend refuses — and memory
81
+ * is unchanged, so a caller that ignores the rejection reads the previous
82
+ * value rather than one that was never stored.
83
+ */
84
+ put(value: TValue): Promise<void>;
85
+ delete(key: string): Promise<void>;
86
+ /** Writes accepted and not yet durable. A number, so shutdown can report it. */
87
+ pendingWrites(): number;
88
+ }
89
+ export interface KeyspaceChange<TValue> {
90
+ readonly keyspace: string;
91
+ readonly key: string;
92
+ /** Absent on a delete. */
93
+ readonly value?: TValue;
94
+ readonly change: 'put' | 'delete';
95
+ }
96
+ export interface KeyspaceResourceConfig<TValue> {
97
+ readonly backend: KeyspaceBackend;
98
+ /**
99
+ * Called after a change is durable **and** visible in memory.
100
+ *
101
+ * Wire it to `createEventBus(...).emit` on a topic declared with
102
+ * `defineEvents`, and a watched read invalidates on it. Kept a callback rather
103
+ * than a bus dependency so a keyspace is usable without one.
104
+ */
105
+ readonly onChanged?: (change: KeyspaceChange<TValue>) => void;
106
+ /**
107
+ * The most writes that may be waiting for the backend at once.
108
+ *
109
+ * Reached, `put` rejects instead of queueing: an unbounded write queue turns a
110
+ * slow backend into memory exhaustion, and the caller finds out only when the
111
+ * process dies. Default 1024.
112
+ */
113
+ readonly maxPendingWrites?: number;
114
+ /**
115
+ * Called when the keyspace closes with writes still queued, with how many.
116
+ *
117
+ * Shutdown is deadline-bounded and a forced close can cut a drain short. The
118
+ * number is the honest report; silence here would be a keyspace that lost
119
+ * records and said nothing.
120
+ */
121
+ readonly onUnwritten?: (count: number) => void;
122
+ /** Resource id. Defaults to `keyspace:<name>`. */
123
+ readonly id?: string;
124
+ readonly dependsOn?: ManagedResource['dependsOn'];
125
+ }
126
+ export declare function defineKeyspace<TValue>(name: string, declaration: {
127
+ schema: z.ZodType<TValue>;
128
+ key: (value: TValue) => string;
129
+ }): KeyspaceDeclaration<TValue>;
130
+ /**
131
+ * A keyspace as a managed resource. Its `start` publishes the {@link OpenKeyspace}.
132
+ */
133
+ export declare function keyspaceResource<TValue>(declaration: KeyspaceDeclaration<TValue>, config: KeyspaceResourceConfig<TValue>): ManagedResource;
134
+ /**
135
+ * A backend that keeps records in this process only.
136
+ *
137
+ * For tests and for a keyspace whose contents are genuinely disposable. It is
138
+ * the honest version of "no backend yet": everything a durable backend does,
139
+ * except survive.
140
+ */
141
+ export declare function memoryKeyspaceBackend(): KeyspaceBackend;
142
+ //# sourceMappingURL=keyspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyspace.d.ts","sourceRoot":"","sources":["../../src/application/keyspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAA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AC,GAAG,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,QAAQ,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB,CAAC,MAAM;IAC5C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC9D;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACnD;AAED,wBAAgB,cAAc,CAAC,MAAM,EACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE;IAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,GACzE,mBAAmB,CAAC,MAAM,CAAC,CAK7B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EACrC,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC,EACxC,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,GACrC,eAAe,CAsGjB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAWvD"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The server half of a watched read: one read per question, however many are asking.
3
+ *
4
+ * Eight panels showing the same conversation are eight subscribers and one read.
5
+ * That is the whole point of the hub, and it is also the only thing here that a
6
+ * caller cannot build correctly by accident — the rest (re-read on an event,
7
+ * publish only what changed, back off on failure) is easy to write and easy to
8
+ * write subtly wrong.
9
+ *
10
+ * ## Single-flight, plus a dirty bit
11
+ *
12
+ * A key has at most **one** read in flight. An invalidation that arrives while a
13
+ * read is running does not start a second one; it marks the key dirty, and the
14
+ * loop reads again when the first finishes.
15
+ *
16
+ * This is not only cheaper, it is what makes the answer ordered. Two overlapping
17
+ * reads can finish in either order, and the slow one carries the older world: a
18
+ * hub that published both would leave the *older* value standing as current,
19
+ * with the state still `live`, the value plausible, and nothing to alert anyone
20
+ * — until an unrelated invalidation happened to fix it. Serialising per key
21
+ * removes the race rather than detecting it.
22
+ *
23
+ * The revision on the wire is the version of the value, and a client drops a
24
+ * frame no newer than what it holds. Belt beside braces: ordering is already
25
+ * guaranteed here, and the revision keeps the guarantee legible at the other end.
26
+ *
27
+ * ## What it does not know
28
+ *
29
+ * How to perform a read. The application supplies `read`, because the hub
30
+ * calling handlers itself would be a second dispatch path — one that skips the
31
+ * auth gate the first one has. And which operations may be watched: that is a
32
+ * predicate over the operation's identity, supplied by the caller, not a field
33
+ * in `meta` (the core attaches no meaning to `meta` — ADR 0002/0021).
34
+ *
35
+ * One source per process. Two processes behind a balancer are two reads, and no
36
+ * test in this repository can show otherwise.
37
+ *
38
+ * → ADR 0153.
39
+ */
40
+ import { type BackoffPolicy } from '../browser/resumable.js';
41
+ import { type WatchKey, type WatchStateFrame, type WatchValueFrame } from '../live/watch-contract.js';
42
+ import type { StitchLogger } from '../logger.js';
43
+ /** The operation a watched read runs — `OperationIdentity`'s two stable halves. */
44
+ export interface WatchOperation {
45
+ readonly service: string;
46
+ readonly action: string;
47
+ }
48
+ export interface WatchSubscriber {
49
+ /** A new value for a key this subscriber is watching. */
50
+ value(frame: WatchValueFrame): void;
51
+ /** A change in what the hub can say about a key. */
52
+ state(frame: WatchStateFrame): void;
53
+ }
54
+ export interface AttachedWatcher {
55
+ open(key: WatchKey, args: unknown): {
56
+ accepted: boolean;
57
+ reason?: string;
58
+ };
59
+ close(key: WatchKey): void;
60
+ /** The connection went away. Releases every key this subscriber held. */
61
+ detach(): void;
62
+ }
63
+ export interface WatchHubConfig {
64
+ /**
65
+ * Perform one read. Supplied by the application, so a watched read goes
66
+ * through the same authorization as the request it mirrors.
67
+ *
68
+ * **It is given no subscriber, and that is the guard, not an omission.** A key
69
+ * shares one read across everyone asking it, so a key that did not separate
70
+ * callers would hand one caller's answer to another. Here it cannot: an answer
71
+ * that depends on who is asking has to carry the asker in `args`, and `args`
72
+ * are what the key's digest is taken over — so two callers who differ get two
73
+ * keys and two reads, by construction rather than by discipline.
74
+ *
75
+ * The one way to defeat that is to resolve an identity from ambient state
76
+ * *inside* this function — a request-scoped context, a module-level "current
77
+ * user". Then every subscriber to that key receives whatever the first read
78
+ * happened to resolve. Do not; put the identity in the arguments.
79
+ */
80
+ read(operation: WatchOperation, args: unknown): Promise<unknown>;
81
+ /** Whether an operation may be watched at all. Refusal is answered in words. */
82
+ watchable(operation: WatchOperation): boolean;
83
+ /** The topics whose announcement means this operation's answer may have changed. */
84
+ invalidatedBy(operation: WatchOperation): readonly string[];
85
+ /** Subscribe to a topic; returns the unsubscribe. Normally an event bus's `on`. */
86
+ subscribe(topic: string, listener: () => void): () => void;
87
+ /** The most keys one subscriber may watch at once. Default 64. */
88
+ maxWatchesPerSubscriber?: number;
89
+ /**
90
+ * How long a key survives its last subscriber, in milliseconds. Default 0.
91
+ *
92
+ * A page that navigates away and back within the window finds the value still
93
+ * warm and reads nothing. Longer means more memory held for readers who may
94
+ * not return.
95
+ */
96
+ holdMs?: number;
97
+ /** Retry pacing after a failed read. */
98
+ backoff?: BackoffPolicy;
99
+ /** Whether two answers are the same. Defaults to key-order-independent JSON equality. */
100
+ same?(previous: unknown, next: unknown): boolean;
101
+ logger?: StitchLogger;
102
+ }
103
+ export interface WatchHub {
104
+ attach(subscriber: WatchSubscriber): AttachedWatcher;
105
+ /**
106
+ * How many reads have actually been performed.
107
+ *
108
+ * Exposed because "two browsers, one read" is only a claim until something
109
+ * counts — and a counter that can only ever go up by one is not a measurement
110
+ * either, which is why the tests also exercise a case that must count two.
111
+ */
112
+ readCount(): number;
113
+ /** Keys currently held, including those inside their hold window. */
114
+ size(): number;
115
+ close(): void;
116
+ }
117
+ /**
118
+ * The identity of a watched read, as the client and the hub both compute it.
119
+ *
120
+ * Exported because the client has to produce exactly this, and two
121
+ * implementations of one key is the failure the digest exists to prevent.
122
+ */
123
+ export declare function watchKey(operation: WatchOperation, args: unknown): Promise<WatchKey>;
124
+ export declare function createWatchHub(config: WatchHubConfig): WatchHub;
125
+ //# sourceMappingURL=watch-hub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-hub.d.ts","sourceRoot":"","sources":["../../src/application/watch-hub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,oDAAoD;IACpD,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,GAAG;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,E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/D"}
@@ -6,9 +6,13 @@ export { type DiagnosticJournal, type DiagnosticJournalCloseResult, DiagnosticJo
6
6
  export { type ApplicationEventSink, type ApplicationEventSinkConfig, type ApplicationLifecycleEvent, ApplicationLifecycleEventSchema, applicationLifecycleEvent, createApplicationEventSink, } from './application/events.js';
7
7
  export { type ApplicationHealthHandlerOptions, ApplicationHealthHandlerOptionsSchema, type ApplicationOperationalHandlers, type ApplicationOperationalHandlersOptions, ApplicationOperationalHandlersOptionsSchema, createApplicationHealthHandler, createApplicationOperationalHandlers, } from './application/health.js';
8
8
  export { type ApplicationAdmission, ApplicationAdmissionError, type ApplicationConfig, type ApplicationHandle, type ApplicationOperationLease, type ApplicationResourceFailure, type ApplicationResourcePhase, type ApplicationShutdownBudget, ApplicationShutdownBudgetSchema, type ApplicationShutdownOptions, ApplicationShutdownOptionsSchema, createApplication, } from './application/kernel.js';
9
+ export { defineKeyspace, type KeyspaceBackend, type KeyspaceChange, type KeyspaceDeclaration, type KeyspaceResourceConfig, keyspaceResource, memoryKeyspaceBackend, type OpenKeyspace, } from './application/keyspace.js';
10
+ export { type SqliteKeyspaceBackendConfig, sqliteKeyspaceBackend, } from './application/keyspace-sqlite.js';
9
11
  export { type ApplicationSnapshotSink, type ApplicationSnapshotSinkConfig, type ApplicationSnapshotSinkError, type ApplicationSnapshotSinkStatus, ApplicationSnapshotSinkStatusSchema, createApplicationSnapshotSink, type RevisionedApplicationSnapshot, } from './application/latest-sink.js';
10
12
  export { defineManagedResource, type ManagedResource, type ManagedResourceContext, type ManagedResourceDependency, type ManagedResourcePublished, type ManagedResourcePublishesNoValue, type ManagedResourceStartResult, managedResourceDependencyId, } from './application/resource.js';
11
13
  export { createManagedSchedule, type ManagedSchedule, type ManagedScheduleClock, type ManagedScheduleConfig, type ManagedScheduleDescriptor, ManagedScheduleDescriptorSchema, type ManagedScheduleErrorPolicy, ManagedScheduleErrorPolicySchema, type ManagedScheduleOverlap, ManagedScheduleOverlapSchema, type ManagedScheduleRunContext, type ManagedScheduleStatus, ManagedScheduleStatusSchema, type ManagedScheduleTimer, } from './application/schedule.js';
12
14
  export { type ApplicationAdmissionSnapshot, ApplicationAdmissionSnapshotSchema, type ApplicationHealth, ApplicationHealthSchema, type ApplicationId, ApplicationIdSchema, type ApplicationLifecycle, ApplicationLifecycleSchema, type ApplicationResourceShutdown, ApplicationResourceShutdownSchema, type ApplicationShutdownResult, ApplicationShutdownResultSchema, type ApplicationSnapshot, ApplicationSnapshotSchema, type ApplicationStatusProjection, ApplicationStatusProjectionSchema, type ManagedResourceSnapshot, ManagedResourceSnapshotSchema, type ManagedResourceState, ManagedResourceStateSchema, projectApplicationStatus, } from './application/schemas.js';
13
15
  export { type ManagedServerResource, type ManagedServerResourceConfig, managedServerResource, } from './application/server-resource.js';
16
+ export { type AttachedWatcher, createWatchHub, type WatchHub, type WatchHubConfig, type WatchOperation, type WatchSubscriber, watchKey, } from './application/watch-hub.js';
17
+ export type { SqliteDatabase, SqliteStatement, SqliteValue } from './internal/sqlite.js';
14
18
  //# sourceMappingURL=application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,aAAa,EAClB,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,2BAA2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9B,+BAA+B,EAC/B,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,4BAA4B,EACjC,kCAAkC,EAClC,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,KAAK,yBAAyB,EAC9B,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,qBAAqB,GACtB,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACtC,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,aAAa,EAClB,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,2BAA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