codelark 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -0
  3. package/SECURITY.md +34 -0
  4. package/SKILL.md +67 -0
  5. package/agents/openai.yaml +4 -0
  6. package/dist/cli.mjs +8794 -0
  7. package/dist/daemon.mjs +47172 -0
  8. package/dist/ui-server.mjs +22165 -0
  9. package/package.json +73 -0
  10. package/schemas/config.v1.schema.json +259 -0
  11. package/schemas/data/audit.v1.schema.json +44 -0
  12. package/schemas/data/auto-tasks.v1.schema.json +94 -0
  13. package/schemas/data/channel-chats.v1.schema.json +159 -0
  14. package/schemas/data/channel-default-targets.v1.schema.json +43 -0
  15. package/schemas/data/messages.v1.schema.json +23 -0
  16. package/schemas/data/number-map.v1.schema.json +9 -0
  17. package/schemas/data/permissions.v1.schema.json +35 -0
  18. package/schemas/data/sessions.v1.schema.json +330 -0
  19. package/schemas/data/string-map.v1.schema.json +9 -0
  20. package/schemas/manifest.json +121 -0
  21. package/scripts/analyze-bridge-log.js +838 -0
  22. package/scripts/build-preflight.d.ts +21 -0
  23. package/scripts/build-preflight.js +70 -0
  24. package/scripts/build.js +53 -0
  25. package/scripts/check-npm-pack.js +46 -0
  26. package/scripts/daemon.ps1 +16 -0
  27. package/scripts/daemon.sh +206 -0
  28. package/scripts/doctor.ps1 +27 -0
  29. package/scripts/doctor.sh +185 -0
  30. package/scripts/hot-update-bridge.sh +298 -0
  31. package/scripts/install-codex-skills.sh +127 -0
  32. package/scripts/install-codex.sh +10 -0
  33. package/scripts/migrate-bindings-to-channel-chats.js +228 -0
  34. package/scripts/patch-codex-sdk-windows-hide.js +96 -0
  35. package/scripts/real-feishu-e2e.ts +5804 -0
  36. package/scripts/run-tests.js +83 -0
  37. package/scripts/setup-wizard-real-e2e.ts +195 -0
  38. package/scripts/supervisor-linux.sh +49 -0
  39. package/scripts/supervisor-macos.sh +167 -0
  40. package/scripts/supervisor-windows.ps1 +481 -0
  41. package/skills/codelark/SKILL.md +67 -0
  42. package/skills/codelark-auto/SKILL.md +80 -0
  43. package/skills/codelark-question/SKILL.md +54 -0
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codelark.local/schemas/data/number-map.v1.schema.json",
4
+ "title": "CodeLark number map store file",
5
+ "type": "object",
6
+ "additionalProperties": {
7
+ "type": "number"
8
+ }
9
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codelark.local/schemas/data/permissions.v1.schema.json",
4
+ "title": "CodeLark data/permissions.json",
5
+ "description": "Map of Codex permission request id to pending/resolved IM permission links.",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "type": "object",
9
+ "required": ["permissionRequestId", "chatId", "messageId", "resolved", "suggestions"],
10
+ "properties": {
11
+ "permissionRequestId": {
12
+ "type": "string",
13
+ "minLength": 1
14
+ },
15
+ "chatId": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "messageId": {
20
+ "type": "string",
21
+ "minLength": 1
22
+ },
23
+ "sessionId": {
24
+ "type": "string"
25
+ },
26
+ "resolved": {
27
+ "type": "boolean"
28
+ },
29
+ "suggestions": {
30
+ "type": "string"
31
+ }
32
+ },
33
+ "additionalProperties": true
34
+ }
35
+ }
@@ -0,0 +1,330 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codelark.local/schemas/data/sessions.v1.schema.json",
4
+ "title": "CodeLark data/sessions.json",
5
+ "description": "Map of bridge session id to BridgeSession records.",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/bridgeSession"
9
+ },
10
+ "$defs": {
11
+ "bridgeSession": {
12
+ "type": "object",
13
+ "required": ["id"],
14
+ "properties": {
15
+ "id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "name": {
20
+ "type": "string"
21
+ },
22
+ "provider_id": {
23
+ "type": "string"
24
+ },
25
+ "runtime": {
26
+ "$ref": "#/$defs/sessionRuntime"
27
+ },
28
+ "session_type": {
29
+ "enum": ["normal", "draft"]
30
+ },
31
+ "hidden": {
32
+ "type": "boolean"
33
+ },
34
+ "parent_session_id": {
35
+ "type": "string"
36
+ },
37
+ "expires_at": {
38
+ "type": "string"
39
+ },
40
+ "runtime_status": {
41
+ "enum": ["idle", "running", "queued"]
42
+ },
43
+ "queued_count": {
44
+ "type": "integer",
45
+ "minimum": 0
46
+ },
47
+ "last_runtime_update_at": {
48
+ "type": "string"
49
+ },
50
+ "health_status": {
51
+ "enum": [
52
+ "idle",
53
+ "running_active",
54
+ "waiting_tool",
55
+ "slow_observed",
56
+ "suspected_stall",
57
+ "suspected_stream_ui_stall",
58
+ "suspected_detached",
59
+ "completed",
60
+ "failed",
61
+ "aborted"
62
+ ]
63
+ },
64
+ "health_reason": {
65
+ "type": "string"
66
+ },
67
+ "last_progress_at": {
68
+ "type": "string"
69
+ },
70
+ "last_progress_type": {
71
+ "type": "string"
72
+ },
73
+ "active_tools_json": {
74
+ "type": "string"
75
+ },
76
+ "active_tool_name": {
77
+ "type": "string"
78
+ },
79
+ "active_tool_started_at": {
80
+ "type": "string"
81
+ },
82
+ "last_tool_finished_at": {
83
+ "type": "string"
84
+ },
85
+ "last_stream_ui_attempt_at": {
86
+ "type": "string"
87
+ },
88
+ "last_stream_ui_update_at": {
89
+ "type": "string"
90
+ },
91
+ "stream_ui_flush_started_at": {
92
+ "type": "string"
93
+ },
94
+ "last_stream_ui_error_at": {
95
+ "type": "string"
96
+ },
97
+ "last_stream_ui_error": {
98
+ "type": "string"
99
+ },
100
+ "stream_ui_consecutive_failures": {
101
+ "type": "integer",
102
+ "minimum": 0
103
+ },
104
+ "mirror_status": {
105
+ "enum": ["inactive", "watching", "stale"]
106
+ },
107
+ "mirror_last_event_at": {
108
+ "type": "string"
109
+ },
110
+ "created_at": {
111
+ "type": "string"
112
+ },
113
+ "updated_at": {
114
+ "type": "string"
115
+ }
116
+ },
117
+ "allOf": [
118
+ {
119
+ "$ref": "#/$defs/noRetiredThreadIdentityFields"
120
+ },
121
+ {
122
+ "$ref": "#/$defs/noRetiredRuntimeTopLevelFields"
123
+ }
124
+ ],
125
+ "additionalProperties": true
126
+ },
127
+ "sessionRuntime": {
128
+ "oneOf": [
129
+ {
130
+ "$ref": "#/$defs/codexSessionRuntime"
131
+ },
132
+ {
133
+ "$ref": "#/$defs/claudeSessionRuntime"
134
+ }
135
+ ]
136
+ },
137
+ "codexSessionRuntime": {
138
+ "type": "object",
139
+ "properties": {
140
+ "activeRuntime": {
141
+ "const": "codex"
142
+ },
143
+ "codex": {
144
+ "type": "object",
145
+ "properties": {
146
+ "threadId": {
147
+ "type": "string"
148
+ },
149
+ "title": {
150
+ "type": "string"
151
+ },
152
+ "model": {
153
+ "type": "string"
154
+ },
155
+ "provider": {
156
+ "enum": ["sdk", "pty", "tmux"]
157
+ },
158
+ "mode": {
159
+ "enum": ["normal", "yolo", "code", "plan", "ask"]
160
+ },
161
+ "sandboxMode": {
162
+ "enum": ["read-only", "workspace-write", "danger-full-access"]
163
+ },
164
+ "networkAccess": {
165
+ "type": "boolean"
166
+ },
167
+ "reasoningEffort": {
168
+ "enum": ["minimal", "low", "medium", "high", "xhigh"]
169
+ }
170
+ },
171
+ "additionalProperties": true
172
+ },
173
+ "claude": {
174
+ "not": {}
175
+ },
176
+ "general": {
177
+ "$ref": "#/$defs/sessionRuntimeGeneral"
178
+ }
179
+ },
180
+ "additionalProperties": true
181
+ },
182
+ "claudeSessionRuntime": {
183
+ "type": "object",
184
+ "required": ["activeRuntime"],
185
+ "properties": {
186
+ "activeRuntime": {
187
+ "const": "claude"
188
+ },
189
+ "codex": {
190
+ "not": {}
191
+ },
192
+ "claude": {
193
+ "type": "object",
194
+ "properties": {
195
+ "sessionId": {
196
+ "type": "string"
197
+ },
198
+ "cwd": {
199
+ "type": "string"
200
+ },
201
+ "model": {
202
+ "type": "string"
203
+ },
204
+ "provider": {
205
+ "enum": ["pty", "sdk"]
206
+ },
207
+ "permissionMode": {
208
+ "type": "string"
209
+ },
210
+ "reasoningEffort": {
211
+ "enum": ["low", "medium", "high", "xhigh", "max"]
212
+ },
213
+ "idleTimeoutMinutes": {
214
+ "type": "integer",
215
+ "minimum": 1
216
+ }
217
+ },
218
+ "additionalProperties": true
219
+ },
220
+ "general": {
221
+ "$ref": "#/$defs/sessionRuntimeGeneral"
222
+ }
223
+ },
224
+ "additionalProperties": true
225
+ },
226
+ "sessionRuntimeGeneral": {
227
+ "type": "object",
228
+ "properties": {
229
+ "workingDirectory": {
230
+ "type": "string"
231
+ },
232
+ "systemPrompt": {
233
+ "type": "string"
234
+ },
235
+ "tmuxSessionName": {
236
+ "type": "string"
237
+ },
238
+ "captureLines": {
239
+ "type": "integer",
240
+ "minimum": 1
241
+ },
242
+ "autoEnter": {
243
+ "type": "boolean"
244
+ },
245
+ "echoInput": {
246
+ "type": "boolean"
247
+ }
248
+ },
249
+ "additionalProperties": true
250
+ },
251
+ "noRetiredRuntimeTopLevelFields": {
252
+ "not": {
253
+ "anyOf": [
254
+ {
255
+ "required": ["working_directory"]
256
+ },
257
+ {
258
+ "required": ["system_prompt"]
259
+ },
260
+ {
261
+ "required": ["model"]
262
+ },
263
+ {
264
+ "required": ["preferred_mode"]
265
+ },
266
+ {
267
+ "required": ["codex_thread_id"]
268
+ },
269
+ {
270
+ "required": ["codex_title"]
271
+ },
272
+ {
273
+ "required": ["reasoning_effort"]
274
+ },
275
+ {
276
+ "required": ["codex_provider"]
277
+ },
278
+ {
279
+ "required": ["codex_sandbox_mode"]
280
+ },
281
+ {
282
+ "required": ["codex_network_access"]
283
+ },
284
+ {
285
+ "required": ["tmux_session_name"]
286
+ },
287
+ {
288
+ "required": ["tmux_capture_lines"]
289
+ },
290
+ {
291
+ "required": ["tmux_auto_enter"]
292
+ },
293
+ {
294
+ "required": ["tmux_echo_input"]
295
+ }
296
+ ]
297
+ }
298
+ },
299
+ "noRetiredThreadIdentityFields": {
300
+ "not": {
301
+ "anyOf": [
302
+ {
303
+ "required": ["sdk_session_id"]
304
+ },
305
+ {
306
+ "required": ["sdkSessionId"]
307
+ },
308
+ {
309
+ "required": ["desktop_thread_id"]
310
+ },
311
+ {
312
+ "required": ["desktopThreadId"]
313
+ },
314
+ {
315
+ "required": ["thread_origin"]
316
+ },
317
+ {
318
+ "required": ["threadOrigin"]
319
+ },
320
+ {
321
+ "required": ["thread_id"]
322
+ },
323
+ {
324
+ "required": ["threadId"]
325
+ }
326
+ ]
327
+ }
328
+ }
329
+ }
330
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codelark.local/schemas/data/string-map.v1.schema.json",
4
+ "title": "CodeLark string map store file",
5
+ "type": "object",
6
+ "additionalProperties": {
7
+ "type": "string"
8
+ }
9
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codelark.local/schemas/manifest.json",
4
+ "schemaVersion": 1,
5
+ "packageName": "codelark",
6
+ "storageRoot": "~/.codelark",
7
+ "validationPolicy": {
8
+ "forbiddenThreadIdentityFields": [
9
+ "sdk_session_id",
10
+ "sdkSessionId",
11
+ "desktop_thread_id",
12
+ "desktopThreadId",
13
+ "thread_origin",
14
+ "threadOrigin",
15
+ "thread_id",
16
+ "threadId"
17
+ ]
18
+ },
19
+ "files": [
20
+ {
21
+ "id": "config.v1",
22
+ "path": "config.json",
23
+ "schema": "schemas/config.v1.schema.json",
24
+ "kind": "config",
25
+ "version": 1,
26
+ "versionField": "schemaVersion",
27
+ "current": true,
28
+ "missingFile": "create-default"
29
+ },
30
+ {
31
+ "id": "data.sessions.v1",
32
+ "path": "data/sessions.json",
33
+ "schema": "schemas/data/sessions.v1.schema.json",
34
+ "kind": "store-map",
35
+ "version": 1,
36
+ "versionField": null,
37
+ "current": true,
38
+ "missingFile": "empty-object"
39
+ },
40
+ {
41
+ "id": "data.channel-chats.v1",
42
+ "path": "data/channel-chats.json",
43
+ "schema": "schemas/data/channel-chats.v1.schema.json",
44
+ "kind": "store-map",
45
+ "version": 1,
46
+ "versionField": null,
47
+ "current": true,
48
+ "missingFile": "empty-object"
49
+ },
50
+ {
51
+ "id": "data.channel-default-targets.v1",
52
+ "path": "data/channel-default-targets.json",
53
+ "schema": "schemas/data/channel-default-targets.v1.schema.json",
54
+ "kind": "store-map",
55
+ "version": 1,
56
+ "versionField": null,
57
+ "current": true,
58
+ "missingFile": "empty-object"
59
+ },
60
+ {
61
+ "id": "data.messages.v1",
62
+ "path": "data/messages/*.json",
63
+ "schema": "schemas/data/messages.v1.schema.json",
64
+ "kind": "store-array",
65
+ "version": 1,
66
+ "versionField": null,
67
+ "current": true,
68
+ "missingFile": "empty-array"
69
+ },
70
+ {
71
+ "id": "data.permissions.v1",
72
+ "path": "data/permissions.json",
73
+ "schema": "schemas/data/permissions.v1.schema.json",
74
+ "kind": "store-map",
75
+ "version": 1,
76
+ "versionField": null,
77
+ "current": true,
78
+ "missingFile": "empty-object"
79
+ },
80
+ {
81
+ "id": "data.offsets.v1",
82
+ "path": "data/offsets.json",
83
+ "schema": "schemas/data/string-map.v1.schema.json",
84
+ "kind": "store-map",
85
+ "version": 1,
86
+ "versionField": null,
87
+ "current": true,
88
+ "missingFile": "empty-object"
89
+ },
90
+ {
91
+ "id": "data.dedup.v1",
92
+ "path": "data/dedup.json",
93
+ "schema": "schemas/data/number-map.v1.schema.json",
94
+ "kind": "store-map",
95
+ "version": 1,
96
+ "versionField": null,
97
+ "current": true,
98
+ "missingFile": "empty-object"
99
+ },
100
+ {
101
+ "id": "data.audit.v1",
102
+ "path": "data/audit.json",
103
+ "schema": "schemas/data/audit.v1.schema.json",
104
+ "kind": "store-array",
105
+ "version": 1,
106
+ "versionField": null,
107
+ "current": true,
108
+ "missingFile": "empty-array"
109
+ },
110
+ {
111
+ "id": "data.auto-tasks.v1",
112
+ "path": "data/auto-tasks.json",
113
+ "schema": "schemas/data/auto-tasks.v1.schema.json",
114
+ "kind": "store-map",
115
+ "version": 1,
116
+ "versionField": null,
117
+ "current": true,
118
+ "missingFile": "empty-object"
119
+ }
120
+ ]
121
+ }