@copyrun/mcp 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -78,7 +78,7 @@ import { randomUUID } from "crypto";
78
78
  import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
79
79
  import { homedir } from "os";
80
80
  import { join } from "path";
81
- var VERSION = "0.3.1";
81
+ var VERSION = "0.3.2";
82
82
  var DEFAULT_API = "https://copyrun.ai";
83
83
  var copyrunHome = (env = process.env) => env.COPYRUN_HOME ?? join(homedir(), ".copyrun");
84
84
  var apiBase = (env = process.env) => (env.COPYRUN_API ?? DEFAULT_API).replace(/\/$/, "");
@@ -284,6 +284,11 @@ var CopyrunApi = class {
284
284
  if (!explanation) throw new ApiError("No step notes came back", 502);
285
285
  return explanation;
286
286
  }
287
+ /** A draft highlight (POST /api/v1/highlights) from one of the person's own shared sessions: always a draft, the person publishes on the site. */
288
+ async draftHighlight(input) {
289
+ const body = { runId: input.runId, title: input.title, ...input.story ? { story: input.story } : {}, ...input.org ? { audience: "team", org: input.org } : { audience: "public" }, status: "draft" };
290
+ return this.json(`/api/v1/highlights`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
291
+ }
287
292
  /** Ask a human (POST /api/v1/decisions): the pending decision's id, url and expiry. Needs a credential. */
288
293
  async askHuman(input) {
289
294
  const body = { kind: "tool-call", agent: input.agent ?? "agent", ...input };
@@ -3561,6 +3566,21 @@ var TOOLS2 = [
3561
3566
  },
3562
3567
  annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
3563
3568
  },
3569
+ {
3570
+ name: "draft_highlight",
3571
+ description: "Draft a highlight from a session the user already shared (share_session returns its run id): one piece of agent work they may want to show on their profile or to their team, with the facts copyrun reads from the session (agent, how often they steered it, whether the tests passed). Only ever a draft: nothing is shown to anyone until the user publishes it on copyrun, so give them the edit link it returns. Offer it after a session that went well; don't make one unasked. The title and story should be the user's words or a suggestion they agreed to; never put code, secrets, customer data or anything private in them.",
3572
+ inputSchema: {
3573
+ type: "object",
3574
+ properties: {
3575
+ run: str2("The run id or link of the user's shared session"),
3576
+ title: str2("What they did, in a few words (up to 100 characters)"),
3577
+ story: str2("Optional: why it mattered and how they steered the agent, in their words (up to 1500 characters)"),
3578
+ team: str2("A team's slug, to draft it for the team's overview instead of the user's public profile")
3579
+ },
3580
+ required: ["run", "title"]
3581
+ },
3582
+ annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
3583
+ },
3564
3584
  ...DECISION_TOOLS
3565
3585
  ];
3566
3586
  var RESOURCE_TEMPLATES = [
@@ -3925,6 +3945,18 @@ async function ownershipTool(deps, args, cwd) {
3925
3945
  ${JSON.stringify(result, null, 2)}`, result);
3926
3946
  return text(JSON.stringify(result, null, 2), result);
3927
3947
  }
3948
+ async function draftHighlight(deps, a) {
3949
+ const run = parseRunRef(a.run);
3950
+ if (!run) return fail("draft_highlight needs the run id or link of a session the user shared (share_session returns it).");
3951
+ const title = typeof a.title === "string" ? a.title.trim().slice(0, 100) : "";
3952
+ if (!title) return fail("draft_highlight needs a title: what the user did, in a few words.");
3953
+ if (!await deps.api.credential()) return fail("draft_highlight needs the user signed in on this machine: ask them to run npx copyrun login.");
3954
+ const got = await deps.api.draftHighlight({ runId: run, title, ...typeof a.story === "string" && a.story.trim() ? { story: a.story.slice(0, 1500) } : {}, ...typeof a.team === "string" && a.team.trim() ? { org: a.team.trim() } : {} });
3955
+ return text(
3956
+ `Drafted "${got.highlight.title}". It's a draft only the user can see. Give them this link to read it, change the words and publish it themselves: ${got.editUrl}`,
3957
+ { id: got.highlight.id, url: got.highlight.url, editUrl: got.editUrl, status: "draft" }
3958
+ );
3959
+ }
3928
3960
  async function callTool(deps, name, args) {
3929
3961
  const a = args && typeof args === "object" && !Array.isArray(args) ? args : {};
3930
3962
  const cwd = deps.cwd ?? process.cwd();
@@ -3952,6 +3984,8 @@ async function callTool(deps, name, args) {
3952
3984
  return await ownershipTool(deps, ["who", ...typeof a.path === "string" ? [a.path] : [], "--json", ...a.team === true ? ["--team"] : []], cwd);
3953
3985
  case "walk_through":
3954
3986
  return await ownershipTool(deps, ["learn", ...typeof a.folder === "string" && a.folder.trim() ? [a.folder.trim()] : [], "--json"], cwd);
3987
+ case "draft_highlight":
3988
+ return await draftHighlight(deps, a);
3955
3989
  case "ask_human":
3956
3990
  return await askHuman(deps, a);
3957
3991
  case "check_decision":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copyrun/mcp",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "MCP server for copyrun: who understands a part of the code (who_understands), a walkthrough of what agents did in a folder (walk_through), plus past runs and sessions, for Claude Code, Codex, Cursor and other MCP clients.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -35,7 +35,7 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "copyrun": "0.3.1"
38
+ "copyrun": "0.3.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "tsup": "8.5.1"