@econ-v1/app-sdk 6.9.2 → 6.9.4

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/dist/index.d.ts CHANGED
@@ -29,7 +29,17 @@
29
29
  * runNodeApp(new MyApp());
30
30
  * ```
31
31
  */
32
+ import { Database } from "bun:sqlite";
32
33
  export { initAppTelemetry, telemetryActive, incrementCounter } from "./otel.js";
34
+ /**
35
+ * Open an app-owned SQLite database with a bounded page cache.
36
+ *
37
+ * Bun does not expose SQLite's live cache-use counter, so this is explicitly
38
+ * a configured upper bound rather than a fabricated memory measurement.
39
+ */
40
+ export declare function openDatabase(path: string, options?: {
41
+ cacheSizeKb?: number;
42
+ }): Database;
33
43
  interface NodeAppCtx {
34
44
  socket: string | undefined;
35
45
  logDir: string | undefined;
@@ -114,6 +124,18 @@ export interface ProvidedCapability {
114
124
  priority?: number;
115
125
  examples?: CapabilityExample[];
116
126
  }
127
+ export interface HeapSnapshotRequest {
128
+ type: "heap_snapshot_request";
129
+ id: string;
130
+ path: string;
131
+ }
132
+ export interface HeapSnapshotResponse {
133
+ type: "heap_snapshot_response";
134
+ id: string;
135
+ success: boolean;
136
+ error?: string;
137
+ size_bytes?: number;
138
+ }
117
139
  /**
118
140
  * Host interaction helper for logging from within app code.
119
141
  * Logs are written to files for persistence and sent via IPC for real-time streaming.
@@ -143,6 +165,20 @@ export declare function invokeCapability(request: CapabilityRequest, timeoutMs?:
143
165
  * This is a fire-and-forget operation — no response is returned.
144
166
  */
145
167
  export declare function publishEvent(eventName: string, data: unknown): void;
168
+ export interface AppMemorySample {
169
+ heap_used_kb: number;
170
+ heap_total_kb: number;
171
+ external_kb?: number;
172
+ heap_capacity_kb?: number;
173
+ }
174
+ /** @internal Exact isolate sample used by the IPC timer and unit tests. */
175
+ export declare function _sampleMemory(): AppMemorySample;
176
+ export declare function _captureHeapSnapshotTo(path: string, generate?: () => ArrayBuffer, write?: (path: string, bytes: ArrayBuffer) => Promise<number>): Promise<{
177
+ size_bytes: number;
178
+ }>;
179
+ export declare function _handleHeapSnapshotRequest(request: HeapSnapshotRequest, send: (message: HeapSnapshotResponse) => void, capture?: (path: string) => Promise<{
180
+ size_bytes: number;
181
+ }>): Promise<void>;
146
182
  interface RoutePolicy {
147
183
  /** All listed permissions must be present in request.caller.granted_permissions */
148
184
  requiredPermissions?: string[];