@schoolai/shipyard 3.2.2 → 3.2.3-rc.20260422.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.
Files changed (31) hide show
  1. package/dist/{auth-5RJ4YKPC.js → auth-LS3NBD42.js} +3 -3
  2. package/dist/{chunk-NZFMJMJN.js → chunk-67VJDX7G.js} +3 -3
  3. package/dist/{chunk-HF5GUPSU.js → chunk-CCW5QAUH.js} +2 -2
  4. package/dist/{chunk-DB5R6SKT.js → chunk-DNIC3FOH.js} +2 -2
  5. package/dist/{chunk-5RH5JP3R.js → chunk-GLH3V7NG.js} +2 -2
  6. package/dist/{chunk-KUV4J6NI.js → chunk-M5M6VC5F.js} +1 -2
  7. package/dist/{chunk-KUV4J6NI.js.map → chunk-M5M6VC5F.js.map} +1 -1
  8. package/dist/{chunk-N4ZTO3K3.js → chunk-PUSIYUI2.js} +2 -2
  9. package/dist/{chunk-N4ZTO3K3.js.map → chunk-PUSIYUI2.js.map} +1 -1
  10. package/dist/{chunk-KWRAP2UK.js → chunk-U3DFIEPO.js} +5 -5
  11. package/dist/index.js +8 -8
  12. package/dist/login-D76M73Z4.js +19 -0
  13. package/dist/{logout-432UPTCL.js → logout-M7F7HXUU.js} +5 -5
  14. package/dist/{mcp-servers-YT5BADYE.js → mcp-servers-MUVTAMDT.js} +4 -4
  15. package/dist/{roi-MVOOANFC.js → roi-ZCVNBSTO.js} +3 -3
  16. package/dist/{serve-O4AHOTL4.js → serve-JJ4IH43W.js} +79 -37
  17. package/dist/{serve-O4AHOTL4.js.map → serve-JJ4IH43W.js.map} +1 -1
  18. package/dist/{start-G2VIRDQI.js → start-HSU4XA4I.js} +8 -8
  19. package/package.json +3 -3
  20. package/dist/login-ZPYQLQ52.js +0 -19
  21. /package/dist/{auth-5RJ4YKPC.js.map → auth-LS3NBD42.js.map} +0 -0
  22. /package/dist/{chunk-NZFMJMJN.js.map → chunk-67VJDX7G.js.map} +0 -0
  23. /package/dist/{chunk-HF5GUPSU.js.map → chunk-CCW5QAUH.js.map} +0 -0
  24. /package/dist/{chunk-DB5R6SKT.js.map → chunk-DNIC3FOH.js.map} +0 -0
  25. /package/dist/{chunk-5RH5JP3R.js.map → chunk-GLH3V7NG.js.map} +0 -0
  26. /package/dist/{chunk-KWRAP2UK.js.map → chunk-U3DFIEPO.js.map} +0 -0
  27. /package/dist/{login-ZPYQLQ52.js.map → login-D76M73Z4.js.map} +0 -0
  28. /package/dist/{logout-432UPTCL.js.map → logout-M7F7HXUU.js.map} +0 -0
  29. /package/dist/{mcp-servers-YT5BADYE.js.map → mcp-servers-MUVTAMDT.js.map} +0 -0
  30. /package/dist/{roi-MVOOANFC.js.map → roi-ZCVNBSTO.js.map} +0 -0
  31. /package/dist/{start-G2VIRDQI.js.map → start-HSU4XA4I.js.map} +0 -0
@@ -47,11 +47,11 @@ import {
47
47
  VaultKeyPutRequestSchema,
48
48
  VaultKeyPutResponseSchema,
49
49
  classifyClaudeCodeCompatibility
50
- } from "./chunk-N4ZTO3K3.js";
50
+ } from "./chunk-PUSIYUI2.js";
51
51
  import "./chunk-EHQITHQX.js";
