@almadar/agent 1.6.3 → 2.0.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/LICENSE +21 -72
- package/README.md +25 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/workspace/index.js +39 -0
- package/dist/workspace/index.js.map +1 -1
- package/package.json +9 -8
- package/dist/agent/index.d.ts +0 -13
- package/dist/api-types-CXrq-fts.d.ts +0 -561
- package/dist/event-transformer/index.d.ts +0 -125
- package/dist/firestore-checkpointer-CkNKXoun.d.ts +0 -184
- package/dist/index-DW3F-Ihx.d.ts +0 -2501
- package/dist/index-DZn69no8.d.ts +0 -1014
- package/dist/index.d.ts +0 -1679
- package/dist/orbital-subagent-BdFuf77p.d.ts +0 -1436
- package/dist/persistence/index.d.ts +0 -201
- package/dist/tools/index.d.ts +0 -8
- package/dist/types.d.ts +0 -170
- package/dist/workspace/index.d.ts +0 -355
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { BaseCheckpointSaver, CheckpointTuple, CheckpointListOptions, Checkpoint, CheckpointMetadata, PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Persistence Types
|
|
6
|
-
*
|
|
7
|
-
* Interfaces for pluggable persistence backends.
|
|
8
|
-
* Consumers provide implementations (memory, Firestore, etc.)
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Session metadata stored by any backend.
|
|
12
|
-
*/
|
|
13
|
-
interface SessionMetadata {
|
|
14
|
-
skill: string;
|
|
15
|
-
workDir: string;
|
|
16
|
-
createdAt: number;
|
|
17
|
-
lastActivityAt: number;
|
|
18
|
-
/** If true, auto-approve all future interrupts without user interaction */
|
|
19
|
-
approveAll?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Session record with thread ID (for listing).
|
|
23
|
-
*/
|
|
24
|
-
interface SessionRecord extends SessionMetadata {
|
|
25
|
-
threadId: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Persistence mode for agent sessions.
|
|
29
|
-
* - 'memory': In-memory storage (default, lost on restart)
|
|
30
|
-
* - 'firestore': Firestore-backed storage (persistent)
|
|
31
|
-
*/
|
|
32
|
-
type PersistenceMode = 'memory' | 'firestore';
|
|
33
|
-
/**
|
|
34
|
-
* Session data for Firestore storage.
|
|
35
|
-
*/
|
|
36
|
-
interface Session {
|
|
37
|
-
threadId: string;
|
|
38
|
-
skill: string;
|
|
39
|
-
workDir: string;
|
|
40
|
-
userId?: string;
|
|
41
|
-
createdAt: Date;
|
|
42
|
-
lastActivityAt: Date;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Firestore Checkpointer for LangGraph
|
|
47
|
-
*
|
|
48
|
-
* Custom implementation of BaseCheckpointSaver using Firebase Firestore.
|
|
49
|
-
* This is required because LangGraph only provides Postgres/Redis savers.
|
|
50
|
-
*
|
|
51
|
-
* IMPORTANT: This module does NOT import firebase-admin directly.
|
|
52
|
-
* The Firestore `db` instance must be injected via constructor options.
|
|
53
|
-
* This keeps the @almadar/agent package free of firebase-admin as a direct dependency.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Minimal Firestore interface to avoid importing firebase-admin.
|
|
58
|
-
* Consumers pass their own Firestore instance.
|
|
59
|
-
*/
|
|
60
|
-
interface FirestoreDb {
|
|
61
|
-
collection(path: string): FirestoreCollectionRef;
|
|
62
|
-
batch(): FirestoreBatch;
|
|
63
|
-
}
|
|
64
|
-
interface FirestoreCollectionRef {
|
|
65
|
-
doc(id: string): FirestoreDocRef;
|
|
66
|
-
where(field: string, op: string, value: unknown): FirestoreQuery;
|
|
67
|
-
orderBy(field: string, direction?: string): FirestoreQuery;
|
|
68
|
-
limit(n: number): FirestoreQuery;
|
|
69
|
-
}
|
|
70
|
-
interface FirestoreDocRef {
|
|
71
|
-
set(data: unknown): Promise<unknown>;
|
|
72
|
-
get(): Promise<FirestoreDocSnapshot>;
|
|
73
|
-
update(data: unknown): Promise<unknown>;
|
|
74
|
-
delete(): Promise<unknown>;
|
|
75
|
-
readonly ref: unknown;
|
|
76
|
-
}
|
|
77
|
-
interface FirestoreDocSnapshot {
|
|
78
|
-
exists: boolean;
|
|
79
|
-
data(): Record<string, unknown> | undefined;
|
|
80
|
-
readonly ref: unknown;
|
|
81
|
-
}
|
|
82
|
-
interface FirestoreQuery {
|
|
83
|
-
where(field: string, op: string, value: unknown): FirestoreQuery;
|
|
84
|
-
orderBy(field: string, direction?: string): FirestoreQuery;
|
|
85
|
-
limit(n: number): FirestoreQuery;
|
|
86
|
-
startAfter(doc: unknown): FirestoreQuery;
|
|
87
|
-
get(): Promise<FirestoreQuerySnapshot>;
|
|
88
|
-
}
|
|
89
|
-
interface FirestoreQuerySnapshot {
|
|
90
|
-
empty: boolean;
|
|
91
|
-
docs: FirestoreQueryDocSnapshot[];
|
|
92
|
-
size: number;
|
|
93
|
-
}
|
|
94
|
-
interface FirestoreQueryDocSnapshot {
|
|
95
|
-
data(): Record<string, unknown>;
|
|
96
|
-
readonly ref: unknown;
|
|
97
|
-
}
|
|
98
|
-
interface FirestoreBatch {
|
|
99
|
-
set(ref: unknown, data: unknown): void;
|
|
100
|
-
delete(ref: unknown): void;
|
|
101
|
-
commit(): Promise<unknown>;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Firestore Timestamp-like interface.
|
|
105
|
-
*/
|
|
106
|
-
interface FirestoreTimestamp {
|
|
107
|
-
toDate(): Date;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Options for FirestoreCheckpointer.
|
|
111
|
-
*/
|
|
112
|
-
interface FirestoreCheckpointerOptions {
|
|
113
|
-
/**
|
|
114
|
-
* Firestore instance. Required — injected by consumer.
|
|
115
|
-
*/
|
|
116
|
-
db: FirestoreDb;
|
|
117
|
-
/**
|
|
118
|
-
* Collection name for checkpoints.
|
|
119
|
-
* @default 'agent_checkpoints'
|
|
120
|
-
*/
|
|
121
|
-
checkpointsCollection?: string;
|
|
122
|
-
/**
|
|
123
|
-
* Collection name for pending writes.
|
|
124
|
-
* @default 'agent_writes'
|
|
125
|
-
*/
|
|
126
|
-
writesCollection?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Firestore-backed checkpointer for LangGraph agents.
|
|
130
|
-
*
|
|
131
|
-
* Provides persistent checkpoint storage across server restarts.
|
|
132
|
-
* Thread checkpoints are stored as Firestore documents.
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* import { getFirestore } from 'firebase-admin/firestore';
|
|
137
|
-
*
|
|
138
|
-
* const checkpointer = new FirestoreCheckpointer({
|
|
139
|
-
* db: getFirestore(),
|
|
140
|
-
* checkpointsCollection: 'agent_checkpoints',
|
|
141
|
-
* });
|
|
142
|
-
*
|
|
143
|
-
* const agent = createDeepAgent({
|
|
144
|
-
* // ...
|
|
145
|
-
* checkpointer,
|
|
146
|
-
* });
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
declare class FirestoreCheckpointer extends BaseCheckpointSaver {
|
|
150
|
-
private db;
|
|
151
|
-
private checkpointsCollection;
|
|
152
|
-
private writesCollection;
|
|
153
|
-
constructor(options: FirestoreCheckpointerOptions);
|
|
154
|
-
/**
|
|
155
|
-
* Get thread ID from config.
|
|
156
|
-
*/
|
|
157
|
-
private getThreadId;
|
|
158
|
-
/**
|
|
159
|
-
* Get checkpoint ID from config, or undefined for latest.
|
|
160
|
-
*/
|
|
161
|
-
private getCheckpointId;
|
|
162
|
-
/**
|
|
163
|
-
* Get checkpoint by config.
|
|
164
|
-
*/
|
|
165
|
-
getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
|
|
166
|
-
/**
|
|
167
|
-
* List checkpoints for a thread.
|
|
168
|
-
*/
|
|
169
|
-
list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
|
|
170
|
-
/**
|
|
171
|
-
* Save a checkpoint.
|
|
172
|
-
*/
|
|
173
|
-
put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, _newVersions: Record<string, number | string>): Promise<RunnableConfig>;
|
|
174
|
-
/**
|
|
175
|
-
* Store pending writes for a checkpoint.
|
|
176
|
-
*/
|
|
177
|
-
putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
|
|
178
|
-
/**
|
|
179
|
-
* Delete all checkpoints and writes for a thread.
|
|
180
|
-
*/
|
|
181
|
-
deleteThread(threadId: string): Promise<void>;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export { FirestoreCheckpointer as F, type PersistenceMode as P, type SessionMetadata as S, type FirestoreCheckpointerOptions as a, type FirestoreDb as b, type FirestoreTimestamp as c, type Session as d, type SessionRecord as e };
|