@staff0rd/assist 0.711.3 → 0.713.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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.711.3",
9
+ version: "0.713.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -41496,20 +41496,16 @@ function stripBlocks(raw) {
41496
41496
  return raw.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").replace(/<task-notification>[\s\S]*?<\/task-notification>/g, "").replace(/<command-[^>]*>[\s\S]*?<\/command-[^>]*>/g, "").replace(/<local-command-[^>]*>[\s\S]*?<\/local-command-[^>]*>/g, "").replace(/<bash-(stdout|stderr)>[\s\S]*?<\/bash-\1>/g, "").trim();
41497
41497
  }
41498
41498
 
41499
- // src/commands/sessions/shared/extractLastUserMessage.ts
41499
+ // src/commands/sessions/shared/renderUserPrompt.ts
41500
41500
  var MAX_LENGTH2 = 2048;
41501
41501
  var INTERRUPT_PREFIX2 = "[Request interrupted";
41502
- function extractLastUserMessage(entries, maxLength = MAX_LENGTH2) {
41503
- for (let i = entries.length - 1; i >= 0; i--) {
41504
- const entry = entries[i];
41505
- if (entry.isSidechain || entry.isMeta) continue;
41506
- if (entry.type !== "user" || isTaskNotification(entry)) continue;
41507
- const raw = promptTextOrNull(entry);
41508
- if (raw === null) continue;
41509
- const message3 = renderPrompt(raw);
41510
- if (message3) return cap(message3, maxLength);
41511
- }
41512
- return void 0;
41502
+ function renderUserPrompt(entry, maxLength = MAX_LENGTH2) {
41503
+ if (entry.isSidechain || entry.isMeta) return void 0;
41504
+ if (entry.type !== "user" || isTaskNotification(entry)) return void 0;
41505
+ const raw = promptTextOrNull(entry);
41506
+ if (raw === null) return void 0;
41507
+ const message3 = renderPrompt(raw);
41508
+ return message3 ? cap(message3, maxLength) : void 0;
41513
41509
  }
41514
41510
  function isTaskNotification(entry) {
41515
41511
  return asRecord3(entry.origin)?.kind === "task-notification";
@@ -41538,6 +41534,15 @@ function asRecord3(value) {
41538
41534
  return value && typeof value === "object" ? value : null;
41539
41535
  }
41540
41536
 
41537
+ // src/commands/sessions/shared/extractLastUserMessage.ts
41538
+ function extractLastUserMessage(entries, maxLength) {
41539
+ for (let i = entries.length - 1; i >= 0; i--) {
41540
+ const message3 = renderUserPrompt(entries[i], maxLength);
41541
+ if (message3) return message3;
41542
+ }
41543
+ return void 0;
41544
+ }
41545
+
41541
41546
  // src/commands/sessions/shared/readTranscriptTail.ts
41542
41547
  import * as fs53 from "fs";
41543
41548
  var DEFAULT_MAX_BYTES = 256 * 1024;
@@ -41612,7 +41617,7 @@ function transcriptTailFingerprint(entries) {
41612
41617
  return null;
41613
41618
  }
41614
41619
 
41615
- // src/commands/sessions/daemon/reconcileTranscriptStatus.ts
41620
+ // src/commands/sessions/daemon/resolveTranscriptPath.ts
41616
41621
  async function resolveTranscriptPath(session) {
41617
41622
  if (session.transcriptPath) return session.transcriptPath;
41618
41623
  if (!session.claudeSessionId) return null;
@@ -41621,6 +41626,8 @@ async function resolveTranscriptPath(session) {
41621
41626
  if (filePath) session.transcriptPath = filePath;
41622
41627
  return filePath;
41623
41628
  }
41629
+
41630
+ // src/commands/sessions/daemon/reconcileTranscriptStatus.ts
41624
41631
  function updateLastUserMessage(session, entries, notify2) {
41625
41632
  const message3 = extractLastUserMessage(entries);
41626
41633
  if (message3 === session.lastUserMessage) return;
@@ -44303,6 +44310,7 @@ var relays = {
44303
44310
  notice: (state, msg) => broadcastToViewers(state, msg),
44304
44311
  "run-conflict": relayRunConflict,
44305
44312
  history: relayHistory,
44313
+ "user-messages": (state, msg) => broadcastToViewers(state, { ...msg, sessionId: nsId(state, msg) }),
44306
44314
  log: (state, msg) => {
44307
44315
  if (typeof msg.line === "string") relayDaemonLog(state.node, msg.line);
44308
44316
  }
@@ -45263,6 +45271,44 @@ function safeParse2(line) {
45263
45271
  }
45264
45272
  }
45265
45273
 
45274
+ // src/commands/sessions/shared/extractUserMessages.ts
45275
+ function extractUserMessages(entries, maxLength) {
45276
+ const messages = [];
45277
+ for (const entry of entries) {
45278
+ const message3 = renderUserPrompt(entry, maxLength);
45279
+ if (message3) messages.push(message3);
45280
+ }
45281
+ return messages;
45282
+ }
45283
+
45284
+ // src/commands/sessions/daemon/handleFetchUserMessages.ts
45285
+ function findSession(manager, id) {
45286
+ let found;
45287
+ manager.update((sessions) => {
45288
+ found = sessions.get(id);
45289
+ return false;
45290
+ });
45291
+ return found;
45292
+ }
45293
+ async function handleFetchUserMessages(client, manager, data) {
45294
+ const sessionId = data.sessionId;
45295
+ const session = findSession(manager, sessionId);
45296
+ const filePath = session ? await resolveTranscriptPath(session) : null;
45297
+ const entries = filePath ? await readTranscriptTail(filePath, Number.POSITIVE_INFINITY) : [];
45298
+ const messages = extractUserMessages(entries);
45299
+ daemonLog(
45300
+ `session ${sessionId} user messages: ${messages.length} from ${filePath ?? "no transcript"}`
45301
+ );
45302
+ sendTo(client, { type: "user-messages", sessionId, messages });
45303
+ }
45304
+
45305
+ // src/commands/sessions/daemon/routed.ts
45306
+ function routed(local) {
45307
+ return (client, m, d) => {
45308
+ if (!m.links.route(client, d)) local(client, m, d);
45309
+ };
45310
+ }
45311
+
45266
45312
  // src/commands/sessions/daemon/withRepoGroups.ts
45267
45313
  function withRepoGroups(sessions) {
45268
45314
  const existence = /* @__PURE__ */ new Map();
@@ -45315,16 +45361,10 @@ async function handleShutdown(client, manager) {
45315
45361
  var lifecycleHandlers = {
45316
45362
  history: handleHistory,
45317
45363
  "fetch-transcript": handleFetchTranscript,
45364
+ "fetch-user-messages": routed(handleFetchUserMessages),
45318
45365
  shutdown: handleShutdown
45319
45366
  };
45320
45367
 
45321
- // src/commands/sessions/daemon/routed.ts
45322
- function routed(local) {
45323
- return (client, m, d) => {
45324
- if (!m.links.route(client, d)) local(client, m, d);
45325
- };
45326
- }
45327
-
45328
45368
  // src/commands/sessions/daemon/setSessionCwd.ts
45329
45369
  function setSessionCwd(sessions, id, cwd) {
45330
45370
  const s = sessions.get(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.711.3",
3
+ "version": "0.713.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {