carlos-flow 0.0.0-stage → 2.6.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.
package/ghost.json ADDED
@@ -0,0 +1,405 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "minCindyVersion": "1.0.2",
4
+ "id": "carlos-flow",
5
+ "name": "Carlos 工作流",
6
+ "description": "机械门禁 MCP:留痕/派发/裁定/审计/快照/免检/还原。自动管理 Bridge 后台常驻,首次调用 ~3-5s,后续 ~1s。",
7
+ "whenToUse": "需要走 Carlos 工作流门禁时使用:留痕/派发/裁定/审计/快照/免检/还原",
8
+ "version": "2.6.0",
9
+ "kind": "mcp",
10
+ "entry": "client/carlos.js",
11
+ "command": "门禁",
12
+ "node": {
13
+ "entry": "__ROOT__/bridge/mcp-bridge.js",
14
+ "protocol": "json-rpc-stdio",
15
+ "lifecycle": "on-demand",
16
+ "idleTimeoutSeconds": 300
17
+ },
18
+ "settingsHtml": "settings.html",
19
+ "tools": [
20
+ {
21
+ "name": "flow_protocol",
22
+ "description": "读取 Carlos 工作流协议全文(路由档位 T0/T1/T2、四段合同、报告规格、错误分层、状态字段、审计事件类型、免检触发词、任务卡模板)。",
23
+ "parameters": {
24
+ "type": "object",
25
+ "properties": {}
26
+ }
27
+ },
28
+ {
29
+ "name": "flow_submit_requirement",
30
+ "description": "提交(留痕)一张任务卡,作为后续派发的唯一依据。任何 T2 改动前必须先调用本工具。",
31
+ "parameters": {
32
+ "type": "object",
33
+ "properties": {
34
+ "goal": {
35
+ "type": "string",
36
+ "description": "一句话目标(任务卡 objective)"
37
+ },
38
+ "quote": {
39
+ "type": "string",
40
+ "description": "用户原话摘录,用于锚点校验,必须能在用户消息中定位"
41
+ },
42
+ "scope": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ },
47
+ "description": "只准改动的文件清单(相对 cwd 的路径)"
48
+ },
49
+ "acceptance": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ },
54
+ "description": "可判定的验收标准"
55
+ },
56
+ "unknowns": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "string"
60
+ },
61
+ "description": "未知/待澄清事项"
62
+ },
63
+ "assumptions": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string"
67
+ },
68
+ "description": "已做的假设"
69
+ },
70
+ "files": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "object",
74
+ "properties": {
75
+ "path": {
76
+ "type": "string"
77
+ },
78
+ "line": {
79
+ "type": "number"
80
+ }
81
+ },
82
+ "required": [
83
+ "path",
84
+ "line"
85
+ ]
86
+ },
87
+ "description": "关键定位点"
88
+ },
89
+ "verify": {
90
+ "type": "object",
91
+ "properties": {
92
+ "cmd": {
93
+ "type": "string"
94
+ }
95
+ },
96
+ "description": "主 Agent 指定的验证命令"
97
+ },
98
+ "confirmed": {
99
+ "type": "boolean",
100
+ "description": "敏感路径是否已获用户确认(sensitive 档必须为 true)"
101
+ },
102
+ "parallel_plan": {
103
+ "type": "string",
104
+ "description": "并行派发计划说明(可选)"
105
+ },
106
+ "sessionId": {
107
+ "type": "string",
108
+ "description": "会话 ID,默认 unknown"
109
+ },
110
+ "cwd": {
111
+ "type": "string",
112
+ "description": "工作目录,默认 process.cwd()"
113
+ },
114
+ "userMessages": {
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string"
118
+ },
119
+ "description": "用户原话列表(可选)"
120
+ },
121
+ "cardText": {
122
+ "type": "string",
123
+ "description": "完整任务卡文本,含 FLOW_CARD: 前缀"
124
+ }
125
+ },
126
+ "required": [
127
+ "goal",
128
+ "quote",
129
+ "scope"
130
+ ]
131
+ }
132
+ },
133
+ {
134
+ "name": "flow_claim",
135
+ "description": "领取一次派发名额(executor 或 auditor)。返回四段合同 prompt,可直接作为子 Agent 的任务描述。",
136
+ "parameters": {
137
+ "type": "object",
138
+ "properties": {
139
+ "sessionId": {
140
+ "type": "string",
141
+ "description": "会话 ID,默认 unknown"
142
+ },
143
+ "role": {
144
+ "type": "string",
145
+ "enum": [
146
+ "executor",
147
+ "auditor"
148
+ ],
149
+ "description": "领取角色"
150
+ },
151
+ "cwd": {
152
+ "type": "string",
153
+ "description": "工作目录,默认 process.cwd()"
154
+ }
155
+ },
156
+ "required": [
157
+ "sessionId",
158
+ "role"
159
+ ]
160
+ }
161
+ },
162
+ {
163
+ "name": "flow_dispatch",
164
+ "description": "按四段合同派发子 Agent。派发前会自动对 scope 内文件做快照。",
165
+ "parameters": {
166
+ "type": "object",
167
+ "properties": {
168
+ "sessionId": {
169
+ "type": "string",
170
+ "description": "会话 ID,默认 unknown"
171
+ },
172
+ "role": {
173
+ "type": "string",
174
+ "enum": [
175
+ "executor",
176
+ "auditor"
177
+ ],
178
+ "description": "派发角色"
179
+ },
180
+ "message": {
181
+ "type": "string",
182
+ "description": "附加说明,原样附在合同末尾"
183
+ },
184
+ "run": {
185
+ "type": "boolean",
186
+ "description": "true = 由本工具直接运行 opencode;false/absent = 只返回 prompt"
187
+ },
188
+ "cwd": {
189
+ "type": "string",
190
+ "description": "工作目录,默认 process.cwd()"
191
+ }
192
+ },
193
+ "required": [
194
+ "sessionId",
195
+ "role"
196
+ ]
197
+ }
198
+ },
199
+ {
200
+ "name": "flow_verdict",
201
+ "description": "记录 auditor 的裁定结果(PASS / DIRECTION / LOCAL)。只有 PASS 会把 completed_ok 置为 true。",
202
+ "parameters": {
203
+ "type": "object",
204
+ "properties": {
205
+ "sessionId": {
206
+ "type": "string",
207
+ "description": "会话 ID,默认 unknown"
208
+ },
209
+ "verdict": {
210
+ "type": "string",
211
+ "enum": [
212
+ "PASS",
213
+ "DIRECTION",
214
+ "LOCAL"
215
+ ],
216
+ "description": "裁定结果"
217
+ },
218
+ "notes": {
219
+ "type": "string",
220
+ "description": "裁定说明/证据摘要"
221
+ },
222
+ "role": {
223
+ "type": "string",
224
+ "description": "记录裁定者角色(通常 auditor)"
225
+ },
226
+ "cwd": {
227
+ "type": "string",
228
+ "description": "工作目录,默认 process.cwd()"
229
+ }
230
+ },
231
+ "required": [
232
+ "sessionId",
233
+ "verdict"
234
+ ]
235
+ }
236
+ },
237
+ {
238
+ "name": "flow_status",
239
+ "description": "查询当前会话的门禁状态:是否有任务卡、风险档、已派发次数/上限、裁定结果、是否过期、是否处于免检模式。",
240
+ "parameters": {
241
+ "type": "object",
242
+ "properties": {
243
+ "sessionId": {
244
+ "type": "string",
245
+ "description": "会话 ID,默认 unknown"
246
+ }
247
+ },
248
+ "required": [
249
+ "sessionId"
250
+ ]
251
+ }
252
+ },
253
+ {
254
+ "name": "flow_audit",
255
+ "description": "读取审计流水,返回事件列表与按 type/kind 的统计。",
256
+ "parameters": {
257
+ "type": "object",
258
+ "properties": {
259
+ "sessionId": {
260
+ "type": "string",
261
+ "description": "会话 ID;不传则聚合全部"
262
+ },
263
+ "type": {
264
+ "type": "string",
265
+ "description": "事件类型过滤:run / finding / decision / resolution"
266
+ },
267
+ "limit": {
268
+ "type": "number",
269
+ "description": "最多返回最近 N 条"
270
+ },
271
+ "date": {
272
+ "type": "string",
273
+ "description": "YYYY-MM-DD,默认今天"
274
+ }
275
+ }
276
+ }
277
+ },
278
+ {
279
+ "name": "flow_diff_hunks",
280
+ "description": "对指定文件跑 git diff -U0 并解析出每个文件的 hunk 范围。",
281
+ "parameters": {
282
+ "type": "object",
283
+ "properties": {
284
+ "cwd": {
285
+ "type": "string",
286
+ "description": "仓库工作目录,默认 process.cwd()"
287
+ },
288
+ "paths": {
289
+ "type": "array",
290
+ "items": {
291
+ "type": "string"
292
+ },
293
+ "description": "要检查的文件路径列表"
294
+ }
295
+ },
296
+ "required": [
297
+ "cwd"
298
+ ]
299
+ }
300
+ },
301
+ {
302
+ "name": "flow_bypass",
303
+ "description": "开关免检模式。仅在用户明确授权时使用。",
304
+ "parameters": {
305
+ "type": "object",
306
+ "properties": {
307
+ "sessionId": {
308
+ "type": "string",
309
+ "description": "会话 ID,默认 unknown"
310
+ },
311
+ "on": {
312
+ "type": "boolean",
313
+ "description": "true 开启免检,false 关闭"
314
+ },
315
+ "reason": {
316
+ "type": "string",
317
+ "description": "开启/关闭理由(建议写用户原话)"
318
+ }
319
+ },
320
+ "required": [
321
+ "sessionId",
322
+ "on"
323
+ ]
324
+ }
325
+ },
326
+ {
327
+ "name": "flow_add_user_msg",
328
+ "description": "写入一条用户原话到会话消息文件,供 quote 锚点校验使用。",
329
+ "parameters": {
330
+ "type": "object",
331
+ "properties": {
332
+ "sessionId": {
333
+ "type": "string",
334
+ "description": "会话 ID,默认 unknown"
335
+ },
336
+ "text": {
337
+ "type": "string",
338
+ "description": "用户原话原文"
339
+ }
340
+ },
341
+ "required": [
342
+ "sessionId",
343
+ "text"
344
+ ]
345
+ }
346
+ },
347
+ {
348
+ "name": "flow_save_result",
349
+ "description": "保存子 Agent 执行结果到会话目录。",
350
+ "parameters": {
351
+ "type": "object",
352
+ "properties": {
353
+ "sessionId": {
354
+ "type": "string",
355
+ "description": "会话 ID,默认 unknown"
356
+ },
357
+ "role": {
358
+ "type": "string",
359
+ "enum": [
360
+ "executor",
361
+ "auditor"
362
+ ],
363
+ "description": "执行角色"
364
+ },
365
+ "stdout": {
366
+ "type": "string",
367
+ "description": "子 Agent 的 stdout"
368
+ },
369
+ "stderr": {
370
+ "type": "string",
371
+ "description": "子 Agent 的 stderr"
372
+ },
373
+ "code": {
374
+ "type": "number",
375
+ "description": "退出码"
376
+ }
377
+ },
378
+ "required": [
379
+ "sessionId",
380
+ "role"
381
+ ]
382
+ }
383
+ },
384
+ {
385
+ "name": "flow_revert_plan",
386
+ "description": "根据本次会话的快照 manifest 生成还原计划。只返回计划,不自动执行。",
387
+ "parameters": {
388
+ "type": "object",
389
+ "properties": {
390
+ "sessionId": {
391
+ "type": "string",
392
+ "description": "会话 ID,默认 unknown"
393
+ },
394
+ "cwd": {
395
+ "type": "string",
396
+ "description": "工作目录,默认 process.cwd()"
397
+ }
398
+ },
399
+ "required": [
400
+ "sessionId"
401
+ ]
402
+ }
403
+ }
404
+ ]
405
+ }
package/opencode.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "mcp": {
4
+ "carlos-flow": {
5
+ "type": "local",
6
+ "command": [
7
+ "node",
8
+ "__ROOT__/src/index.js"
9
+ ],
10
+ "enabled": true,
11
+ "environment": {
12
+ "CARLOS_FLOW_HOME": "<CARLOS_FLOW_HOME>"
13
+ }
14
+ }
15
+ },
16
+ "instructions": [
17
+ "__ROOT__/README.md"
18
+ ],
19
+ "model": "<YOUR_PREFERRED_MODEL>",
20
+ "agent": {
21
+ "carlos": {
22
+ "permission": {
23
+ "question": "allow",
24
+ "*": "allow"
25
+ }
26
+ }
27
+ },
28
+ "permission": {
29
+ "question": "allow",
30
+ "*": "allow"
31
+ }
32
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "mcp": {
4
+ "carlos-flow": {
5
+ "type": "local",
6
+ "command": [
7
+ "node",
8
+ "__ROOT__/src/index.js"
9
+ ],
10
+ "enabled": true,
11
+ "environment": {
12
+ "CARLOS_FLOW_HOME": "<CARLOS_FLOW_HOME>"
13
+ }
14
+ }
15
+ },
16
+ "instructions": [
17
+ "__ROOT__/README.md"
18
+ ],
19
+ "model": "<YOUR_PREFERRED_MODEL>",
20
+ "agent": {
21
+ "carlos": {
22
+ "permission": {
23
+ "question": "allow",
24
+ "*": "allow"
25
+ }
26
+ }
27
+ },
28
+ "permission": {
29
+ "question": "allow",
30
+ "*": "allow"
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,6 +1,89 @@
1
1
  {
2
2
  "name": "carlos-flow",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.6.0",
4
+ "description": "Carlos 工作流 — AI 编码 Agent 的机械门禁。留痕/派发/验证/裁定/审计/还原,约束写在代码里而非提示词里。单一包支持 Cindy/OpenCode/Cursor/Cline/VS Code/Claude Desktop。",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "bin": {
8
+ "carlos-flow": "client/carlos.js",
9
+ "carlos-flow-cindy": "client/carlos.js",
10
+ "carlos-flow-opencode": "client/carlos.js"
11
+ },
12
+ "exports": {
13
+ ".": "./src/index.js",
14
+ "./cindy": "./ghost.json",
15
+ "./opencode": "./opencode.json",
16
+ "./trigger-config": "./trigger-config.usable.json"
17
+ },
18
+ "scripts": {
19
+ "test": "node test/smoke.js",
20
+ "test:e2e": "node test/e2e-carlos.mjs",
21
+ "test:p0": "node test/p0-gates.mjs",
22
+ "test:trigger": "node test/trigger-e2e.mjs",
23
+ "test:concurrency": "node test/concurrency-e2e.mjs",
24
+ "test:acceptance": "node test/e2e-acceptance.mjs",
25
+ "test:all": "npm run test && npm run test:e2e && npm run test:p0 && npm run test:trigger && npm run test:concurrency && npm run test:acceptance",
26
+ "test:mutation": "node scripts/mutation-check.mjs",
27
+ "sync:readme": "node scripts/sync-readme.mjs",
28
+ "check:readme": "node scripts/sync-readme.mjs --check",
29
+ "check:parity": "node scripts/check-repo-parity.mjs",
30
+ "clean:readme": "node scripts/clean-readme-noise.mjs README.md README.zh.md README.en.md && npm run sync:readme",
31
+ "prepublishOnly": "npm run check:readme",
32
+ "start:bridge": "node bridge/mcp-bridge.js",
33
+ "lint": "echo \"no linter configured\"",
34
+ "check:anchors": "node scripts/check-mutant-anchors.mjs",
35
+ "init:cindy": "node client/carlos.js init --target cindy",
36
+ "init:opencode": "node client/carlos.js init --target opencode",
37
+ "init:cursor": "node client/carlos.js init --target cursor",
38
+ "init:cline": "node client/carlos.js init --target cline",
39
+ "init:vscode": "node client/carlos.js init --target vscode",
40
+ "init:claude": "node client/carlos.js init --target claude"
41
+ },
42
+ "keywords": [
43
+ "carlos",
44
+ "workflow",
45
+ "mcp",
46
+ "cindy",
47
+ "opencode",
48
+ "gate",
49
+ "audit",
50
+ "trigger"
51
+ ],
52
+ "author": "Carlos Flow Contributors",
53
+ "license": "MIT",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/skyer-now/carlos-flow.git"
57
+ },
58
+ "bugs": {
59
+ "url": "https://github.com/skyer-now/carlos-flow/issues"
60
+ },
61
+ "homepage": "https://github.com/skyer-now/carlos-flow#readme",
62
+ "engines": {
63
+ "node": ">=22.0.0"
64
+ },
65
+ "dependencies": {
66
+ "@modelcontextprotocol/sdk": "^1.29.0"
67
+ },
68
+ "files": [
69
+ "client/",
70
+ "src/",
71
+ "bridge/",
72
+ "plugins/",
73
+ "scripts/",
74
+ "templates/",
75
+ "ghost.json",
76
+ "opencode.json",
77
+ "opencode.json.template",
78
+ ".mcprc.template",
79
+ "trigger-config.usable.json",
80
+ "trigger-config.example.json",
81
+ "README.md",
82
+ "README.zh.md",
83
+ "README.en.md",
84
+ "TRIGGER_GUIDE.md",
85
+ "MIGRATION.md",
86
+ "CHANGELOG.md",
87
+ "LICENSE"
88
+ ]
6
89
  }