@brainervirus/workit-codex 8.14.0 → 8.14.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.
package/dist/launch-mcp.js
CHANGED
|
@@ -14236,6 +14236,8 @@ var text = string2().check((ctx) => {
|
|
|
14236
14236
|
ctx.issues.push({ code: "custom", input: ctx.value, message: "invalid Unicode", path: [] });
|
|
14237
14237
|
});
|
|
14238
14238
|
var id = text.regex(uuidPattern, "expected lowercase UUID");
|
|
14239
|
+
var idRefPattern = /^[0-9a-f][0-9a-f-]{7,35}$/;
|
|
14240
|
+
var idRef = text.regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters");
|
|
14239
14241
|
var digest = text.regex(digestPattern, "expected lowercase SHA-256 digest");
|
|
14240
14242
|
var revision = text.regex(uuidPattern, "expected UUID revision");
|
|
14241
14243
|
var validUtc = (value) => {
|
|
@@ -14613,7 +14615,7 @@ var workerReportSchema = object({
|
|
|
14613
14615
|
outcome: _enum(["completed", "failed", "cancelled"]),
|
|
14614
14616
|
summary: text,
|
|
14615
14617
|
evidenceIds: array(id),
|
|
14616
|
-
findingIds: array(
|
|
14618
|
+
findingIds: array(idRef)
|
|
14617
14619
|
}).strict();
|
|
14618
14620
|
var workerSchema = object({
|
|
14619
14621
|
assignment: assignmentSchema,
|
|
@@ -14859,7 +14861,7 @@ var findingOperations = {
|
|
|
14859
14861
|
action: literal("resolve"),
|
|
14860
14862
|
...taskId,
|
|
14861
14863
|
expectedRevision: revision.optional(),
|
|
14862
|
-
findingId:
|
|
14864
|
+
findingId: idRef,
|
|
14863
14865
|
disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
|
|
14864
14866
|
reason: text,
|
|
14865
14867
|
evidenceIds: array(id),
|
|
@@ -14900,7 +14902,7 @@ var workerOperations = {
|
|
|
14900
14902
|
...taskId,
|
|
14901
14903
|
expectedRevision: revision.optional(),
|
|
14902
14904
|
expectedWorkspaceRevision: revision.optional(),
|
|
14903
|
-
workerId:
|
|
14905
|
+
workerId: idRef,
|
|
14904
14906
|
report: workerReportSchema
|
|
14905
14907
|
}),
|
|
14906
14908
|
cancel: operation({
|
|
@@ -14908,7 +14910,7 @@ var workerOperations = {
|
|
|
14908
14910
|
...taskId,
|
|
14909
14911
|
...revisions,
|
|
14910
14912
|
expectedWorkspaceRevision: revision.optional(),
|
|
14911
|
-
workerId:
|
|
14913
|
+
workerId: idRef,
|
|
14912
14914
|
reason: text
|
|
14913
14915
|
})
|
|
14914
14916
|
};
|
|
@@ -14958,6 +14960,16 @@ var success = (revisionValue, workspaceRevisionValue, data) => ({
|
|
|
14958
14960
|
data
|
|
14959
14961
|
});
|
|
14960
14962
|
var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
|
|
14963
|
+
function resolveIdRef(kind, ref, ids) {
|
|
14964
|
+
if (ids.includes(ref))
|
|
14965
|
+
return success(null, null, ref);
|
|
14966
|
+
const matches = ids.filter((candidate) => candidate.startsWith(ref));
|
|
14967
|
+
if (matches.length === 1)
|
|
14968
|
+
return success(null, null, matches[0]);
|
|
14969
|
+
if (matches.length === 0)
|
|
14970
|
+
return failure2("not_found", `${kind} not found`);
|
|
14971
|
+
return failure2("invalid_input", `${kind} prefix ${ref} is ambiguous; candidates: ${matches.join(", ")}`);
|
|
14972
|
+
}
|
|
14961
14973
|
function parseOperation(family, input) {
|
|
14962
14974
|
if (typeof input === "object" && input !== null && "schemaVersion" in input && input.schemaVersion !== SCHEMA_VERSION)
|
|
14963
14975
|
return failure2("unsupported_version", "unsupported schema version", { operation: family });
|
|
@@ -17476,20 +17488,26 @@ class TaskStore {
|
|
|
17476
17488
|
return success(null, null, { key: key.data, bound: bound.data });
|
|
17477
17489
|
}
|
|
17478
17490
|
taskForWorker(workerId) {
|
|
17479
|
-
if (typeof workerId !== "string" || !
|
|
17491
|
+
if (typeof workerId !== "string" || !idRefPattern.test(workerId))
|
|
17480
17492
|
return failure2("invalid_input", "needs a worker id: `workit worker cancel|report <workerId>`");
|
|
17481
17493
|
const listed = this.listTaskIndex();
|
|
17482
17494
|
if (!listed.ok)
|
|
17483
17495
|
return listed;
|
|
17496
|
+
const owners = new Map;
|
|
17484
17497
|
for (const entry of listed.data) {
|
|
17485
17498
|
if (entry.status === "closed")
|
|
17486
17499
|
continue;
|
|
17487
17500
|
const loaded = this.load(entry.id);
|
|
17488
17501
|
if (!loaded.ok)
|
|
17489
17502
|
return loaded;
|
|
17490
|
-
|
|
17491
|
-
|
|
17503
|
+
for (const worker of loaded.data?.record.workers ?? [])
|
|
17504
|
+
owners.set(worker.id, entry.id);
|
|
17492
17505
|
}
|
|
17506
|
+
const resolved = resolveIdRef("worker", workerId, [...owners.keys()]);
|
|
17507
|
+
if (resolved.ok)
|
|
17508
|
+
return success(null, null, owners.get(resolved.data) ?? null);
|
|
17509
|
+
if (resolved.code !== "not_found")
|
|
17510
|
+
return resolved;
|
|
17493
17511
|
return success(null, null, null);
|
|
17494
17512
|
}
|
|
17495
17513
|
originTaskEntry() {
|
|
@@ -23207,6 +23225,8 @@ var TASK_SCOPED_ACTIONS = new Set([
|
|
|
23207
23225
|
"worker.cancel",
|
|
23208
23226
|
"state.export"
|
|
23209
23227
|
]);
|
|
23228
|
+
var ONLY_OWN_REPORT = "workers can submit only their own report";
|
|
23229
|
+
var NO_HELPER_CONTROL = "helpers cannot cancel or control workers";
|
|
23210
23230
|
var WORKER_ADDRESSED_ACTIONS = new Set(["worker.cancel", "worker.report"]);
|
|
23211
23231
|
var workerCommand = (taskId, request) => {
|
|
23212
23232
|
const { action, workerId, reason, report } = request;
|
|
@@ -24104,6 +24124,10 @@ class WorkitCore {
|
|
|
24104
24124
|
}
|
|
24105
24125
|
if (helper?.ok)
|
|
24106
24126
|
return failure2("permission_denied", "helpers cannot resolve findings");
|
|
24127
|
+
const findingRef = resolveIdRef("finding", input.findingId, task.data.findings.map((entry) => entry.id));
|
|
24128
|
+
if (!findingRef.ok)
|
|
24129
|
+
return findingRef;
|
|
24130
|
+
input.findingId = findingRef.data;
|
|
24107
24131
|
const finding = task.data.findings.find((entry) => entry.id === input.findingId);
|
|
24108
24132
|
if (!finding)
|
|
24109
24133
|
return failure2("not_found", "finding not found");
|
|
@@ -24255,15 +24279,31 @@ class WorkitCore {
|
|
|
24255
24279
|
return changed;
|
|
24256
24280
|
return success(changed.data.task.revision, changed.data.workspace.revision, changed.data.task.workers.at(-1));
|
|
24257
24281
|
}
|
|
24282
|
+
const workerRef = resolveIdRef("worker", input.workerId, helperId === null ? task.data.workers.map((candidate) => candidate.id) : [helperId]);
|
|
24283
|
+
if (!workerRef.ok)
|
|
24284
|
+
return helperId === null ? workerRef : failure2("permission_denied", input.action === "report" ? ONLY_OWN_REPORT : NO_HELPER_CONTROL);
|
|
24285
|
+
input.workerId = workerRef.data;
|
|
24258
24286
|
const entry = task.data.workers.find((candidate) => candidate.id === input.workerId);
|
|
24259
24287
|
if (!entry)
|
|
24260
24288
|
return failure2("not_found", "worker not found");
|
|
24261
24289
|
if (input.action === "report") {
|
|
24262
24290
|
if (helperId === null || helperId !== input.workerId)
|
|
24263
|
-
return failure2("permission_denied",
|
|
24291
|
+
return failure2("permission_denied", ONLY_OWN_REPORT);
|
|
24264
24292
|
const helper = this.helperEntry(task.data, true, true);
|
|
24265
24293
|
if (!helper.ok)
|
|
24266
24294
|
return helper;
|
|
24295
|
+
const ownFindings = task.data.findings.filter((candidate) => candidate.provenance.workerId === helperId).map((candidate) => candidate.id);
|
|
24296
|
+
const reported = [];
|
|
24297
|
+
for (const findingRef of input.report.findingIds) {
|
|
24298
|
+
const found = resolveIdRef("finding", findingRef, ownFindings);
|
|
24299
|
+
if (found.ok)
|
|
24300
|
+
reported.push(found.data);
|
|
24301
|
+
else if (found.code === "not_found")
|
|
24302
|
+
reported.push(findingRef);
|
|
24303
|
+
else
|
|
24304
|
+
return found;
|
|
24305
|
+
}
|
|
24306
|
+
input.report.findingIds = reported;
|
|
24267
24307
|
const evidence = task.data.evidence.filter((candidate) => input.report.evidenceIds.includes(candidate.id));
|
|
24268
24308
|
const findings = task.data.findings.filter((candidate) => input.report.findingIds.includes(candidate.id));
|
|
24269
24309
|
if (evidence.length !== input.report.evidenceIds.length || findings.length !== input.report.findingIds.length)
|
|
@@ -24291,7 +24331,7 @@ class WorkitCore {
|
|
|
24291
24331
|
return updated ? success(changed.data.task.revision, changed.data.workspace.revision, updated) : failure2("recovery_required", "worker disappeared during report");
|
|
24292
24332
|
}
|
|
24293
24333
|
if (helperId !== null)
|
|
24294
|
-
return failure2("permission_denied",
|
|
24334
|
+
return failure2("permission_denied", NO_HELPER_CONTROL);
|
|
24295
24335
|
if (task.data.status === "closed")
|
|
24296
24336
|
return failure2("invalid_transition", "closed task cannot cancel workers");
|
|
24297
24337
|
if (entry.data.state === "stopped") {
|
|
@@ -7966,6 +7966,8 @@ var text = string2().check((ctx) => {
|
|
|
7966
7966
|
ctx.issues.push({ code: "custom", input: ctx.value, message: "invalid Unicode", path: [] });
|
|
7967
7967
|
});
|
|
7968
7968
|
var id = text.regex(uuidPattern, "expected lowercase UUID");
|
|
7969
|
+
var idRefPattern = /^[0-9a-f][0-9a-f-]{7,35}$/;
|
|
7970
|
+
var idRef = text.regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters");
|
|
7969
7971
|
var digest = text.regex(digestPattern, "expected lowercase SHA-256 digest");
|
|
7970
7972
|
var revision = text.regex(uuidPattern, "expected UUID revision");
|
|
7971
7973
|
var validUtc = (value) => {
|
|
@@ -8343,7 +8345,7 @@ var workerReportSchema = object({
|
|
|
8343
8345
|
outcome: _enum(["completed", "failed", "cancelled"]),
|
|
8344
8346
|
summary: text,
|
|
8345
8347
|
evidenceIds: array(id),
|
|
8346
|
-
findingIds: array(
|
|
8348
|
+
findingIds: array(idRef)
|
|
8347
8349
|
}).strict();
|
|
8348
8350
|
var workerSchema = object({
|
|
8349
8351
|
assignment: assignmentSchema,
|
|
@@ -8589,7 +8591,7 @@ var findingOperations = {
|
|
|
8589
8591
|
action: literal("resolve"),
|
|
8590
8592
|
...taskId,
|
|
8591
8593
|
expectedRevision: revision.optional(),
|
|
8592
|
-
findingId:
|
|
8594
|
+
findingId: idRef,
|
|
8593
8595
|
disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
|
|
8594
8596
|
reason: text,
|
|
8595
8597
|
evidenceIds: array(id),
|
|
@@ -8630,7 +8632,7 @@ var workerOperations = {
|
|
|
8630
8632
|
...taskId,
|
|
8631
8633
|
expectedRevision: revision.optional(),
|
|
8632
8634
|
expectedWorkspaceRevision: revision.optional(),
|
|
8633
|
-
workerId:
|
|
8635
|
+
workerId: idRef,
|
|
8634
8636
|
report: workerReportSchema
|
|
8635
8637
|
}),
|
|
8636
8638
|
cancel: operation({
|
|
@@ -8638,7 +8640,7 @@ var workerOperations = {
|
|
|
8638
8640
|
...taskId,
|
|
8639
8641
|
...revisions,
|
|
8640
8642
|
expectedWorkspaceRevision: revision.optional(),
|
|
8641
|
-
workerId:
|
|
8643
|
+
workerId: idRef,
|
|
8642
8644
|
reason: text
|
|
8643
8645
|
})
|
|
8644
8646
|
};
|
|
@@ -8688,6 +8690,16 @@ var success = (revisionValue, workspaceRevisionValue, data) => ({
|
|
|
8688
8690
|
data
|
|
8689
8691
|
});
|
|
8690
8692
|
var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
|
|
8693
|
+
function resolveIdRef(kind, ref, ids) {
|
|
8694
|
+
if (ids.includes(ref))
|
|
8695
|
+
return success(null, null, ref);
|
|
8696
|
+
const matches = ids.filter((candidate) => candidate.startsWith(ref));
|
|
8697
|
+
if (matches.length === 1)
|
|
8698
|
+
return success(null, null, matches[0]);
|
|
8699
|
+
if (matches.length === 0)
|
|
8700
|
+
return failure2("not_found", `${kind} not found`);
|
|
8701
|
+
return failure2("invalid_input", `${kind} prefix ${ref} is ambiguous; candidates: ${matches.join(", ")}`);
|
|
8702
|
+
}
|
|
8691
8703
|
function parseOperation(family, input) {
|
|
8692
8704
|
if (typeof input === "object" && input !== null && "schemaVersion" in input && input.schemaVersion !== SCHEMA_VERSION)
|
|
8693
8705
|
return failure2("unsupported_version", "unsupported schema version", { operation: family });
|
|
@@ -10937,20 +10949,26 @@ class TaskStore {
|
|
|
10937
10949
|
return success(null, null, { key: key.data, bound: bound.data });
|
|
10938
10950
|
}
|
|
10939
10951
|
taskForWorker(workerId) {
|
|
10940
|
-
if (typeof workerId !== "string" || !
|
|
10952
|
+
if (typeof workerId !== "string" || !idRefPattern.test(workerId))
|
|
10941
10953
|
return failure2("invalid_input", "needs a worker id: `workit worker cancel|report <workerId>`");
|
|
10942
10954
|
const listed = this.listTaskIndex();
|
|
10943
10955
|
if (!listed.ok)
|
|
10944
10956
|
return listed;
|
|
10957
|
+
const owners = new Map;
|
|
10945
10958
|
for (const entry of listed.data) {
|
|
10946
10959
|
if (entry.status === "closed")
|
|
10947
10960
|
continue;
|
|
10948
10961
|
const loaded = this.load(entry.id);
|
|
10949
10962
|
if (!loaded.ok)
|
|
10950
10963
|
return loaded;
|
|
10951
|
-
|
|
10952
|
-
|
|
10964
|
+
for (const worker of loaded.data?.record.workers ?? [])
|
|
10965
|
+
owners.set(worker.id, entry.id);
|
|
10953
10966
|
}
|
|
10967
|
+
const resolved = resolveIdRef("worker", workerId, [...owners.keys()]);
|
|
10968
|
+
if (resolved.ok)
|
|
10969
|
+
return success(null, null, owners.get(resolved.data) ?? null);
|
|
10970
|
+
if (resolved.code !== "not_found")
|
|
10971
|
+
return resolved;
|
|
10954
10972
|
return success(null, null, null);
|
|
10955
10973
|
}
|
|
10956
10974
|
originTaskEntry() {
|
|
@@ -16294,6 +16312,8 @@ var TASK_SCOPED_ACTIONS = new Set([
|
|
|
16294
16312
|
"worker.cancel",
|
|
16295
16313
|
"state.export"
|
|
16296
16314
|
]);
|
|
16315
|
+
var ONLY_OWN_REPORT = "workers can submit only their own report";
|
|
16316
|
+
var NO_HELPER_CONTROL = "helpers cannot cancel or control workers";
|
|
16297
16317
|
var WORKER_ADDRESSED_ACTIONS = new Set(["worker.cancel", "worker.report"]);
|
|
16298
16318
|
var workerCommand = (taskId, request) => {
|
|
16299
16319
|
const { action, workerId, reason, report } = request;
|
|
@@ -17191,6 +17211,10 @@ class WorkitCore {
|
|
|
17191
17211
|
}
|
|
17192
17212
|
if (helper?.ok)
|
|
17193
17213
|
return failure2("permission_denied", "helpers cannot resolve findings");
|
|
17214
|
+
const findingRef = resolveIdRef("finding", input.findingId, task.data.findings.map((entry) => entry.id));
|
|
17215
|
+
if (!findingRef.ok)
|
|
17216
|
+
return findingRef;
|
|
17217
|
+
input.findingId = findingRef.data;
|
|
17194
17218
|
const finding = task.data.findings.find((entry) => entry.id === input.findingId);
|
|
17195
17219
|
if (!finding)
|
|
17196
17220
|
return failure2("not_found", "finding not found");
|
|
@@ -17342,15 +17366,31 @@ class WorkitCore {
|
|
|
17342
17366
|
return changed;
|
|
17343
17367
|
return success(changed.data.task.revision, changed.data.workspace.revision, changed.data.task.workers.at(-1));
|
|
17344
17368
|
}
|
|
17369
|
+
const workerRef = resolveIdRef("worker", input.workerId, helperId === null ? task.data.workers.map((candidate) => candidate.id) : [helperId]);
|
|
17370
|
+
if (!workerRef.ok)
|
|
17371
|
+
return helperId === null ? workerRef : failure2("permission_denied", input.action === "report" ? ONLY_OWN_REPORT : NO_HELPER_CONTROL);
|
|
17372
|
+
input.workerId = workerRef.data;
|
|
17345
17373
|
const entry = task.data.workers.find((candidate) => candidate.id === input.workerId);
|
|
17346
17374
|
if (!entry)
|
|
17347
17375
|
return failure2("not_found", "worker not found");
|
|
17348
17376
|
if (input.action === "report") {
|
|
17349
17377
|
if (helperId === null || helperId !== input.workerId)
|
|
17350
|
-
return failure2("permission_denied",
|
|
17378
|
+
return failure2("permission_denied", ONLY_OWN_REPORT);
|
|
17351
17379
|
const helper = this.helperEntry(task.data, true, true);
|
|
17352
17380
|
if (!helper.ok)
|
|
17353
17381
|
return helper;
|
|
17382
|
+
const ownFindings = task.data.findings.filter((candidate) => candidate.provenance.workerId === helperId).map((candidate) => candidate.id);
|
|
17383
|
+
const reported = [];
|
|
17384
|
+
for (const findingRef of input.report.findingIds) {
|
|
17385
|
+
const found = resolveIdRef("finding", findingRef, ownFindings);
|
|
17386
|
+
if (found.ok)
|
|
17387
|
+
reported.push(found.data);
|
|
17388
|
+
else if (found.code === "not_found")
|
|
17389
|
+
reported.push(findingRef);
|
|
17390
|
+
else
|
|
17391
|
+
return found;
|
|
17392
|
+
}
|
|
17393
|
+
input.report.findingIds = reported;
|
|
17354
17394
|
const evidence = task.data.evidence.filter((candidate) => input.report.evidenceIds.includes(candidate.id));
|
|
17355
17395
|
const findings = task.data.findings.filter((candidate) => input.report.findingIds.includes(candidate.id));
|
|
17356
17396
|
if (evidence.length !== input.report.evidenceIds.length || findings.length !== input.report.findingIds.length)
|
|
@@ -17378,7 +17418,7 @@ class WorkitCore {
|
|
|
17378
17418
|
return updated ? success(changed.data.task.revision, changed.data.workspace.revision, updated) : failure2("recovery_required", "worker disappeared during report");
|
|
17379
17419
|
}
|
|
17380
17420
|
if (helperId !== null)
|
|
17381
|
-
return failure2("permission_denied",
|
|
17421
|
+
return failure2("permission_denied", NO_HELPER_CONTROL);
|
|
17382
17422
|
if (task.data.status === "closed")
|
|
17383
17423
|
return failure2("invalid_transition", "closed task cannot cancel workers");
|
|
17384
17424
|
if (entry.data.state === "stopped") {
|
package/dist/workit-hook.js
CHANGED
|
@@ -37,6 +37,6 @@ if (quiet)
|
|
|
37
37
|
process.stdout.write(`${JSON.stringify({ hookSpecificOutput: { hookEventName: quiet } })}
|
|
38
38
|
`);
|
|
39
39
|
else {
|
|
40
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
40
|
+
const { runCodexHook } = await import("./workit-hook-m4bfzykw.js");
|
|
41
41
|
await runCodexHook([payload]);
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-codex",
|
|
3
|
-
"version": "8.14.
|
|
3
|
+
"version": "8.14.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"build": "bun scripts/build.ts"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@brainervirus/workit-core": "^8.14.
|
|
43
|
-
"@brainervirus/workit-mcp": "^8.14.
|
|
42
|
+
"@brainervirus/workit-core": "^8.14.1",
|
|
43
|
+
"@brainervirus/workit-mcp": "^8.14.1"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=24"
|