cocheck 0.4.0 → 0.4.1

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 (81) hide show
  1. package/README.md +17 -3
  2. package/dist/agent-transcripts.js +15 -12
  3. package/dist/attribution/evidence.js +2 -1
  4. package/dist/attribution/reconstruct.js +19 -0
  5. package/dist/attribution/tag.js +3 -3
  6. package/dist/build-info.json +1 -1
  7. package/dist/cli.js +31 -11
  8. package/dist/connector/export-view.js +1 -1
  9. package/dist/coverage.js +5 -3
  10. package/dist/credit-guard.js +59 -54
  11. package/dist/harness-cmd/create.js +76 -0
  12. package/dist/harness-cmd/index.js +19 -0
  13. package/dist/harness-cmd/record.js +327 -0
  14. package/dist/harness-cmd/scrub.js +25 -0
  15. package/dist/harness-cmd/test.js +318 -0
  16. package/dist/harnesses/README.md +5 -0
  17. package/dist/harnesses/claude/cocheck-harness.json +344 -0
  18. package/dist/harnesses/codex/cocheck-harness.json +212 -0
  19. package/dist/harnesses/copilot/cocheck-harness.json +296 -0
  20. package/dist/{copilot-helpers.js → helper-linker.js} +43 -32
  21. package/dist/hook-adapter.js +287 -63
  22. package/dist/hook-cli.js +73 -36
  23. package/dist/hook-journal.js +40 -12
  24. package/dist/hosts/claude.js +23 -159
  25. package/dist/hosts/codex.js +41 -81
  26. package/dist/hosts/compile.js +275 -0
  27. package/dist/hosts/copilot.js +7 -162
  28. package/dist/hosts/extras.js +55 -0
  29. package/dist/hosts/harnesses.js +66 -0
  30. package/dist/hosts/index.js +176 -8
  31. package/dist/hosts/install-block.js +332 -0
  32. package/dist/hosts/manifest.js +372 -0
  33. package/dist/hosts/shared.js +21 -0
  34. package/dist/hosts/tool-classes.js +6 -0
  35. package/dist/hosts/types.js +1 -0
  36. package/dist/install.js +69 -22
  37. package/dist/ledger.js +11 -0
  38. package/dist/normalize.js +33 -9
  39. package/dist/open-pick.js +5 -3
  40. package/dist/patch-secrets.js +11 -11
  41. package/dist/review-server.js +2 -2
  42. package/dist/timeline/attribution.js +2 -2
  43. package/dist/timeline/describe.js +20 -17
  44. package/dist/timeline/load.js +2 -2
  45. package/dist/timeline/rail/assets/review.js +1 -1
  46. package/dist/timeline/rail/model.js +8 -8
  47. package/dist/timeline/read-signal.js +4 -4
  48. package/dist/timeline/render/view-v1.js +2 -13
  49. package/dist/timeline/runs.js +9 -9
  50. package/dist/timeline/timeline.js +8 -8
  51. package/dist/timeline/write-signal.js +4 -3
  52. package/package.json +2 -2
  53. package/public-kit/harness/GUIDE.md +81 -0
  54. package/public-kit/harness/README.md +10 -0
  55. package/public-kit/harness/cases/claude/shell-writes-file.json +120 -0
  56. package/public-kit/harness/cases/codex/apply-patch-writes-files.json +177 -0
  57. package/public-kit/harness/cases/codex/helper-writes-file.json +160 -0
  58. package/public-kit/harness/cases/codex/shell-writes-and-fails.json +110 -0
  59. package/public-kit/harness/cases/copilot/camel-case-patch-and-failure.json +126 -0
  60. package/public-kit/harness/cases/copilot/helper-writes-file.json +209 -0
  61. package/public-kit/harness/cases/copilot/vscode-helper-writes-file.json +236 -0
  62. package/public-kit/harness/examples/toyagent/cases/write-notes.json +142 -0
  63. package/public-kit/harness/examples/toyagent/cocheck-harness.json +47 -0
  64. package/public-kit/harness/examples/toyagent/recordings/payloads.jsonl +8 -0
  65. package/public-kit/harness/harnesses/antigravity/README.md +32 -0
  66. package/public-kit/harness/harnesses/antigravity/cases/failed-edit.json +99 -0
  67. package/public-kit/harness/harnesses/antigravity/cases/helper-writes-file.json +270 -0
  68. package/public-kit/harness/harnesses/antigravity/cases/shell-ok-fail-and-denied.json +211 -0
  69. package/public-kit/harness/harnesses/antigravity/cases/write-then-edit.json +191 -0
  70. package/public-kit/harness/harnesses/antigravity/cocheck-harness.json +62 -0
  71. package/public-kit/harness/harnesses/antigravity/recordings/payloads.jsonl +63 -0
  72. package/public-kit/harness/harnesses/cursor/README.md +40 -0
  73. package/public-kit/harness/harnesses/cursor/cases/editor-write-edit-shell-helper.json +359 -0
  74. package/public-kit/harness/harnesses/cursor/cases/read-then-write-one-call-id.json +159 -0
  75. package/public-kit/harness/harnesses/cursor/cocheck-harness.json +67 -0
  76. package/public-kit/harness/harnesses/cursor/recordings/payloads.jsonl +28 -0
  77. package/public-kit/harness/scaffold/README.md +42 -0
  78. package/public-kit/harness/scaffold/cocheck-harness.json +72 -0
  79. package/public-kit/harness/scaffold/recordings/.gitkeep +0 -0
  80. package/public-kit/harness/spec/v1.md +286 -0
  81. package/scripts/hook-launch.sh +1 -1
