@brainervirus/workit-cursor 8.13.1 → 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/mcp-server.js
CHANGED
|
@@ -16617,6 +16617,8 @@ var text = string2().check((ctx) => {
|
|
|
16617
16617
|
ctx.issues.push({ code: "custom", input: ctx.value, message: "invalid Unicode", path: [] });
|
|
16618
16618
|
});
|
|
16619
16619
|
var id = text.regex(uuidPattern, "expected lowercase UUID");
|
|
16620
|
+
var idRefPattern = /^[0-9a-f][0-9a-f-]{7,35}$/;
|
|
16621
|
+
var idRef = text.regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters");
|
|
16620
16622
|
var digest = text.regex(digestPattern, "expected lowercase SHA-256 digest");
|
|
16621
16623
|
var revision = text.regex(uuidPattern, "expected UUID revision");
|
|
16622
16624
|
var validUtc = (value) => {
|
|
@@ -16994,7 +16996,7 @@ var workerReportSchema = object2({
|
|
|
16994
16996
|
outcome: _enum(["completed", "failed", "cancelled"]),
|
|
16995
16997
|
summary: text,
|
|
16996
16998
|
evidenceIds: array(id),
|
|
16997
|
-
findingIds: array(
|
|
16999
|
+
findingIds: array(idRef)
|
|
16998
17000
|
}).strict();
|
|
16999
17001
|
var workerSchema = object2({
|
|
17000
17002
|
assignment: assignmentSchema,
|
|
@@ -17240,7 +17242,7 @@ var findingOperations = {
|
|
|
17240
17242
|
action: literal("resolve"),
|
|
17241
17243
|
...taskId,
|
|
17242
17244
|
expectedRevision: revision.optional(),
|
|
17243
|
-
findingId:
|
|
17245
|
+
findingId: idRef,
|
|
17244
17246
|
disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
|
|
17245
17247
|
reason: text,
|
|
17246
17248
|
evidenceIds: array(id),
|
|
@@ -17281,7 +17283,7 @@ var workerOperations = {
|
|
|
17281
17283
|
...taskId,
|
|
17282
17284
|
expectedRevision: revision.optional(),
|
|
17283
17285
|
expectedWorkspaceRevision: revision.optional(),
|
|
17284
|
-
workerId:
|
|
17286
|
+
workerId: idRef,
|
|
17285
17287
|
report: workerReportSchema
|
|
17286
17288
|
}),
|
|
17287
17289
|
cancel: operation({
|
|
@@ -17289,7 +17291,7 @@ var workerOperations = {
|
|
|
17289
17291
|
...taskId,
|
|
17290
17292
|
...revisions,
|
|
17291
17293
|
expectedWorkspaceRevision: revision.optional(),
|
|
17292
|
-
workerId:
|
|
17294
|
+
workerId: idRef,
|
|
17293
17295
|
reason: text
|
|
17294
17296
|
})
|
|
17295
17297
|
};
|
|
@@ -17339,6 +17341,16 @@ var success = (revisionValue, workspaceRevisionValue, data) => ({
|
|
|
17339
17341
|
data
|
|
17340
17342
|
});
|
|
17341
17343
|
var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
|
|
17344
|
+
function resolveIdRef(kind, ref, ids) {
|
|
17345
|
+
if (ids.includes(ref))
|
|
17346
|
+
return success(null, null, ref);
|
|
17347
|
+
const matches = ids.filter((candidate) => candidate.startsWith(ref));
|
|
17348
|
+
if (matches.length === 1)
|
|
17349
|
+
return success(null, null, matches[0]);
|
|
17350
|
+
if (matches.length === 0)
|
|
17351
|
+
return failure2("not_found", `${kind} not found`);
|
|
17352
|
+
return failure2("invalid_input", `${kind} prefix ${ref} is ambiguous; candidates: ${matches.join(", ")}`);
|
|
17353
|
+
}
|
|
17342
17354
|
function parseOperation(family, input) {
|
|
17343
17355
|
if (typeof input === "object" && input !== null && "schemaVersion" in input && input.schemaVersion !== SCHEMA_VERSION)
|
|
17344
17356
|
return failure2("unsupported_version", "unsupported schema version", { operation: family });
|
|
@@ -19857,20 +19869,26 @@ class TaskStore {
|
|
|
19857
19869
|
return success(null, null, { key: key.data, bound: bound.data });
|
|
19858
19870
|
}
|
|
19859
19871
|
taskForWorker(workerId) {
|
|
19860
|
-
if (typeof workerId !== "string" || !
|
|
19872
|
+
if (typeof workerId !== "string" || !idRefPattern.test(workerId))
|
|
19861
19873
|
return failure2("invalid_input", "needs a worker id: `workit worker cancel|report <workerId>`");
|
|
19862
19874
|
const listed = this.listTaskIndex();
|
|
19863
19875
|
if (!listed.ok)
|
|
19864
19876
|
return listed;
|
|
19877
|
+
const owners = new Map;
|
|
19865
19878
|
for (const entry of listed.data) {
|
|
19866
19879
|
if (entry.status === "closed")
|
|
19867
19880
|
continue;
|
|
19868
19881
|
const loaded = this.load(entry.id);
|
|
19869
19882
|
if (!loaded.ok)
|
|
19870
19883
|
return loaded;
|
|
19871
|
-
|
|
19872
|
-
|
|
19884
|
+
for (const worker of loaded.data?.record.workers ?? [])
|
|
19885
|
+
owners.set(worker.id, entry.id);
|
|
19873
19886
|
}
|
|
19887
|
+
const resolved = resolveIdRef("worker", workerId, [...owners.keys()]);
|
|
19888
|
+
if (resolved.ok)
|
|
19889
|
+
return success(null, null, owners.get(resolved.data) ?? null);
|
|
19890
|
+
if (resolved.code !== "not_found")
|
|
19891
|
+
return resolved;
|
|
19874
19892
|
return success(null, null, null);
|
|
19875
19893
|
}
|
|
19876
19894
|
originTaskEntry() {
|
|
@@ -21983,6 +22001,8 @@ var workspaceConfigSchema = object2({
|
|
|
21983
22001
|
defaultEndpoint: unknown().optional(),
|
|
21984
22002
|
verification: _enum(["self", "independent"]).optional(),
|
|
21985
22003
|
trailers: boolean2().optional(),
|
|
22004
|
+
liveSessionGuard: boolean2().optional(),
|
|
22005
|
+
fanout: object2({ tierModels: unknown().optional() }).passthrough().optional(),
|
|
21986
22006
|
autonomy: object2(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
|
|
21987
22007
|
kind,
|
|
21988
22008
|
union([boolean2(), literal("verified")]).optional()
|
|
@@ -22300,6 +22320,17 @@ var resolveRuntimeReleaseTracks = (cwd) => {
|
|
|
22300
22320
|
const matched = matchRuntimeWorkspace(cwd);
|
|
22301
22321
|
return matched ? { workspace: matched.selected.name, releaseTracks: matched.selected.releaseTracks } : null;
|
|
22302
22322
|
};
|
|
22323
|
+
var TIER_KEYS = new Set(["mundane", "standard", "hard"]);
|
|
22324
|
+
var TIER_HOSTS = new Set([
|
|
22325
|
+
"claude_code",
|
|
22326
|
+
"opencode",
|
|
22327
|
+
"codex",
|
|
22328
|
+
"codex_cli",
|
|
22329
|
+
"codex_desktop",
|
|
22330
|
+
"cursor",
|
|
22331
|
+
"pi",
|
|
22332
|
+
"default"
|
|
22333
|
+
]);
|
|
22303
22334
|
var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
|
|
22304
22335
|
const matched = matchRuntimeWorkspace(cwd);
|
|
22305
22336
|
if (!matched)
|
|
@@ -25575,6 +25606,8 @@ var TASK_SCOPED_ACTIONS = new Set([
|
|
|
25575
25606
|
"worker.cancel",
|
|
25576
25607
|
"state.export"
|
|
25577
25608
|
]);
|
|
25609
|
+
var ONLY_OWN_REPORT = "workers can submit only their own report";
|
|
25610
|
+
var NO_HELPER_CONTROL = "helpers cannot cancel or control workers";
|
|
25578
25611
|
var WORKER_ADDRESSED_ACTIONS = new Set(["worker.cancel", "worker.report"]);
|
|
25579
25612
|
var workerCommand = (taskId, request) => {
|
|
25580
25613
|
const { action, workerId, reason, report } = request;
|
|
@@ -26472,6 +26505,10 @@ class WorkitCore {
|
|
|
26472
26505
|
}
|
|
26473
26506
|
if (helper?.ok)
|
|
26474
26507
|
return failure2("permission_denied", "helpers cannot resolve findings");
|
|
26508
|
+
const findingRef = resolveIdRef("finding", input.findingId, task.data.findings.map((entry) => entry.id));
|
|
26509
|
+
if (!findingRef.ok)
|
|
26510
|
+
return findingRef;
|
|
26511
|
+
input.findingId = findingRef.data;
|
|
26475
26512
|
const finding = task.data.findings.find((entry) => entry.id === input.findingId);
|
|
26476
26513
|
if (!finding)
|
|
26477
26514
|
return failure2("not_found", "finding not found");
|
|
@@ -26623,15 +26660,31 @@ class WorkitCore {
|
|
|
26623
26660
|
return changed;
|
|
26624
26661
|
return success(changed.data.task.revision, changed.data.workspace.revision, changed.data.task.workers.at(-1));
|
|
26625
26662
|
}
|
|
26663
|
+
const workerRef = resolveIdRef("worker", input.workerId, helperId === null ? task.data.workers.map((candidate) => candidate.id) : [helperId]);
|
|
26664
|
+
if (!workerRef.ok)
|
|
26665
|
+
return helperId === null ? workerRef : failure2("permission_denied", input.action === "report" ? ONLY_OWN_REPORT : NO_HELPER_CONTROL);
|
|
26666
|
+
input.workerId = workerRef.data;
|
|
26626
26667
|
const entry = task.data.workers.find((candidate) => candidate.id === input.workerId);
|
|
26627
26668
|
if (!entry)
|
|
26628
26669
|
return failure2("not_found", "worker not found");
|
|
26629
26670
|
if (input.action === "report") {
|
|
26630
26671
|
if (helperId === null || helperId !== input.workerId)
|
|
26631
|
-
return failure2("permission_denied",
|
|
26672
|
+
return failure2("permission_denied", ONLY_OWN_REPORT);
|
|
26632
26673
|
const helper = this.helperEntry(task.data, true, true);
|
|
26633
26674
|
if (!helper.ok)
|
|
26634
26675
|
return helper;
|
|
26676
|
+
const ownFindings = task.data.findings.filter((candidate) => candidate.provenance.workerId === helperId).map((candidate) => candidate.id);
|
|
26677
|
+
const reported = [];
|
|
26678
|
+
for (const findingRef of input.report.findingIds) {
|
|
26679
|
+
const found = resolveIdRef("finding", findingRef, ownFindings);
|
|
26680
|
+
if (found.ok)
|
|
26681
|
+
reported.push(found.data);
|
|
26682
|
+
else if (found.code === "not_found")
|
|
26683
|
+
reported.push(findingRef);
|
|
26684
|
+
else
|
|
26685
|
+
return found;
|
|
26686
|
+
}
|
|
26687
|
+
input.report.findingIds = reported;
|
|
26635
26688
|
const evidence = task.data.evidence.filter((candidate) => input.report.evidenceIds.includes(candidate.id));
|
|
26636
26689
|
const findings = task.data.findings.filter((candidate) => input.report.findingIds.includes(candidate.id));
|
|
26637
26690
|
if (evidence.length !== input.report.evidenceIds.length || findings.length !== input.report.findingIds.length)
|
|
@@ -26659,7 +26712,7 @@ class WorkitCore {
|
|
|
26659
26712
|
return updated ? success(changed.data.task.revision, changed.data.workspace.revision, updated) : failure2("recovery_required", "worker disappeared during report");
|
|
26660
26713
|
}
|
|
26661
26714
|
if (helperId !== null)
|
|
26662
|
-
return failure2("permission_denied",
|
|
26715
|
+
return failure2("permission_denied", NO_HELPER_CONTROL);
|
|
26663
26716
|
if (task.data.status === "closed")
|
|
26664
26717
|
return failure2("invalid_transition", "closed task cannot cancel workers");
|
|
26665
26718
|
if (entry.data.state === "stopped") {
|
|
@@ -28462,10 +28515,44 @@ var capabilitiesFor = (descriptor, observed = {}) => descriptor.capabilities.map
|
|
|
28462
28515
|
var signals = new Map;
|
|
28463
28516
|
var cache = new Map;
|
|
28464
28517
|
var TURN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
28518
|
+
// packages/workit-core/src/core/live-session.ts
|
|
28519
|
+
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
28520
|
+
var LIVE_SESSION_TTL_MS = 15 * 60000;
|
|
28521
|
+
var liveProbe = {
|
|
28522
|
+
platform: process.platform,
|
|
28523
|
+
run: (args) => spawnSync15("ps", args, { encoding: "utf8", timeout: 2000 }).stdout ?? "",
|
|
28524
|
+
start: (pid) => processStartOf(pid)
|
|
28525
|
+
};
|
|
28526
|
+
var PIDS = new Map;
|
|
28527
|
+
|
|
28465
28528
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
28466
28529
|
var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
|
|
28467
28530
|
var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
|
|
28468
28531
|
var cache2 = new Map;
|
|
28532
|
+
var MUTATING_GIT = new Set([
|
|
28533
|
+
"add",
|
|
28534
|
+
"am",
|
|
28535
|
+
"apply",
|
|
28536
|
+
"checkout",
|
|
28537
|
+
"cherry-pick",
|
|
28538
|
+
"clean",
|
|
28539
|
+
"commit",
|
|
28540
|
+
"merge",
|
|
28541
|
+
"mv",
|
|
28542
|
+
"pull",
|
|
28543
|
+
"rebase",
|
|
28544
|
+
"reset",
|
|
28545
|
+
"restore",
|
|
28546
|
+
"revert",
|
|
28547
|
+
"rm",
|
|
28548
|
+
"stash",
|
|
28549
|
+
"switch"
|
|
28550
|
+
]);
|
|
28551
|
+
var DRY_N = new Set(["add", "clean", "rm", "mv"]);
|
|
28552
|
+
var MUTATING_WORKIT_GIT = new Set(["commit", "branch"]);
|
|
28553
|
+
var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
|
|
28554
|
+
var PUSHD2 = new Set(["pushd", "push-location"]);
|
|
28555
|
+
var POPD2 = new Set(["popd", "pop-location"]);
|
|
28469
28556
|
// packages/workit-core/src/core/skill-manifests.ts
|
|
28470
28557
|
if (false) {}
|
|
28471
28558
|
|