@claude-flow/plugin-gastown-bridge 0.1.2 → 0.1.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.
Files changed (60) hide show
  1. package/dist/bd-bridge-C9wTbkhi.d.cts +318 -0
  2. package/dist/bd-bridge-C9wTbkhi.d.ts +318 -0
  3. package/dist/bridges.cjs +1 -1
  4. package/dist/bridges.d.cts +5 -604
  5. package/dist/bridges.d.ts +5 -604
  6. package/dist/bridges.js +1 -1
  7. package/dist/chunk-2KNTWGUX.js +12 -0
  8. package/dist/chunk-2KNTWGUX.js.map +1 -0
  9. package/dist/chunk-46PJFOMY.cjs +11 -0
  10. package/dist/chunk-46PJFOMY.cjs.map +1 -0
  11. package/dist/chunk-7UPWLRZX.js +11 -0
  12. package/dist/chunk-7UPWLRZX.js.map +1 -0
  13. package/dist/chunk-7VD5N6NG.cjs +11 -0
  14. package/dist/chunk-7VD5N6NG.cjs.map +1 -0
  15. package/dist/chunk-EBOVUTYL.js +12 -0
  16. package/dist/chunk-EBOVUTYL.js.map +1 -0
  17. package/dist/chunk-I2TLUPMJ.cjs +12 -0
  18. package/dist/chunk-I2TLUPMJ.cjs.map +1 -0
  19. package/dist/chunk-Q7MLH722.cjs +11 -0
  20. package/dist/chunk-Q7MLH722.cjs.map +1 -0
  21. package/dist/chunk-QFMFM7NE.cjs +13 -0
  22. package/dist/chunk-QFMFM7NE.cjs.map +1 -0
  23. package/dist/chunk-SUKPSMVK.cjs +12 -0
  24. package/dist/chunk-SUKPSMVK.cjs.map +1 -0
  25. package/dist/chunk-TGFYZY3C.js +11 -0
  26. package/dist/chunk-TGFYZY3C.js.map +1 -0
  27. package/dist/chunk-U74VYTRV.js +11 -0
  28. package/dist/chunk-U74VYTRV.js.map +1 -0
  29. package/dist/chunk-UJ56JMNG.js +13 -0
  30. package/dist/chunk-UJ56JMNG.js.map +1 -0
  31. package/dist/convoy.cjs +2 -0
  32. package/dist/convoy.cjs.map +1 -0
  33. package/dist/convoy.d.cts +6 -0
  34. package/dist/convoy.d.ts +6 -0
  35. package/dist/convoy.js +2 -0
  36. package/dist/convoy.js.map +1 -0
  37. package/dist/formula.cjs +2 -0
  38. package/dist/formula.cjs.map +1 -0
  39. package/dist/formula.d.cts +317 -0
  40. package/dist/formula.d.ts +317 -0
  41. package/dist/formula.js +2 -0
  42. package/dist/formula.js.map +1 -0
  43. package/dist/gt-bridge-B7hZz5vC.d.cts +291 -0
  44. package/dist/gt-bridge-B7hZz5vC.d.ts +291 -0
  45. package/dist/index-BzkAx4ho.d.ts +785 -0
  46. package/dist/index-CGJs8eMa.d.cts +785 -0
  47. package/dist/index.cjs +8 -9
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +13 -2237
  50. package/dist/index.d.ts +13 -2237
  51. package/dist/index.js +8 -9
  52. package/dist/index.js.map +1 -1
  53. package/dist/types-CMoOZXrm.d.cts +1146 -0
  54. package/dist/types-CMoOZXrm.d.ts +1146 -0
  55. package/dist/wasm-loader.js +1 -1
  56. package/package.json +16 -20
  57. package/dist/chunk-2QQ3FUZF.cjs +0 -14
  58. package/dist/chunk-2QQ3FUZF.cjs.map +0 -1
  59. package/dist/chunk-GKNIKJVQ.js +0 -14
  60. package/dist/chunk-GKNIKJVQ.js.map +0 -1
