claude-threads 0.16.6 → 0.16.8
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/CHANGELOG.md +12 -0
- package/dist/index.js +16 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Context prompt**: Fixed context prompt appearing when starting a session with the first message in a thread
|
|
12
|
+
- The triggering message was incorrectly included in the count, making it show "1 message before this point" when there were none
|
|
13
|
+
|
|
14
|
+
## [0.16.7] - 2025-12-31
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Session resume**: Validate working directory exists before resuming sessions after restart
|
|
18
|
+
- Prevents crashes when a worktree or directory has been deleted
|
|
19
|
+
|
|
20
|
+
## [0.16.6] - 2025-12-31
|
|
21
|
+
|
|
10
22
|
### Added
|
|
11
23
|
- **Worktree context**: Replay first user prompt after mid-session worktree creation (`!worktree create`)
|
|
12
24
|
- **Thread context prompt**: When starting a session mid-thread (replying to an existing thread), offers to include previous conversation context
|
package/dist/index.js
CHANGED
|
@@ -18926,6 +18926,7 @@ async function updateSessionHeader(session, ctx) {
|
|
|
18926
18926
|
|
|
18927
18927
|
// src/session/lifecycle.ts
|
|
18928
18928
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
18929
|
+
import { existsSync as existsSync7 } from "fs";
|
|
18929
18930
|
function findPersistedByThreadId(persisted, threadId) {
|
|
18930
18931
|
for (const session of persisted.values()) {
|
|
18931
18932
|
if (session.threadId === threadId) {
|
|
@@ -19034,7 +19035,7 @@ async function startSession(options, username, replyToPostId, platformId, ctx) {
|
|
|
19034
19035
|
const content = await ctx.buildMessageContent(options.prompt, session.platform, options.files);
|
|
19035
19036
|
const messageText = typeof content === "string" ? content : options.prompt;
|
|
19036
19037
|
if (replyToPostId) {
|
|
19037
|
-
const contextOffered = await ctx.offerContextPrompt(session, messageText);
|
|
19038
|
+
const contextOffered = await ctx.offerContextPrompt(session, messageText, replyToPostId);
|
|
19038
19039
|
if (contextOffered) {
|
|
19039
19040
|
return;
|
|
19040
19041
|
}
|
|
@@ -19059,6 +19060,17 @@ async function resumeSession(state, ctx) {
|
|
|
19059
19060
|
console.log(` \u26A0\uFE0F Max sessions reached, skipping resume for ${shortId}...`);
|
|
19060
19061
|
return;
|
|
19061
19062
|
}
|
|
19063
|
+
if (!existsSync7(state.workingDir)) {
|
|
19064
|
+
console.log(` \u26A0\uFE0F Working directory ${state.workingDir} no longer exists, skipping resume for ${shortId}...`);
|
|
19065
|
+
ctx.sessionStore.remove(`${state.platformId}:${state.threadId}`);
|
|
19066
|
+
try {
|
|
19067
|
+
await platform.createPost(`\u26A0\uFE0F **Cannot resume session** - working directory no longer exists:
|
|
19068
|
+
\`${state.workingDir}\`
|
|
19069
|
+
|
|
19070
|
+
Please start a new session.`, state.threadId);
|
|
19071
|
+
} catch {}
|
|
19072
|
+
return;
|
|
19073
|
+
}
|
|
19062
19074
|
const platformId = state.platformId;
|
|
19063
19075
|
const sessionId = ctx.getSessionId(platformId, state.threadId);
|
|
19064
19076
|
const skipPerms = ctx.skipPermissions && !state.forceInteractivePermissions;
|
|
@@ -19874,7 +19886,7 @@ class SessionManager {
|
|
|
19874
19886
|
shouldPromptForWorktree: (s) => this.shouldPromptForWorktree(s),
|
|
19875
19887
|
postWorktreePrompt: (s, r) => this.postWorktreePrompt(s, r),
|
|
19876
19888
|
buildMessageContent: (t, p, f) => this.buildMessageContent(t, p, f),
|
|
19877
|
-
offerContextPrompt: (s, q) => this.offerContextPrompt(s, q)
|
|
19889
|
+
offerContextPrompt: (s, q, e) => this.offerContextPrompt(s, q, e)
|
|
19878
19890
|
};
|
|
19879
19891
|
}
|
|
19880
19892
|
getEventContext() {
|
|
@@ -20013,8 +20025,8 @@ class SessionManager {
|
|
|
20013
20025
|
console.log(` \uD83E\uDDF5 Session (${shortId}\u2026) context prompt timed out, continuing without context`);
|
|
20014
20026
|
}
|
|
20015
20027
|
}
|
|
20016
|
-
async offerContextPrompt(session, queuedPrompt) {
|
|
20017
|
-
const messageCount = await getThreadContextCount(session);
|
|
20028
|
+
async offerContextPrompt(session, queuedPrompt, excludePostId) {
|
|
20029
|
+
const messageCount = await getThreadContextCount(session, excludePostId);
|
|
20018
20030
|
if (messageCount === 0) {
|
|
20019
20031
|
if (session.claude.isRunning()) {
|
|
20020
20032
|
session.claude.sendMessage(queuedPrompt);
|