@jini-ai/daemon 0.3.7 → 0.5.0
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/CHANGELOG.md +119 -0
- package/README.md +50 -8
- package/dist/agent-executor/contracts.d.ts +736 -0
- package/dist/agent-executor/contracts.js +28 -0
- package/dist/agent-executor/event-translation.d.ts +87 -0
- package/dist/agent-executor/event-translation.js +230 -0
- package/dist/agent-executor/events.d.ts +190 -0
- package/dist/agent-executor/events.js +848 -0
- package/dist/agent-executor/handoff.d.ts +18 -0
- package/dist/agent-executor/handoff.js +16 -0
- package/dist/agent-executor/index.d.ts +98 -0
- package/dist/agent-executor/index.js +98 -0
- package/dist/agent-executor/launch.d.ts +375 -0
- package/dist/agent-executor/launch.js +1001 -0
- package/dist/agent-executor/mcp-bridge.d.ts +338 -0
- package/dist/agent-executor/mcp-bridge.js +835 -0
- package/dist/agent-executor/values.d.ts +5 -0
- package/dist/agent-executor/values.js +13 -0
- package/dist/agent-executor.d.ts +382 -177
- package/dist/agent-executor.js +408 -344
- package/dist/close-status.d.ts +11 -8
- package/dist/close-status.js +31 -19
- package/dist/continuation/continuation-transport.d.ts +3 -1
- package/dist/continuation/continuation-transport.js +1 -1
- package/dist/continuation/journal.d.ts +12 -5
- package/dist/continuation/journal.js +4 -4
- package/dist/continuation/run-scoped-context-store.d.ts +13 -4
- package/dist/continuation/run-scoped-context-store.js +6 -6
- package/dist/continuation/run-start-handler.d.ts +1 -1
- package/dist/continuation/run-start-handler.js +3 -16
- package/dist/delegated-tool-bridge.d.ts +7 -3
- package/dist/delegated-tool-bridge.js +32 -31
- package/dist/event-log.d.ts +7 -5
- package/dist/event-log.js +12 -11
- package/dist/frontend-capability-tools.d.ts +1 -1
- package/dist/frontend-capability-tools.js +3 -2
- package/dist/frontend-session-registry.d.ts +32 -9
- package/dist/frontend-session-registry.js +12 -11
- package/dist/http/active-context.d.ts +105 -0
- package/dist/http/active-context.js +67 -0
- package/dist/http/agents.d.ts +68 -0
- package/dist/http/agents.js +12 -0
- package/dist/http/attachments.d.ts +618 -0
- package/dist/http/attachments.js +1034 -0
- package/dist/http/cancel-owned-runs.d.ts +49 -0
- package/dist/http/cancel-owned-runs.js +35 -0
- package/dist/http/component-catalog.d.ts +84 -0
- package/dist/http/component-catalog.js +64 -0
- package/dist/http/connectors.d.ts +209 -0
- package/dist/http/connectors.js +409 -0
- package/dist/http/daemon-status.d.ts +76 -0
- package/dist/http/daemon-status.js +55 -0
- package/dist/http/db-ops.d.ts +123 -0
- package/dist/http/db-ops.js +189 -0
- package/dist/http/delegated-tools.d.ts +113 -0
- package/dist/http/delegated-tools.js +230 -0
- package/dist/http/frontend-control.d.ts +136 -0
- package/dist/http/frontend-control.js +79 -0
- package/dist/http/frontend-sessions.d.ts +110 -0
- package/dist/http/frontend-sessions.js +180 -0
- package/dist/http/health.d.ts +95 -0
- package/dist/http/health.js +40 -0
- package/dist/http/host-tools.d.ts +214 -0
- package/dist/http/host-tools.js +329 -0
- package/dist/http/index.d.ts +52 -0
- package/dist/http/index.js +27 -0
- package/dist/http/media.d.ts +146 -0
- package/dist/http/media.js +346 -0
- package/dist/http/memory.d.ts +265 -0
- package/dist/http/memory.js +328 -0
- package/dist/http/model-proxy.d.ts +49 -0
- package/dist/http/model-proxy.js +642 -0
- package/dist/http/remote-run-events.d.ts +70 -0
- package/dist/http/remote-run-events.js +224 -0
- package/dist/http/research.d.ts +48 -0
- package/dist/http/research.js +315 -0
- package/dist/http/route-manifest.d.ts +35 -0
- package/dist/http/route-manifest.js +103 -0
- package/dist/http/routines.d.ts +120 -0
- package/dist/http/routines.js +298 -0
- package/dist/http/run-credentials.d.ts +73 -0
- package/dist/http/run-credentials.js +71 -0
- package/dist/http/runs.d.ts +91 -0
- package/dist/http/runs.js +221 -0
- package/dist/http/terminals.d.ts +138 -0
- package/dist/http/terminals.js +325 -0
- package/dist/http/tool-catalog.d.ts +78 -0
- package/dist/http/tool-catalog.js +66 -0
- package/dist/http/workspace-root.d.ts +77 -0
- package/dist/http/workspace-root.js +63 -0
- package/dist/http/xai.d.ts +90 -0
- package/dist/http/xai.js +655 -0
- package/dist/image-prompt-delivery.d.ts +13 -3
- package/dist/image-prompt-delivery.js +5 -5
- package/dist/index.d.ts +556 -4
- package/dist/index.js +556 -4
- package/dist/legacy-data-migration.d.ts +59 -8
- package/dist/legacy-data-migration.js +38 -33
- package/dist/read-only-tools.d.ts +130 -0
- package/dist/read-only-tools.js +115 -0
- package/dist/remote-tool-bridge.d.ts +11 -5
- package/dist/remote-tool-bridge.js +15 -15
- package/dist/routines/index.d.ts +1 -1
- package/dist/routines/index.js +1 -1
- package/dist/routines/routine-store.d.ts +34 -12
- package/dist/routines/routine-store.js +21 -20
- package/dist/routines/schedule.d.ts +48 -10
- package/dist/routines/schedule.js +21 -21
- package/dist/routines/scheduler.d.ts +32 -11
- package/dist/routines/scheduler.js +61 -57
- package/dist/routines/types.d.ts +10 -3
- package/dist/run/core/result.d.ts +6 -2
- package/dist/run/core/result.js +3 -3
- package/dist/run/core/retry.d.ts +17 -4
- package/dist/run/core/retry.js +7 -11
- package/dist/run/diagnostics/diagnostics.d.ts +14 -4
- package/dist/run/diagnostics/diagnostics.js +7 -7
- package/dist/run/index.d.ts +1 -1
- package/dist/run/index.js +1 -1
- package/dist/run-credentials.d.ts +138 -0
- package/dist/run-credentials.js +152 -0
- package/dist/run-lifecycle.d.ts +92 -33
- package/dist/run-lifecycle.js +86 -73
- package/dist/scheduler.d.ts +8 -0
- package/dist/scheduler.js +2 -0
- package/dist/session-coordination.d.ts +115 -0
- package/dist/session-coordination.js +111 -0
- package/dist/store/agent-sessions/errors.d.ts +8 -0
- package/dist/store/agent-sessions/errors.js +10 -0
- package/dist/store/agent-sessions/index.d.ts +12 -0
- package/dist/store/agent-sessions/index.js +19 -0
- package/dist/store/agent-sessions/pglite.d.ts +12 -0
- package/dist/store/agent-sessions/pglite.js +7 -0
- package/dist/store/agent-sessions/ports.d.ts +24 -0
- package/dist/store/agent-sessions/ports.js +2 -0
- package/dist/store/agent-sessions/postgres.d.ts +12 -0
- package/dist/store/agent-sessions/postgres.js +7 -0
- package/dist/store/agent-sessions/schema.d.ts +3 -0
- package/dist/store/agent-sessions/schema.js +23 -0
- package/dist/store/agent-sessions/sql.d.ts +35 -0
- package/dist/store/agent-sessions/sql.js +59 -0
- package/dist/store/agent-sessions/sqlite.d.ts +117 -0
- package/dist/store/agent-sessions/sqlite.js +128 -0
- package/dist/store/event-log/sqlite.d.ts +75 -0
- package/dist/store/event-log/sqlite.js +230 -0
- package/dist/surface-exchanges.d.ts +97 -0
- package/dist/surface-exchanges.js +153 -0
- package/dist/terminal-session.d.ts +43 -11
- package/dist/terminal-session.js +22 -20
- package/dist/tokens.js +4 -4
- package/dist/tool-audit.d.ts +114 -0
- package/dist/tool-audit.js +95 -0
- package/dist/tool-executor.d.ts +22 -7
- package/dist/tool-executor.js +16 -16
- package/dist/tool-result-media.d.ts +3 -1
- package/dist/tool-result-media.js +1 -1
- package/dist/tool-result-surfaces.d.ts +3 -1
- package/dist/tool-result-surfaces.js +1 -1
- package/package.json +127 -9
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Stable boundary failure with the original driver failure retained as a cause. */
|
|
2
|
+
export declare class AgentSessionStoreError extends Error {
|
|
3
|
+
readonly code: 'invalid-input' | 'unavailable';
|
|
4
|
+
constructor({ code }: {
|
|
5
|
+
readonly code: 'invalid-input' | 'unavailable';
|
|
6
|
+
}, options?: ErrorOptions);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Stable boundary failure with the original driver failure retained as a cause. */
|
|
2
|
+
export class AgentSessionStoreError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor({ code }, options = {}) {
|
|
5
|
+
super(code === 'invalid-input' ? 'invalid agent session kernel' : 'agent session store unavailable', options);
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.name = 'AgentSessionStoreError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Neutral session-id port and reference adapter; never imports SQL or a driver. */
|
|
2
|
+
import type { AgentSessionStore } from './ports.js';
|
|
3
|
+
export type { AgentSessionStore } from './ports.js';
|
|
4
|
+
export { AgentSessionStoreError } from './errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Private in-memory mapping for opaque (conversation, agent) pairs.
|
|
7
|
+
* JSON pair encoding prevents delimiter collisions; overwrite/clear affect only that pair.
|
|
8
|
+
* @returns Independent store with asynchronous get/set/clear contracts.
|
|
9
|
+
* @complexity Each operation O(k) for encoding k identity characters, plus expected O(1) map access.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createInMemoryAgentSessionStore(_requiredArgs: Record<string, never>): AgentSessionStore;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { AgentSessionStoreError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Private in-memory mapping for opaque (conversation, agent) pairs.
|
|
4
|
+
* JSON pair encoding prevents delimiter collisions; overwrite/clear affect only that pair.
|
|
5
|
+
* @returns Independent store with asynchronous get/set/clear contracts.
|
|
6
|
+
* @complexity Each operation O(k) for encoding k identity characters, plus expected O(1) map access.
|
|
7
|
+
*/
|
|
8
|
+
export function createInMemoryAgentSessionStore(_requiredArgs) {
|
|
9
|
+
// This reference store owns no conversation foreign key, so test/lazy compositions need only
|
|
10
|
+
// a map; opening an in-memory SQL database and running DDL would add no invariant to enforce.
|
|
11
|
+
const sessions = new Map();
|
|
12
|
+
const key = (conversationId, agentId) => JSON.stringify([conversationId, agentId]);
|
|
13
|
+
return {
|
|
14
|
+
async getSessionId({ conversationId, agentId }) { return sessions.get(key(conversationId, agentId)) ?? null; },
|
|
15
|
+
async setSessionId({ conversationId, agentId, sessionId }) { sessions.set(key(conversationId, agentId), sessionId); },
|
|
16
|
+
async clearSessionId({ conversationId, agentId }) { sessions.delete(key(conversationId, agentId)); },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Clock } from '@jini-ai/core/primitives';
|
|
2
|
+
import type { StorageKernel } from '@jini-ai/db/kernel';
|
|
3
|
+
import type { AgentSessionStore } from './ports.js';
|
|
4
|
+
import { type AgentSessionDatabase } from './sql.js';
|
|
5
|
+
export type { AgentSessionDatabase } from './sql.js';
|
|
6
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
7
|
+
export declare function createPgliteAgentSessionStore<DB extends AgentSessionDatabase>(input: {
|
|
8
|
+
kernel: StorageKernel<DB>;
|
|
9
|
+
}, options?: {
|
|
10
|
+
clock?: Clock;
|
|
11
|
+
}): AgentSessionStore;
|
|
12
|
+
//# sourceMappingURL=pglite.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createSqlAgentSessionStore, validateSessionKernel } from './sql.js';
|
|
2
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
3
|
+
export function createPgliteAgentSessionStore(input, options = {}) {
|
|
4
|
+
validateSessionKernel({ kernel: input.kernel, dialect: 'postgres', transports: ['pglite', 'pglite-socket'] });
|
|
5
|
+
return createSqlAgentSessionStore({ kernel: input.kernel }, options);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=pglite.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Underlying CLI resume ids; distinct from rich legacy agent_sessions records. */
|
|
2
|
+
export interface AgentSessionStore {
|
|
3
|
+
/** A missing pair starts a fresh CLI session; do not attempt a resume without an id. */
|
|
4
|
+
getSessionId(args: {
|
|
5
|
+
readonly conversationId: string;
|
|
6
|
+
readonly agentId: string;
|
|
7
|
+
}): Promise<string | null>;
|
|
8
|
+
/** Each resumed turn can return a successor id, so overwrite the previous id rather than append. */
|
|
9
|
+
setSessionId(args: {
|
|
10
|
+
readonly conversationId: string;
|
|
11
|
+
readonly agentId: string;
|
|
12
|
+
readonly sessionId: string;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Clear when a resumed run ends without confirming a session id. Retaining a dead id would
|
|
16
|
+
* make every later turn repeat the same failed resume until someone repairs storage manually.
|
|
17
|
+
* Clearing an absent pair is a silent no-op, making repeated terminal-event handling safe.
|
|
18
|
+
*/
|
|
19
|
+
clearSessionId(args: {
|
|
20
|
+
readonly conversationId: string;
|
|
21
|
+
readonly agentId: string;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Clock } from '@jini-ai/core/primitives';
|
|
2
|
+
import type { StorageKernel } from '@jini-ai/db/kernel';
|
|
3
|
+
import type { AgentSessionStore } from './ports.js';
|
|
4
|
+
import { type AgentSessionDatabase } from './sql.js';
|
|
5
|
+
export type { AgentSessionDatabase } from './sql.js';
|
|
6
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
7
|
+
export declare function createPostgresAgentSessionStore<DB extends AgentSessionDatabase>(input: {
|
|
8
|
+
kernel: StorageKernel<DB>;
|
|
9
|
+
}, options?: {
|
|
10
|
+
clock?: Clock;
|
|
11
|
+
}): AgentSessionStore;
|
|
12
|
+
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createSqlAgentSessionStore, validateSessionKernel } from './sql.js';
|
|
2
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
3
|
+
export function createPostgresAgentSessionStore(input, options = {}) {
|
|
4
|
+
validateSessionKernel({ kernel: input.kernel, dialect: 'postgres', transports: ['node-postgres'] });
|
|
5
|
+
return createSqlAgentSessionStore({ kernel: input.kernel }, options);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=postgres.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Rich legacy resume-identity table, separate from assistant_agent_sessions. */
|
|
2
|
+
export declare const LEGACY_AGENT_SESSIONS_DDL = " CREATE TABLE IF NOT EXISTS agent_sessions (\n conversation_id TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n session_id TEXT NOT NULL,\n stable_prompt_hash TEXT,\n -- Resume identity guard: the session is only safe to resume when the\n -- conversation has not changed shape under it. model/cwd are the runtime\n -- identity the upstream session was created with; a change forces a fresh\n -- session. last_message_id is the assistant message this session produced\n -- on its last turn -- if it is no longer the latest completed assistant\n -- turn (another agent ran in between, or it was edited away), the session\n -- is behind and we reseed the full transcript.\n model TEXT,\n cwd TEXT,\n last_message_id TEXT,\n updated_at INTEGER NOT NULL,\n PRIMARY KEY (conversation_id, agent_id),\n FOREIGN KEY(conversation_id) REFERENCES conversations(id) ON DELETE CASCADE\n );\n\n";
|
|
3
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Rich legacy resume-identity table, separate from assistant_agent_sessions. */
|
|
2
|
+
export const LEGACY_AGENT_SESSIONS_DDL = ` CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3
|
+
conversation_id TEXT NOT NULL,
|
|
4
|
+
agent_id TEXT NOT NULL,
|
|
5
|
+
session_id TEXT NOT NULL,
|
|
6
|
+
stable_prompt_hash TEXT,
|
|
7
|
+
-- Resume identity guard: the session is only safe to resume when the
|
|
8
|
+
-- conversation has not changed shape under it. model/cwd are the runtime
|
|
9
|
+
-- identity the upstream session was created with; a change forces a fresh
|
|
10
|
+
-- session. last_message_id is the assistant message this session produced
|
|
11
|
+
-- on its last turn -- if it is no longer the latest completed assistant
|
|
12
|
+
-- turn (another agent ran in between, or it was edited away), the session
|
|
13
|
+
-- is behind and we reseed the full transcript.
|
|
14
|
+
model TEXT,
|
|
15
|
+
cwd TEXT,
|
|
16
|
+
last_message_id TEXT,
|
|
17
|
+
updated_at INTEGER NOT NULL,
|
|
18
|
+
PRIMARY KEY (conversation_id, agent_id),
|
|
19
|
+
FOREIGN KEY(conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** One simple-session query implementation over the host's borrowed, migrated kernel. */
|
|
2
|
+
import { type Clock } from '@jini-ai/core/primitives';
|
|
3
|
+
import type { ColumnType } from 'kysely';
|
|
4
|
+
import type { StorageKernel, StorageDialect, StorageTransport } from '@jini-ai/db/kernel';
|
|
5
|
+
import type { AgentSessionStore } from './ports.js';
|
|
6
|
+
/** Hosts can add tables; the adapter requires only this unchanged mapping table. */
|
|
7
|
+
export interface AgentSessionDatabase {
|
|
8
|
+
assistant_agent_sessions: {
|
|
9
|
+
conversation_id: string;
|
|
10
|
+
agent_id: string;
|
|
11
|
+
session_id: string;
|
|
12
|
+
updated_at: number | string | ColumnType<number | string, number, number>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Factory validation is pure; PGlite supports embedded and socket transports. */
|
|
16
|
+
export declare function validateSessionKernel<DB>({ kernel, dialect, transports }: {
|
|
17
|
+
readonly kernel: StorageKernel<DB>;
|
|
18
|
+
readonly dialect: StorageDialect;
|
|
19
|
+
readonly transports: readonly StorageTransport[];
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a three-method mapping with no migration, pragma, open, close, or query at construction.
|
|
23
|
+
* All queries join the host kernel's existing transaction; concurrent set is one atomic upsert.
|
|
24
|
+
* @param kernel Borrowed host kernel with assistant_agent_sessions already migrated.
|
|
25
|
+
* @param optional Core Clock, evaluated once per set; defaults to system wall time.
|
|
26
|
+
* @returns Session-id port; missing pairs read null and clear is idempotent.
|
|
27
|
+
* @throws AgentSessionStoreError when a driver/query fails.
|
|
28
|
+
* @complexity Each operation is one primary-key statement, O(log n) index lookup for n pairs.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createSqlAgentSessionStore<DB extends AgentSessionDatabase>({ kernel }: {
|
|
31
|
+
readonly kernel: StorageKernel<DB>;
|
|
32
|
+
}, { clock }?: {
|
|
33
|
+
readonly clock?: Clock;
|
|
34
|
+
}): AgentSessionStore;
|
|
35
|
+
//# sourceMappingURL=sql.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** One simple-session query implementation over the host's borrowed, migrated kernel. */
|
|
2
|
+
import { createSystemClock } from '@jini-ai/core/primitives';
|
|
3
|
+
import { AgentSessionStoreError } from './errors.js';
|
|
4
|
+
/** Factory validation is pure; PGlite supports embedded and socket transports. */
|
|
5
|
+
export function validateSessionKernel({ kernel, dialect, transports }) {
|
|
6
|
+
if (!kernel || kernel.dialect !== dialect || !transports.includes(kernel.transport))
|
|
7
|
+
throw new AgentSessionStoreError({ code: 'invalid-input' });
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The single table-subset projection preserves the original kernel's transaction context.
|
|
11
|
+
* DB's bound proves the required table; this erasure does not bridge separate Kysely versions.
|
|
12
|
+
*/
|
|
13
|
+
function runSessionQuery(kernel, body) {
|
|
14
|
+
return kernel.run(db => body(db));
|
|
15
|
+
}
|
|
16
|
+
/** Translate opaque driver failures without losing their cause or mutating host state. */
|
|
17
|
+
async function atSessionBoundary(operation) {
|
|
18
|
+
try {
|
|
19
|
+
return await operation();
|
|
20
|
+
}
|
|
21
|
+
catch (cause) {
|
|
22
|
+
throw new AgentSessionStoreError({ code: 'unavailable' }, { cause });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a three-method mapping with no migration, pragma, open, close, or query at construction.
|
|
27
|
+
* All queries join the host kernel's existing transaction; concurrent set is one atomic upsert.
|
|
28
|
+
* @param kernel Borrowed host kernel with assistant_agent_sessions already migrated.
|
|
29
|
+
* @param optional Core Clock, evaluated once per set; defaults to system wall time.
|
|
30
|
+
* @returns Session-id port; missing pairs read null and clear is idempotent.
|
|
31
|
+
* @throws AgentSessionStoreError when a driver/query fails.
|
|
32
|
+
* @complexity Each operation is one primary-key statement, O(log n) index lookup for n pairs.
|
|
33
|
+
*/
|
|
34
|
+
export function createSqlAgentSessionStore({ kernel }, { clock = createSystemClock() } = {}) {
|
|
35
|
+
return {
|
|
36
|
+
getSessionId({ conversationId, agentId }) {
|
|
37
|
+
return atSessionBoundary(async () => {
|
|
38
|
+
const row = await runSessionQuery(kernel, db => db.selectFrom('assistant_agent_sessions').select('session_id')
|
|
39
|
+
.where('conversation_id', '=', conversationId).where('agent_id', '=', agentId).executeTakeFirst());
|
|
40
|
+
return row?.session_id ?? null;
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
setSessionId({ conversationId, agentId, sessionId }) {
|
|
44
|
+
return atSessionBoundary(async () => {
|
|
45
|
+
const updatedAt = clock.nowMs();
|
|
46
|
+
await runSessionQuery(kernel, db => db.insertInto('assistant_agent_sessions')
|
|
47
|
+
.values({ conversation_id: conversationId, agent_id: agentId, session_id: sessionId, updated_at: updatedAt })
|
|
48
|
+
.onConflict(oc => oc.columns(['conversation_id', 'agent_id']).doUpdateSet({ session_id: sessionId, updated_at: updatedAt })).execute());
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
clearSessionId({ conversationId, agentId }) {
|
|
52
|
+
return atSessionBoundary(async () => {
|
|
53
|
+
await runSessionQuery(kernel, db => db.deleteFrom('assistant_agent_sessions')
|
|
54
|
+
.where('conversation_id', '=', conversationId).where('agent_id', '=', agentId).execute());
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=sql.js.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module db/agent-sessions
|
|
3
|
+
* Owns the per-(conversation, agent) upstream CLI session cache used by the resume identity guard.
|
|
4
|
+
* Imports only the core/ kernel (types). No other db concern is imported.
|
|
5
|
+
*
|
|
6
|
+
* NOTE (neutral port): no OD-specific columns or logic — every field (session id, prompt hash,
|
|
7
|
+
* model, cwd, last message id) is generic resume-identity bookkeeping already matched 1:1 by the
|
|
8
|
+
* already-ported `schema/migrate.ts` `agent_sessions` table. Ported verbatim aside from
|
|
9
|
+
* de-branding the module doc comment.
|
|
10
|
+
*/
|
|
11
|
+
import type { SqliteDb } from '@jini-ai/db/sqlite';
|
|
12
|
+
/**
|
|
13
|
+
* Returns the stored upstream CLI session id for a (conversation, agent) pair, or null if none exists.
|
|
14
|
+
* Used as a quick existence check before the full record is needed.
|
|
15
|
+
* @param db - Open SQLite database handle.
|
|
16
|
+
* @param conversationId - Conversation scope for the session.
|
|
17
|
+
* @param agentId - Agent whose session to look up.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getAgentSession({ db, conversationId, agentId }: {
|
|
20
|
+
readonly db: SqliteDb;
|
|
21
|
+
readonly conversationId: string;
|
|
22
|
+
readonly agentId: string;
|
|
23
|
+
}): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Creates or replaces the agent session record for a (conversation, agent) pair.
|
|
26
|
+
* All nullable fields are stored as SQL NULL when omitted, preserving the resume guard's
|
|
27
|
+
* ability to detect staleness via stablePromptHash and lastMessageId.
|
|
28
|
+
* @param db - Open SQLite database handle.
|
|
29
|
+
* @param input - Session fields to persist; conversationId, agentId, and sessionId are required.
|
|
30
|
+
*/
|
|
31
|
+
export declare function upsertAgentSession({ db, input }: {
|
|
32
|
+
readonly db: SqliteDb;
|
|
33
|
+
readonly input: {
|
|
34
|
+
conversationId: string;
|
|
35
|
+
agentId: string;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
stablePromptHash?: string | null;
|
|
38
|
+
model?: string | null;
|
|
39
|
+
cwd?: string | null;
|
|
40
|
+
lastMessageId?: string | null;
|
|
41
|
+
};
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches the full agent session record for a (conversation, agent) pair, or null if absent.
|
|
45
|
+
* Callers that need only the session id should use {@link getAgentSession} instead.
|
|
46
|
+
* @param db - Open SQLite database handle.
|
|
47
|
+
* @param conversationId - Conversation scope for the session.
|
|
48
|
+
* @param agentId - Agent whose session to retrieve.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getAgentSessionRecord({ db, conversationId, agentId }: {
|
|
51
|
+
readonly db: SqliteDb;
|
|
52
|
+
readonly conversationId: string;
|
|
53
|
+
readonly agentId: string;
|
|
54
|
+
}): {
|
|
55
|
+
sessionId: string;
|
|
56
|
+
stablePromptHash: string | null;
|
|
57
|
+
model: string | null;
|
|
58
|
+
cwd: string | null;
|
|
59
|
+
lastMessageId: string | null;
|
|
60
|
+
} | null;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the conversation cursor used by the resume identity guard: the id of the most recent
|
|
63
|
+
* completed (succeeded) assistant message, excluding the current in-flight placeholder.
|
|
64
|
+
* See the inline comment above for the full invariant and the resumableMessageId exception.
|
|
65
|
+
* @param db - Open SQLite database handle.
|
|
66
|
+
* @param conversationId - Conversation to inspect.
|
|
67
|
+
* @param excludeMessageId - The in-flight run's own placeholder message id to skip.
|
|
68
|
+
* @param resumableMessageId - Optional id of a transiently-failed session's last message, admitted through the succeeded-only filter.
|
|
69
|
+
* @returns The matching message id, or null if no prior completed turn exists.
|
|
70
|
+
*/
|
|
71
|
+
export declare function latestCompletedAssistantMessageId({ db, conversationId, excludeMessageId }: {
|
|
72
|
+
readonly db: SqliteDb;
|
|
73
|
+
readonly conversationId: string;
|
|
74
|
+
readonly excludeMessageId: string;
|
|
75
|
+
}, { resumableMessageId }?: {
|
|
76
|
+
readonly resumableMessageId?: string | null;
|
|
77
|
+
}): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Updates the stable prompt hash for an existing agent session without touching other fields.
|
|
80
|
+
* Called after the resume path confirms the prompt context is still stable, recording the
|
|
81
|
+
* current hash so future identity checks can compare against it.
|
|
82
|
+
* @param db - Open SQLite database handle.
|
|
83
|
+
* @param conversationId - Conversation scope for the session.
|
|
84
|
+
* @param agentId - Agent whose session to update.
|
|
85
|
+
* @param stablePromptHash - The new prompt hash to record.
|
|
86
|
+
*/
|
|
87
|
+
export declare function updateAgentSessionStableHash({ db, conversationId, agentId, stablePromptHash }: {
|
|
88
|
+
readonly db: SqliteDb;
|
|
89
|
+
readonly conversationId: string;
|
|
90
|
+
readonly agentId: string;
|
|
91
|
+
readonly stablePromptHash: string;
|
|
92
|
+
}): void;
|
|
93
|
+
/**
|
|
94
|
+
* Deletes the agent session record for a (conversation, agent) pair.
|
|
95
|
+
* Forces the next run to start a fresh upstream CLI session rather than attempting resume.
|
|
96
|
+
* @param db - Open SQLite database handle.
|
|
97
|
+
* @param conversationId - Conversation scope for the session.
|
|
98
|
+
* @param agentId - Agent whose session to clear.
|
|
99
|
+
*/
|
|
100
|
+
export declare function clearAgentSession({ db, conversationId, agentId }: {
|
|
101
|
+
readonly db: SqliteDb;
|
|
102
|
+
readonly conversationId: string;
|
|
103
|
+
readonly agentId: string;
|
|
104
|
+
}): void;
|
|
105
|
+
export { LEGACY_AGENT_SESSIONS_DDL } from './schema.js';
|
|
106
|
+
import type { Clock } from '@jini-ai/core/primitives';
|
|
107
|
+
import type { StorageKernel } from '@jini-ai/db/kernel';
|
|
108
|
+
import type { AgentSessionStore } from './ports.js';
|
|
109
|
+
import { type AgentSessionDatabase } from './sql.js';
|
|
110
|
+
export type { AgentSessionDatabase } from './sql.js';
|
|
111
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
112
|
+
export declare function createSqliteAgentSessionStore<DB extends AgentSessionDatabase>(input: {
|
|
113
|
+
kernel: StorageKernel<DB>;
|
|
114
|
+
}, options?: {
|
|
115
|
+
clock?: Clock;
|
|
116
|
+
}): AgentSessionStore;
|
|
117
|
+
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the stored upstream CLI session id for a (conversation, agent) pair, or null if none exists.
|
|
3
|
+
* Used as a quick existence check before the full record is needed.
|
|
4
|
+
* @param db - Open SQLite database handle.
|
|
5
|
+
* @param conversationId - Conversation scope for the session.
|
|
6
|
+
* @param agentId - Agent whose session to look up.
|
|
7
|
+
*/
|
|
8
|
+
export function getAgentSession({ db, conversationId, agentId }) {
|
|
9
|
+
const row = db
|
|
10
|
+
.prepare(`SELECT session_id FROM agent_sessions
|
|
11
|
+
WHERE conversation_id = ? AND agent_id = ?`)
|
|
12
|
+
.get(conversationId, agentId);
|
|
13
|
+
return row && typeof row.session_id === 'string' ? row.session_id : null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates or replaces the agent session record for a (conversation, agent) pair.
|
|
17
|
+
* All nullable fields are stored as SQL NULL when omitted, preserving the resume guard's
|
|
18
|
+
* ability to detect staleness via stablePromptHash and lastMessageId.
|
|
19
|
+
* @param db - Open SQLite database handle.
|
|
20
|
+
* @param input - Session fields to persist; conversationId, agentId, and sessionId are required.
|
|
21
|
+
*/
|
|
22
|
+
export function upsertAgentSession({ db, input }) {
|
|
23
|
+
db.prepare(`INSERT INTO agent_sessions
|
|
24
|
+
(conversation_id, agent_id, session_id, stable_prompt_hash, model, cwd, last_message_id, updated_at)
|
|
25
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
26
|
+
ON CONFLICT(conversation_id, agent_id)
|
|
27
|
+
DO UPDATE SET session_id = excluded.session_id,
|
|
28
|
+
stable_prompt_hash = excluded.stable_prompt_hash,
|
|
29
|
+
model = excluded.model,
|
|
30
|
+
cwd = excluded.cwd,
|
|
31
|
+
last_message_id = excluded.last_message_id,
|
|
32
|
+
updated_at = excluded.updated_at`).run(input.conversationId, input.agentId, input.sessionId, input.stablePromptHash ?? null, input.model ?? null, input.cwd ?? null, input.lastMessageId ?? null, Date.now());
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetches the full agent session record for a (conversation, agent) pair, or null if absent.
|
|
36
|
+
* Callers that need only the session id should use {@link getAgentSession} instead.
|
|
37
|
+
* @param db - Open SQLite database handle.
|
|
38
|
+
* @param conversationId - Conversation scope for the session.
|
|
39
|
+
* @param agentId - Agent whose session to retrieve.
|
|
40
|
+
*/
|
|
41
|
+
export function getAgentSessionRecord({ db, conversationId, agentId }) {
|
|
42
|
+
const row = db
|
|
43
|
+
.prepare(`SELECT session_id, stable_prompt_hash, model, cwd, last_message_id FROM agent_sessions
|
|
44
|
+
WHERE conversation_id = ? AND agent_id = ?`)
|
|
45
|
+
.get(conversationId, agentId);
|
|
46
|
+
if (!row || typeof row.session_id !== 'string')
|
|
47
|
+
return null;
|
|
48
|
+
return {
|
|
49
|
+
sessionId: row.session_id,
|
|
50
|
+
stablePromptHash: typeof row.stable_prompt_hash === 'string' ? row.stable_prompt_hash : null,
|
|
51
|
+
model: typeof row.model === 'string' ? row.model : null,
|
|
52
|
+
cwd: typeof row.cwd === 'string' ? row.cwd : null,
|
|
53
|
+
lastMessageId: typeof row.last_message_id === 'string' ? row.last_message_id : null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Conversation cursor for the resume identity guard: the id of the latest
|
|
57
|
+
// COMPLETED assistant message in the conversation, EXCLUDING the current run's
|
|
58
|
+
// in-flight placeholder (`excludeMessageId`). At resolve time the session is in
|
|
59
|
+
// sync iff this equals the assistant message the session last produced —
|
|
60
|
+
// otherwise another agent completed a turn in between, or the session's own last
|
|
61
|
+
// message was edited/removed, and the session is behind. Returns null when there
|
|
62
|
+
// is no prior completed assistant turn.
|
|
63
|
+
//
|
|
64
|
+
// "Completed" means run_status = 'succeeded' — a run stamps its assistant
|
|
65
|
+
// message with the terminal status on finish, so an intervening agent run that
|
|
66
|
+
// FAILED or was CANCELED leaves a placeholder that produced no completed turn;
|
|
67
|
+
// counting it as advancement would force a needless cold reseed (silently
|
|
68
|
+
// disabling the resume perf path) even though the stored session is still the
|
|
69
|
+
// latest completed turn. In-flight placeholders have a null run_status and are
|
|
70
|
+
// likewise excluded.
|
|
71
|
+
//
|
|
72
|
+
// `resumableMessageId` is the one allowed exception: a resume-on-failure path
|
|
73
|
+
// may persist a session whose own last assistant turn FAILED transiently (the
|
|
74
|
+
// CLI session already committed a tool/artifact block and is resumable). That
|
|
75
|
+
// stored id is admitted through the filter so the session it owns still matches
|
|
76
|
+
// its cursor — while a DIFFERENT later failed/canceled turn (a different id)
|
|
77
|
+
// stays excluded, so genuine advancement by a later succeeded turn is still
|
|
78
|
+
// detected.
|
|
79
|
+
/**
|
|
80
|
+
* Returns the conversation cursor used by the resume identity guard: the id of the most recent
|
|
81
|
+
* completed (succeeded) assistant message, excluding the current in-flight placeholder.
|
|
82
|
+
* See the inline comment above for the full invariant and the resumableMessageId exception.
|
|
83
|
+
* @param db - Open SQLite database handle.
|
|
84
|
+
* @param conversationId - Conversation to inspect.
|
|
85
|
+
* @param excludeMessageId - The in-flight run's own placeholder message id to skip.
|
|
86
|
+
* @param resumableMessageId - Optional id of a transiently-failed session's last message, admitted through the succeeded-only filter.
|
|
87
|
+
* @returns The matching message id, or null if no prior completed turn exists.
|
|
88
|
+
*/
|
|
89
|
+
export function latestCompletedAssistantMessageId({ db, conversationId, excludeMessageId }, { resumableMessageId = null } = {}) {
|
|
90
|
+
const row = db
|
|
91
|
+
.prepare(`SELECT id FROM messages
|
|
92
|
+
WHERE conversation_id = ? AND role = 'assistant' AND id != ?
|
|
93
|
+
AND (run_status = 'succeeded' OR id = ?)
|
|
94
|
+
ORDER BY position DESC LIMIT 1`)
|
|
95
|
+
.get(conversationId, excludeMessageId, resumableMessageId);
|
|
96
|
+
return row && typeof row.id === 'string' ? row.id : null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Updates the stable prompt hash for an existing agent session without touching other fields.
|
|
100
|
+
* Called after the resume path confirms the prompt context is still stable, recording the
|
|
101
|
+
* current hash so future identity checks can compare against it.
|
|
102
|
+
* @param db - Open SQLite database handle.
|
|
103
|
+
* @param conversationId - Conversation scope for the session.
|
|
104
|
+
* @param agentId - Agent whose session to update.
|
|
105
|
+
* @param stablePromptHash - The new prompt hash to record.
|
|
106
|
+
*/
|
|
107
|
+
export function updateAgentSessionStableHash({ db, conversationId, agentId, stablePromptHash }) {
|
|
108
|
+
db.prepare(`UPDATE agent_sessions SET stable_prompt_hash = ?, updated_at = ?
|
|
109
|
+
WHERE conversation_id = ? AND agent_id = ?`).run(stablePromptHash, Date.now(), conversationId, agentId);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Deletes the agent session record for a (conversation, agent) pair.
|
|
113
|
+
* Forces the next run to start a fresh upstream CLI session rather than attempting resume.
|
|
114
|
+
* @param db - Open SQLite database handle.
|
|
115
|
+
* @param conversationId - Conversation scope for the session.
|
|
116
|
+
* @param agentId - Agent whose session to clear.
|
|
117
|
+
*/
|
|
118
|
+
export function clearAgentSession({ db, conversationId, agentId }) {
|
|
119
|
+
db.prepare(`DELETE FROM agent_sessions WHERE conversation_id = ? AND agent_id = ?`).run(conversationId, agentId);
|
|
120
|
+
}
|
|
121
|
+
export { LEGACY_AGENT_SESSIONS_DDL } from './schema.js';
|
|
122
|
+
import { createSqlAgentSessionStore, validateSessionKernel } from './sql.js';
|
|
123
|
+
/** Simple session-id mapping over a borrowed, migrated kernel; optional core Clock defaults to wall time. */
|
|
124
|
+
export function createSqliteAgentSessionStore(input, options = {}) {
|
|
125
|
+
validateSessionKernel({ kernel: input.kernel, dialect: 'sqlite', transports: ['better-sqlite3'] });
|
|
126
|
+
return createSqlAgentSessionStore({ kernel: input.kernel }, options);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=sqlite.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type Clock } from '@jini-ai/core/primitives';
|
|
2
|
+
/**
|
|
3
|
+
* `createSqliteEventLog` — the durable `EventLog` adapter (extraction-plan §8 task 8,
|
|
4
|
+
* §2.6: "`@jini-ai/daemon/store/event-log/sqlite` is the default adapter... an adapter conformance suite covers
|
|
5
|
+
* transactions/ordering/cursor-durability/cancellation/migrations").
|
|
6
|
+
*
|
|
7
|
+
* Implements the protocol's two-object `EventLog` call shape, with the same distinguishable `'replay-gap'` result,
|
|
8
|
+
* same never-reused monotonic per-run cursor allocation, same FIFO eviction at
|
|
9
|
+
* `maxEntriesPerRun` — see `createInMemoryEventLog` in `@jini-ai/daemon` for the
|
|
10
|
+
* reference behavior this mirrors. `better-sqlite3` is synchronous; every public
|
|
11
|
+
* method still returns a `Promise` per extraction-plan §2.6 ("ports are async-only
|
|
12
|
+
* from day one... a real persistent adapter is a drop-in swap"), and every
|
|
13
|
+
* multi-statement operation (`append`'s dedupe-check + insert + eviction) runs
|
|
14
|
+
* inside a `better-sqlite3` transaction for atomicity.
|
|
15
|
+
*
|
|
16
|
+
* Three deliberate divergences from the in-memory reference adapter, all scoped to this durable
|
|
17
|
+
* adapter only: (1) `maxEntriesPerRun` defaults to {@link DEFAULT_MAX_ENTRIES_PER_RUN} (2000)
|
|
18
|
+
* instead of unbounded — see `SqliteEventLogOptions.maxEntriesPerRun`'s doc; (2) `replay`'s
|
|
19
|
+
* `afterCursor` is validated up front and throws for anything other than `null` or a
|
|
20
|
+
* non-negative-safe-integer string, instead of returning a `'invalid-cursor'` result — see
|
|
21
|
+
* `assertValidReplayCursor`; (3) dedupe evidence is retained only while its entry remains in the
|
|
22
|
+
* FIFO window. Memory keeps dedupe evidence until drop, including evicted entries. This durable
|
|
23
|
+
* adapter preserves its existing bounded SQL/schema behavior rather than adding a hidden archive.
|
|
24
|
+
*/
|
|
25
|
+
import { type SqliteDb, type SqliteSyncOpener } from '@jini-ai/db/sqlite';
|
|
26
|
+
import type { EventLog } from '@jini-ai/protocol';
|
|
27
|
+
/**
|
|
28
|
+
* Default per-run retention cap applied when `SqliteEventLogOptions.maxEntriesPerRun` is
|
|
29
|
+
* omitted — see that option's doc for why a durable adapter defaults to a bound instead of
|
|
30
|
+
* mirroring the in-memory reference adapter's unbounded-by-default behavior.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_MAX_ENTRIES_PER_RUN = 2000;
|
|
33
|
+
export interface SqliteEventLogOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Maximum entries retained per run before the oldest are evicted. Defaults to
|
|
36
|
+
* {@link DEFAULT_MAX_ENTRIES_PER_RUN} (2000) when omitted — unlike the in-memory reference
|
|
37
|
+
* adapter (`@jini-ai/daemon`'s `createInMemoryEventLog`), where an omitted cap means unbounded,
|
|
38
|
+
* a durable on-disk store defaults to a bounded retention window because unbounded persistent
|
|
39
|
+
* growth is a real, unattended operational risk (disk exhaustion across long-lived runs) in a
|
|
40
|
+
* way an in-process, GC'd, process-lifetime-bounded structure is not. Pass an explicit value
|
|
41
|
+
* (larger, smaller, or `0`) to override the default in either direction — the caller then
|
|
42
|
+
* owns that tradeoff explicitly. Must be a non-negative safe integer; anything else (negative,
|
|
43
|
+
* fractional, `NaN`, `Infinity`) throws at construction time.
|
|
44
|
+
*/
|
|
45
|
+
readonly maxEntriesPerRun?: number;
|
|
46
|
+
/** Core Clock for durable recordedAt values; omitted clock preserves system wall time. */
|
|
47
|
+
readonly clock?: Clock;
|
|
48
|
+
}
|
|
49
|
+
/** A `@jini-ai/daemon` `EventLog` backed by a `better-sqlite3` database, plus a `close()` to release the file handle. */
|
|
50
|
+
export interface SqliteEventLog extends EventLog {
|
|
51
|
+
close(_args: Record<string, never>): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Borrows the caller's connection and ensures the dedicated event-log schema idempotently.
|
|
55
|
+
* Closing this adapter never closes a borrowed handle or changes its pragmas.
|
|
56
|
+
* Use openSqliteEventLog with an explicit file/opener to acquire an owned connection.
|
|
57
|
+
* @throws Host SQL/setup failures, or a missing borrowed connection.
|
|
58
|
+
* @complexity Setup O(1) statements; append costs depend on the retained per-run cap.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createSqliteEventLog(input: {
|
|
61
|
+
db: SqliteDb;
|
|
62
|
+
}, options?: SqliteEventLogOptions): SqliteEventLog;
|
|
63
|
+
/**
|
|
64
|
+
* Acquires a connection through the host opener; setup failure closes that connection.
|
|
65
|
+
* Successful close is idempotent and closes only this owned handle.
|
|
66
|
+
* @param input File and host-owned opener; no ambient driver is loaded.
|
|
67
|
+
* @returns Durable event log with an owned closer.
|
|
68
|
+
* @throws Original acquisition/schema/prepare failure; cleanup never masks it.
|
|
69
|
+
* @complexity O(1) acquisition calls; subsequent costs are the borrowed adapter's.
|
|
70
|
+
*/
|
|
71
|
+
export declare function openSqliteEventLog(input: {
|
|
72
|
+
file: string;
|
|
73
|
+
open: SqliteSyncOpener;
|
|
74
|
+
}, options?: SqliteEventLogOptions): SqliteEventLog;
|
|
75
|
+
//# sourceMappingURL=sqlite.d.ts.map
|