52
52
  import {
53
53
  loadAuthToken
54
- } from "./chunk-5RH5JP3R.js";
54
+ } from "./chunk-GLH3V7NG.js";
55
55
  import {
56
56
  DiscoveryStateSchema,
57
57
  detectMCPServers,
@@ -62,19 +62,19 @@ import {
62
62
  redactEnv,
63
63
  resolveEnabledMcpServers,
64
64
  resolveStdioEnv
65
- } from "./chunk-NZFMJMJN.js";
65
+ } from "./chunk-67VJDX7G.js";
66
66
  import {
67
67
  createChildLogger,
68
68
  flushLogger,
69
69
  logger
70
- } from "./chunk-DB5R6SKT.js";
70
+ } from "./chunk-DNIC3FOH.js";
71
71
  import {
72
72
  external_exports,
73
73
  getShipyardHome,
74
74
  isVanillaAgentMode,
75
75
  toJSONSchema,
76
76
  validateEnv
77
- } from "./chunk-KUV4J6NI.js";
77
+ } from "./chunk-M5M6VC5F.js";
78
78
  import {
79
79
  detectSkills
80
80
  } from "./chunk-DPMRSLYJ.js";
@@ -31690,7 +31690,7 @@ function nanoid(size2 = 21) {
31690
31690
  }
31691
31691
 
31692
31692
  // src/services/bootstrap/signaling.ts
