@schoolai/shipyard-mcp 0.1.3 → 0.2.0-next.477

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.
@@ -1,5 +1,7 @@
1
1
  # Server Environment Variables
2
2
  # Copy this file to .env and adjust values for local development
3
+ #
4
+ # NOTE: Production URLs are the defaults. Only set these for local development.
3
5
 
4
6
  # Server configuration
5
7
  NODE_ENV=development
@@ -10,8 +12,15 @@ REGISTRY_PORT=32191
10
12
  SHIPYARD_STATE_DIR=~/.shipyard
11
13
 
12
14
  # Web UI URL (for links generated by server)
15
+ # Default: https://schoolai.github.io/shipyard (production)
16
+ # Uncomment for local development:
13
17
  SHIPYARD_WEB_URL=http://localhost:5173
14
18
 
19
+ # WebRTC signaling server
20
+ # Default: wss://shipyard-signaling.jacob-191.workers.dev (production)
21
+ # Uncomment for local development:
22
+ SIGNALING_URL=ws://localhost:4444
23
+
15
24
  # GitHub integration (optional - falls back to gh CLI)
16
25
  GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
17
26
 
@@ -863,7 +863,7 @@ function createHandedOffConversationVersion(params) {
863
863
  return ConversationVersionSchema.parse(version);
864
864
  }
865
865
 
866
- // ../../packages/schema/dist/yjs-helpers-xzZyVQl7.mjs
866
+ // ../../packages/schema/dist/yjs-helpers-BBG4tC2R.mjs
867
867
  import { z as z2 } from "zod";
868
868
  import { nanoid as nanoid2 } from "nanoid";
869
869
  import * as Y from "yjs";
@@ -959,6 +959,7 @@ var CreateSubscriptionRequestSchema = z2.object({
959
959
  threshold: z2.number().positive().optional()
960
960
  });
961
961
  var CreateSubscriptionResponseSchema = z2.object({ clientId: z2.string() });
