@brainervirus/workit-mcp 8.15.1 → 8.17.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/dist/index.js CHANGED
@@ -21245,6 +21245,7 @@ import fs9 from "node:fs";
21245
21245
  import path9 from "node:path";
21246
21246
  var SCRIPT_CHECKS = ["test", "lint", "typecheck", "check"];
21247
21247
  var CHECKS_FILE = "workit.checks.json";
21248
+ var checksConfigFile = (root) => path9.join(root, CHECKS_FILE);
21248
21249
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
21249
21250
  var SHELL_META = /[|&;<>()$`\\*?[\]{}~!#]/u;
21250
21251
  function splitCommand(command) {
@@ -21357,7 +21358,7 @@ function detectedChecks(root) {
21357
21358
  var GATES = ["testing", "verification"];
21358
21359
  function loadCheckConfig(cwd) {
21359
21360
  const root = checkRoot(cwd);
21360
- const file = path9.join(root, CHECKS_FILE);
21361
+ const file = checksConfigFile(root);
21361
21362
  const none = (error = null) => ({
21362
21363
  source: error ? CHECKS_FILE : "none",
21363
21364
  root,
@@ -21994,6 +21995,7 @@ var workspaceConfigSchema = object2({
21994
21995
  autoApprove: union([boolean2(), array(nonBlank)]).optional(),
21995
21996
  defaultEndpoint: unknown().optional(),
21996
21997
  verification: _enum(["self", "independent"]).optional(),
21998
+ delegation: unknown().optional(),
21997
21999
  trailers: boolean2().optional(),
21998
22000
  liveSessionGuard: boolean2().optional(),
21999
22001
  fanout: object2({ tierModels: unknown().optional() }).passthrough().optional(),
@@ -24784,6 +24786,58 @@ function evaluateClosure(requestedOutcome, view) {
24784
24786
  requirementIds: evaluations.map((item) => item.requirementId)
24785
24787
  });
24786
24788
  }
24789
+ var BRIEF_TEXT = 250;
24790
+ var BRIEF_BLOCKERS = 3;
24791
+ var BRIEF_OPEN = 8;
24792
+ var clip = (value) => {
24793
+ const fits = (text) => Buffer.byteLength(JSON.stringify(text)) <= BRIEF_TEXT;
24794
+ if (fits(value))
24795
+ return value;
24796
+ let length = Math.min(value.length, BRIEF_TEXT);
24797
+ while (length > 0 && !fits(`${value.slice(0, length)}…`))
24798
+ length -= 1;
24799
+ return `${value.slice(0, length)}…`;
24800
+ };
24801
+ function boundTaskSummary(summary) {
24802
+ const rules = new Map((summary.policy?.requirements ?? []).map((item) => [item.id, item]));
24803
+ const unmet = summary.requirements.filter((item) => item.status === "unsatisfied" || item.status === "unavailable");
24804
+ const { progress, closure } = summary;
24805
+ const next = progress.nextAction;
24806
+ const open = unmet.slice(0, BRIEF_OPEN).map((item) => ({
24807
+ dimension: rules.get(item.requirementId)?.dimension ?? "verification",
24808
+ before: rules.get(item.requirementId)?.before ?? "close",
24809
+ status: item.status
24810
+ }));
24811
+ const brief = {
24812
+ id: summary.id,
24813
+ revision: summary.revision,
24814
+ workspaceRevision: summary.workspaceRevision,
24815
+ updatedAt: summary.updatedAt,
24816
+ objective: clip(summary.objective),
24817
+ status: summary.status,
24818
+ closure: closure && {
24819
+ outcome: closure.outcome,
24820
+ at: closure.at,
24821
+ summary: clip(closure.summary)
24822
+ },
24823
+ progress: {
24824
+ summary: clip(progress.summary),
24825
+ nextAction: next && clip(next),
24826
+ blockers: progress.blockers.slice(0, BRIEF_BLOCKERS).map((item) => ({
24827
+ reason: clip(item.reason),
24828
+ dependentAction: clip(item.dependentAction)
24829
+ }))
24830
+ },
24831
+ requirements: { total: summary.requirements.length, unmet: unmet.length, open },
24832
+ truncated: false
24833
+ };
24834
+ brief.truncated = JSON.stringify(brief).includes("…") || progress.blockers.length > BRIEF_BLOCKERS || unmet.length > BRIEF_OPEN;
24835
+ return brief;
24836
+ }
24837
+ function briefInspectResult(request, result) {
24838
+ const { action, view } = request ?? {};
24839
+ return result.ok && action === "inspect" && (view ?? "summary") === "summary" ? { ...result, data: boundTaskSummary(result.data) } : result;
24840
+ }
24787
24841
 
24788
24842
  // packages/workit-core/src/core/methods.ts
24789
24843
  var METHODS = {
@@ -25086,6 +25140,7 @@ var LAUNCHERS = new Set([
25086
25140
  "sudo",
25087
25141
  "command"
25088
25142
  ]);
25143
+ var PACKAGE_RUNNERS = new Set(["npx", "bunx", "pnpx"]);
25089
25144
  var PUSH_VALUE_OPTIONS = new Set(["-o", "--push-option", "--receive-pack", "--exec", "--repo"]);
25090
25145
  var VALUE_OPTIONS = {
25091
25146
  git: new Set([
@@ -26044,6 +26099,15 @@ class WorkitCore {
26044
26099
  if (!parsed.ok)
26045
26100
  return parsed;
26046
26101
  const input = parsed.data;
26102
+ if (this.context.readOnlyChild) {
26103
+ if (input.action !== "inspect")
26104
+ return failure2("permission_denied", "child sessions can only inspect the task summary");
26105
+ const task = this.store.readTask(input.taskId);
26106
+ if (!task.ok)
26107
+ return task;
26108
+ const summary = this.summary(task.data);
26109
+ return summary.ok ? { ...summary, data: boundTaskSummary(summary.data) } : summary;
26110
+ }
26047
26111
  if ((this.context.workerId ?? null) !== null) {
26048
26112
  if (input.action !== "inspect" && input.action !== "list")
26049
26113
  return failure2("permission_denied", "helpers cannot control task lifecycle or scope");
@@ -28481,7 +28545,8 @@ function createMcpServer(host, contextProvider) {
28481
28545
  }, workspaceRoot);
28482
28546
  const core = new WorkitCore(new TaskStore(context.root), context);
28483
28547
  const run = core[family];
28484
- return resultForClient(run.call(core, parsed.data), workspaceRoot);
28548
+ const result = run.call(core, parsed.data);
28549
+ return resultForClient(family === "task" && context.callerAttested !== true ? briefInspectResult(parsed.data, result) : result, workspaceRoot);
28485
28550
  } catch (error) {
28486
28551
  return thrownResult(toolName, error, workspaceRoot);
28487
28552
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-mcp",
3
- "version": "8.15.1",
3
+ "version": "8.17.0",
4
4
  "private": false,
5
5
  "description": "Workit shared MCP transport for the eight task and policy operation families",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "build": "bun scripts/build.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@brainervirus/workit-core": "^8.15.1",
45
+ "@brainervirus/workit-core": "^8.17.0",
46
46
  "@modelcontextprotocol/sdk": "1.32.0",
47
47
  "zod": "4.6.5"
48
48
  },
package/src/server.ts CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  markSourcesLoaded,
26
26
  } from "@brainervirus/workit-core/src/core/boundary";
27
27
  import type { Host, Result } from "@brainervirus/workit-core/src/core/task-contract";
28
+ import { briefInspectResult } from "@brainervirus/workit-core/src/core/task-evaluation";
28
29
  import { redactSecrets } from "@brainervirus/workit-core/src/core/logger";
29
30
  import { readExternalContext } from "@brainervirus/workit-core/src/core/context-read";
30
31
 
@@ -362,7 +363,13 @@ export function createMcpServer(host: McpHost, contextProvider: NativeContextPro
362
363
 
363
364
  const core = new WorkitCore(new TaskStore(context.root), context);
364
365
  const run = core[family] as unknown as (input: unknown) => Result<unknown>;
365
- return resultForClient(run.call(core, parsed.data), workspaceRoot);
366
+ const result = run.call(core, parsed.data);
367
+ return resultForClient(
368
+ family === "task" && context.callerAttested !== true
369
+ ? briefInspectResult(parsed.data, result)
370
+ : result,
371
+ workspaceRoot,
372
+ );
366
373
  } catch (error) {
367
374
  return thrownResult(toolName, error, workspaceRoot);
368
375
  }