@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.d.cts
CHANGED
|
@@ -297,6 +297,7 @@ interface ServerConfig {
|
|
|
297
297
|
cacheDir?: string;
|
|
298
298
|
tailSize?: number;
|
|
299
299
|
directoryScanDebounceMs?: number;
|
|
300
|
+
defaultSystemPrompt?: string;
|
|
300
301
|
}
|
|
301
302
|
interface PTYManagerOptions {
|
|
302
303
|
onOutput?: (sessionId: string, data: string) => void;
|
|
@@ -766,6 +767,7 @@ declare class StreamerServer {
|
|
|
766
767
|
private pairTokens;
|
|
767
768
|
private exchangeAttempts;
|
|
768
769
|
private ptyGracePeriodMs;
|
|
770
|
+
private defaultSystemPrompt;
|
|
769
771
|
private ptyGraceTimers;
|
|
770
772
|
private sessionSubscribers;
|
|
771
773
|
private clientIdToWs;
|
package/dist/index.d.ts
CHANGED
|
@@ -297,6 +297,7 @@ interface ServerConfig {
|
|
|
297
297
|
cacheDir?: string;
|
|
298
298
|
tailSize?: number;
|
|
299
299
|
directoryScanDebounceMs?: number;
|
|
300
|
+
defaultSystemPrompt?: string;
|
|
300
301
|
}
|
|
301
302
|
interface PTYManagerOptions {
|
|
302
303
|
onOutput?: (sessionId: string, data: string) => void;
|
|
@@ -766,6 +767,7 @@ declare class StreamerServer {
|
|
|
766
767
|
private pairTokens;
|
|
767
768
|
private exchangeAttempts;
|
|
768
769
|
private ptyGracePeriodMs;
|
|
770
|
+
private defaultSystemPrompt;
|
|
769
771
|
private ptyGraceTimers;
|
|
770
772
|
private sessionSubscribers;
|
|
771
773
|
private clientIdToWs;
|
package/dist/index.js
CHANGED
|
@@ -4285,6 +4285,7 @@ var WSHub = class {
|
|
|
4285
4285
|
|
|
4286
4286
|
// src/server.ts
|
|
4287
4287
|
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.`;
|
|
4288
|
+
var DEFAULT_SYSTEM_PROMPT = "When presenting options or choices to the user, limit the options to at most 3.";
|
|
4288
4289
|
var DEFAULT_PTY_GRACE_PERIOD_MS = 27e4;
|
|
4289
4290
|
function parseIncludeAgentsEnv(raw) {
|
|
4290
4291
|
if (raw === void 0) return false;
|
|
@@ -4335,6 +4336,7 @@ var StreamerServer = class {
|
|
|
4335
4336
|
pairTokens = new PairTokenStore();
|
|
4336
4337
|
exchangeAttempts = /* @__PURE__ */ new Map();
|
|
4337
4338
|
ptyGracePeriodMs;
|
|
4339
|
+
defaultSystemPrompt;
|
|
4338
4340
|
// Map of sessionId → grace timer; fires to kill PTY after WS disconnect
|
|
4339
4341
|
ptyGraceTimers = /* @__PURE__ */ new Map();
|
|
4340
4342
|
// Map of sessionId → set of subscribed WS clients
|
|
@@ -4375,6 +4377,7 @@ var StreamerServer = class {
|
|
|
4375
4377
|
this.scanProfiles = config.scanProfiles;
|
|
4376
4378
|
this.codexRoots = config.codexRoots ?? [join12(homedir5(), ".codex", "sessions")];
|
|
4377
4379
|
this.ptyGracePeriodMs = config.ptyGracePeriodMs ?? DEFAULT_PTY_GRACE_PERIOD_MS;
|
|
4380
|
+
this.defaultSystemPrompt = config.defaultSystemPrompt ?? DEFAULT_SYSTEM_PROMPT;
|
|
4378
4381
|
this.cacheDir = config.cacheDir ?? loadCacheDir() ?? join12(homedir5(), ".threadbase", "cache");
|
|
4379
4382
|
this.tailSize = config.tailSize ?? loadTailSize() ?? 10;
|
|
4380
4383
|
this.directoryDebounceMs = parseDirScanDebounceEnv(process.env.THREADBASE_DIR_SCAN_DEBOUNCE_MS) ?? config.directoryScanDebounceMs ?? 1e3;
|
|
@@ -5985,7 +5988,7 @@ var StreamerServer = class {
|
|
|
5985
5988
|
return;
|
|
5986
5989
|
}
|
|
5987
5990
|
const body = await readBody(req);
|
|
5988
|
-
const { path: relativePath } = body;
|
|
5991
|
+
const { path: relativePath, systemPrompt: clientPrompt } = body;
|
|
5989
5992
|
if (typeof relativePath !== "string") {
|
|
5990
5993
|
json(res, 400, { error: "Missing path field" });
|
|
5991
5994
|
return;
|
|
@@ -5999,11 +6002,16 @@ var StreamerServer = class {
|
|
|
5999
6002
|
return;
|
|
6000
6003
|
}
|
|
6001
6004
|
this.discoveryCache = null;
|
|
6005
|
+
const systemPromptParts = [
|
|
6006
|
+
this.defaultSystemPrompt,
|
|
6007
|
+
BROWSE_SYSTEM_PROMPT(this.browseRoot),
|
|
6008
|
+
typeof clientPrompt === "string" ? clientPrompt : null
|
|
6009
|
+
].filter(Boolean);
|
|
6002
6010
|
try {
|
|
6003
6011
|
const session = await this.ptyManager.startFresh({
|
|
6004
6012
|
projectPath: resolvedPath,
|
|
6005
6013
|
projectName: body.projectName,
|
|
6006
|
-
systemPrompt:
|
|
6014
|
+
systemPrompt: systemPromptParts.join("\n")
|
|
6007
6015
|
});
|
|
6008
6016
|
this.sessionStore.addManaged(session);
|
|
6009
6017
|
json(res, 202, { id: session.id, status: "pending" });
|