962
+ var DEFAULT_INPUT_REQUEST_TIMEOUT_SECONDS = 1800;
962
963
  var InputRequestTypeValues = [
963
964
  "text",
964
965
  "multiline",
@@ -977,7 +978,7 @@ var InputRequestBaseSchema = z2.object({
977
978
  message: z2.string().min(1, "Message cannot be empty"),
978
979
  status: z2.enum(InputRequestStatusValues),
979
980
  defaultValue: z2.string().optional(),
980
- timeout: z2.number().int().min(10, "Timeout must be at least 10 seconds").max(900, "Timeout cannot exceed 15 minutes").optional(),
981
+ timeout: z2.number().int().min(10, "Timeout must be at least 10 seconds").max(14400, "Timeout cannot exceed 4 hours").optional(),
981
982
  planId: z2.string().optional(),
982
983
  response: z2.unknown().optional(),
983
984
  answeredAt: z2.number().optional(),
@@ -1175,6 +1176,30 @@ function applyStatusTransitionFields(map, transition) {
1175
1176
  assertNever(transition);
1176
1177
  }
1177
1178
  }
1179
+ function resetPlanToDraft(ydoc, actor) {
1180
+ const metadataResult = getPlanMetadataWithValidation(ydoc);
1181
+ if (!metadataResult.success) return {
1182
+ success: false,
1183
+ error: metadataResult.error
1184
+ };
1185
+ if (metadataResult.data.status === "draft") return {
1186
+ success: false,
1187
+ error: "Plan is already in draft status"
1188
+ };
1189
+ ydoc.transact(() => {
1190
+ const map = ydoc.getMap(YDOC_KEYS.METADATA);
1191
+ map.set("status", "draft");
1192
+ map.delete("reviewRequestId");
1193
+ map.delete("reviewedAt");
1194
+ map.delete("reviewedBy");
1195
+ map.delete("reviewComment");
1196
+ map.delete("completedAt");
1197
+ map.delete("completedBy");
1198
+ map.delete("snapshotUrl");
1199
+ map.set("updatedAt", Date.now());
1200
+ }, actor ? { actor } : void 0);
1201
+ return { success: true };
1202
+ }
1178
1203
  function transitionPlanStatus(ydoc, transition, actor) {
1179
1204
  const metadataResult = getPlanMetadataWithValidation(ydoc);
1180
1205
  if (!metadataResult.success) return {
@@ -1700,6 +1725,34 @@ function cancelInputRequest(ydoc, requestId) {
1700
1725
  });
1701
1726
  return { success: true };
1702
1727
  }
1728
+ function declineInputRequest(ydoc, requestId) {
1729
+ const requestsArray = ydoc.getArray(YDOC_KEYS.INPUT_REQUESTS);
1730
+ const requests = requestsArray.toJSON();
1731
+ const index = requests.findIndex((r) => r.id === requestId);
1732
+ if (index === -1) return {
1733
+ success: false,
1734
+ error: "Request not found"
1735
+ };
1736
+ const request = requests[index];
1737
+ if (!request) return {
1738
+ success: false,
1739
+ error: "Request not found"
1740
+ };
1741
+ if (request.status !== "pending") return {
1742
+ success: false,
1743
+ error: `Request is not pending`
1744
+ };
1745
+ const declinedRequest = {
1746
+ ...request,
1747
+ status: "declined"
1748
+ };
1749
+ const validated = InputRequestSchema.parse(declinedRequest);
1750
+ ydoc.transact(() => {
1751
+ requestsArray.delete(index, 1);
1752
+ requestsArray.insert(index, [validated]);
1753
+ });
1754
+ return { success: true };
1755
+ }
1703
1756
 
1704
1757
  // ../../packages/schema/dist/url-encoding.mjs
1705
1758
  var import_lz_string = __toESM(require_lz_string(), 1);
@@ -2770,6 +2823,7 @@ export {
2770
2823
  UnregisterServerResponseSchema,
2771
2824
  CreateSubscriptionRequestSchema,
2772
2825
  CreateSubscriptionResponseSchema,
2826
+ DEFAULT_INPUT_REQUEST_TIMEOUT_SECONDS,
2773
2827
  InputRequestTypeValues,
2774
2828
  InputRequestStatusValues,
2775
2829
  InputRequestSchema,
@@ -2786,6 +2840,7 @@ export {
2786
2840
  getPlanMetadata,
2787
2841
  getPlanMetadataWithValidation,
2788
2842
  setPlanMetadata,
2843
+ resetPlanToDraft,
2789
2844
  transitionPlanStatus,
2790
2845
  initPlanMetadata,
2791
2846
  getStepCompletions,
@@ -2840,6 +2895,7 @@ export {
2840
2895
  unarchivePlan,
2841
2896
  answerInputRequest,
2842
2897
  cancelInputRequest,
2898
+ declineInputRequest,
2843
2899
  isUrlEncodedPlanV1,
2844
2900
  isUrlEncodedPlanV2,
2845
2901
  encodePlan,
@@ -3,7 +3,7 @@ import {
3
3
  YDOC_KEYS,
4
4
  createInputRequest,
5
5
  logPlanEvent
6
- } from "./chunk-LTC26IRQ.js";
6
+ } from "./chunk-76JWRTPI.js";
7
7
  import {
8
8
  logger
9
9
  } from "./chunk-GSGLHRWX.js";
@@ -156,10 +156,9 @@ var InputRequestManager = class {
156
156
  const handleTimeout = () => {
157
157
  if (resolved) return;
158
158
  logger.warn({ requestId, timeout: effectiveTimeout }, "Input request timed out");
159
- markRequestAsCancelled();
160
- if (resolved) return;
161
159
  resolved = true;
162
160
  cleanup();
161
+ markRequestAsCancelled();
163
162
  const timeStr = formatDuration(effectiveTimeout);
164
163
  resolve({
165
164
  success: false,
@@ -169,7 +168,6 @@ var InputRequestManager = class {
169
168
  };
170
169
  const markRequestAsCancelled = () => {
171
170
  ydoc.transact(() => {
172
- if (resolved) return;
173
171
  const currentRequest = findRequest();
174
172
  if (!currentRequest || currentRequest.status !== "pending") {
175
173
  return;
@@ -5,6 +5,8 @@ import {
5
5
 
6
6
  // src/server-identity.ts
7
7
  import { execSync as execSync2 } from "child_process";
8
+ import os from "os";
9
+ import { basename } from "path";
8
10
 
9
11
  // src/config/env/github.ts
10
12
  import { execSync } from "child_process";
@@ -150,9 +152,29 @@ function getUsernameFromGitConfig() {
150
152
  return null;
151
153
  }
152
154
  }
155
+ function getGitBranch() {
156
+ try {
157
+ return execSync2("git branch --show-current", {
158
+ encoding: "utf-8",
159
+ timeout: 2e3,
160
+ stdio: ["pipe", "pipe", "pipe"]
161
+ }).trim() || void 0;
162
+ } catch {
163
+ return void 0;
164
+ }
165
+ }
166
+ function getEnvironmentContext() {
167
+ return {
168
+ projectName: basename(process.cwd()) || void 0,
169
+ branch: getGitBranch(),
170
+ hostname: os.hostname(),
171
+ repo: getRepositoryFullName() || void 0
172
+ };
173
+ }
153
174
 
154
175
  export {
155
176
  githubConfig,
156
177
  getRepositoryFullName,
157
- getGitHubUsername
178
+ getGitHubUsername,
179
+ getEnvironmentContext
158
180
  };
@@ -23,6 +23,7 @@ import {
23
23
  CreateSubscriptionRequestSchema,
24
24
  CreateSubscriptionResponseSchema,
25
25
  CursorOriginMetadataSchema,
26
+ DEFAULT_INPUT_REQUEST_TIMEOUT_SECONDS,
26
27
  DeleteSubscriptionResponseSchema,
27
28
  DeliverableSchema,
28
29
  DevinOriginMetadataSchema,
@@ -108,6 +109,7 @@ import {
108
109
  createPlanUrl,
109
110
  createPlanUrlWithHistory,
110
111
  createUserResolver,
112
+ declineInputRequest,
111
113
  decodeChunkMessage,
112
114
  decodeExportEndMessage,
113
115
  decodeExportStartMessage,
@@ -185,6 +187,7 @@ import {
185
187
  removePlanIndexEntry,
186
188
  removePlanTag,
187
189
  removeViewedByFromIndex,
190
+ resetPlanToDraft,
188
191
  resolvePRReviewComment,
189
192
  revokeUser,
190
193
  setAgentPresence,
@@ -201,7 +204,7 @@ import {
201
204
  updateLinkedPRStatus,
202
205
  updatePlanIndexViewedBy,
203
206
  validateA2AMessages
204
- } from "./chunk-LTC26IRQ.js";
207
+ } from "./chunk-76JWRTPI.js";
205
208
  import "./chunk-JSBRDJBE.js";
206
209
  export {
207
210
  A2ADataPartSchema,
@@ -228,6 +231,7 @@ export {
228
231
  CreateSubscriptionRequestSchema,
229
232
  CreateSubscriptionResponseSchema,
230
233
  CursorOriginMetadataSchema,
234
+ DEFAULT_INPUT_REQUEST_TIMEOUT_SECONDS,
231
235
  DeleteSubscriptionResponseSchema,
232
236
  DeliverableSchema,
233
237
  DevinOriginMetadataSchema,
@@ -313,6 +317,7 @@ export {
313
317
  createPlanUrl,
314
318
  createPlanUrlWithHistory,
315
319
  createUserResolver,
320
+ declineInputRequest,
316
321
  decodeChunkMessage,
317
322
  decodeExportEndMessage,
318
323
  decodeExportStartMessage,
@@ -390,6 +395,7 @@ export {
390
395
  removePlanIndexEntry,
391
396
  removePlanTag,
392
397
  removeViewedByFromIndex,
398
+ resetPlanToDraft,
393
399
  resolvePRReviewComment,
394
400
  revokeUser,
395
401
  setAgentPresence,