flockbay 0.10.15
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/README.md +56 -0
- package/bin/flockbay-mcp.mjs +56 -0
- package/bin/flockbay.mjs +78 -0
- package/dist/codex/flockbayMcpStdioBridge.cjs +383 -0
- package/dist/codex/flockbayMcpStdioBridge.d.cts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.d.mts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +381 -0
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +136 -0
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +138 -0
- package/dist/index--o4BPz5o.cjs +10311 -0
- package/dist/index-CUp3juDS.mjs +10268 -0
- package/dist/index.cjs +43 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +40 -0
- package/dist/lib.cjs +33 -0
- package/dist/lib.d.cts +957 -0
- package/dist/lib.d.mts +957 -0
- package/dist/lib.mjs +23 -0
- package/dist/runCodex-D3eT-TvB.cjs +3449 -0
- package/dist/runCodex-o6PCbHQ7.mjs +3446 -0
- package/dist/runGemini-Bt0oEj_g.mjs +3183 -0
- package/dist/runGemini-CBxZp6I7.cjs +3185 -0
- package/dist/types-C-jnUdn_.cjs +4498 -0
- package/dist/types-DGd6ea2Z.mjs +4450 -0
- package/kits/kit.open_world/kit.json +59 -0
- package/package.json +130 -0
- package/scripts/claude_local_launcher.cjs +73 -0
- package/scripts/claude_remote_launcher.cjs +16 -0
- package/scripts/claude_version_utils.cjs +391 -0
- package/scripts/ripgrep_launcher.cjs +33 -0
- package/scripts/session_hook_forwarder.cjs +49 -0
- package/scripts/test-codex-abort-history.mjs +77 -0
- package/scripts/unpack-tools.cjs +222 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +7 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +184 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Config/FilterPlugin.ini +8 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1160 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +924 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +709 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +896 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPProjectCommands.cpp +72 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPUMGCommands.cpp +544 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +321 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +419 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPModule.cpp +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +27 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +40 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/MCPServerRunnable.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPBridge.h +64 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPModule.h +22 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +78 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/UnrealMCP.uplugin +36 -0
- package/tools/unreal-mcp/upstream/Python/README.md +40 -0
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -0
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +203 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +497 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +194 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +267 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +618 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +366 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +390 -0
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +420 -0
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -0
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +430 -0
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +64 -0
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +333 -0
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -0
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -0
package/dist/lib.d.mts
ADDED
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { Socket } from 'socket.io-client';
|
|
4
|
+
import { ExpoPushMessage } from 'expo-server-sdk';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Simplified schema that only validates fields actually used in the codebase
|
|
8
|
+
* while preserving all other fields through passthrough()
|
|
9
|
+
*/
|
|
10
|
+
|
|
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
|
+
declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"user">;
|
|
32
|
+
isSidechain: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
isMeta: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
uuid: z.ZodString;
|
|
35
|
+
message: z.ZodObject<{
|
|
36
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
37
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
38
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
39
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
40
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
41
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
42
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
43
|
+
type: z.ZodLiteral<"user">;
|
|
44
|
+
isSidechain: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
isMeta: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
uuid: z.ZodString;
|
|
47
|
+
message: z.ZodObject<{
|
|
48
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
49
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
50
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
51
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
52
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
53
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
54
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
55
|
+
type: z.ZodLiteral<"user">;
|
|
56
|
+
isSidechain: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
isMeta: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
uuid: z.ZodString;
|
|
59
|
+
message: z.ZodObject<{
|
|
60
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
61
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
62
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
63
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
64
|
+
content: z.ZodUnion<[z.ZodString, z.ZodAny]>;
|
|
65
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
67
|
+
uuid: z.ZodString;
|
|
68
|
+
type: z.ZodLiteral<"assistant">;
|
|
69
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
input_tokens: z.ZodNumber;
|
|
72
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
output_tokens: z.ZodNumber;
|
|
75
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
77
|
+
input_tokens: z.ZodNumber;
|
|
78
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
output_tokens: z.ZodNumber;
|
|
81
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
83
|
+
input_tokens: z.ZodNumber;
|
|
84
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
output_tokens: z.ZodNumber;
|
|
87
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
89
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
90
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
input_tokens: z.ZodNumber;
|
|
92
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
output_tokens: z.ZodNumber;
|
|
95
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
97
|
+
input_tokens: z.ZodNumber;
|
|
98
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
output_tokens: z.ZodNumber;
|
|
101
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
103
|
+
input_tokens: z.ZodNumber;
|
|
104
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
output_tokens: z.ZodNumber;
|
|
107
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
109
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
110
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
input_tokens: z.ZodNumber;
|
|
112
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
output_tokens: z.ZodNumber;
|
|
115
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
117
|
+
input_tokens: z.ZodNumber;
|
|
118
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
output_tokens: z.ZodNumber;
|
|
121
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
123
|
+
input_tokens: z.ZodNumber;
|
|
124
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
output_tokens: z.ZodNumber;
|
|
127
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
128
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
129
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
130
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
131
|
+
uuid: z.ZodString;
|
|
132
|
+
type: z.ZodLiteral<"assistant">;
|
|
133
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
input_tokens: z.ZodNumber;
|
|
136
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
output_tokens: z.ZodNumber;
|
|
139
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
141
|
+
input_tokens: z.ZodNumber;
|
|
142
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
output_tokens: z.ZodNumber;
|
|
145
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
147
|
+
input_tokens: z.ZodNumber;
|
|
148
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
output_tokens: z.ZodNumber;
|
|
151
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
153
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
154
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
155
|
+
input_tokens: z.ZodNumber;
|
|
156
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
output_tokens: z.ZodNumber;
|
|
159
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
161
|
+
input_tokens: z.ZodNumber;
|
|
162
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
output_tokens: z.ZodNumber;
|
|
165
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
167
|
+
input_tokens: z.ZodNumber;
|
|
168
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
170
|
+
output_tokens: z.ZodNumber;
|
|
171
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
172
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
173
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
174
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
175
|
+
input_tokens: z.ZodNumber;
|
|
176
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
output_tokens: z.ZodNumber;
|
|
179
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
181
|
+
input_tokens: z.ZodNumber;
|
|
182
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
output_tokens: z.ZodNumber;
|
|
185
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
187
|
+
input_tokens: z.ZodNumber;
|
|
188
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
output_tokens: z.ZodNumber;
|
|
191
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
193
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
195
|
+
uuid: z.ZodString;
|
|
196
|
+
type: z.ZodLiteral<"assistant">;
|
|
197
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
input_tokens: z.ZodNumber;
|
|
200
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
output_tokens: z.ZodNumber;
|
|
203
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
204
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
205
|
+
input_tokens: z.ZodNumber;
|
|
206
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
208
|
+
output_tokens: z.ZodNumber;
|
|
209
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
210
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
211
|
+
input_tokens: z.ZodNumber;
|
|
212
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
output_tokens: z.ZodNumber;
|
|
215
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
217
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
218
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
input_tokens: z.ZodNumber;
|
|
220
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
output_tokens: z.ZodNumber;
|
|
223
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
224
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
225
|
+
input_tokens: z.ZodNumber;
|
|
226
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
output_tokens: z.ZodNumber;
|
|
229
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
230
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
231
|
+
input_tokens: z.ZodNumber;
|
|
232
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
output_tokens: z.ZodNumber;
|
|
235
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
236
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
237
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
238
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
239
|
+
input_tokens: z.ZodNumber;
|
|
240
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
output_tokens: z.ZodNumber;
|
|
243
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
244
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
245
|
+
input_tokens: z.ZodNumber;
|
|
246
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
output_tokens: z.ZodNumber;
|
|
249
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
251
|
+
input_tokens: z.ZodNumber;
|
|
252
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
output_tokens: z.ZodNumber;
|
|
255
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
256
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
257
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
258
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
259
|
+
type: z.ZodLiteral<"summary">;
|
|
260
|
+
summary: z.ZodString;
|
|
261
|
+
leafUuid: z.ZodString;
|
|
262
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
263
|
+
type: z.ZodLiteral<"summary">;
|
|
264
|
+
summary: z.ZodString;
|
|
265
|
+
leafUuid: z.ZodString;
|
|
266
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
267
|
+
type: z.ZodLiteral<"summary">;
|
|
268
|
+
summary: z.ZodString;
|
|
269
|
+
leafUuid: z.ZodString;
|
|
270
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
271
|
+
type: z.ZodLiteral<"system">;
|
|
272
|
+
uuid: z.ZodString;
|
|
273
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
274
|
+
type: z.ZodLiteral<"system">;
|
|
275
|
+
uuid: z.ZodString;
|
|
276
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
277
|
+
type: z.ZodLiteral<"system">;
|
|
278
|
+
uuid: z.ZodString;
|
|
279
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
280
|
+
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
281
|
+
|
|
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
|
+
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;
|
|
497
|
+
flockbayDevBypassUeGates: z.ZodOptional<z.ZodBoolean>;
|
|
498
|
+
}, "strip", z.ZodTypeAny, {
|
|
499
|
+
host: string;
|
|
500
|
+
platform: string;
|
|
501
|
+
flockbayCliVersion: string;
|
|
502
|
+
homeDir: string;
|
|
503
|
+
flockbayHomeDir: string;
|
|
504
|
+
flockbayLibDir: string;
|
|
505
|
+
flockbayDevBypassUeGates?: boolean | undefined;
|
|
506
|
+
}, {
|
|
507
|
+
host: string;
|
|
508
|
+
platform: string;
|
|
509
|
+
flockbayCliVersion: string;
|
|
510
|
+
homeDir: string;
|
|
511
|
+
flockbayHomeDir: string;
|
|
512
|
+
flockbayLibDir: string;
|
|
513
|
+
flockbayDevBypassUeGates?: boolean | undefined;
|
|
514
|
+
}>;
|
|
515
|
+
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
516
|
+
/**
|
|
517
|
+
* Daemon state - dynamic runtime information (frequently updated)
|
|
518
|
+
*/
|
|
519
|
+
declare const DaemonStateSchema: z.ZodObject<{
|
|
520
|
+
status: z.ZodUnion<[z.ZodEnum<["running", "shutting-down"]>, z.ZodString]>;
|
|
521
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
522
|
+
httpPort: z.ZodOptional<z.ZodNumber>;
|
|
523
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
524
|
+
shutdownRequestedAt: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
shutdownSource: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["mobile-app", "cli", "os-signal", "unknown"]>, z.ZodString]>>;
|
|
526
|
+
}, "strip", z.ZodTypeAny, {
|
|
527
|
+
status: string;
|
|
528
|
+
pid?: number | undefined;
|
|
529
|
+
httpPort?: number | undefined;
|
|
530
|
+
startedAt?: number | undefined;
|
|
531
|
+
shutdownRequestedAt?: number | undefined;
|
|
532
|
+
shutdownSource?: string | undefined;
|
|
533
|
+
}, {
|
|
534
|
+
status: string;
|
|
535
|
+
pid?: number | undefined;
|
|
536
|
+
httpPort?: number | undefined;
|
|
537
|
+
startedAt?: number | undefined;
|
|
538
|
+
shutdownRequestedAt?: number | undefined;
|
|
539
|
+
shutdownSource?: string | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
type DaemonState = z.infer<typeof DaemonStateSchema>;
|
|
542
|
+
type Machine = {
|
|
543
|
+
id: string;
|
|
544
|
+
dataEncryptionKey: string;
|
|
545
|
+
encryptionKey: Uint8Array;
|
|
546
|
+
metadata: MachineMetadata;
|
|
547
|
+
metadataVersion: number;
|
|
548
|
+
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
|
+
};
|
|
732
|
+
type AgentState = {
|
|
733
|
+
controlledByUser?: boolean | null | undefined;
|
|
734
|
+
requests?: {
|
|
735
|
+
[id: string]: {
|
|
736
|
+
tool: string;
|
|
737
|
+
arguments: any;
|
|
738
|
+
createdAt: number;
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
completedRequests?: {
|
|
742
|
+
[id: string]: {
|
|
743
|
+
tool: string;
|
|
744
|
+
arguments: any;
|
|
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
|
+
};
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
interface SpawnSessionOptions {
|
|
757
|
+
machineId?: string;
|
|
758
|
+
directory: string;
|
|
759
|
+
sessionId?: string;
|
|
760
|
+
approvedNewDirectoryCreation?: boolean;
|
|
761
|
+
agent?: 'claude' | 'codex' | 'gemini';
|
|
762
|
+
token?: string;
|
|
763
|
+
autoPrompt?: string | null;
|
|
764
|
+
autoExitOnIdle?: boolean;
|
|
765
|
+
coordination?: {
|
|
766
|
+
workspaceProjectId?: string;
|
|
767
|
+
featureId?: string;
|
|
768
|
+
workItemId?: string;
|
|
769
|
+
projectRootPath?: string;
|
|
770
|
+
} | null;
|
|
771
|
+
}
|
|
772
|
+
type SpawnSessionResult = {
|
|
773
|
+
type: 'success';
|
|
774
|
+
sessionId: string;
|
|
775
|
+
} | {
|
|
776
|
+
type: 'requestToApproveDirectoryCreation';
|
|
777
|
+
directory: string;
|
|
778
|
+
} | {
|
|
779
|
+
type: 'error';
|
|
780
|
+
errorMessage: string;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* WebSocket client for machine/daemon communication with Flockbay server
|
|
785
|
+
* Similar to ApiSessionClient but for machine-scoped connections
|
|
786
|
+
*/
|
|
787
|
+
|
|
788
|
+
type MachineRpcHandlers = {
|
|
789
|
+
spawnSession: (options: SpawnSessionOptions) => Promise<SpawnSessionResult>;
|
|
790
|
+
stopSession: (sessionId: string) => boolean;
|
|
791
|
+
requestShutdown: () => void;
|
|
792
|
+
};
|
|
793
|
+
declare class ApiMachineClient {
|
|
794
|
+
private token;
|
|
795
|
+
private machine;
|
|
796
|
+
private socket;
|
|
797
|
+
private keepAliveInterval;
|
|
798
|
+
private rpcHandlerManager;
|
|
799
|
+
constructor(token: string, machine: Machine);
|
|
800
|
+
setRPCHandlers({ spawnSession, stopSession, requestShutdown }: MachineRpcHandlers): void;
|
|
801
|
+
/**
|
|
802
|
+
* Update machine metadata
|
|
803
|
+
* Currently unused, changes from the mobile client are more likely
|
|
804
|
+
* for example to set a custom name.
|
|
805
|
+
*/
|
|
806
|
+
updateMachineMetadata(handler: (metadata: MachineMetadata | null) => MachineMetadata): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* Update daemon state (runtime info) - similar to session updateAgentState
|
|
809
|
+
* Simplified without lock - relies on backoff for retry
|
|
810
|
+
*/
|
|
811
|
+
updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
|
|
812
|
+
connect(): void;
|
|
813
|
+
private startKeepAlive;
|
|
814
|
+
private stopKeepAlive;
|
|
815
|
+
shutdown(): void;
|
|
816
|
+
}
|
|
817
|
+
|
|
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
|
+
/**
|
|
848
|
+
* Minimal persistence functions for Flockbay CLI
|
|
849
|
+
*
|
|
850
|
+
* Handles settings and private key storage in ~/.flockbay/
|
|
851
|
+
*/
|
|
852
|
+
|
|
853
|
+
type Credentials = {
|
|
854
|
+
token: string;
|
|
855
|
+
encryption: {
|
|
856
|
+
type: 'dataKey';
|
|
857
|
+
publicKey: Uint8Array;
|
|
858
|
+
machineKey: Uint8Array;
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
declare class ApiClient {
|
|
863
|
+
static create(credential: Credentials): Promise<ApiClient>;
|
|
864
|
+
private readonly credential;
|
|
865
|
+
private readonly pushClient;
|
|
866
|
+
private constructor();
|
|
867
|
+
/**
|
|
868
|
+
* Create a new session or load existing one with the given tag
|
|
869
|
+
*/
|
|
870
|
+
getOrCreateSession(opts: {
|
|
871
|
+
tag: string;
|
|
872
|
+
metadata: Metadata;
|
|
873
|
+
state: AgentState | null;
|
|
874
|
+
}): Promise<Session>;
|
|
875
|
+
/**
|
|
876
|
+
* Register or update machine with the server
|
|
877
|
+
* Returns the current machine state from the server with decrypted metadata and daemonState
|
|
878
|
+
*/
|
|
879
|
+
getOrCreateMachine(opts: {
|
|
880
|
+
machineId: string;
|
|
881
|
+
metadata: MachineMetadata;
|
|
882
|
+
daemonState?: DaemonState;
|
|
883
|
+
}): 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
|
+
getMachine(machineId: string): Promise<Machine>;
|
|
889
|
+
sessionSyncClient(session: Session): ApiSessionClient;
|
|
890
|
+
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
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Design decisions:
|
|
906
|
+
* - Logging should be done only through file for debugging, otherwise we might disturb the claude session when in interactive mode
|
|
907
|
+
* - Use info for logs that are useful to the user - this is our UI
|
|
908
|
+
* - File output location: ~/.handy/logs/<date time in local timezone>.log
|
|
909
|
+
*/
|
|
910
|
+
declare class Logger {
|
|
911
|
+
readonly logFilePath: string;
|
|
912
|
+
private dangerouslyUnencryptedServerLoggingUrl;
|
|
913
|
+
private remoteLogErrorCount;
|
|
914
|
+
private lastRemoteLogErrorAt;
|
|
915
|
+
private logFileAppendErrorCount;
|
|
916
|
+
private lastLogFileAppendErrorAt;
|
|
917
|
+
private reportRemoteLoggingError;
|
|
918
|
+
private reportLogFileAppendError;
|
|
919
|
+
constructor(logFilePath?: string);
|
|
920
|
+
localTimezoneTimestamp(): string;
|
|
921
|
+
debug(message: string, ...args: unknown[]): void;
|
|
922
|
+
debugLargeJson(message: string, object: unknown, maxStringLength?: number, maxArrayLength?: number): void;
|
|
923
|
+
info(message: string, ...args: unknown[]): void;
|
|
924
|
+
infoDeveloper(message: string, ...args: unknown[]): void;
|
|
925
|
+
warn(message: string, ...args: unknown[]): void;
|
|
926
|
+
getLogPath(): string;
|
|
927
|
+
private logToConsole;
|
|
928
|
+
private sendToRemoteServer;
|
|
929
|
+
private logToFile;
|
|
930
|
+
}
|
|
931
|
+
declare let logger: Logger;
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Global configuration for Flockbay CLI
|
|
935
|
+
*
|
|
936
|
+
* Centralizes all configuration including environment variables and paths
|
|
937
|
+
* Environment files should be loaded using Node's --env-file flag
|
|
938
|
+
*/
|
|
939
|
+
declare class Configuration {
|
|
940
|
+
readonly serverUrl: string;
|
|
941
|
+
readonly webappUrl: string;
|
|
942
|
+
readonly isDaemonProcess: boolean;
|
|
943
|
+
readonly flockbayHomeDir: string;
|
|
944
|
+
readonly logsDir: string;
|
|
945
|
+
readonly settingsFile: string;
|
|
946
|
+
readonly privateKeyFile: string;
|
|
947
|
+
readonly daemonStateFile: string;
|
|
948
|
+
readonly daemonLockFile: string;
|
|
949
|
+
readonly currentCliVersion: string;
|
|
950
|
+
readonly isExperimentalEnabled: boolean;
|
|
951
|
+
readonly disableCaffeinate: boolean;
|
|
952
|
+
constructor();
|
|
953
|
+
}
|
|
954
|
+
declare const configuration: Configuration;
|
|
955
|
+
|
|
956
|
+
export { ApiClient, ApiSessionClient, RawJSONLinesSchema, configuration, logger };
|
|
957
|
+
export type { RawJSONLines };
|