askshepherd 0.1.26 → 0.1.29

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/README.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # AskShepherd
2
2
 
3
- Customer-facing raw sync onboarding for Shepherd.
3
+ Customer-facing production onboarding and MCP for Shepherd.
4
+
5
+ The npm package is `askshepherd`. The installed binary also exposes `shepherd`,
6
+ but the public one-liner uses the package name:
7
+
8
+ ```sh
9
+ npx -y askshepherd@latest agent
10
+ ```
4
11
 
5
12
  ## Coding Agent One-liner
6
13
 
@@ -10,8 +17,8 @@ Give this to a coding agent:
10
17
  npx -y askshepherd@latest agent
11
18
  ```
12
19
 
13
- The command defaults to the customer-facing production Shepherd cloud. It prints the exact prompt the agent should follow, then the exact follow-up commands to open Shepherd WorkOS login/signup, guide Google Workspace Admin Console delegation, open source auth for non-Google sources, open Granola's API key page, finalize, start cloud raw polling/backfills, request downstream production processing, and install local Messages sync.
14
- The agent prompt tells coding agents to ask short selection questions first: existing/new org, sources to connect, and Messages skip/provide-handle. If Messages is selected, the agent runs `messages-chats`, opens a minimal searchable local webpage, and has the user select which contacts/groups to sync. Account creation/relinking always starts with Shepherd WorkOS auth.
20
+ The command defaults to the customer-facing production Shepherd cloud. In coding-agent shells, it gives the agent the onboarding contract and follow-up commands. In a normal interactive terminal, it does not print the agent contract; it points the user to the direct terminal onboarding flow instead.
21
+ Coding-agent onboarding asks short selection questions first: existing/new org, sources to connect, and Messages skip/provide-handle. If Messages is selected, the agent runs `messages-chats`, opens a minimal searchable local webpage, and has the user select which contacts/groups to sync. Account creation/relinking always starts with Shepherd WorkOS auth.
15
22
  Existing-organization joins are verified from Shepherd login and company email domain; the typed org name is not trusted by itself.
16
23
 
17
24
  For experiments, pass a separate non-production API explicitly:
@@ -11,7 +11,7 @@ import { fileURLToPath } from "node:url";
11
11
  const DEFAULT_API_URL = "https://brain-api-customer-facing.up.railway.app";
12
12
  const PACKAGE_NAME = "askshepherd";
13
13
  const PACKAGE_SPEC = `${PACKAGE_NAME}@latest`;
14
- const PACKAGE_VERSION = "0.1.26";
14
+ const PACKAGE_VERSION = "0.1.29";
15
15
  const MCP_SERVER_NAME = "shepherd";
16
16
  const PACKAGE_DIR = dirname(dirname(fileURLToPath(import.meta.url)));
17
17
  const DEFAULT_AGENT_STATE_PATH = join(homedir(), ".shepherd", "raw-onboarding-agent.json");
@@ -283,7 +283,11 @@ async function runAgentOnboarding() {
283
283
  );
284
284
 
285
285
  if (!wantsStart) {
286
- printAgentContract();
286
+ if (shouldPrintAgentContract()) {
287
+ printAgentContract();
288
+ } else {
289
+ printAgentTerminalHandoff();
290
+ }
287
291
  return;
288
292
  }
289
293
  if (!workosAuth) {
@@ -665,7 +669,7 @@ async function runMcpProxy() {
665
669
  { StreamableHTTPClientTransport },
666
670
  { Server },
667
671
  { StdioServerTransport },
668
- { ResultSchema },
672
+ { CallToolRequestSchema, ListToolsRequestSchema, ResultSchema },
669
673
  ] = await Promise.all([
670
674
  import("@modelcontextprotocol/sdk/client/index.js"),
671
675
  import("@modelcontextprotocol/sdk/client/streamableHttp.js"),
@@ -673,6 +677,7 @@ async function runMcpProxy() {
673
677
  import("@modelcontextprotocol/sdk/server/stdio.js"),
674
678
  import("@modelcontextprotocol/sdk/types.js"),
675
679
  ]);
680
+ const proxyRequestOptions = { timeout: 240_000, resetTimeoutOnProgress: true };
676
681
 
677
682
  const remote = new Client(
678
683
  { name: "askshepherd-mcp-proxy", version: PACKAGE_VERSION },
@@ -697,13 +702,17 @@ async function runMcpProxy() {
697
702
  fallbackRequestHandler: async (request, extra) => remote.request(
698
703
  request,
699
704
  passthroughResultSchema,
700
- { signal: extra.signal, timeout: 120_000, resetTimeoutOnProgress: true },
705
+ { ...proxyRequestOptions, signal: extra.signal },
701
706
  ),
702
707
  fallbackNotificationHandler: async (notification) => {
703
708
  await remote.notification(notification);
704
709
  },
705
710
  },
706
711
  );
712
+ local.setRequestHandler(ListToolsRequestSchema, async (request, extra) =>
713
+ remote.listTools(request.params, { ...proxyRequestOptions, signal: extra.signal }));
714
+ local.setRequestHandler(CallToolRequestSchema, async (request, extra) =>
715
+ remote.callTool(request.params, passthroughResultSchema, { ...proxyRequestOptions, signal: extra.signal }));
707
716
  await local.connect(new StdioServerTransport());
708
717
  }
709
718
 
@@ -1048,19 +1057,19 @@ function parseArgs(argv) {
1048
1057
 
1049
1058
  function printHelp(which) {
1050
1059
  if (which === "agent") {
1051
- console.log(`Shepherd coding-agent onboarding
1060
+ console.log(`Shepherd coding-agent setup
1052
1061
 
1053
1062
  Usage:
1054
1063
  npx -y ${PACKAGE_NAME}@latest agent
1055
1064
  npx -y ${PACKAGE_NAME}@latest agent --login
1056
1065
  npx -y ${PACKAGE_NAME}@latest agent --name <name> --org <organization>
1057
- npx -y ${PACKAGE_NAME}@latest messages-chats
1058
1066
  npx -y ${PACKAGE_NAME}@latest agent --continue --granola-api-key <key> --messages-handle <value> --messages-chat-ids <ids>
1059
1067
  npx -y ${PACKAGE_NAME}@latest agent --status
1068
+ npx -y ${PACKAGE_NAME}@latest messages-chats
1060
1069
  npx -y ${PACKAGE_NAME}@latest granola-api-keys
1061
1070
 
1062
- Agent mode is non-interactive. It prints the user prompt and exact commands a coding agent should run.
1063
- Always run --login first. WorkOS login/signup creates or relinks the Shepherd account before source setup; Google Workspace uses Admin Console domain-wide delegation, not WorkOS OAuth.
1071
+ The bare agent command is intended for coding-agent shells. For direct terminal setup, run:
1072
+ npx -y ${PACKAGE_NAME}@latest
1064
1073
  `);
