@sideboard-ai/core 0.1.157 → 0.1.158

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.d.cts CHANGED
@@ -3978,6 +3978,9 @@ declare class Orchestrator {
3978
3978
  * finish or a user send so a later crash can recover again.
3979
3979
  */
3980
3980
  private readonly crashContinued;
3981
+ /** Auto-continues after a worktree turn ended while a detached job still runs. */
3982
+ private readonly jobContinueCount;
3983
+ private readonly jobContinueNudged;
3981
3984
  private maxConcurrent;
3982
3985
  private runningCount;
3983
3986
  constructor(opts?: {
@@ -4042,6 +4045,12 @@ declare class Orchestrator {
4042
4045
  * next prompt so the same agent can continue instead of sitting on lastError.
4043
4046
  */
4044
4047
  private maybeEnqueueCrashContinue;
4048
+ /**
4049
+ * Worktree agent ended the turn after “I’ll let you know” (or left a
4050
+ * detached test/pack job running). Queue a continue so the chat does not
4051
+ * go idle with nobody watching the log.
4052
+ */
4053
+ private maybeEnqueueJobContinue;
4045
4054
  getThreads(includeArchived?: boolean): Thread[];
4046
4055
  getThread(idOrRef: string): Thread | null;
4047
4056
  createThread(input: CreateThreadInput): Promise<Thread>;
@@ -4644,7 +4653,7 @@ declare function startMcpServer(): Promise<void>;
4644
4653
  type SideboardMcpProfile = 'worktree' | 'orchestration';
4645
4654
  declare const SIDEBOARD_MCP_PROFILE_ENV = "SIDEBOARD_MCP_PROFILE";
4646
4655
  /** UI tools always registered when SIDEBOARD_MCP_PROFILE=worktree (coding chats). */
4647
- declare const WORKTREE_MCP_TOOLS: readonly ["present_artifact", "ask_user", "present_plan", "present_schema", "present_files"];
4656
+ declare const WORKTREE_MCP_TOOLS: readonly ["present_artifact", "ask_user", "present_plan", "present_schema", "present_files", "wait_for_job"];
4648
4657
  /** GitHub Issues via Account `gh` — always registered on worktree + orchestration. */
4649
4658
  declare const WORKTREE_GITHUB_MCP_TOOLS: readonly ["github_get_issue", "github_comment", "github_update_issue", "github_create_issue"];
4650
4659
  /** Account Linear tools registered when Linear is connected. */
package/dist/index.d.ts CHANGED
@@ -3978,6 +3978,9 @@ declare class Orchestrator {
3978
3978
  * finish or a user send so a later crash can recover again.
3979
3979
  */
3980
3980
  private readonly crashContinued;
3981
+ /** Auto-continues after a worktree turn ended while a detached job still runs. */
3982
+ private readonly jobContinueCount;
3983
+ private readonly jobContinueNudged;
3981
3984
  private maxConcurrent;
3982
3985
  private runningCount;
3983
3986
  constructor(opts?: {
@@ -4042,6 +4045,12 @@ declare class Orchestrator {
4042
4045
  * next prompt so the same agent can continue instead of sitting on lastError.
4043
4046
  */
4044
4047
  private maybeEnqueueCrashContinue;
4048
+ /**
4049
+ * Worktree agent ended the turn after “I’ll let you know” (or left a
4050
+ * detached test/pack job running). Queue a continue so the chat does not
4051
+ * go idle with nobody watching the log.
4052
+ */
4053
+ private maybeEnqueueJobContinue;
4045
4054
  getThreads(includeArchived?: boolean): Thread[];
4046
4055
  getThread(idOrRef: string): Thread | null;
4047
4056
  createThread(input: CreateThreadInput): Promise<Thread>;
@@ -4644,7 +4653,7 @@ declare function startMcpServer(): Promise<void>;
4644
4653
  type SideboardMcpProfile = 'worktree' | 'orchestration';
4645
4654
  declare const SIDEBOARD_MCP_PROFILE_ENV = "SIDEBOARD_MCP_PROFILE";
4646
4655
  /** UI tools always registered when SIDEBOARD_MCP_PROFILE=worktree (coding chats). */
4647
- declare const WORKTREE_MCP_TOOLS: readonly ["present_artifact", "ask_user", "present_plan", "present_schema", "present_files"];
4656
+ declare const WORKTREE_MCP_TOOLS: readonly ["present_artifact", "ask_user", "present_plan", "present_schema", "present_files", "wait_for_job"];
4648
4657
  /** GitHub Issues via Account `gh` — always registered on worktree + orchestration. */
4649
4658
  declare const WORKTREE_GITHUB_MCP_TOOLS: readonly ["github_get_issue", "github_comment", "github_update_issue", "github_create_issue"];
4650
4659
  /** Account Linear tools registered when Linear is connected. */
package/dist/index.js CHANGED
@@ -162,6 +162,10 @@ import {
162
162
  listWorktreeFiles,
163
163
  loadAgentInstructions,
164
164
  maybeCompactContext,
165
+ mcpWaitFinishedHint,
166
+ mcpWaitForJobTimeoutMs,
167
+ mcpWaitForTurnTimeoutMs,
168
+ mcpWaitStillRunningHint,
165
169
  mergeSetupOutput,
166
170
  messagesSinceLastBrightsyContextSummary,
167
171
  normalizeServiceOrigin,
@@ -223,13 +227,14 @@ import {
223
227
  updateSchedule,
224
228
  upsertSlackWorkspace,
225
229
  verifyOptionalService,
230
+ waitForDetachedJob,
226
231
  waitForPidExit,
227
232
  withAgentInstructions,
228
233
  worktreeBoardStatus,
229
234
  worktreeCleanupSettings,
230
235
  wrapReviewSkillMarkdown,
231
236
  writeWorktreeFile
232
- } from "./chunk-GWEEGE6L.js";
237
+ } from "./chunk-KYKNFJK5.js";
233
238
  import {
234
239
  LEGACY_PLAN_FILE_REL,
235
240
  PLAN_FILE_NAME,
@@ -332,7 +337,7 @@ import {
332
337
  withEventParentId,
333
338
  withEventsParentId,
334
339
  writeInjectedMcpConfig
335
- } from "./chunk-TIJ6QVX5.js";
340
+ } from "./chunk-BLRHO7XQ.js";
336
341
  import {
337
342
  CLOUD_COORDINATOR_BUSY_REPLY,
338
343
  CLOUD_COORDINATOR_STOPPED_REPLY,
@@ -2294,28 +2299,6 @@ function mcpArchiveBlockedReason(thread) {
2294
2299
  return null;
2295
2300
  }
2296
2301
 
2297
- // src/mcp/wait-for-turn.ts
2298
- var MCP_WAIT_FOR_TURN_MAX_MS = 45e3;
2299
- function mcpWaitForTurnTimeoutMs(requested) {
2300
- const n = requested ?? MCP_WAIT_FOR_TURN_MAX_MS;
2301
- if (!Number.isFinite(n)) return MCP_WAIT_FOR_TURN_MAX_MS;
2302
- return Math.min(Math.max(1e3, Math.floor(n)), MCP_WAIT_FOR_TURN_MAX_MS);
2303
- }
2304
- var MCP_WAIT_STILL_RUNNING_HINT = "Child is still working. Call wait_for_turn again. Do not send a check-in prompt or assume a hang while progress is updating.";
2305
- var MCP_WAIT_QUEUED_HINT = "Child is queued waiting for a concurrency slot \u2014 it has not started yet. Call wait_for_turn again. Do not send a check-in prompt, force_stop, or assume it failed to start.";
2306
- function mcpWaitStillRunningHint(status) {
2307
- return status === "queued" ? MCP_WAIT_QUEUED_HINT : MCP_WAIT_STILL_RUNNING_HINT;
2308
- }
2309
- var MCP_WAIT_STOPPED_HINT = "Child was stopped before the turn finished. Do not treat this as success. send_to_thread to resume, or tell the user.";
2310
- var MCP_WAIT_BROKEN_HINT = "Child worktree is broken (missing on disk). Tell the user \u2014 do not treat this as success.";
2311
- var MCP_WAIT_ERROR_HINT = "Child turn failed. lastError/text is the failure \u2014 switch agent, tell the user, or retry. Do not treat empty text as success.";
2312
- function mcpWaitFinishedHint(status) {
2313
- if (status === "stopped") return MCP_WAIT_STOPPED_HINT;
2314
- if (status === "broken") return MCP_WAIT_BROKEN_HINT;
2315
- if (status === "error") return MCP_WAIT_ERROR_HINT;
2316
- return void 0;
2317
- }
2318
-
2319
2302
  // src/mcp/thread-visibility.ts
2320
2303
  function lastMessagePreview(messages, max = 160) {
2321
2304
  if (!messages?.length) return null;
@@ -4125,6 +4108,20 @@ async function startMcpServer() {
4125
4108
  return { content: [{ type: "text", text: JSON.stringify(payload) }] };
4126
4109
  }
4127
4110
  );
4111
+ server.tool(
4112
+ "wait_for_job",
4113
+ "Wait on a detached long job (tests, pack, deploy) started with detached-job.js. MCP clients kill tools around 60s, so this returns within 45s. stillRunning is the source of truth \u2014 if true, present_artifact type=log with content=delta (same artifact_id) and call wait_for_job again. Do not end the turn or tell the user you will let them know later. If false, ok/failed is the result.",
4114
+ {
4115
+ id: z6.string().describe("Detached job id (same kebab-case id passed to detached-job.js start)"),
4116
+ timeoutMs: z6.number().optional()
4117
+ },
4118
+ async ({ id, timeoutMs }) => {
4119
+ const result = await waitForDetachedJob(process.cwd(), id, {
4120
+ timeoutMs: mcpWaitForJobTimeoutMs(timeoutMs)
4121
+ });
4122
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
4123
+ }
4124
+ );
4128
4125
  if (!worktreeProfile) {
4129
4126
  registerSlackTools(server);
4130
4127
  registerConnectedIssueVendorTools(server);