flockbay 0.10.15 → 0.10.16
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/codex/flockbayMcpStdioBridge.cjs +339 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +339 -0
- package/dist/{index--o4BPz5o.cjs → index-Cau-_Qvn.cjs} +2683 -609
- package/dist/{index-CUp3juDS.mjs → index-DtmFQzXY.mjs} +2684 -611
- package/dist/index.cjs +3 -5
- package/dist/index.mjs +3 -5
- package/dist/lib.cjs +7 -9
- package/dist/lib.d.cts +219 -531
- package/dist/lib.d.mts +219 -531
- package/dist/lib.mjs +7 -9
- package/dist/{runCodex-o6PCbHQ7.mjs → runCodex-Di9eHddq.mjs} +263 -42
- package/dist/{runCodex-D3eT-TvB.cjs → runCodex-DzP3VUa-.cjs} +264 -43
- package/dist/{runGemini-Bt0oEj_g.mjs → runGemini-BS6sBU_V.mjs} +63 -28
- package/dist/{runGemini-CBxZp6I7.cjs → runGemini-CpmehDQ2.cjs} +64 -29
- package/dist/{types-DGd6ea2Z.mjs → types-CwzNqYEx.mjs} +465 -1142
- package/dist/{types-C-jnUdn_.cjs → types-SUAKq-K0.cjs} +466 -1146
- package/package.json +1 -1
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +195 -6
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +376 -5
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommandSchema.cpp +731 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +476 -8
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +1518 -94
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +7 -4
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +150 -112
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +2 -1
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +4 -1
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommandSchema.h +42 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +4 -1
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +0 -136
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +0 -138
package/dist/lib.d.mts
CHANGED
|
@@ -1,32 +1,103 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { EventEmitter } from 'node:events';
|
|
3
2
|
import { Socket } from 'socket.io-client';
|
|
4
|
-
import {
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Common RPC types and interfaces for both session and machine clients
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Generic RPC handler function type
|
|
10
|
+
* @template TRequest - The request data type
|
|
11
|
+
* @template TResponse - The response data type
|
|
12
|
+
*/
|
|
13
|
+
type RpcHandler<TRequest = any, TResponse = any> = (data: TRequest) => TResponse | Promise<TResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* RPC request data from server
|
|
16
|
+
*/
|
|
17
|
+
interface RpcRequest {
|
|
18
|
+
method: string;
|
|
19
|
+
params: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for RPC handler manager
|
|
23
|
+
*/
|
|
24
|
+
interface RpcHandlerConfig {
|
|
25
|
+
scopePrefix: string;
|
|
26
|
+
logger?: (message: string, data?: any) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generic RPC handler manager for session and machine clients
|
|
31
|
+
* Manages RPC method registration and handler execution
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
declare class RpcHandlerManager {
|
|
35
|
+
private handlers;
|
|
36
|
+
private readonly scopePrefix;
|
|
37
|
+
private readonly logger;
|
|
38
|
+
private socket;
|
|
39
|
+
constructor(config: RpcHandlerConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Register an RPC handler for a specific method
|
|
42
|
+
* @param method - The method name (without prefix)
|
|
43
|
+
* @param handler - The handler function
|
|
44
|
+
*/
|
|
45
|
+
registerHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Handle an incoming RPC request
|
|
48
|
+
* @param request - The RPC request data
|
|
49
|
+
* @param callback - The response callback
|
|
50
|
+
*/
|
|
51
|
+
handleRequest(request: RpcRequest): Promise<any>;
|
|
52
|
+
onSocketConnect(socket: Socket): void;
|
|
53
|
+
onSocketDisconnect(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get the number of registered handlers
|
|
56
|
+
*/
|
|
57
|
+
getHandlerCount(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a handler is registered
|
|
60
|
+
* @param method - The method name (without prefix)
|
|
61
|
+
*/
|
|
62
|
+
hasHandler(method: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Clear all handlers
|
|
65
|
+
*/
|
|
66
|
+
clearHandlers(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Get the prefixed method name
|
|
69
|
+
* @param method - The method name
|
|
70
|
+
*/
|
|
71
|
+
private getPrefixedMethod;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class CoordinationLeaseGuard {
|
|
75
|
+
private readonly expiresByFile;
|
|
76
|
+
grant(files: string[], ttlMs?: number): {
|
|
77
|
+
granted: string[];
|
|
78
|
+
expiresAt: number;
|
|
79
|
+
};
|
|
80
|
+
has(filePath: string, nowMs?: number): boolean;
|
|
81
|
+
revoke(files: string[]): {
|
|
82
|
+
revoked: string[];
|
|
83
|
+
};
|
|
84
|
+
clear(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Debug-only: return current granted files and expiry.
|
|
87
|
+
* This intentionally leaks coordination state for diagnosis (safe for prelaunch).
|
|
88
|
+
*/
|
|
89
|
+
snapshot(nowMs?: number): Array<{
|
|
90
|
+
file: string;
|
|
91
|
+
expiresAt: number;
|
|
92
|
+
expiresInMs: number;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
5
95
|
|
|
6
96
|
/**
|
|
7
97
|
* Simplified schema that only validates fields actually used in the codebase
|
|
8
98
|
* while preserving all other fields through passthrough()
|
|
9
99
|
*/
|
|
10
100
|
|
|
11
|
-
declare const UsageSchema: z.ZodObject<{
|
|
12
|
-
input_tokens: z.ZodNumber;
|
|
13
|
-
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
output_tokens: z.ZodNumber;
|
|
16
|
-
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
18
|
-
input_tokens: z.ZodNumber;
|
|
19
|
-
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
20
|
-
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
21
|
-
output_tokens: z.ZodNumber;
|
|
22
|
-
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
24
|
-
input_tokens: z.ZodNumber;
|
|
25
|
-
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
output_tokens: z.ZodNumber;
|
|
28
|
-
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
30
101
|
declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
31
102
|
type: z.ZodLiteral<"user">;
|
|
32
103
|
isSidechain: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -279,250 +350,42 @@ declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
279
350
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
280
351
|
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
281
352
|
|
|
282
|
-
/**
|
|
283
|
-
* Common RPC types and interfaces for both session and machine clients
|
|
284
|
-
*/
|
|
285
|
-
/**
|
|
286
|
-
* Generic RPC handler function type
|
|
287
|
-
* @template TRequest - The request data type
|
|
288
|
-
* @template TResponse - The response data type
|
|
289
|
-
*/
|
|
290
|
-
type RpcHandler<TRequest = any, TResponse = any> = (data: TRequest) => TResponse | Promise<TResponse>;
|
|
291
|
-
/**
|
|
292
|
-
* RPC request data from server
|
|
293
|
-
*/
|
|
294
|
-
interface RpcRequest {
|
|
295
|
-
method: string;
|
|
296
|
-
params: string;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Configuration for RPC handler manager
|
|
300
|
-
*/
|
|
301
|
-
interface RpcHandlerConfig {
|
|
302
|
-
scopePrefix: string;
|
|
303
|
-
encryptionKey: Uint8Array;
|
|
304
|
-
logger?: (message: string, data?: any) => void;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Generic RPC handler manager for session and machine clients
|
|
309
|
-
* Manages RPC method registration, encryption/decryption, and handler execution
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
declare class RpcHandlerManager {
|
|
313
|
-
private handlers;
|
|
314
|
-
private readonly scopePrefix;
|
|
315
|
-
private readonly encryptionKey;
|
|
316
|
-
private readonly logger;
|
|
317
|
-
private socket;
|
|
318
|
-
constructor(config: RpcHandlerConfig);
|
|
319
|
-
/**
|
|
320
|
-
* Register an RPC handler for a specific method
|
|
321
|
-
* @param method - The method name (without prefix)
|
|
322
|
-
* @param handler - The handler function
|
|
323
|
-
*/
|
|
324
|
-
registerHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
|
|
325
|
-
/**
|
|
326
|
-
* Handle an incoming RPC request
|
|
327
|
-
* @param request - The RPC request data
|
|
328
|
-
* @param callback - The response callback
|
|
329
|
-
*/
|
|
330
|
-
handleRequest(request: RpcRequest): Promise<any>;
|
|
331
|
-
onSocketConnect(socket: Socket): void;
|
|
332
|
-
onSocketDisconnect(): void;
|
|
333
|
-
/**
|
|
334
|
-
* Get the number of registered handlers
|
|
335
|
-
*/
|
|
336
|
-
getHandlerCount(): number;
|
|
337
|
-
/**
|
|
338
|
-
* Check if a handler is registered
|
|
339
|
-
* @param method - The method name (without prefix)
|
|
340
|
-
*/
|
|
341
|
-
hasHandler(method: string): boolean;
|
|
342
|
-
/**
|
|
343
|
-
* Clear all handlers
|
|
344
|
-
*/
|
|
345
|
-
clearHandlers(): void;
|
|
346
|
-
/**
|
|
347
|
-
* Get the prefixed method name
|
|
348
|
-
* @param method - The method name
|
|
349
|
-
*/
|
|
350
|
-
private getPrefixedMethod;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
declare class CoordinationLeaseGuard {
|
|
354
|
-
private readonly expiresByFile;
|
|
355
|
-
grant(files: string[], ttlMs?: number): {
|
|
356
|
-
granted: string[];
|
|
357
|
-
expiresAt: number;
|
|
358
|
-
};
|
|
359
|
-
has(filePath: string, nowMs?: number): boolean;
|
|
360
|
-
revoke(files: string[]): {
|
|
361
|
-
revoked: string[];
|
|
362
|
-
};
|
|
363
|
-
clear(): void;
|
|
364
|
-
/**
|
|
365
|
-
* Debug-only: return current granted files and expiry.
|
|
366
|
-
* This intentionally leaks coordination state for diagnosis (safe for prelaunch).
|
|
367
|
-
*/
|
|
368
|
-
snapshot(nowMs?: number): Array<{
|
|
369
|
-
file: string;
|
|
370
|
-
expiresAt: number;
|
|
371
|
-
expiresInMs: number;
|
|
372
|
-
}>;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
declare class ApiSessionClient extends EventEmitter {
|
|
376
|
-
private readonly token;
|
|
377
|
-
readonly sessionId: string;
|
|
378
|
-
private metadata;
|
|
379
|
-
private metadataVersion;
|
|
380
|
-
private agentState;
|
|
381
|
-
private agentStateVersion;
|
|
382
|
-
private socket;
|
|
383
|
-
private pendingMessages;
|
|
384
|
-
private pendingMessageCallback;
|
|
385
|
-
private pendingOutboundMessages;
|
|
386
|
-
readonly rpcHandlerManager: RpcHandlerManager;
|
|
387
|
-
private agentStateLock;
|
|
388
|
-
private metadataLock;
|
|
389
|
-
private encryptionKey;
|
|
390
|
-
readonly coordinationLeaseGuard: CoordinationLeaseGuard;
|
|
391
|
-
private coordinationLedgerReadAt;
|
|
392
|
-
private docsIndexReadAt;
|
|
393
|
-
constructor(token: string, session: Session);
|
|
394
|
-
/**
|
|
395
|
-
* Returns the session client's bearer token for calling authenticated HTTP endpoints.
|
|
396
|
-
* Intended for internal integrations (e.g. uploading artifacts for this session).
|
|
397
|
-
*/
|
|
398
|
-
getAuthToken(): string;
|
|
399
|
-
/**
|
|
400
|
-
* True when this session has workspaceProjectId/workItemId metadata
|
|
401
|
-
* (i.e. ledger tools are available and claim enforcement makes sense).
|
|
402
|
-
*/
|
|
403
|
-
hasCoordinationContext(): boolean;
|
|
404
|
-
markCoordinationLedgerRead(atMs?: number): void;
|
|
405
|
-
getCoordinationLedgerReadAt(): number;
|
|
406
|
-
didReadCoordinationLedgerWithin(ms: number): boolean;
|
|
407
|
-
markDocsIndexRead(atMs?: number): void;
|
|
408
|
-
getDocsIndexReadAt(): number;
|
|
409
|
-
didReadDocsIndexWithin(ms: number): boolean;
|
|
410
|
-
private startCoordinationAutopilot;
|
|
411
|
-
private flushOutboundQueue;
|
|
412
|
-
private emitMessageOrQueue;
|
|
413
|
-
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
414
|
-
/**
|
|
415
|
-
* Send message to session
|
|
416
|
-
* @param body - Message body (can be MessageContent or raw content for agent messages)
|
|
417
|
-
*/
|
|
418
|
-
sendClaudeSessionMessage(body: RawJSONLines): void;
|
|
419
|
-
sendCodexMessage(body: any): void;
|
|
420
|
-
/**
|
|
421
|
-
* Send a generic agent message to the session.
|
|
422
|
-
* Works for any agent type (Gemini, Codex, Claude, etc.)
|
|
423
|
-
*
|
|
424
|
-
* @param agentType - The type of agent sending the message (e.g., 'gemini', 'codex', 'claude')
|
|
425
|
-
* @param body - The message payload
|
|
426
|
-
*/
|
|
427
|
-
sendAgentMessage(agentType: 'gemini' | 'codex' | 'claude' | 'opencode', body: any): void;
|
|
428
|
-
sendSessionEvent(event: {
|
|
429
|
-
type: 'switch';
|
|
430
|
-
mode: 'local' | 'remote';
|
|
431
|
-
} | {
|
|
432
|
-
type: 'message';
|
|
433
|
-
message: string;
|
|
434
|
-
} | {
|
|
435
|
-
type: 'permission-mode-changed';
|
|
436
|
-
mode: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
437
|
-
} | {
|
|
438
|
-
type: 'ready';
|
|
439
|
-
}, id?: string): void;
|
|
440
|
-
/**
|
|
441
|
-
* Send a ping message to keep the connection alive
|
|
442
|
-
*/
|
|
443
|
-
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
444
|
-
/**
|
|
445
|
-
* Send session death message
|
|
446
|
-
*/
|
|
447
|
-
sendSessionDeath(): void;
|
|
448
|
-
/**
|
|
449
|
-
* Send usage data to the server
|
|
450
|
-
*/
|
|
451
|
-
sendUsageData(usage: Usage): void;
|
|
452
|
-
/**
|
|
453
|
-
* Update session metadata
|
|
454
|
-
* @param handler - Handler function that returns the updated metadata
|
|
455
|
-
*/
|
|
456
|
-
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
457
|
-
/**
|
|
458
|
-
* Update session agent state
|
|
459
|
-
* @param handler - Handler function that returns the updated agent state
|
|
460
|
-
*/
|
|
461
|
-
updateAgentState(handler: (metadata: AgentState) => AgentState): void;
|
|
462
|
-
/**
|
|
463
|
-
* Wait for socket buffer to flush
|
|
464
|
-
*/
|
|
465
|
-
flush(): Promise<void>;
|
|
466
|
-
close(): Promise<void>;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Usage data type from Claude
|
|
473
|
-
*/
|
|
474
|
-
type Usage = z.infer<typeof UsageSchema>;
|
|
475
|
-
/**
|
|
476
|
-
* Session information
|
|
477
|
-
*/
|
|
478
|
-
type Session = {
|
|
479
|
-
id: string;
|
|
480
|
-
seq: number;
|
|
481
|
-
encryptionKey: Uint8Array;
|
|
482
|
-
metadata: Metadata;
|
|
483
|
-
metadataVersion: number;
|
|
484
|
-
agentState: AgentState | null;
|
|
485
|
-
agentStateVersion: number;
|
|
486
|
-
};
|
|
487
|
-
/**
|
|
488
|
-
* Machine metadata - static information (rarely changes)
|
|
489
|
-
*/
|
|
490
353
|
declare const MachineMetadataSchema: z.ZodObject<{
|
|
491
|
-
host: z.ZodString
|
|
492
|
-
platform: z.ZodString
|
|
493
|
-
flockbayCliVersion: z.ZodString
|
|
494
|
-
homeDir: z.ZodString
|
|
495
|
-
flockbayHomeDir: z.ZodString
|
|
496
|
-
flockbayLibDir: z.ZodString
|
|
354
|
+
host: z.ZodOptional<z.ZodString>;
|
|
355
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
356
|
+
flockbayCliVersion: z.ZodOptional<z.ZodString>;
|
|
357
|
+
homeDir: z.ZodOptional<z.ZodString>;
|
|
358
|
+
flockbayHomeDir: z.ZodOptional<z.ZodString>;
|
|
359
|
+
flockbayLibDir: z.ZodOptional<z.ZodString>;
|
|
360
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
497
361
|
flockbayDevBypassUeGates: z.ZodOptional<z.ZodBoolean>;
|
|
498
362
|
}, "strip", z.ZodTypeAny, {
|
|
499
|
-
host
|
|
500
|
-
platform
|
|
501
|
-
flockbayCliVersion
|
|
502
|
-
homeDir
|
|
503
|
-
flockbayHomeDir
|
|
504
|
-
flockbayLibDir
|
|
363
|
+
host?: string | undefined;
|
|
364
|
+
platform?: string | undefined;
|
|
365
|
+
flockbayCliVersion?: string | undefined;
|
|
366
|
+
homeDir?: string | undefined;
|
|
367
|
+
flockbayHomeDir?: string | undefined;
|
|
368
|
+
flockbayLibDir?: string | undefined;
|
|
369
|
+
displayName?: string | undefined;
|
|
505
370
|
flockbayDevBypassUeGates?: boolean | undefined;
|
|
506
371
|
}, {
|
|
507
|
-
host
|
|
508
|
-
platform
|
|
509
|
-
flockbayCliVersion
|
|
510
|
-
homeDir
|
|
511
|
-
flockbayHomeDir
|
|
512
|
-
flockbayLibDir
|
|
372
|
+
host?: string | undefined;
|
|
373
|
+
platform?: string | undefined;
|
|
374
|
+
flockbayCliVersion?: string | undefined;
|
|
375
|
+
homeDir?: string | undefined;
|
|
376
|
+
flockbayHomeDir?: string | undefined;
|
|
377
|
+
flockbayLibDir?: string | undefined;
|
|
378
|
+
displayName?: string | undefined;
|
|
513
379
|
flockbayDevBypassUeGates?: boolean | undefined;
|
|
514
380
|
}>;
|
|
515
381
|
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
516
|
-
/**
|
|
517
|
-
* Daemon state - dynamic runtime information (frequently updated)
|
|
518
|
-
*/
|
|
519
382
|
declare const DaemonStateSchema: z.ZodObject<{
|
|
520
|
-
status: z.
|
|
383
|
+
status: z.ZodString;
|
|
521
384
|
pid: z.ZodOptional<z.ZodNumber>;
|
|
522
385
|
httpPort: z.ZodOptional<z.ZodNumber>;
|
|
523
386
|
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
524
387
|
shutdownRequestedAt: z.ZodOptional<z.ZodNumber>;
|
|
525
|
-
shutdownSource: z.ZodOptional<z.
|
|
388
|
+
shutdownSource: z.ZodOptional<z.ZodString>;
|
|
526
389
|
}, "strip", z.ZodTypeAny, {
|
|
527
390
|
status: string;
|
|
528
391
|
pid?: number | undefined;
|
|
@@ -541,218 +404,63 @@ declare const DaemonStateSchema: z.ZodObject<{
|
|
|
541
404
|
type DaemonState = z.infer<typeof DaemonStateSchema>;
|
|
542
405
|
type Machine = {
|
|
543
406
|
id: string;
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
407
|
+
seq: number;
|
|
408
|
+
active: boolean;
|
|
409
|
+
activeAt: number | null;
|
|
410
|
+
createdAt: number | null;
|
|
411
|
+
updatedAt: number | null;
|
|
412
|
+
metadata: MachineMetadata | null;
|
|
548
413
|
daemonState: DaemonState | null;
|
|
549
|
-
daemonStateVersion: number;
|
|
550
|
-
};
|
|
551
|
-
declare const UserMessageSchema: z.ZodObject<{
|
|
552
|
-
role: z.ZodLiteral<"user">;
|
|
553
|
-
content: z.ZodObject<{
|
|
554
|
-
type: z.ZodLiteral<"text">;
|
|
555
|
-
text: z.ZodString;
|
|
556
|
-
}, "strip", z.ZodTypeAny, {
|
|
557
|
-
type: "text";
|
|
558
|
-
text: string;
|
|
559
|
-
}, {
|
|
560
|
-
type: "text";
|
|
561
|
-
text: string;
|
|
562
|
-
}>;
|
|
563
|
-
localKey: z.ZodOptional<z.ZodString>;
|
|
564
|
-
meta: z.ZodOptional<z.ZodObject<{
|
|
565
|
-
sentFrom: z.ZodOptional<z.ZodString>;
|
|
566
|
-
permissionMode: z.ZodOptional<z.ZodString>;
|
|
567
|
-
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
568
|
-
customSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
569
|
-
appendSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
570
|
-
allowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
571
|
-
disallowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
572
|
-
displayText: z.ZodOptional<z.ZodString>;
|
|
573
|
-
attachments: z.ZodOptional<z.ZodObject<{
|
|
574
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
575
|
-
mimeType: z.ZodString;
|
|
576
|
-
base64: z.ZodString;
|
|
577
|
-
name: z.ZodOptional<z.ZodString>;
|
|
578
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
579
|
-
height: z.ZodOptional<z.ZodNumber>;
|
|
580
|
-
}, "strip", z.ZodTypeAny, {
|
|
581
|
-
mimeType: string;
|
|
582
|
-
base64: string;
|
|
583
|
-
name?: string | undefined;
|
|
584
|
-
width?: number | undefined;
|
|
585
|
-
height?: number | undefined;
|
|
586
|
-
}, {
|
|
587
|
-
mimeType: string;
|
|
588
|
-
base64: string;
|
|
589
|
-
name?: string | undefined;
|
|
590
|
-
width?: number | undefined;
|
|
591
|
-
height?: number | undefined;
|
|
592
|
-
}>, "many">>;
|
|
593
|
-
}, "strip", z.ZodTypeAny, {
|
|
594
|
-
images?: {
|
|
595
|
-
mimeType: string;
|
|
596
|
-
base64: string;
|
|
597
|
-
name?: string | undefined;
|
|
598
|
-
width?: number | undefined;
|
|
599
|
-
height?: number | undefined;
|
|
600
|
-
}[] | undefined;
|
|
601
|
-
}, {
|
|
602
|
-
images?: {
|
|
603
|
-
mimeType: string;
|
|
604
|
-
base64: string;
|
|
605
|
-
name?: string | undefined;
|
|
606
|
-
width?: number | undefined;
|
|
607
|
-
height?: number | undefined;
|
|
608
|
-
}[] | undefined;
|
|
609
|
-
}>>;
|
|
610
|
-
}, "strip", z.ZodTypeAny, {
|
|
611
|
-
sentFrom?: string | undefined;
|
|
612
|
-
permissionMode?: string | undefined;
|
|
613
|
-
model?: string | null | undefined;
|
|
614
|
-
customSystemPrompt?: string | null | undefined;
|
|
615
|
-
appendSystemPrompt?: string | null | undefined;
|
|
616
|
-
allowedTools?: string[] | null | undefined;
|
|
617
|
-
disallowedTools?: string[] | null | undefined;
|
|
618
|
-
displayText?: string | undefined;
|
|
619
|
-
attachments?: {
|
|
620
|
-
images?: {
|
|
621
|
-
mimeType: string;
|
|
622
|
-
base64: string;
|
|
623
|
-
name?: string | undefined;
|
|
624
|
-
width?: number | undefined;
|
|
625
|
-
height?: number | undefined;
|
|
626
|
-
}[] | undefined;
|
|
627
|
-
} | undefined;
|
|
628
|
-
}, {
|
|
629
|
-
sentFrom?: string | undefined;
|
|
630
|
-
permissionMode?: string | undefined;
|
|
631
|
-
model?: string | null | undefined;
|
|
632
|
-
customSystemPrompt?: string | null | undefined;
|
|
633
|
-
appendSystemPrompt?: string | null | undefined;
|
|
634
|
-
allowedTools?: string[] | null | undefined;
|
|
635
|
-
disallowedTools?: string[] | null | undefined;
|
|
636
|
-
displayText?: string | undefined;
|
|
637
|
-
attachments?: {
|
|
638
|
-
images?: {
|
|
639
|
-
mimeType: string;
|
|
640
|
-
base64: string;
|
|
641
|
-
name?: string | undefined;
|
|
642
|
-
width?: number | undefined;
|
|
643
|
-
height?: number | undefined;
|
|
644
|
-
}[] | undefined;
|
|
645
|
-
} | undefined;
|
|
646
|
-
}>>;
|
|
647
|
-
}, "strip", z.ZodTypeAny, {
|
|
648
|
-
content: {
|
|
649
|
-
type: "text";
|
|
650
|
-
text: string;
|
|
651
|
-
};
|
|
652
|
-
role: "user";
|
|
653
|
-
localKey?: string | undefined;
|
|
654
|
-
meta?: {
|
|
655
|
-
sentFrom?: string | undefined;
|
|
656
|
-
permissionMode?: string | undefined;
|
|
657
|
-
model?: string | null | undefined;
|
|
658
|
-
customSystemPrompt?: string | null | undefined;
|
|
659
|
-
appendSystemPrompt?: string | null | undefined;
|
|
660
|
-
allowedTools?: string[] | null | undefined;
|
|
661
|
-
disallowedTools?: string[] | null | undefined;
|
|
662
|
-
displayText?: string | undefined;
|
|
663
|
-
attachments?: {
|
|
664
|
-
images?: {
|
|
665
|
-
mimeType: string;
|
|
666
|
-
base64: string;
|
|
667
|
-
name?: string | undefined;
|
|
668
|
-
width?: number | undefined;
|
|
669
|
-
height?: number | undefined;
|
|
670
|
-
}[] | undefined;
|
|
671
|
-
} | undefined;
|
|
672
|
-
} | undefined;
|
|
673
|
-
}, {
|
|
674
|
-
content: {
|
|
675
|
-
type: "text";
|
|
676
|
-
text: string;
|
|
677
|
-
};
|
|
678
|
-
role: "user";
|
|
679
|
-
localKey?: string | undefined;
|
|
680
|
-
meta?: {
|
|
681
|
-
sentFrom?: string | undefined;
|
|
682
|
-
permissionMode?: string | undefined;
|
|
683
|
-
model?: string | null | undefined;
|
|
684
|
-
customSystemPrompt?: string | null | undefined;
|
|
685
|
-
appendSystemPrompt?: string | null | undefined;
|
|
686
|
-
allowedTools?: string[] | null | undefined;
|
|
687
|
-
disallowedTools?: string[] | null | undefined;
|
|
688
|
-
displayText?: string | undefined;
|
|
689
|
-
attachments?: {
|
|
690
|
-
images?: {
|
|
691
|
-
mimeType: string;
|
|
692
|
-
base64: string;
|
|
693
|
-
name?: string | undefined;
|
|
694
|
-
width?: number | undefined;
|
|
695
|
-
height?: number | undefined;
|
|
696
|
-
}[] | undefined;
|
|
697
|
-
} | undefined;
|
|
698
|
-
} | undefined;
|
|
699
|
-
}>;
|
|
700
|
-
type UserMessage = z.infer<typeof UserMessageSchema>;
|
|
701
|
-
type Metadata = {
|
|
702
|
-
path: string;
|
|
703
|
-
projectRootPath?: string;
|
|
704
|
-
host: string;
|
|
705
|
-
version?: string;
|
|
706
|
-
name?: string;
|
|
707
|
-
os?: string;
|
|
708
|
-
summary?: {
|
|
709
|
-
text: string;
|
|
710
|
-
updatedAt: number;
|
|
711
|
-
};
|
|
712
|
-
machineId?: string;
|
|
713
|
-
workspaceProjectId?: string;
|
|
714
|
-
featureId?: string;
|
|
715
|
-
workItemId?: string;
|
|
716
|
-
claudeSessionId?: string;
|
|
717
|
-
tools?: string[];
|
|
718
|
-
slashCommands?: string[];
|
|
719
|
-
homeDir: string;
|
|
720
|
-
flockbayHomeDir: string;
|
|
721
|
-
flockbayLibDir: string;
|
|
722
|
-
flockbayToolsDir: string;
|
|
723
|
-
startedFromDaemon?: boolean;
|
|
724
|
-
hostPid?: number;
|
|
725
|
-
startedBy?: 'daemon' | 'terminal';
|
|
726
|
-
lifecycleState?: 'running' | 'archiveRequested' | 'archived' | string;
|
|
727
|
-
lifecycleStateSince?: number;
|
|
728
|
-
archivedBy?: string;
|
|
729
|
-
archiveReason?: string;
|
|
730
|
-
flavor?: string;
|
|
731
414
|
};
|
|
732
|
-
type AgentState =
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
createdAt: number;
|
|
746
|
-
completedAt: number;
|
|
747
|
-
status: 'canceled' | 'denied' | 'approved';
|
|
748
|
-
reason?: string;
|
|
749
|
-
mode?: PermissionMode;
|
|
750
|
-
decision?: 'approved' | 'approved_for_session' | 'denied' | 'abort';
|
|
751
|
-
allowTools?: string[];
|
|
752
|
-
};
|
|
753
|
-
};
|
|
415
|
+
type AgentState = Record<string, any>;
|
|
416
|
+
type Metadata = Record<string, any>;
|
|
417
|
+
type Session = {
|
|
418
|
+
id: string;
|
|
419
|
+
seq: number;
|
|
420
|
+
active: boolean;
|
|
421
|
+
activeAt: number | null;
|
|
422
|
+
createdAt: number | null;
|
|
423
|
+
updatedAt: number | null;
|
|
424
|
+
metadata: Metadata | null;
|
|
425
|
+
metadataVersion: number;
|
|
426
|
+
agentState: AgentState | null;
|
|
427
|
+
agentStateVersion: number;
|
|
754
428
|
};
|
|
755
429
|
|
|
430
|
+
declare class ApiSessionClient extends EventEmitter {
|
|
431
|
+
private readonly token;
|
|
432
|
+
readonly sessionId: string;
|
|
433
|
+
private metadata;
|
|
434
|
+
private metadataVersion;
|
|
435
|
+
private agentState;
|
|
436
|
+
private agentStateVersion;
|
|
437
|
+
private socket;
|
|
438
|
+
readonly rpcHandlerManager: RpcHandlerManager;
|
|
439
|
+
readonly coordinationLeaseGuard: CoordinationLeaseGuard;
|
|
440
|
+
private coordinationLedgerLastReadAtMs;
|
|
441
|
+
private readonly outboundQueue;
|
|
442
|
+
constructor(token: string, session: Session);
|
|
443
|
+
connect(): void;
|
|
444
|
+
connectAndWait(timeoutMs?: number): Promise<void>;
|
|
445
|
+
disconnect(): void;
|
|
446
|
+
close(): void;
|
|
447
|
+
getAuthToken(): string;
|
|
448
|
+
listMessages(): Promise<any[]>;
|
|
449
|
+
markCoordinationLedgerRead(timeMs?: number): void;
|
|
450
|
+
getCoordinationLedgerLastReadAtMs(): number | null;
|
|
451
|
+
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
452
|
+
sendSessionDeath(): void;
|
|
453
|
+
sendSessionEvent(event: any): void;
|
|
454
|
+
sendCodexMessage(body: any): void;
|
|
455
|
+
sendAgentMessage(agentType: 'gemini' | 'codex' | 'claude' | 'opencode', body: any): void;
|
|
456
|
+
sendClaudeSessionMessage(body: any): void;
|
|
457
|
+
private emitMessageOrQueue;
|
|
458
|
+
flush(): void;
|
|
459
|
+
onUserMessage(handler: (message: any) => void): () => void;
|
|
460
|
+
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
461
|
+
updateAgentState(handler: (state: AgentState) => AgentState): void;
|
|
462
|
+
}
|
|
463
|
+
|
|
756
464
|
interface SpawnSessionOptions {
|
|
757
465
|
machineId?: string;
|
|
758
466
|
directory: string;
|
|
@@ -796,109 +504,88 @@ declare class ApiMachineClient {
|
|
|
796
504
|
private socket;
|
|
797
505
|
private keepAliveInterval;
|
|
798
506
|
private rpcHandlerManager;
|
|
507
|
+
private connected;
|
|
508
|
+
private lastConnectError;
|
|
509
|
+
private lastDisconnectReason;
|
|
510
|
+
private lastHttpUpsertError;
|
|
511
|
+
private lastHttpUpsertStatus;
|
|
512
|
+
private lastHttpUpsertAt;
|
|
513
|
+
private readonly upsertBackoff;
|
|
799
514
|
constructor(token: string, machine: Machine);
|
|
800
515
|
setRPCHandlers({ spawnSession, stopSession, requestShutdown }: MachineRpcHandlers): void;
|
|
801
516
|
/**
|
|
802
|
-
*
|
|
803
|
-
* Currently unused, changes from the mobile client are more likely
|
|
804
|
-
* for example to set a custom name.
|
|
517
|
+
* Upsert machine record (metadata + daemon state) via HTTP (workspace-native V1).
|
|
805
518
|
*/
|
|
806
|
-
|
|
519
|
+
private upsertMachineHttp;
|
|
807
520
|
/**
|
|
808
|
-
* Update daemon state (runtime info)
|
|
809
|
-
* Simplified without lock - relies on backoff for retry
|
|
521
|
+
* Update daemon state (runtime info) via HTTP upsert.
|
|
810
522
|
*/
|
|
811
523
|
updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
|
|
524
|
+
/**
|
|
525
|
+
* Best-effort single attempt (no retries). Useful during shutdown.
|
|
526
|
+
*/
|
|
527
|
+
updateDaemonStateOnce(handler: (state: DaemonState | null) => DaemonState): Promise<boolean>;
|
|
528
|
+
getStatusSnapshot(): {
|
|
529
|
+
connected: boolean;
|
|
530
|
+
lastConnectError: string | null;
|
|
531
|
+
lastDisconnectReason: string | null;
|
|
532
|
+
lastHttpUpsertError: string | null;
|
|
533
|
+
lastHttpUpsertStatus: number | null;
|
|
534
|
+
lastHttpUpsertAt: number | null;
|
|
535
|
+
};
|
|
812
536
|
connect(): void;
|
|
813
537
|
private startKeepAlive;
|
|
814
538
|
private stopKeepAlive;
|
|
815
539
|
shutdown(): void;
|
|
816
540
|
}
|
|
817
541
|
|
|
818
|
-
interface PushToken {
|
|
819
|
-
id: string;
|
|
820
|
-
token: string;
|
|
821
|
-
createdAt: number;
|
|
822
|
-
updatedAt: number;
|
|
823
|
-
}
|
|
824
|
-
declare class PushNotificationClient {
|
|
825
|
-
private readonly token;
|
|
826
|
-
private readonly baseUrl;
|
|
827
|
-
private readonly expo;
|
|
828
|
-
constructor(token: string, baseUrl?: string);
|
|
829
|
-
/**
|
|
830
|
-
* Fetch all push tokens for the authenticated user
|
|
831
|
-
*/
|
|
832
|
-
fetchPushTokens(): Promise<PushToken[]>;
|
|
833
|
-
/**
|
|
834
|
-
* Send push notification via Expo Push API with retry
|
|
835
|
-
* @param messages - Array of push messages to send
|
|
836
|
-
*/
|
|
837
|
-
sendPushNotifications(messages: ExpoPushMessage[]): Promise<void>;
|
|
838
|
-
/**
|
|
839
|
-
* Send a push notification to all registered devices for the user
|
|
840
|
-
* @param title - Notification title
|
|
841
|
-
* @param body - Notification body
|
|
842
|
-
* @param data - Additional data to send with the notification
|
|
843
|
-
*/
|
|
844
|
-
sendToAllDevices(title: string, body: string, data?: Record<string, any>): void;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
542
|
/**
|
|
848
543
|
* Minimal persistence functions for Flockbay CLI
|
|
849
544
|
*
|
|
850
545
|
* Handles settings and private key storage in ~/.flockbay/
|
|
851
546
|
*/
|
|
852
547
|
|
|
853
|
-
type
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
publicKey: Uint8Array;
|
|
858
|
-
machineKey: Uint8Array;
|
|
859
|
-
};
|
|
548
|
+
type WorkspaceAuth = {
|
|
549
|
+
machineToken: string;
|
|
550
|
+
orgId: string;
|
|
551
|
+
createdAtMs?: number;
|
|
860
552
|
};
|
|
861
553
|
|
|
862
554
|
declare class ApiClient {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
private readonly pushClient;
|
|
555
|
+
private readonly auth;
|
|
556
|
+
static create(auth: WorkspaceAuth): Promise<ApiClient>;
|
|
866
557
|
private constructor();
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
558
|
+
private baseUrl;
|
|
559
|
+
createSession(opts: {
|
|
560
|
+
metadata: any;
|
|
561
|
+
state?: AgentState | null;
|
|
562
|
+
}): Promise<Session>;
|
|
870
563
|
getOrCreateSession(opts: {
|
|
871
|
-
tag
|
|
872
|
-
metadata:
|
|
873
|
-
state
|
|
564
|
+
tag?: string | null;
|
|
565
|
+
metadata: any;
|
|
566
|
+
state?: AgentState | null;
|
|
874
567
|
}): Promise<Session>;
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
568
|
+
getSessionById(sessionId: string): Promise<Session>;
|
|
569
|
+
upsertMachine(opts: {
|
|
570
|
+
machineId: string;
|
|
571
|
+
metadata: MachineMetadata;
|
|
572
|
+
daemonState?: DaemonState | null;
|
|
573
|
+
}): Promise<Machine>;
|
|
879
574
|
getOrCreateMachine(opts: {
|
|
880
575
|
machineId: string;
|
|
881
576
|
metadata: MachineMetadata;
|
|
882
|
-
daemonState?: DaemonState;
|
|
577
|
+
daemonState?: DaemonState | null;
|
|
883
578
|
}): Promise<Machine>;
|
|
884
|
-
/**
|
|
885
|
-
* Fetch an existing machine by id.
|
|
886
|
-
* Useful when the daemon needs the latest server-side machine metadata (e.g. dev toggles).
|
|
887
|
-
*/
|
|
888
579
|
getMachine(machineId: string): Promise<Machine>;
|
|
580
|
+
registerVendorToken(vendor: string, token: any): Promise<{
|
|
581
|
+
ok: true;
|
|
582
|
+
}>;
|
|
583
|
+
getVendorToken(vendor: string): Promise<any | null>;
|
|
584
|
+
push(): {
|
|
585
|
+
sendToAllDevices: (...args: any[]) => Promise<void>;
|
|
586
|
+
};
|
|
889
587
|
sessionSyncClient(session: Session): ApiSessionClient;
|
|
890
588
|
machineSyncClient(machine: Machine): ApiMachineClient;
|
|
891
|
-
push(): PushNotificationClient;
|
|
892
|
-
/**
|
|
893
|
-
* Register a vendor API token with the server
|
|
894
|
-
* The token is sent as a JSON string - server handles encryption
|
|
895
|
-
*/
|
|
896
|
-
registerVendorToken(vendor: 'openai' | 'anthropic' | 'gemini', apiKey: any): Promise<void>;
|
|
897
|
-
/**
|
|
898
|
-
* Get vendor API token from the server
|
|
899
|
-
* Returns the token if it exists, null otherwise
|
|
900
|
-
*/
|
|
901
|
-
getVendorToken(vendor: 'openai' | 'anthropic' | 'gemini'): Promise<any | null>;
|
|
902
589
|
}
|
|
903
590
|
|
|
904
591
|
/**
|
|
@@ -940,6 +627,7 @@ declare class Configuration {
|
|
|
940
627
|
readonly serverUrl: string;
|
|
941
628
|
readonly webappUrl: string;
|
|
942
629
|
readonly isDaemonProcess: boolean;
|
|
630
|
+
readonly profile: string;
|
|
943
631
|
readonly flockbayHomeDir: string;
|
|
944
632
|
readonly logsDir: string;
|
|
945
633
|
readonly settingsFile: string;
|