@@ -0,0 +1,318 @@
1
+ import { ChildProcess } from 'child_process';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Beads CLI Bridge
6
+ *
7
+ * Provides a secure wrapper around the `bd` (Beads) CLI tool.
8
+ * Implements command execution with proper input sanitization,
9
+ * argument validation, JSONL parsing, and error handling.
10
+ *
11
+ * Security Features:
12
+ * - All inputs validated with Zod schemas
13
+ * - No shell execution (uses execFile)
14
+ * - Command allowlist enforcement
15
+ * - Argument sanitization
16
+ * - JSONL streaming support
17
+ *
18
+ * @module v3/plugins/gastown-bridge/bridges/bd-bridge
19
+ */
20
+
21
+ /**
22
+ * Bead ID schema (UUID or custom format)
23
+ */
24
+ declare const BeadIdSchema: z.ZodString;
25
+ /**
26
+ * Bead type schema
27
+ */
28
+ declare const BeadTypeSchema: z.ZodEnum<["prompt", "response", "code", "context", "memory", "tool-call", "tool-result", "system", "error", "metadata"]>;
29
+ /**
30
+ * Bead schema
31
+ */
32
+ declare const BeadSchema: z.ZodObject<{
33
+ id: z.ZodString;
34
+ type: z.ZodEnum<["prompt", "response", "code", "context", "memory", "tool-call", "tool-result", "system", "error", "metadata"]>;
35
+ content: z.ZodString;
36
+ timestamp: z.ZodOptional<z.ZodString>;
37
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
38
+ parentId: z.ZodOptional<z.ZodString>;
39
+ threadId: z.ZodOptional<z.ZodString>;
40
+ agentId: z.ZodOptional<z.ZodString>;
41
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
43
+ hash: z.ZodOptional<z.ZodString>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ id: string;
46
+ type: "code" | "metadata" | "error" | "prompt" | "response" | "context" | "memory" | "tool-call" | "tool-result" | "system";
47
+ content: string;
48
+ parentId?: string | undefined;
49
+ metadata?: Record<string, unknown> | undefined;
50
+ timestamp?: string | undefined;
51
+ threadId?: string | undefined;
52
+ agentId?: string | undefined;
53
+ tags?: string[] | undefined;
54
+ embedding?: number[] | undefined;
55
+ hash?: string | undefined;
56
+ }, {
57
+ id: string;
58
+ type: "code" | "metadata" | "error" | "prompt" | "response" | "context" | "memory" | "tool-call" | "tool-result" | "system";
59
+ content: string;
60
+ parentId?: string | undefined;
61
+ metadata?: Record<string, unknown> | undefined;
62
+ timestamp?: string | undefined;
63
+ threadId?: string | undefined;
64
+ agentId?: string | undefined;
65
+ tags?: string[] | undefined;
66
+ embedding?: number[] | undefined;
67
+ hash?: string | undefined;
68
+ }>;
69
+ /**
70
+ * BD command argument schema
71
+ */
72
+ declare const BdArgumentSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
73
+ /**
74
+ * Bead type (inferred from schema)
75
+ */
76
+ type Bead = z.infer<typeof BeadSchema>;
77
+ /**
78
+ * Bead type enum
79
+ */
80
+ type BeadType = z.infer<typeof BeadTypeSchema>;
81
+ /**
82
+ * Beads bridge configuration
83
+ */
84
+ interface BdBridgeConfig {
85
+ /**
86
+ * Path to bd executable
87
+ * Default: 'bd' (assumes in PATH)
88
+ */
89
+ bdPath?: string;
90
+ /**
91
+ * Working directory for execution
92
+ */
93
+ cwd?: string;
94
+ /**
95
+ * Execution timeout in milliseconds
96
+ * Default: 60000 (60 seconds)
97
+ */
98
+ timeout?: number;
99
+ /**
100
+ * Maximum buffer size for output
101
+ * Default: 50MB (beads can be large)
102
+ */
103
+ maxBuffer?: number;
104
+ /**
105
+ * Environment variables
106
+ */
107
+ env?: NodeJS.ProcessEnv;
108
+ /**
109
+ * Default storage path
110
+ */
111
+ storagePath?: string;
112
+ }
113
+ /**
114
+ * Bead query parameters
115
+ */
116
+ interface BeadQuery {
117
+ type?: BeadType | BeadType[];
118
+ threadId?: string;
119
+ agentId?: string;
120
+ tags?: string[];
121
+ after?: string;
122
+ before?: string;
123
+ limit?: number;
124
+ offset?: number;
125
+ sortBy?: 'timestamp' | 'id' | 'type';
126
+ sortOrder?: 'asc' | 'desc';
127
+ }
128
+ /**
129
+ * Bead creation parameters
130
+ */
131
+ interface CreateBeadParams {
132
+ type: BeadType;
133
+ content: string;
134
+ parentId?: string;
135
+ threadId?: string;
136
+ agentId?: string;
137
+ tags?: string[];
138
+ metadata?: Record<string, unknown>;
139
+ }
140
+ /**
141
+ * BD execution result
142
+ */
143
+ interface BdResult<T = unknown> {
144
+ success: boolean;
145
+ data?: T;
146
+ error?: string;
147
+ command: string;
148
+ args: string[];
149
+ durationMs: number;
150
+ }
151
+ /**
152
+ * Streaming execution result
153
+ */
154
+ interface BdStreamResult {
155
+ process: ChildProcess;
156
+ stdout: NodeJS.ReadableStream | null;
157
+ stderr: NodeJS.ReadableStream | null;
158
+ promise: Promise<BdResult<string>>;
159
+ }
160
+ /**
161
+ * Logger interface
162
+ */
163
+ interface BdLogger {
164
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
165
+ info: (msg: string, meta?: Record<string, unknown>) => void;
166
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
167
+ error: (msg: string, meta?: Record<string, unknown>) => void;
168
+ }
169
+ /**
170
+ * Beads bridge error codes
171
+ */
172
+ type BdErrorCode = 'COMMAND_NOT_FOUND' | 'EXECUTION_FAILED' | 'TIMEOUT' | 'INVALID_ARGUMENT' | 'INVALID_OUTPUT' | 'PARSE_ERROR' | 'VALIDATION_ERROR' | 'BEAD_NOT_FOUND';
173
+ /**
174
+ * Beads bridge error
175
+ */
176
+ declare class BdBridgeError extends Error {
177
+ readonly code: BdErrorCode;
178
+ readonly command?: string | undefined;
179
+ readonly args?: string[] | undefined;
180
+ readonly cause?: Error | undefined;
181
+ constructor(message: string, code: BdErrorCode, command?: string | undefined, args?: string[] | undefined, cause?: Error | undefined);
182
+ }
183
+ /**
184
+ * Beads CLI Bridge
185
+ *
186
+ * Secure wrapper around the `bd` CLI tool for bead management.
187
+ * Supports JSONL output parsing for streaming large datasets.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const bdBridge = new BdBridge({ bdPath: '/usr/local/bin/bd' });
192
+ * await bdBridge.initialize();
193
+ *
194
+ * const beads = await bdBridge.listBeads({ type: 'prompt', limit: 100 });
195
+ * ```
196
+ */
197
+ declare class BdBridge {
198
+ private config;
199
+ private logger;
200
+ private initialized;
201
+ /** Commands that can be cached (read-only, no side effects) */
202
+ private static readonly CACHEABLE_COMMANDS;
203
+ /** Commands that should use longer cache (static data) */
204
+ private static readonly STATIC_COMMANDS;
205
+ constructor(config?: BdBridgeConfig, logger?: BdLogger);
206
+ /**
207
+ * Initialize the bridge and verify bd is available
208
+ */
209
+ initialize(): Promise<void>;
210
+ /**
211
+ * Execute a bd command with validated arguments
212
+ *
213
+ * @param args - Command arguments (validated and sanitized)
214
+ * @returns Command output
215
+ */
216
+ execBd(args: string[], skipCache?: boolean): Promise<BdResult<string>>;
217
+ /**
218
+ * Execute bd command with streaming output
219
+ */
220
+ execBdStreaming(args: string[]): BdStreamResult;
221
+ /**
222
+ * Parse JSONL output from bd command into Bead array
223
+ *
224
+ * @param output - JSONL formatted output
225
+ * @returns Array of parsed and validated beads
226
+ */
227
+ parseBdOutput(output: string): Bead[];
228
+ /**
229
+ * Parse single bead from JSON output
230
+ */
231
+ parseSingleBead(output: string): Bead;
232
+ /**
233
+ * List beads with optional query parameters
234
+ */
235
+ listBeads(query?: BeadQuery): Promise<Bead[]>;
236
+ /**
237
+ * Get a single bead by ID
238
+ */
239
+ getBead(beadId: string): Promise<Bead>;
240
+ /**
241
+ * Create a new bead
242
+ */
243
+ createBead(params: CreateBeadParams): Promise<Bead>;
244
+ /**
245
+ * Search beads with semantic query
246
+ */
247
+ searchBeads(query: string, options?: {
248
+ limit?: number;
249
+ threshold?: number;
250
+ type?: BeadType | BeadType[];
251
+ }): Promise<Bead[]>;
252
+ /**
253
+ * Export beads to JSONL format
254
+ */
255
+ exportBeads(query?: BeadQuery): Promise<string>;
256
+ /**
257
+ * Get bead statistics
258
+ */
259
+ getStats(): Promise<{
260
+ totalBeads: number;
261
+ beadsByType: Record<string, number>;
262
+ totalThreads: number;
263
+ oldestBead?: string;
264
+ newestBead?: string;
265
+ storageSize?: number;
266
+ }>;
267
+ /**
268
+ * Validate and sanitize command arguments
269
+ */
270
+ private validateAndSanitizeArgs;
271
+ /**
272
+ * Ensure bridge is initialized
273
+ */
274
+ private ensureInitialized;
275
+ /**
276
+ * Check if bridge is initialized
277
+ */
278
+ isInitialized(): boolean;
279
+ /**
280
+ * Get current configuration
281
+ */
282
+ getConfig(): Readonly<Required<BdBridgeConfig>>;
283
+ /**
284
+ * Get cache statistics for performance monitoring
285
+ */
286
+ getCacheStats(): {
287
+ beadQueryCache: {
288
+ entries: number;
289
+ sizeBytes: number;
290
+ };
291
+ singleBeadCache: {
292
+ entries: number;
293
+ sizeBytes: number;
294
+ };
295
+ staticCache: {
296
+ entries: number;
297
+ sizeBytes: number;
298
+ };
299
+ parsedCache: {
300
+ entries: number;
301
+ sizeBytes: number;
302
+ };
303
+ };
304
+ /**
305
+ * Clear all caches (useful for testing or memory pressure)
306
+ */
307
+ clearCaches(): void;
308
+ /**
309
+ * Invalidate cache for a specific bead (after create/update/delete)
310
+ */
311
+ invalidateBeadCache(beadId: string): void;
312
+ }
313
+ /**
314
+ * Create a new Beads bridge instance
315
+ */
316
+ declare function createBdBridge(config?: BdBridgeConfig, logger?: BdLogger): BdBridge;
317
+
318
+ export { BdBridge as B, type CreateBeadParams as C, BdArgumentSchema as a, type BdBridgeConfig as b, BdBridgeError as c, type BdErrorCode as d, type BdLogger as e, type BdResult as f, type BdStreamResult as g, BeadIdSchema as h, type BeadQuery as i, type Bead as j, BeadSchema as k, type BeadType as l, BeadTypeSchema as m, createBdBridge as n };
@@ -0,0 +1,318 @@
1
+ import { ChildProcess } from 'child_process';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Beads CLI Bridge
6
+ *
7
+ * Provides a secure wrapper around the `bd` (Beads) CLI tool.
8
+ * Implements command execution with proper input sanitization,
9
+ * argument validation, JSONL parsing, and error handling.
10
+ *
11
+ * Security Features:
12
+ * - All inputs validated with Zod schemas
13
+ * - No shell execution (uses execFile)
14
+ * - Command allowlist enforcement
15
+ * - Argument sanitization
16
+ * - JSONL streaming support
17
+ *
18
+ * @module v3/plugins/gastown-bridge/bridges/bd-bridge
19
+ */
20
+
21
+ /**
22
+ * Bead ID schema (UUID or custom format)
23
+ */
24
+ declare const BeadIdSchema: z.ZodString;
25
+ /**
26
+ * Bead type schema
27
+ */
28
+ declare const BeadTypeSchema: z.ZodEnum<["prompt", "response", "code", "context", "memory", "tool-call", "tool-result", "system", "error", "metadata"]>;
29
+ /**
30
+ * Bead schema
31
+ */
32
+ declare const BeadSchema: z.ZodObject<{
33
+ id: z.ZodString;
34
+ type: z.ZodEnum<["prompt", "response", "code", "context", "memory", "tool-call", "tool-result", "system", "error", "metadata"]>;
35
+ content: z.ZodString;
36
+ timestamp: z.ZodOptional<z.ZodString>;
37
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
38
+ parentId: z.ZodOptional<z.ZodString>;
39
+ threadId: z.ZodOptional<z.ZodString>;
40
+ agentId: z.ZodOptional<z.ZodString>;
41
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
43
+ hash: z.ZodOptional<z.ZodString>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ id: string;
46
+ type: "code" | "metadata" | "error" | "prompt" | "response" | "context" | "memory" | "tool-call" | "tool-result" | "system";
47
+ content: string;
48
+ parentId?: string | undefined;
49
+ metadata?: Record<string, unknown> | undefined;
50
+ timestamp?: string | undefined;
51
+ threadId?: string | undefined;
52
+ agentId?: string | undefined;
53
+ tags?: string[] | undefined;
54
+ embedding?: number[] | undefined;
55
+ hash?: string | undefined;
56
+ }, {
57
+ id: string;
58
+ type: "code" | "metadata" | "error" | "prompt" | "response" | "context" | "memory" | "tool-call" | "tool-result" | "system";
59
+ content: string;
60
+ parentId?: string | undefined;
61
+ metadata?: Record<string, unknown> | undefined;
62
+ timestamp?: string | undefined;
63
+ threadId?: string | undefined;
64
+ agentId?: string | undefined;
65
+ tags?: string[] | undefined;
66
+ embedding?: number[] | undefined;
67
+ hash?: string | undefined;
68
+ }>;
69
+ /**
70
+ * BD command argument schema
71
+ */
72
+ declare const BdArgumentSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
73
+ /**
74
+ * Bead type (inferred from schema)
75
+ */
76
+ type Bead = z.infer<typeof BeadSchema>;
77
+ /**
78
+ * Bead type enum
79
+ */
80
+ type BeadType = z.infer<typeof BeadTypeSchema>;
81
+ /**
82
+ * Beads bridge configuration
83
+ */
84
+ interface BdBridgeConfig {
85
+ /**
86
+ * Path to bd executable
87
+ * Default: 'bd' (assumes in PATH)
88
+ */
89
+ bdPath?: string;
90
+ /**
91
+ * Working directory for execution
92
+ */
93
+ cwd?: string;
94
+ /**
95
+ * Execution timeout in milliseconds
96
+ * Default: 60000 (60 seconds)
97
+ */
98
+ timeout?: number;
99
+ /**
100
+ * Maximum buffer size for output
101
+ * Default: 50MB (beads can be large)
102
+ */
103
+ maxBuffer?: number;
104
+ /**
105
+ * Environment variables
106
+ */
107
+ env?: NodeJS.ProcessEnv;
108
+ /**
109
+ * Default storage path
110
+ */
111
+ storagePath?: string;
112
+ }
113
+ /**
114
+ * Bead query parameters
115
+ */
116
+ interface BeadQuery {
117
+ type?: BeadType | BeadType[];
118
+ threadId?: string;
119
+ agentId?: string;
120
+ tags?: string[];
121
+ after?: string;
122
+ before?: string;
123
+ limit?: number;
124
+ offset?: number;
125
+ sortBy?: 'timestamp' | 'id' | 'type';
126
+ sortOrder?: 'asc' | 'desc';
127
+ }
128
+ /**
129
+ * Bead creation parameters
130
+ */
131
+ interface CreateBeadParams {
132
+ type: BeadType;
133
+ content: string;
134
+ parentId?: string;
135
+ threadId?: string;
136
+ agentId?: string;
137
+ tags?: string[];
138
+ metadata?: Record<string, unknown>;
139
+ }
140
+ /**
141
+ * BD execution result
142
+ */
143
+ interface BdResult<T = unknown> {
144
+ success: boolean;
145
+ data?: T;
146
+ error?: string;
147
+ command: string;
148
+ args: string[];
149
+ durationMs: number;
150
+ }
151
+ /**
152
+ * Streaming execution result
153
+ */
154
+ interface BdStreamResult {
155
+ process: ChildProcess;
156
+ stdout: NodeJS.ReadableStream | null;
157
+ stderr: NodeJS.ReadableStream | null;
158
+ promise: Promise<BdResult<string>>;
159
+ }
160
+ /**
161
+ * Logger interface
162
+ */
163
+ interface BdLogger {
164
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
165
+ info: (msg: string, meta?: Record<string, unknown>) => void;
166
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
167
+ error: (msg: string, meta?: Record<string, unknown>) => void;
168
+ }
169
+ /**
170
+ * Beads bridge error codes
171
+ */
172
+ type BdErrorCode = 'COMMAND_NOT_FOUND' | 'EXECUTION_FAILED' | 'TIMEOUT' | 'INVALID_ARGUMENT' | 'INVALID_OUTPUT' | 'PARSE_ERROR' | 'VALIDATION_ERROR' | 'BEAD_NOT_FOUND';
173
+ /**
174
+ * Beads bridge error
175
+ */
176
+ declare class BdBridgeError extends Error {
177
+ readonly code: BdErrorCode;
178
+ readonly command?: string | undefined;
179
+ readonly args?: string[] | undefined;
180
+ readonly cause?: Error | undefined;
181
+ constructor(message: string, code: BdErrorCode, command?: string | undefined, args?: string[] | undefined, cause?: Error | undefined);
182
+ }
183
+ /**
184
+ * Beads CLI Bridge
185
+ *
186
+ * Secure wrapper around the `bd` CLI tool for bead management.
187
+ * Supports JSONL output parsing for streaming large datasets.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const bdBridge = new BdBridge({ bdPath: '/usr/local/bin/bd' });
192
+ * await bdBridge.initialize();
193
+ *
194
+ * const beads = await bdBridge.listBeads({ type: 'prompt', limit: 100 });
195
+ * ```
196
+ */
197
+ declare class BdBridge {
198
+ private config;
199
+ private logger;
200
+ private initialized;
201
+ /** Commands that can be cached (read-only, no side effects) */
202
+ private static readonly CACHEABLE_COMMANDS;
203
+ /** Commands that should use longer cache (static data) */
204
+ private static readonly STATIC_COMMANDS;
205
+ constructor(config?: BdBridgeConfig, logger?: BdLogger);
206
+ /**
207
+ * Initialize the bridge and verify bd is available
208
+ */
209
+ initialize(): Promise<void>;
210
+ /**
211
+ * Execute a bd command with validated arguments
212
+ *
213
+ * @param args - Command arguments (validated and sanitized)
214
+ * @returns Command output
215
+ */
216
+ execBd(args: string[], skipCache?: boolean): Promise<BdResult<string>>;
217
+ /**
218
+ * Execute bd command with streaming output
219
+ */
220
+ execBdStreaming(args: string[]): BdStreamResult;
221
+ /**
222
+ * Parse JSONL output from bd command into Bead array
223
+ *
224
+ * @param output - JSONL formatted output
225
+ * @returns Array of parsed and validated beads
226
+ */
227
+ parseBdOutput(output: string): Bead[];
228
+ /**
229
+ * Parse single bead from JSON output
230
+ */
231
+ parseSingleBead(output: string): Bead;
232
+ /**
233
+ * List beads with optional query parameters
234
+ */
235
+ listBeads(query?: BeadQuery): Promise<Bead[]>;
236
+ /**
237
+ * Get a single bead by ID
238
+ */
239
+ getBead(beadId: string): Promise<Bead>;
240
+ /**
241
+ * Create a new bead
242
+ */
243
+ createBead(params: CreateBeadParams): Promise<Bead>;
244
+ /**
245
+ * Search beads with semantic query
246
+ */
247
+ searchBeads(query: string, options?: {
248
+ limit?: number;
249
+ threshold?: number;
250
+ type?: BeadType | BeadType[];
251
+ }): Promise<Bead[]>;
252
+ /**
253
+ * Export beads to JSONL format
254
+ */
255
+ exportBeads(query?: BeadQuery): Promise<string>;
256
+ /**
257
+ * Get bead statistics
258
+ */
259
+ getStats(): Promise<{
260
+ totalBeads: number;
261
+ beadsByType: Record<string, number>;
262
+ totalThreads: number;
263
+ oldestBead?: string;
264
+ newestBead?: string;
265
+ storageSize?: number;
266
+ }>;
267
+ /**
268
+ * Validate and sanitize command arguments
269
+ */
270
+ private validateAndSanitizeArgs;
271
+ /**
272
+ * Ensure bridge is initialized
273
+ */
274
+ private ensureInitialized;
275
+ /**
276
+ * Check if bridge is initialized
277
+ */
278
+ isInitialized(): boolean;
279
+ /**
280
+ * Get current configuration
281
+ */
282
+ getConfig(): Readonly<Required<BdBridgeConfig>>;
283
+ /**
284
+ * Get cache statistics for performance monitoring
285
+ */
286
+ getCacheStats(): {
287
+ beadQueryCache: {
288
+ entries: number;
289
+ sizeBytes: number;
290
+ };
291
+ singleBeadCache: {
292
+ entries: number;
293
+ sizeBytes: number;
294
+ };
295
+ staticCache: {
296
+ entries: number;
297
+ sizeBytes: number;
298
+ };
299
+ parsedCache: {
300
+ entries: number;
301
+ sizeBytes: number;
302
+ };
303
+ };
304
+ /**
305
+ * Clear all caches (useful for testing or memory pressure)
306
+ */
307
+ clearCaches(): void;
308
+ /**
309
+ * Invalidate cache for a specific bead (after create/update/delete)
310
+ */
311
+ invalidateBeadCache(beadId: string): void;
312
+ }
313
+ /**
314
+ * Create a new Beads bridge instance
315
+ */
316
+ declare function createBdBridge(config?: BdBridgeConfig, logger?: BdLogger): BdBridge;
317
+
318
+ export { BdBridge as B, type CreateBeadParams as C, BdArgumentSchema as a, type BdBridgeConfig as b, BdBridgeError as c, type BdErrorCode as d, type BdLogger as e, type BdResult as f, type BdStreamResult as g, BeadIdSchema as h, type BeadQuery as i, type Bead as j, BeadSchema as k, type BeadType as l, BeadTypeSchema as m, createBdBridge as n };
package/dist/bridges.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk2QQ3FUZF_cjs=require('./chunk-2QQ3FUZF.cjs');Object.defineProperty(exports,"AddressSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.k}});Object.defineProperty(exports,"AgentDBEntrySchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.A}});Object.defineProperty(exports,"BdArgumentSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.t}});Object.defineProperty(exports,"BdBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.v}});Object.defineProperty(exports,"BdBridgeError",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.u}});Object.defineProperty(exports,"BeadIdSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.q}});Object.defineProperty(exports,"CliBeadSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.s}});Object.defineProperty(exports,"CliBeadTypeSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.r}});Object.defineProperty(exports,"CliSyncDirectionSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.y}});Object.defineProperty(exports,"ConflictStrategySchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.x}});Object.defineProperty(exports,"GasLimitSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.i}});Object.defineProperty(exports,"GasPriceSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.h}});Object.defineProperty(exports,"GtArgumentSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.m}});Object.defineProperty(exports,"GtBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.o}});Object.defineProperty(exports,"GtBridgeError",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.n}});Object.defineProperty(exports,"GtIdentifierSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.g}});Object.defineProperty(exports,"GtSafeStringSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.f}});Object.defineProperty(exports,"NetworkSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.l}});Object.defineProperty(exports,"SyncBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.C}});Object.defineProperty(exports,"SyncBridgeError",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.B}});Object.defineProperty(exports,"SyncStatusSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.z}});Object.defineProperty(exports,"TxHashSchema",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.j}});Object.defineProperty(exports,"createBdBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.w}});Object.defineProperty(exports,"createGtBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.p}});Object.defineProperty(exports,"createSyncBridge",{enumerable:true,get:function(){return chunk2QQ3FUZF_cjs.D}});//# sourceMappingURL=bridges.cjs.map
1
+ 'use strict';var chunkQFMFM7NE_cjs=require('./chunk-QFMFM7NE.cjs'),chunkI2TLUPMJ_cjs=require('./chunk-I2TLUPMJ.cjs');Object.defineProperty(exports,"AddressSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.f}});Object.defineProperty(exports,"AgentDBEntrySchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.o}});Object.defineProperty(exports,"CliSyncDirectionSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.m}});Object.defineProperty(exports,"ConflictStrategySchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.l}});Object.defineProperty(exports,"GasLimitSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.d}});Object.defineProperty(exports,"GasPriceSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.c}});Object.defineProperty(exports,"GtArgumentSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.h}});Object.defineProperty(exports,"GtBridge",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.j}});Object.defineProperty(exports,"GtBridgeError",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.i}});Object.defineProperty(exports,"GtIdentifierSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.b}});Object.defineProperty(exports,"GtSafeStringSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.a}});Object.defineProperty(exports,"NetworkSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.g}});Object.defineProperty(exports,"SyncBridge",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.q}});Object.defineProperty(exports,"SyncBridgeError",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.p}});Object.defineProperty(exports,"SyncStatusSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.n}});Object.defineProperty(exports,"TxHashSchema",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.e}});Object.defineProperty(exports,"createGtBridge",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.k}});Object.defineProperty(exports,"createSyncBridge",{enumerable:true,get:function(){return chunkQFMFM7NE_cjs.r}});Object.defineProperty(exports,"BdArgumentSchema",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.d}});Object.defineProperty(exports,"BdBridge",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.f}});Object.defineProperty(exports,"BdBridgeError",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.e}});Object.defineProperty(exports,"BeadIdSchema",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.a}});Object.defineProperty(exports,"CliBeadSchema",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.c}});Object.defineProperty(exports,"CliBeadTypeSchema",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.b}});Object.defineProperty(exports,"createBdBridge",{enumerable:true,get:function(){return chunkI2TLUPMJ_cjs.g}});//# sourceMappingURL=bridges.cjs.map
2
2
  //# sourceMappingURL=bridges.cjs.map