@brainervirus/workit-mcp 8.15.1 → 8.16.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
@@ -24784,6 +24784,58 @@ function evaluateClosure(requestedOutcome, view) {
24784
24784
  requirementIds: evaluations.map((item) => item.requirementId)
24785
24785
  });
24786
24786
  }
24787
+ var BRIEF_TEXT = 250;
24788
+ var BRIEF_BLOCKERS = 3;
24789
+ var BRIEF_OPEN = 8;
24790
+ var clip = (value) => {
24791
+ const fits = (text) => Buffer.byteLength(JSON.stringify(text)) <= BRIEF_TEXT;
24792
+ if (fits(value))
24793
+ return value;
24794
+ let length = Math.min(value.length, BRIEF_TEXT);
24795
+ while (length > 0 && !fits(`${value.slice(0, length)}…`))
24796
+ length -= 1;
24797
+ return `${value.slice(0, length)}…`;
24798
+ };
24799
+ function boundTaskSummary(summary) {
24800
+ const rules = new Map((summary.policy?.requirements ?? []).map((item) => [item.id, item]));
24801
+ const unmet = summary.requirements.filter((item) => item.status === "unsatisfied" || item.status === "unavailable");
24802
+ const { progress, closure } = summary;
24803
+ const next = progress.nextAction;
24804
+ const open = unmet.slice(0, BRIEF_OPEN).map((item) => ({
24805
+ dimension: rules.get(item.requirementId)?.dimension ?? "verification",
24806
+ before: rules.get(item.requirementId)?.before ?? "close",
24807
+ status: item.status
24808
+ }));
24809
+ const brief = {
24810
+ id: summary.id,
24811
+ revision: summary.revision,
24812
+ workspaceRevision: summary.workspaceRevision,
24813
+ updatedAt: summary.updatedAt,
24814
+ objective: clip(summary.objective),
24815
+ status: summary.status,
24816
+ closure: closure && {
24817
+ outcome: closure.outcome,
24818
+ at: closure.at,
24819
+ summary: clip(closure.summary)
24820
+ },
24821
+ progress: {
24822
+ summary: clip(progress.summary),
24823
+ nextAction: next && clip(next),
24824
+ blockers: progress.blockers.slice(0, BRIEF_BLOCKERS).map((item) => ({
24825
+ reason: clip(item.reason),
24826
+ dependentAction: clip(item.dependentAction)
24827
+ }))
24828
+ },
24829
+ requirements: { total: summary.requirements.length, unmet: unmet.length, open },
24830
+ truncated: false
24831
+ };
24832
+ brief.truncated = JSON.stringify(brief).includes("…") || progress.blockers.length > BRIEF_BLOCKERS || unmet.length > BRIEF_OPEN;
24833
+ return brief;
24834
+ }
24835
+ function briefInspectResult(request, result) {
24836
+ const { action, view } = request ?? {};
24837
+ return result.ok && action === "inspect" && (view ?? "summary") === "summary" ? { ...result, data: boundTaskSummary(result.data) } : result;
24838
+ }
24787
24839
 
24788
24840
  // packages/workit-core/src/core/methods.ts
24789
24841
  var METHODS = {
@@ -26044,6 +26096,15 @@ class WorkitCore {
26044
26096
  if (!parsed.ok)
26045
26097
  return parsed;
26046
26098
  const input = parsed.data;
26099
+ if (this.context.readOnlyChild) {
26100
+ if (input.action !== "inspect")
26101
+ return failure2("permission_denied", "child sessions can only inspect the task summary");
26102
+ const task = this.store.readTask(input.taskId);
26103
+ if (!task.ok)
26104
+ return task;
26105
+ const summary = this.summary(task.data);
26106
+ return summary.ok ? { ...summary, data: boundTaskSummary(summary.data) } : summary;
26107
+ }
26047
26108
  if ((this.context.workerId ?? null) !== null) {
26048
26109
  if (input.action !== "inspect" && input.action !== "list")
26049
26110
  return failure2("permission_denied", "helpers cannot control task lifecycle or scope");
@@ -28481,7 +28542,8 @@ function createMcpServer(host, contextProvider) {
28481
28542
  }, workspaceRoot);
28482
28543
  const core = new WorkitCore(new TaskStore(context.root), context);
28483
28544
  const run = core[family];
28484
- return resultForClient(run.call(core, parsed.data), workspaceRoot);
28545
+ const result = run.call(core, parsed.data);
28546
+ return resultForClient(family === "task" && context.callerAttested !== true ? briefInspectResult(parsed.data, result) : result, workspaceRoot);
28485
28547
  } catch (error) {
28486
28548
  return thrownResult(toolName, error, workspaceRoot);
28487
28549
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-mcp",
3
- "version": "8.15.1",
3
+ "version": "8.16.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.16.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
  }