@@ -0,0 +1,212 @@
1
+ {
2
+ "schema": "cocheck-harness/1",
3
+ "key": "codex",
4
+ "displayName": "Codex",
5
+ "chip": "C",
6
+ "testedVersions": [
7
+ "0.162.0-alpha.2",
8
+ "0.164.0-alpha.11.1"
9
+ ],
10
+ "events": {
11
+ "PreToolUse": "tool-pre",
12
+ "PostToolUse": "tool-post",
13
+ "PostToolUseFailure": "tool-failure",
14
+ "Stop": "stop",
15
+ "SubagentStop": "subagent-stop",
16
+ "UserPromptSubmit": "prompt"
17
+ },
18
+ "eventFrom": {
19
+ "payload": "hook_event_name"
20
+ },
21
+ "fields": {
22
+ "session": "session_id",
23
+ "eventName": "hook_event_name",
24
+ "cwd": "cwd",
25
+ "toolName": "tool_name",
26
+ "toolInput": "tool_input",
27
+ "toolResponse": "tool_response",
28
+ "agentId": "agent_id",
29
+ "agentType": "agent_type",
30
+ "transcriptPath": "transcript_path",
31
+ "lastAssistantMessage": "last_assistant_message",
32
+ "prompt": "prompt",
33
+ "callReason": "description"
34
+ },
35
+ "callId": {
36
+ "payload": "tool_use_id"
37
+ },
38
+ "extraFields": {
39
+ "turnId": "turn_id",
40
+ "permissionMode": "permission_mode",
41
+ "model": "model",
42
+ "stopHookActive": "stop_hook_active"
43
+ },
44
+ "toolClasses": {
45
+ "send_message": {
46
+ "class": "never-credited"
47
+ },
48
+ "list_agents": {
49
+ "class": "never-credited"
50
+ },
51
+ "apply_patch": {
52
+ "class": "patch",
53
+ "anyCase": true
54
+ },
55
+ "patch": {
56
+ "class": "patch",
57
+ "anyCase": true
58
+ },
59
+ "spawn_agent": {
60
+ "class": "launcher"
61
+ },
62
+ "wait_agent": {
63
+ "class": "wait"
64
+ },
65
+ "Bash": {
66
+ "class": "shell",
67
+ "dialect": "bash",
68
+ "backgroundable": true,
69
+ "anyCase": true
70
+ },
71
+ "shell": {
72
+ "class": "shell",
73
+ "anyCase": true
74
+ },
75
+ "sh": {
76
+ "class": "shell",
77
+ "anyCase": true
78
+ },
79
+ "zsh": {
80
+ "class": "shell",
81
+ "anyCase": true
82
+ },
83
+ "exec": {
84
+ "class": "shell",
85
+ "anyCase": true
86
+ },
87
+ "exec_command": {
88
+ "class": "shell",
89
+ "anyCase": true
90
+ },
91
+ "local_shell": {
92
+ "class": "shell",
93
+ "anyCase": true
94
+ },
95
+ "container.exec": {
96
+ "class": "shell",
97
+ "anyCase": true
98
+ },
99
+ "run_shell_command": {
100
+ "class": "shell",
101
+ "anyCase": true
102
+ },
103
+ "terminal": {
104
+ "class": "shell",
105
+ "anyCase": true
106
+ },
107
+ "powershell": {
108
+ "class": "shell",
109
+ "dialect": "powershell",
110
+ "anyCase": true
111
+ },
112
+ "pwsh": {
113
+ "class": "shell",
114
+ "dialect": "powershell",
115
+ "anyCase": true
116
+ }
117
+ },
118
+ "narration": {
119
+ "sources": [
120
+ {
121
+ "kind": "commentary-before-call",
122
+ "readableAt": "pre",
123
+ "reason": true
124
+ },
125
+ {
126
+ "kind": "closing-message",
127
+ "readableAt": "post"
128
+ }
129
+ ]
130
+ },
131
+ "capabilities": {
132
+ "failureEvent": false,
133
+ "argvTag": false,
134
+ "helperSessions": false,
135
+ "launchKey": false,
136
+ "readsForeignHooks": false
137
+ },
138
+ "install": {
139
+ "skillRoot": ".agents/skills",
140
+ "inBothAlias": true,
141
+ "reusesRecord": true,
142
+ "hostFlag": "codex",
143
+ "folderFromPayloadCwd": true,
144
+ "editorExtra": "codex-toml-editor",
145
+ "events": [
146
+ "SessionStart",
147
+ "PreToolUse",
148
+ "PostToolUse",
149
+ "SubagentStart",
150
+ "SubagentStop",
151
+ "Stop",
152
+ "UserPromptSubmit"
153
+ ],
154
+ "checkPayload": {
155
+ "payload": {
156
+ "session_id": "install-check",
157
+ "cwd": "{folder}",
158
+ "hook_event_name": "PreToolUse",
159
+ "tool_name": "Bash",
160
+ "tool_use_id": "install-check-1",
161
+ "tool_input": {
162
+ "command": "true"
163
+ }
164
+ }
165
+ },
166
+ "afterInstall": "Codex asks you to trust new hooks before they run: open Codex and trust the new hooks in Codex once, or CoCheck records nothing from it."
167
+ },
168
+ "extras": [
169
+ "codex-rollout-narration",
170
+ "codex-rollout-locate",
171
+ "codex-helper-rollout-lookup",
172
+ "codex-rollout-call-readers",
173
+ "codex-display-text",
174
+ "codex-session-title",
175
+ "codex-failure-read",
176
+ "codex-tool-name",
177
+ "codex-trust-probe"
178
+ ],
179
+ "shape": {
180
+ "SessionStart": [
181
+ "session_id"
182
+ ],
183
+ "SubagentStart": [
184
+ "session_id",
185
+ "agent_id"
186
+ ],
187
+ "SubagentStop": [
188
+ "session_id",
189
+ "agent_id"
190
+ ],
191
+ "PreToolUse": [
192
+ "session_id",
193
+ "tool_name",
194
+ "tool_use_id",
195
+ "tool_input"
196
+ ],
197
+ "PostToolUse": [
198
+ "session_id",
199
+ "tool_name",
200
+ "tool_use_id",
201
+ "tool_input",
202
+ "tool_response"
203
+ ],
204
+ "Stop": [
205
+ "session_id"
206
+ ],
207
+ "UserPromptSubmit": [
208
+ "session_id",
209
+ "prompt"
210
+ ]
211
+ }
212
+ }
@@ -0,0 +1,296 @@
1
+ {
2
+ "schema": "cocheck-harness/1",
3
+ "key": "copilot",
4
+ "displayName": "Copilot",
5
+ "chip": "P",
6
+ "testedVersions": [
7
+ "1.0.93",
8
+ "1.0.98",
9
+ "1.140.0"
10
+ ],
11
+ "events": {
12
+ "userPromptSubmitted": "prompt",
13
+ "sessionStart": "other",
14
+ "sessionEnd": "other",
15
+ "preToolUse": "tool-pre",
16
+ "postToolUse": "tool-post",
17
+ "postToolUseFailure": "tool-failure",
18
+ "agentStop": "stop",
19
+ "subagentStart": "other",
20
+ "subagentStop": "subagent-stop",
21
+ "userPromptTransformed": "other",
22
+ "permissionRequest": "other",
23
+ "notification": "other"
24
+ },
25
+ "eventFrom": {
26
+ "arg": "--event"
27
+ },
28
+ "unverifiedEvents": [
29
+ "errorOccurred",
30
+ "preCompact"
31
+ ],
32
+ "fields": {
33
+ "session": "sessionId",
34
+ "cwd": "cwd",
35
+ "toolName": "toolName",
36
+ "toolInput": "toolArgs",
37
+ "toolResponse": "toolResult",
38
+ "agentId": "agentId",
39
+ "agentType": "agentType",
40
+ "transcriptPath": "transcriptPath",
41
+ "lastAssistantMessage": "response",
42
+ "prompt": "prompt",
43
+ "parentSession": "parentAgentId",
44
+ "callReason": "description"
45
+ },
46
+ "toolInputEncoding": "json-text",
47
+ "callId": {
48
+ "payload": "toolCallId",
49
+ "synthesized": true
50
+ },
51
+ "extraFields": {
52
+ "stopHookActive": "stop_hook_active"
53
+ },
54
+ "failure": {
55
+ "tool-failure": {
56
+ "text": [
57
+ "error"
58
+ ]
59
+ },
60
+ "tool-post": {
61
+ "exitCode": {
62
+ "from": "toolResult.textResultForLlm",
63
+ "pattern": "<shellId:\\s*[^>]*?completed with exit code (-?\\d+)>"
64
+ }
65
+ }
66
+ },
67
+ "refine": [
68
+ {
69
+ "kinds": [
70
+ "prompt",
71
+ "stop"
72
+ ],
73
+ "becomes": "other",
74
+ "whenPresent": "agentId"
75
+ },
76
+ {
77
+ "kinds": [
78
+ "prompt"
79
+ ],
80
+ "becomes": "prompt",
81
+ "whenMatches": {
82
+ "path": "prompt",
83
+ "pattern": "^<system_notification>[\\s\\S]*(?:<system_notification>|<\\/system_notification>)[\\s\\S]*<\\/system_notification>$"
84
+ }
85
+ },
86
+ {
87
+ "kinds": [
88
+ "prompt"
89
+ ],
90
+ "becomes": "other",
91
+ "whenMatches": {
92
+ "path": "prompt",
93
+ "pattern": "^<system_notification>[\\s\\S]*<\\/system_notification>$"
94
+ }
95
+ }
96
+ ],
97
+ "toolClasses": {
98
+ "glob": {
99
+ "class": "read-only"
100
+ },
101
+ "rg": {
102
+ "class": "read-only"
103
+ },
104
+ "view": {
105
+ "class": "read-only"
106
+ },
107
+ "list_agents": {
108
+ "class": "never-credited"
109
+ },
110
+ "Read": {
111
+ "class": "read"
112
+ },
113
+ "Edit": {
114
+ "class": "edit",
115
+ "pathFields": [
116
+ "file_path",
117
+ "path"
118
+ ],
119
+ "pathChecked": true,
120
+ "fileInput": true,
121
+ "anyCase": true
122
+ },
123
+ "Bash": {
124
+ "class": "shell",
125
+ "dialect": "bash",
126
+ "backgroundable": true,
127
+ "anyCase": true
128
+ },
129
+ "create": {
130
+ "class": "write",
131
+ "pathFields": [
132
+ "path",
133
+ "file_path"
134
+ ],
135
+ "anyCase": true
136
+ },
137
+ "edit": {
138
+ "class": "edit",
139
+ "pathFields": [
140
+ "file_path",
141
+ "path"
142
+ ],
143
+ "anyCase": true
144
+ },
145
+ "apply_patch": {
146
+ "class": "patch",
147
+ "anyCase": true
148
+ },
149
+ "patch": {
150
+ "class": "patch",
151
+ "anyCase": true
152
+ },
153
+ "task": {
154
+ "class": "launcher"
155
+ },
156
+ "read_agent": {
157
+ "class": "wait",
158
+ "waitFlag": "wait"
159
+ },
160
+ "bash": {
161
+ "class": "shell",
162
+ "dialect": "bash",
163
+ "anyCase": true
164
+ },
165
+ "powershell": {
166
+ "class": "shell",
167
+ "dialect": "powershell",
168
+ "anyCase": true
169
+ },
170
+ "pwsh": {
171
+ "class": "shell",
172
+ "dialect": "powershell",
173
+ "anyCase": true
174
+ }
175
+ },
176
+ "narration": {
177
+ "sources": [
178
+ {
179
+ "kind": "commentary-before-call",
180
+ "readableAt": "pre",
181
+ "reason": true
182
+ },
183
+ {
184
+ "kind": "closing-message",
185
+ "readableAt": "post"
186
+ }
187
+ ],
188
+ "closingWaitMs": 1000
189
+ },
190
+ "capabilities": {
191
+ "failureEvent": false,
192
+ "argvTag": false,
193
+ "helperSessions": true,
194
+ "launchKey": true,
195
+ "readsForeignHooks": true
196
+ },
197
+ "foreignHookFingerprint": {
198
+ "present": [
199
+ "timestamp"
200
+ ],
201
+ "strings": [
202
+ "hook_event_name"
203
+ ],
204
+ "absent": [
205
+ "permission_mode",
206
+ "tool_use_id",
207
+ "turn_id"
208
+ ]
209
+ },
210
+ "readsConfigsOf": [
211
+ "claude"
212
+ ],
213
+ "install": {
214
+ "skillRoot": ".copilot/skills",
215
+ "hostFlag": "copilot",
216
+ "folderFromPayloadCwd": true,
217
+ "ownsFile": true,
218
+ "promptContext": false,
219
+ "afterInstall": "Copilot trust step for user-level hooks: unverified. Repo hooks need a trusted folder; whether hooks in ~/.copilot/hooks ask for trust too is not known yet. If Copilot asks, trust them once, or CoCheck records nothing from it.",
220
+ "notes": "If you turn on Copilot's sandbox (copilot --sandbox, or /sandbox enable), its hooks stop working unless settings.json grants them access: add {launcherDir} and {home} to sandbox.userPolicy.filesystem.readwritePaths. CoCheck does not edit your Copilot settings.",
221
+ "checkPayload": {
222
+ "payload": {
223
+ "sessionId": "install-check",
224
+ "cwd": "{folder}",
225
+ "toolName": "bash",
226
+ "toolArgs": {
227
+ "command": "true"
228
+ }
229
+ },
230
+ "event": "preToolUse"
231
+ },
232
+ "format": "json",
233
+ "path": "{env:COPILOT_HOME|{home}/.copilot}/hooks/cocheck.json",
234
+ "mode": "owned",
235
+ "rootKey": "hooks",
236
+ "envelope": {
237
+ "version": 1
238
+ },
239
+ "events": [
240
+ "userPromptSubmitted",
241
+ "preToolUse",
242
+ "postToolUse",
243
+ "postToolUseFailure",
244
+ "agentStop",
245
+ "subagentStop"
246
+ ],
247
+ "entryTemplate": {
248
+ "type": "command",
249
+ "bash": "{command}",
250
+ "timeoutSec": 30
251
+ },
252
+ "eventInCommand": true,
253
+ "failOpenEvents": [
254
+ "preToolUse"
255
+ ],
256
+ "windowsCommandKey": "powershell"
257
+ },
258
+ "extras": [
259
+ "copilot-events-narration",
260
+ "copilot-events-locate",
261
+ "helper-linker",
262
+ "copilot-session-title"
263
+ ],
264
+ "shape": {
265
+ "preToolUse": [
266
+ "sessionId",
267
+ "cwd",
268
+ "toolName",
269
+ "toolArgs"
270
+ ],
271
+ "postToolUse": [
272
+ "sessionId",
273
+ "cwd",
274
+ "toolName",
275
+ "toolArgs",
276
+ "toolResult"
277
+ ],
278
+ "postToolUseFailure": [
279
+ "sessionId",
280
+ "cwd",
281
+ "toolName",
282
+ "toolArgs",
283
+ "error"
284
+ ],
285
+ "agentStop": [
286
+ "sessionId",
287
+ "cwd",
288
+ "transcriptPath"
289
+ ],
290
+ "userPromptSubmitted": [
291
+ "sessionId",
292
+ "cwd",
293
+ "prompt"
294
+ ]
295
+ }
296
+ }