1065
1074
  return;
1066
1075
  }
@@ -1204,6 +1213,26 @@ Options:
1204
1213
  `);
1205
1214
  }
1206
1215
 
1216
+ function shouldPrintAgentContract() {
1217
+ return Boolean(args.prompt || args.json || !isInteractiveTerminal());
1218
+ }
1219
+
1220
+ function isInteractiveTerminal() {
1221
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
1222
+ }
1223
+
1224
+ function printAgentTerminalHandoff() {
1225
+ console.log(`Shepherd raw sync setup
1226
+
1227
+ This command is meant for coding-agent shells. To set up Shepherd directly in this terminal, run:
1228
+ ${agentCommand()}
1229
+
1230
+ If a coding agent asked you to onboard Shepherd, ask the agent to run:
1231
+ ${agentCommand()} agent
1232
+
1233
+ No source setup has started.`);
1234
+ }
1235
+
1207
1236
  function printAgentContract() {
1208
1237
  const command = agentCommand();
1209
1238
  const payload = {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "askshepherd",
3
- "version": "0.1.26",
4
- "description": "Customer-facing Shepherd raw sync onboarding CLI",
3
+ "version": "0.1.29",
4
+ "description": "Customer-facing Shepherd production onboarding and MCP CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "askshepherd": "bin/shepherd-onboard.js",
8
+ "shepherd": "bin/shepherd-onboard.js",
8
9
  "shepherd-onboard": "bin/shepherd-onboard.js"
9
10
  },
10
11
  "dependencies": {