@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 +10 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -4319,6 +4319,7 @@ var WSHub = class {
|
|
|
4319
4319
|
|
|
4320
4320
|
// src/server.ts
|
|
4321
4321
|
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.`;
|
|
4322
|
+
var DEFAULT_SYSTEM_PROMPT = "When presenting options or choices to the user, limit the options to at most 3.";
|
|
4322
4323
|
var DEFAULT_PTY_GRACE_PERIOD_MS = 27e4;
|
|
4323
4324
|
function parseIncludeAgentsEnv(raw) {
|
|
4324
4325
|
if (raw === void 0) return false;
|
|
@@ -4369,6 +4370,7 @@ var StreamerServer = class {
|
|
|
4369
4370
|
pairTokens = new PairTokenStore();
|
|
4370
4371
|
exchangeAttempts = /* @__PURE__ */ new Map();
|
|
4371
4372
|
ptyGracePeriodMs;
|
|
4373
|
+
defaultSystemPrompt;
|
|
4372
4374
|
// Map of sessionId → grace timer; fires to kill PTY after WS disconnect
|
|
4373
4375
|
ptyGraceTimers = /* @__PURE__ */ new Map();
|
|
4374
4376
|
// Map of sessionId → set of subscribed WS clients
|
|
@@ -4409,6 +4411,7 @@ var StreamerServer = class {
|
|
|
4409
4411
|
this.scanProfiles = config.scanProfiles;
|
|
4410
4412
|
this.codexRoots = config.codexRoots ?? [(0, import_path11.join)((0, import_os6.homedir)(), ".codex", "sessions")];
|
|
4411
4413
|
this.ptyGracePeriodMs = config.ptyGracePeriodMs ?? DEFAULT_PTY_GRACE_PERIOD_MS;
|
|
4414
|
+
this.defaultSystemPrompt = config.defaultSystemPrompt ?? DEFAULT_SYSTEM_PROMPT;
|
|
4412
4415
|
this.cacheDir = config.cacheDir ?? loadCacheDir() ?? (0, import_path11.join)((0, import_os6.homedir)(), ".threadbase", "cache");
|
|
4413
4416
|
this.tailSize = config.tailSize ?? loadTailSize() ?? 10;
|
|
4414
4417
|
this.directoryDebounceMs = parseDirScanDebounceEnv(process.env.THREADBASE_DIR_SCAN_DEBOUNCE_MS) ?? config.directoryScanDebounceMs ?? 1e3;
|
|
@@ -6019,7 +6022,7 @@ var StreamerServer = class {
|
|
|
6019
6022
|
return;
|
|
6020
6023
|
}
|
|
6021
6024
|
const body = await readBody(req);
|
|
6022
|
-
const { path: relativePath } = body;
|
|
6025
|
+
const { path: relativePath, systemPrompt: clientPrompt } = body;
|
|
6023
6026
|
if (typeof relativePath !== "string") {
|
|
6024
6027
|
json(res, 400, { error: "Missing path field" });
|
|
6025
6028
|
return;
|
|
@@ -6033,11 +6036,16 @@ var StreamerServer = class {
|
|
|
6033
6036
|
return;
|
|
6034
6037
|
}
|
|
6035
6038
|
this.discoveryCache = null;
|
|
6039
|
+
const systemPromptParts = [
|
|
6040
|
+
this.defaultSystemPrompt,
|
|
6041
|
+
BROWSE_SYSTEM_PROMPT(this.browseRoot),
|
|
6042
|
+
typeof clientPrompt === "string" ? clientPrompt : null
|
|
6043
|
+
].filter(Boolean);
|
|
6036
6044
|
try {
|
|
6037
6045
|
const session = await this.ptyManager.startFresh({
|
|
6038
6046
|
projectPath: resolvedPath,
|
|
6039
6047
|
projectName: body.projectName,
|
|
6040
|
-
systemPrompt:
|
|
6048
|
+
systemPrompt: systemPromptParts.join("\n")
|
|
6041
6049
|
});
|
|
6042
6050
|
this.sessionStore.addManaged(session);
|
|
6043
6051
|
json(res, 202, { id: session.id, status: "pending" });
|