31693
- var DAEMON_NPM_VERSION = true ? "3.2.2" : "unknown";
31693
+ var DAEMON_NPM_VERSION = true ? "3.2.3" : "unknown";
31694
31694
  function createDaemonSignaling(config2) {
31695
31695
  const agentId = config2.agentId ?? nanoid();
31696
31696
  function send(msg) {
@@ -34005,7 +34005,6 @@ async function deleteAdvertisement(shipyardHome) {
34005
34005
 
34006
34006
  // src/services/local-direct/local-direct-wiring.ts
34007
34007
  async function setupLocalDirect(deps) {
34008
- if (!deps.env.SHIPYARD_LOCAL_DIRECT) return null;
34009
34008
  const token = generateLocalDirectToken();
34010
34009
  const server = await createLocalDirectServer({
34011
34010
  token,
@@ -84572,16 +84571,18 @@ async function buildRateLimitStore(dataDir, opts) {
84572
84571
  }
84573
84572
  };
84574
84573
  }
84574
+ function deriveWindowFromEvent(incoming, eventTime) {
84575
+ if (!isWindowKey(incoming.rateLimitType)) return void 0;
84576
+ const utilization = typeof incoming.utilization === "number" ? incoming.utilization : incoming.status === "rejected" ? 1 : void 0;
84577
+ if (utilization === void 0) return void 0;
84578
+ return { utilization, resetsAt: incoming.resetsAt, updatedAt: eventTime };
84579
+ }
84575
84580
  function mergeEvent(prev, incoming, eventTime) {
84576
84581
  const prevByWindow = prev?.byWindow ?? {};
84577
84582
  const byWindow = { ...prevByWindow };
84578
- if (isWindowKey(incoming.rateLimitType) && typeof incoming.utilization === "number") {
84579
- const window2 = {
84580
- utilization: incoming.utilization,
84581
- resetsAt: incoming.resetsAt,
84582
- updatedAt: eventTime
84583
- };
84584
- byWindow[incoming.rateLimitType] = window2;
84583
+ const derived = deriveWindowFromEvent(incoming, eventTime);
84584
+ if (derived && isWindowKey(incoming.rateLimitType)) {
84585
+ byWindow[incoming.rateLimitType] = derived;
84585
84586
  }
84586
84587
  const nowInOverage = incoming.isUsingOverage === true;
84587
84588
  const wasInOverage = prev?.overageStartedAt !== void 0;
@@ -84635,12 +84636,15 @@ function migrateV1toV2(v1) {
84635
84636
  for (const [accountKey, record] of Object.entries(v1.records)) {
84636
84637
  const { info, updatedAt } = record;
84637
84638
  const byWindow = {};
84638
- if (isWindowKey(info.rateLimitType) && typeof info.utilization === "number") {
84639
- byWindow[info.rateLimitType] = {
84640
- utilization: info.utilization,
84641
- resetsAt: info.resetsAt,
84642
- updatedAt
84643
- };
84639
+ if (isWindowKey(info.rateLimitType)) {
84640
+ const utilization = typeof info.utilization === "number" ? info.utilization : info.status === "rejected" ? 1 : void 0;
84641
+ if (utilization !== void 0) {
84642
+ byWindow[info.rateLimitType] = {
84643
+ utilization,
84644
+ resetsAt: info.resetsAt,
84645
+ updatedAt
84646
+ };
84647
+ }
84644
84648
  }
84645
84649
  const nowInOverage = info.isUsingOverage === true;
84646
84650
  records[accountKey] = {
@@ -91117,11 +91121,24 @@ var StructuredTaskTracker = class {
91117
91121
  #ccTaskWatcherDispose = null;
91118
91122
  #suppressWriteThrough = false;
91119
91123
  #ccTaskFileWriter;
91120
- #restoreInProgress = false;
91124
+ /**
91125
+ * Gate the first flush until an overlay has either been applied or the
91126
+ * caller has explicitly signaled that none is coming. Both flags below
91127
+ * must be false for the flush to proceed during restore.
91128
+ */
91129
+ #restoreNeedsOverlay = false;
91130
+ /**
91131
+ * Gate the first flush until the file watcher's initial disk reconcile
91132
+ * has fired. Only set during restore for tasks with a session id.
91133
+ */
91134
+ #restoreNeedsDisk = false;
91121
91135
  constructor(deps) {
91122
91136
  this.#deps = deps;
91123
91137
  this.#ccTaskFileWriter = createCCTaskFileWriter(null, deps.log);
91124
- this.#restoreInProgress = deps.restoreInProgress ?? false;
91138
+ if (deps.restoreInProgress) {
91139
+ this.#restoreNeedsOverlay = true;
91140
+ this.#restoreNeedsDisk = deps.restoreExpectDisk ?? false;
91141
+ }
91125
91142
  }
91126
91143
  get currentOverlay() {
91127
91144
  return this.#currentOverlay;
@@ -91165,24 +91182,37 @@ var StructuredTaskTracker = class {
91165
91182
  }
91166
91183
  /**
91167
91184
  * Apply an overlay on top of CC tasks. Stores the overlay and re-flushes.
91168
- * Exits restore mode applyOverlay is the terminal piece of restoration
91169
- * (disk reconcile is idempotent with the seeded overlay, so we flush once
91170
- * here with full inputs instead of producing a partial pre-overlay flush).
91185
+ * Clears the overlay-pending gate. The flush still waits if a disk reconcile
91186
+ * is expected (restoreExpectDisk=true at construction): without that second
91187
+ * gate, the applyOverlay-first restart ordering would emit an overlay-only
91188
+ * map to the store on every boot, bumping TaskRecord.lastActivityAt for
91189
+ * every restored task that has an overlay.
91171
91190
  */
91172
91191
  applyOverlay(overlay) {
91173
91192
  this.#currentOverlay = overlay;
91174
- this.#restoreInProgress = false;
91193
+ this.#restoreNeedsOverlay = false;
91175
91194
  this.#flushStructuredTasks();
91176
91195
  }
91177
91196
  /**
91178
- * Signal that restoration has finished for tasks that have no persisted
91179
- * overlay to apply. Unblocks #flushStructuredTasks and runs one flush with
91180
- * the current state (disk-only, no overlay). Must be called by the
91181
- * restoration caller whenever applyOverlay will not be invoked.
91197
+ * Signal that no overlay will be applied during this restore. Clears the
91198
+ * overlay-pending gate but NOT the disk gate if the restored task has a
91199
+ * session id, the file watcher's first reconcile remains the terminal
91200
+ * signal before the store receives a flush.
91201
+ */
91202
+ markNoOverlay() {
91203
+ if (!this.#restoreNeedsOverlay) return;
91204
+ this.#restoreNeedsOverlay = false;
91205
+ this.#flushStructuredTasks();
91206
+ }
91207
+ /**
91208
+ * Clear BOTH restore gates. Used in error paths (hydration promise rejected)
91209
+ * and by restorers that know neither an overlay nor a disk reconcile will
91210
+ * arrive. If either signal fires after this, the natural flush handles it.
91182
91211
  */
91183
91212
  markRestoreComplete() {
91184
- if (!this.#restoreInProgress) return;
91185
- this.#restoreInProgress = false;
91213
+ if (!this.#restoreNeedsOverlay && !this.#restoreNeedsDisk) return;
91214
+ this.#restoreNeedsOverlay = false;
91215
+ this.#restoreNeedsDisk = false;
91186
91216
  this.#flushStructuredTasks();
91187
91217
  }
91188
91218
  processStructuredTaskEvents(content) {
@@ -91292,7 +91322,7 @@ var StructuredTaskTracker = class {
91292
91322
  * 7. Push to updateStructuredTasks
91293
91323
  */
91294
91324
  #flushStructuredTasks() {
91295
- if (this.#restoreInProgress) return;
91325
+ if (this.#restoreNeedsOverlay || this.#restoreNeedsDisk) return;
91296
91326
  const overlay = this.#currentOverlay ?? DEFAULT_TASK_OVERLAY;
91297
91327
  const merged = applyOverlayToMap(this.#structuredTasks, overlay);
91298
91328
  const todoProgress = computeTodoProgress(merged);
@@ -91314,6 +91344,7 @@ var StructuredTaskTracker = class {
91314
91344
  * - Re-flush with overlay applied
91315
91345
  */
91316
91346
  #reconcileFromDisk(ccTasks) {
91347
+ this.#restoreNeedsDisk = false;
91317
91348
  const currentDiskIds = /* @__PURE__ */ new Set();
91318
91349
  for (const file of ccTasks) {
91319
91350
  currentDiskIds.add(file.id);
@@ -92497,7 +92528,12 @@ var Task = class {
92497
92528
  taskId: deps.taskId,
92498
92529
  log: deps.log,
92499
92530
  updateStructuredTasks: deps.updateStructuredTasks,
92500
- restoreInProgress: deps.restoreInProgress ?? false
92531
+ restoreInProgress: deps.restoreInProgress ?? false,
92532
+ /**
92533
+ * Only wait for a disk reconcile if a CC session exists — else the file
92534
+ * watcher never attaches and the gate would never clear.
92535
+ */
92536
+ restoreExpectDisk: Boolean(deps.restoreInProgress && deps.existingSessionId)
92501
92537
  });
92502
92538
  this.#pushManager = new ResourcePushManager({
92503
92539
  taskId: deps.taskId,
@@ -94192,6 +94228,10 @@ Use this context to maintain continuity. You have already done this work \u2014
94192
94228
  markStructuredTaskRestoreComplete() {
94193
94229
  this.#structuredTaskTracker.markRestoreComplete();
94194
94230
  }
94231
+ /** See StructuredTaskTracker.markNoOverlay. */
94232
+ markStructuredTaskNoOverlay() {
94233
+ this.#structuredTaskTracker.markNoOverlay();
94234
+ }
94195
94235
  /** ---------------------------------------------------------------- */
94196
94236
  /** Resource resolution */
94197
94237
  /** ---------------------------------------------------------------- */
@@ -95132,11 +95172,14 @@ var TaskManager = class {
95132
95172
  const cwd = opts.cwd;
95133
95173
  const mode = opts.mode ?? "task";
95134
95174
  let orchestratorRef = null;
95175
+ const hasSession = Boolean(opts.existingSessionId);
95135
95176
  const restoreHydration = async () => {
95136
95177
  const record = await this.#deps.taskStateStore.getTask(taskId);
95137
95178
  if (!orchestratorRef || !this.#tasks.has(taskId)) return;
95138
95179
  if (record?.taskOverlay) {
95139
95180
  orchestratorRef.applyOverlay(record.taskOverlay);
95181
+ } else if (hasSession) {
95182
+ orchestratorRef.markStructuredTaskNoOverlay();
95140
95183
  } else {
95141
95184
  orchestratorRef.markStructuredTaskRestoreComplete();
95142
95185
  }
@@ -99787,7 +99830,7 @@ function friendlyExecError(err) {
99787
99830
  async function refreshPluginCapabilities(daemon, tokenStore) {
99788
99831
  const [updatedMarketplace, updatedMcp, updatedSkills] = await Promise.all([
99789
99832
  detectMarketplacePlugins(),
99790
- import("./mcp-servers-YT5BADYE.js").then(
99833
+ import("./mcp-servers-MUVTAMDT.js").then(
99791
99834
  (m2) => m2.detectMCPServers(daemon.capabilities.environments, tokenStore)
99792
99835
  ),
99793
99836
  import("./skills-NCKYNLUS.js").then(
@@ -105558,7 +105601,6 @@ async function serve(options = {}) {
105558
105601
  const peerManager = peerSetupDeps ? buildPeerManager(peerSetupDeps) : null;
105559
105602
  if (peerSetupDeps && !localDirectRef.current) {
105560
105603
  const handle = await setupLocalDirect({
105561
- env,
105562
105604
  shipyardHome,
105563
105605
  daemonId: daemonPeerId,
105564
105606
  userId: auth3.userId,
@@ -105701,4 +105743,4 @@ export {
105701
105743
  _testing,
105702
105744
  serve
105703
105745
  };
105704
- //# sourceMappingURL=serve-O4AHOTL4.js.map
105746
+ //# sourceMappingURL=serve-JJ4IH43W.js.map