@threadbase-sh/streamer 1.19.0 → 1.20.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.
package/dist/cli.cjs CHANGED
@@ -142077,6 +142077,7 @@ var WSHub = class {
142077
142077
 
142078
142078
  // src/server.ts
142079
142079
  var BROWSE_SYSTEM_PROMPT = (browseRoot) => `You are working within the project boundary: ${browseRoot}. Do not read, write, or execute commands that access files or directories outside this boundary.`;
142080
+ var DEFAULT_SYSTEM_PROMPT = "When presenting options or choices to the user, limit the options to at most 3.";
142080
142081
  var DEFAULT_PTY_GRACE_PERIOD_MS = 27e4;
142081
142082
  function parseIncludeAgentsEnv(raw2) {
142082
142083
  if (raw2 === void 0) return false;
@@ -142127,6 +142128,7 @@ var StreamerServer = class {
142127
142128
  pairTokens = new PairTokenStore();
142128
142129
  exchangeAttempts = /* @__PURE__ */ new Map();
142129
142130
  ptyGracePeriodMs;
142131
+ defaultSystemPrompt;
142130
142132
  // Map of sessionId → grace timer; fires to kill PTY after WS disconnect
142131
142133
  ptyGraceTimers = /* @__PURE__ */ new Map();
142132
142134
  // Map of sessionId → set of subscribed WS clients
@@ -142167,6 +142169,7 @@ var StreamerServer = class {
142167
142169
  this.scanProfiles = config2.scanProfiles;
142168
142170
  this.codexRoots = config2.codexRoots ?? [(0, import_path19.join)((0, import_os10.homedir)(), ".codex", "sessions")];
142169
142171
  this.ptyGracePeriodMs = config2.ptyGracePeriodMs ?? DEFAULT_PTY_GRACE_PERIOD_MS;
142172
+ this.defaultSystemPrompt = config2.defaultSystemPrompt ?? DEFAULT_SYSTEM_PROMPT;
142170
142173
  this.cacheDir = config2.cacheDir ?? loadCacheDir() ?? (0, import_path19.join)((0, import_os10.homedir)(), ".threadbase", "cache");
142171
142174
  this.tailSize = config2.tailSize ?? loadTailSize() ?? 10;
142172
142175
  this.directoryDebounceMs = parseDirScanDebounceEnv(process.env.THREADBASE_DIR_SCAN_DEBOUNCE_MS) ?? config2.directoryScanDebounceMs ?? 1e3;
@@ -143777,7 +143780,7 @@ var StreamerServer = class {
143777
143780
  return;
143778
143781
  }
143779
143782
  const body = await readBody(req);
143780
- const { path: relativePath } = body;
143783
+ const { path: relativePath, systemPrompt: clientPrompt } = body;
143781
143784
  if (typeof relativePath !== "string") {
143782
143785
  json2(res, 400, { error: "Missing path field" });
143783
143786
  return;
@@ -143791,11 +143794,16 @@ var StreamerServer = class {
143791
143794
  return;
143792
143795
  }
143793
143796
  this.discoveryCache = null;
143797
+ const systemPromptParts = [
143798
+ this.defaultSystemPrompt,
143799
+ BROWSE_SYSTEM_PROMPT(this.browseRoot),
143800
+ typeof clientPrompt === "string" ? clientPrompt : null
143801
+ ].filter(Boolean);
143794
143802
  try {
143795
143803
  const session = await this.ptyManager.startFresh({
143796
143804
  projectPath: resolvedPath,
143797
143805
  projectName: body.projectName,
143798
- systemPrompt: BROWSE_SYSTEM_PROMPT(this.browseRoot)
143806
+ systemPrompt: systemPromptParts.join("\n")
143799
143807
  });
143800
143808
  this.sessionStore.addManaged(session);
143801
143809
  json2(res, 202, { id: session.id, status: "pending" });