@oscharko-dev/keiko-server 0.2.6 → 0.2.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.
Files changed (60) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/chat-compaction-evidence.d.ts +12 -0
  3. package/dist/chat-compaction-evidence.d.ts.map +1 -0
  4. package/dist/chat-compaction-evidence.js +46 -0
  5. package/dist/chat-handlers.d.ts +16 -0
  6. package/dist/chat-handlers.d.ts.map +1 -1
  7. package/dist/chat-handlers.js +78 -28
  8. package/dist/chat-stream-handlers.d.ts.map +1 -1
  9. package/dist/chat-stream-handlers.js +13 -1
  10. package/dist/conversation-compaction.d.ts +12 -0
  11. package/dist/conversation-compaction.d.ts.map +1 -0
  12. package/dist/conversation-compaction.js +102 -0
  13. package/dist/deps.d.ts +3 -0
  14. package/dist/deps.d.ts.map +1 -1
  15. package/dist/deps.js +3 -2
  16. package/dist/files.d.ts +18 -0
  17. package/dist/files.d.ts.map +1 -1
  18. package/dist/files.js +174 -0
  19. package/dist/gateway-readiness.d.ts +6 -0
  20. package/dist/gateway-readiness.d.ts.map +1 -0
  21. package/dist/gateway-readiness.js +624 -0
  22. package/dist/grounded-context-diagnostics.d.ts +5 -0
  23. package/dist/grounded-context-diagnostics.d.ts.map +1 -0
  24. package/dist/grounded-context-diagnostics.js +77 -0
  25. package/dist/grounded-orchestrator.d.ts +2 -0
  26. package/dist/grounded-orchestrator.d.ts.map +1 -1
  27. package/dist/grounded-orchestrator.js +122 -53
  28. package/dist/grounded-qa-hybrid.d.ts.map +1 -1
  29. package/dist/grounded-qa-hybrid.js +7 -4
  30. package/dist/grounded-qa-multi-source.d.ts.map +1 -1
  31. package/dist/grounded-qa-multi-source.js +49 -2
  32. package/dist/grounded-qa.d.ts +4 -0
  33. package/dist/grounded-qa.d.ts.map +1 -1
  34. package/dist/grounded-qa.js +36 -2
  35. package/dist/index.d.ts +3 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +6 -1
  38. package/dist/local-knowledge-grounded-qa.d.ts.map +1 -1
  39. package/dist/local-knowledge-grounded-qa.js +11 -2
  40. package/dist/routes.d.ts.map +1 -1
  41. package/dist/routes.js +5 -10
  42. package/dist/run-handlers.d.ts +0 -1
  43. package/dist/run-handlers.d.ts.map +1 -1
  44. package/dist/run-handlers.js +0 -217
  45. package/dist/store/db.d.ts.map +1 -1
  46. package/dist/store/db.js +2 -1
  47. package/dist/store/index.d.ts +1 -1
  48. package/dist/store/index.d.ts.map +1 -1
  49. package/dist/store/messages.d.ts +2 -1
  50. package/dist/store/messages.d.ts.map +1 -1
  51. package/dist/store/messages.js +46 -4
  52. package/dist/store/schema.d.ts +1 -1
  53. package/dist/store/schema.d.ts.map +1 -1
  54. package/dist/store/schema.js +7 -1
  55. package/dist/store/types.d.ts +3 -2
  56. package/dist/store/types.d.ts.map +1 -1
  57. package/package.json +19 -19
  58. package/dist/grounded-handoff.d.ts +0 -4
  59. package/dist/grounded-handoff.d.ts.map +0 -1
  60. package/dist/grounded-handoff.js +0 -445
@@ -0,0 +1,12 @@
1
+ import type { ContextCompactionRecord } from "@oscharko-dev/keiko-contracts";
2
+ import type { UiHandlerDeps } from "./deps.js";
3
+ export interface ChatCompactionEvidenceInput {
4
+ readonly compaction: ContextCompactionRecord | undefined;
5
+ readonly chatId: string;
6
+ readonly modelId: string;
7
+ readonly messageCount: number;
8
+ readonly startedAt: number;
9
+ readonly finishedAt: number;
10
+ }
11
+ export declare function persistChatCompactionEvidence(deps: UiHandlerDeps, input: ChatCompactionEvidenceInput): void;
12
+ //# sourceMappingURL=chat-compaction-evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-compaction-evidence.d.ts","sourceRoot":"","sources":["../src/chat-compaction-evidence.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,MAAM,WAAW,2BAA2B;IAE1C,QAAQ,CAAC,UAAU,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAGzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAYD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,2BAA2B,GACjC,IAAI,CA8BN"}
@@ -0,0 +1,46 @@
1
+ // ADR-0057 D3: best-effort wiring of the chat history-compaction record into regulated evidence.
2
+ // buildGatewayMessages drops the ContextCompactionRecord that conversationForGatewayWithCompaction
3
+ // produces on the slow path (> MAX_CONTEXT_MESSAGES filtered turns with an active profile). This
4
+ // module persists it via persistCompactionEvidence AFTER the turn completes, redacted and retained
5
+ // under DEFAULT_RETENTION. The raw chatId NEVER reaches the manifest — only sha256Hex(chatId) and a
6
+ // derived runId. Persistence is strictly best-effort: a malformed chatId, an invalid runId, or a
7
+ // throwing store can NEVER fail the chat send. The fast path (no compaction record) is a no-op.
8
+ import { persistCompactionEvidence } from "@oscharko-dev/keiko-evidence";
9
+ import { resolveCostClass } from "@oscharko-dev/keiko-model-gateway";
10
+ import { sha256Hex } from "@oscharko-dev/keiko-security";
11
+ import { currentRedactionSecrets } from "./deps.js";
12
+ // runId = chat-<sha256Hex(chatId)[:16]>-t<messageCount>. Hex-only + the fixed prefix/suffix are all
13
+ // in the assertValidRunId charset [A-Za-z0-9._-]; max length 5+16+2+20 = 43 << 256.
14
+ function compactionRunId(chatIdHash, messageCount) {
15
+ return `chat-${chatIdHash.slice(0, 16)}-t${String(messageCount)}`;
16
+ }
17
+ // Best-effort persist of one compaction record. EVERYTHING after the fast-path guard — including the
18
+ // chatId hash, runId construction, and persistCompactionEvidence (which itself calls
19
+ // assertValidRunId) — is wrapped so a malformed chatId or a throwing store cannot escape into the
20
+ // send path. The fast path (no record) returns immediately without touching the store.
21
+ export function persistChatCompactionEvidence(deps, input) {
22
+ if (input.compaction === undefined) {
23
+ return;
24
+ }
25
+ const record = input.compaction;
26
+ try {
27
+ const chatIdHash = sha256Hex(input.chatId);
28
+ persistCompactionEvidence({
29
+ runId: compactionRunId(chatIdHash, input.messageCount),
30
+ modelId: input.modelId,
31
+ records: [record],
32
+ startedAt: input.startedAt,
33
+ finishedAt: input.finishedAt,
34
+ chatIdHash,
35
+ }, {
36
+ store: deps.evidenceStore,
37
+ env: deps.env,
38
+ additionalSecrets: currentRedactionSecrets(deps),
39
+ costClassResolver: resolveCostClass,
40
+ });
41
+ }
42
+ catch (error) {
43
+ // eslint-disable-next-line no-console
44
+ console.warn("chat-compaction-evidence: persistence failed (best-effort, send unaffected)", error);
45
+ }
46
+ }
@@ -5,12 +5,19 @@ import { type ConversationAttachment } from "./conversation-validation.js";
5
5
  import type { UiHandlerDeps } from "./deps.js";
6
6
  import type { RouteContext, RouteResult } from "./routes.js";
7
7
  import { type ConversationMemoryRuntimeContext } from "./memory-conversation-context.js";
8
+ import type { ConversationCompactionOutcome } from "./conversation-compaction.js";
9
+ export declare const MAX_CONTEXT_MESSAGES = 24;
8
10
  export interface GatewayConversationMessage {
9
11
  readonly role: "system" | "user" | "assistant";
10
12
  readonly content: string;
11
13
  }
12
14
  export declare function redactErrorMessage(message: string, deps: UiHandlerDeps): string;
13
15
  export declare function desktopChatErrorResult(error: unknown, deps: UiHandlerDeps): RouteResult;
16
+ export declare function usableGatewayMessages(messages: readonly ChatMessage[]): {
17
+ role: "user" | "assistant";
18
+ content: string;
19
+ }[];
20
+ export declare function conversationForGateway(messages: readonly ChatMessage[]): GatewayConversationMessage[];
14
21
  export interface SendDesktopChatRequest {
15
22
  readonly chatId: string;
16
23
  readonly projectPath: string;
@@ -34,7 +41,16 @@ export declare function buildChatPatch(chat: Chat, request: SendDesktopChatReque
34
41
  selectedModel: string;
35
42
  title?: string;
36
43
  };
44
+ export declare function deriveCompactionOutcome(deps: UiHandlerDeps, request: SendDesktopChatRequest): ConversationCompactionOutcome;
37
45
  export declare function buildGatewayMessages(deps: UiHandlerDeps, request: SendDesktopChatRequest, memoryText: string): GatewayConversationMessage[];
46
+ export interface ChatCompactionTurn {
47
+ readonly outcome: ConversationCompactionOutcome;
48
+ readonly request: SendDesktopChatRequest;
49
+ readonly modelId: string;
50
+ readonly messageCount: number;
51
+ readonly startedAt: number;
52
+ }
53
+ export declare function recordChatCompaction(deps: UiHandlerDeps, turn: ChatCompactionTurn): void;
38
54
  export declare function handleCreateDesktopChat(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
39
55
  export interface PreparedDesktopChatSend {
40
56
  readonly request: SendDesktopChatRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-handlers.d.ts","sourceRoot":"","sources":["../src/chat-handlers.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,wCAAwC,CAAC;AAuBhD,OAAO,EAGL,KAAK,IAAI,EACT,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS7D,OAAO,EAGL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;AAgB1C,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;C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ory-audit-handler.js";
25
25
  import { captureSalientFromTurn } from "./memory-salience.js";
26
26
  import { assertUsableAssistantContent, isLegacyEmptyAssistantPlaceholder, } from "./assistant-response.js";
27
+ import { conversationForGatewayWithCompaction } from "./conversation-compaction.js";
28
+ import { persistChatCompactionEvidence } from "./chat-compaction-evidence.js";
27
29
  const DEFAULT_CHAT_MODEL = "example-chat-model";
28
30
  const DEFAULT_CHAT_TITLE = "New chat";
29
31
  const MAX_BODY_BYTES = 128_000;
30
32
  const MAX_CHAT_INPUT_CHARS = 16_000;
31
- const MAX_CONTEXT_MESSAGES = 24;
33
+ export const MAX_CONTEXT_MESSAGES = 24;
32
34
  class BodyTooLargeError extends Error {
33
35
  constructor() {
34
36
  super("request body too large");
@@ -204,11 +206,17 @@ function messageForGateway(message) {
204
206
  }
205
207
  return { role: message.role, content: message.content };
206
208
  }
207
- function conversationForGateway(messages) {
208
- const usable = messages
209
+ // The map+filter projection shared by conversationForGateway and the PR4-W2 compaction shim
210
+ // (conversation-compaction.ts). Returns the full filtered, ORDER-PRESERVED set of user/assistant
211
+ // turns BEFORE the recent-window slice — so the shim's "post-filter count", kept window, and
212
+ // dropped prefix are derived from the exact same selection the slice operates on.
213
+ export function usableGatewayMessages(messages) {
214
+ return messages
209
215
  .map(messageForGateway)
210
- .filter((message) => message !== null)
211
- .slice(-MAX_CONTEXT_MESSAGES);
216
+ .filter((message) => message !== null);
217
+ }
218
+ export function conversationForGateway(messages) {
219
+ const usable = usableGatewayMessages(messages).slice(-MAX_CONTEXT_MESSAGES);
212
220
  return [
213
221
  {
214
222
  role: "system",
@@ -688,48 +696,90 @@ export function buildChatPatch(chat, request, modelId) {
688
696
  // memory text). Shared by the buffered (persistModelChatTurn) and streaming
689
697
  // (handleSendDesktopChatStream) paths so both send a byte-identical prompt. `memoryText` is
690
698
  // `memory.context.text`.
699
+ // ADR-0057 D3: the full compaction outcome for the latest turn, including the optional
700
+ // ContextCompactionRecord that buildGatewayMessages drops. Both send paths call this to capture the
701
+ // record for best-effort regulated evidence; buildGatewayMessages delegates here for the messages.
702
+ // Reads store.listMessages once — identical history slice the prompt is built from.
703
+ export function deriveCompactionOutcome(deps, request) {
704
+ return conversationForGatewayWithCompaction(deps.store.listMessages(request.chatId), {
705
+ contextProfile: deps.contextProfile,
706
+ });
707
+ }
691
708
  export function buildGatewayMessages(deps, request, memoryText) {
692
- const history = conversationForGateway(deps.store.listMessages(request.chatId));
693
- return applyDocumentContextToLatestUserTurn(history, request, memoryText);
709
+ // PR4-W2 (ADR-0055 D3): route history assembly through the predicate-gated compaction shim. On
710
+ // the fast path (no profile or <= MAX_CONTEXT_MESSAGES filtered turns) the shim returns the EXACT
711
+ // conversationForGateway(...) value, so this is byte-identical to the pre-PR4 path.
712
+ const { messages } = deriveCompactionOutcome(deps, request);
713
+ return applyDocumentContextToLatestUserTurn(messages, request, memoryText);
714
+ }
715
+ // ADR-0057 D3: best-effort persist of the turn's compaction record AFTER the response completes.
716
+ // finishedAt is captured here (post-turn). Shared by the buffered and streaming send paths so the
717
+ // runId + timing are identical. Never throws into the send path (persistChatCompactionEvidence is
718
+ // fully guarded and a no-op on the fast path).
719
+ export function recordChatCompaction(deps, turn) {
720
+ persistChatCompactionEvidence(deps, {
721
+ compaction: turn.outcome.compaction,
722
+ chatId: turn.request.chatId,
723
+ modelId: turn.modelId,
724
+ messageCount: turn.messageCount,
725
+ startedAt: turn.startedAt,
726
+ finishedAt: Date.now(),
727
+ });
694
728
  }
695
729
  async function persistModelChatTurn(deps, request, chat, modelId, memoryContext) {
696
730
  const model = deps.modelPortFactory(modelId);
697
731
  if (model === undefined) {
698
732
  return { status: 400, body: errorBody("NO_MODEL", "No model provider is configured.") };
699
733
  }
734
+ // ADR-0057 D3: pin the pre-user-message count BEFORE createUserMessage stores the turn, so the
735
+ // compaction-evidence runId is collision-free and matches the streaming path's lifecycle moment.
736
+ const messageCountBeforeTurn = deps.store.listMessages(request.chatId).length;
737
+ const startedAt = Date.now();
700
738
  try {
701
739
  const memory = memoryContext === undefined
702
740
  ? emptyMemoryResult(false)
703
741
  : await buildMemoryResult(request, deps, memoryContext);
704
742
  const userMessage = createUserMessage(deps, request);
743
+ const outcome = deriveCompactionOutcome(deps, request);
705
744
  const messages = buildGatewayMessages(deps, request, memory.context.text);
706
- const response = await model.call({
745
+ const response = await model.call({ modelId, messages, stream: false }, new AbortController().signal);
746
+ recordChatCompaction(deps, {
747
+ outcome,
748
+ request,
707
749
  modelId,
708
- messages,
709
- stream: false,
710
- }, new AbortController().signal);
711
- // Issue #631 redact the model's raw content before persisting and before returning it to
712
- // the browser. A model that echoes a secret from its context (e.g. an apiKey injected via
713
- // system prompt) would otherwise surface it un-redacted on the success path, mirroring the
714
- // grounded-QA path (grounded-qa.ts line 549) which already applies deps.redactor here.
715
- const redactedContent = deps.redactor(response.content);
716
- const assistantMessage = createAssistantMessage(deps, request, redactedContent, modelId);
717
- const memoryActions = await collectMemoryActions(deps, request, memoryContext, modelId, redactedContent);
718
- const chatPatch = buildChatPatch(chat, request, modelId);
719
- return {
720
- status: 200,
721
- body: {
722
- chat: deps.store.updateChat(request.chatId, chatPatch),
723
- messages: [userMessage, assistantMessage],
724
- usage: response.usage,
725
- memory: { ...memory, actions: memoryActions },
726
- },
727
- };
750
+ messageCount: messageCountBeforeTurn,
751
+ startedAt,
752
+ });
753
+ return await finalizeBufferedTurn(deps, { request, chat, modelId, memoryContext }, memory, {
754
+ userMessage,
755
+ response,
756
+ });
728
757
  }
729
758
  catch (error) {
730
759
  return desktopChatErrorResult(error, deps);
731
760
  }
732
761
  }
762
+ // Post-response assembly for the buffered send: redacts the model content, persists the assistant
763
+ // message, collects memory actions, and builds the 200 body. Extracted to keep persistModelChatTurn
764
+ // within the function-length budget after the ADR-0057 D3 compaction wiring.
765
+ async function finalizeBufferedTurn(deps, turn, memory, result) {
766
+ const { request, chat, modelId, memoryContext } = turn;
767
+ // Issue #631 — redact the model's raw content before persisting and before returning it to the
768
+ // browser, mirroring the grounded-QA path which already applies deps.redactor here.
769
+ const redactedContent = deps.redactor(result.response.content);
770
+ const assistantMessage = createAssistantMessage(deps, request, redactedContent, modelId);
771
+ const memoryActions = await collectMemoryActions(deps, request, memoryContext, modelId, redactedContent);
772
+ const chatPatch = buildChatPatch(chat, request, modelId);
773
+ return {
774
+ status: 200,
775
+ body: {
776
+ chat: deps.store.updateChat(request.chatId, chatPatch),
777
+ messages: [result.userMessage, assistantMessage],
778
+ usage: result.response.usage,
779
+ memory: { ...memory, actions: memoryActions },
780
+ },
781
+ };
782
+ }
733
783
  export async function handleCreateDesktopChat(ctx, deps) {
734
784
  const body = await readJsonObject(ctx.req);
735
785
  if (isRouteResult(body))
@@ -1 +1 @@
1
- {"version":3,"file":"chat-stream-handlers.d.ts","sourceRoot":"","sources":["../src/chat-stream-handlers.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAyK/C,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,cAAc,CAAC,CAyBzB"}
1
+ {"version":3,"file":"chat-stream-handlers.d.ts","sourceRoot":"","sources":["../src/chat-stream-handlers.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAuL/C,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,cAAc,CAAC,CAyBzB"}
@@ -10,7 +10,7 @@
10
10
  import { SSE_HEADERS } from "./sse.js";
11
11
  import { writeOrDestroy } from "./sse-write.js";
12
12
  import { STREAMING, errorBody } from "./routes.js";
13
- import { buildChatPatch, buildGatewayMessages, buildMemoryResult, collectMemoryActions, createAssistantMessage, createUserMessage, desktopChatErrorResult, emptyMemoryResult, prepareDesktopChatSend, } from "./chat-handlers.js";
13
+ import { buildChatPatch, buildGatewayMessages, buildMemoryResult, collectMemoryActions, createAssistantMessage, createUserMessage, deriveCompactionOutcome, desktopChatErrorResult, emptyMemoryResult, prepareDesktopChatSend, recordChatCompaction, } from "./chat-handlers.js";
14
14
  // One SSE message. JSON.stringify never emits a raw newline inside a string (newlines escape to
15
15
  // `\n`), so a single `data:` line is always valid framing — no manual escaping, mirroring sse.ts.
16
16
  function sseMessage(event, data) {
@@ -93,7 +93,12 @@ function errorEvent(error, deps) {
93
93
  async function streamAndPersist(ctx, deps, prepared, callStream, controller) {
94
94
  const { request, chat, modelId, memoryContext } = prepared;
95
95
  const memory = await resolveMemory(deps, request, memoryContext);
96
+ // ADR-0057 D3: pin the pre-user-message count BEFORE createUserMessage, mirroring the buffered
97
+ // path's lifecycle moment so the compaction-evidence runId is identical across both paths.
98
+ const messageCountBeforeTurn = deps.store.listMessages(request.chatId).length;
99
+ const startedAt = Date.now();
96
100
  const userMessage = createUserMessage(deps, request);
101
+ const outcome = deriveCompactionOutcome(deps, request);
97
102
  const messages = buildGatewayMessages(deps, request, memory.context.text);
98
103
  const stream = callStream({ modelId, messages }, controller.signal);
99
104
  const turn = await streamConversation(ctx, deps, stream, controller);
@@ -102,6 +107,13 @@ async function streamAndPersist(ctx, deps, prepared, callStream, controller) {
102
107
  return;
103
108
  }
104
109
  const payload = await persistStreamedTurn(deps, request, chat, modelId, memory, memoryContext, turn, userMessage);
110
+ recordChatCompaction(deps, {
111
+ outcome,
112
+ request,
113
+ modelId,
114
+ messageCount: messageCountBeforeTurn,
115
+ startedAt,
116
+ });
105
117
  ctx.res.write(sseMessage("done", payload));
106
118
  }
107
119
  export async function handleSendDesktopChatStream(ctx, deps) {
@@ -0,0 +1,12 @@
1
+ import { type ContextCompactionRecord, type ContextProfile } from "@oscharko-dev/keiko-contracts";
2
+ import type { ChatMessage } from "./store/index.js";
3
+ import { type GatewayConversationMessage } from "./chat-handlers.js";
4
+ export interface ConversationCompactionOptions {
5
+ readonly contextProfile?: ContextProfile | undefined;
6
+ }
7
+ export interface ConversationCompactionOutcome {
8
+ readonly messages: GatewayConversationMessage[];
9
+ readonly compaction?: ContextCompactionRecord | undefined;
10
+ }
11
+ export declare function conversationForGatewayWithCompaction(messages: readonly ChatMessage[], opts?: ConversationCompactionOptions): ConversationCompactionOutcome;
12
+ //# sourceMappingURL=conversation-compaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-compaction.d.ts","sourceRoot":"","sources":["../src/conversation-compaction.ts"],"names":[],"mappings":"AAcA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EAEpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAC3D;AAgBD,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,IAAI,GAAE,6BAAkC,GACvC,6BAA6B,CAM/B"}
@@ -0,0 +1,102 @@
1
+ // PR4-W2 chat history-compaction splice (ADR-0055 D3) — the ONE genuine behavioral change in the
2
+ // context-engineering milestone. A PURE, deterministic, offline, no-clock, no-random shim that
3
+ // wraps conversationForGateway (chat-handlers.ts).
4
+ //
5
+ // ACTIVATION PREDICATE (the unchanged-guarantee, ADR-0055 D6):
6
+ // opts.contextProfile === undefined || filtered.length <= MAX_CONTEXT_MESSAGES
7
+ // When true, this returns the EXACT return value of conversationForGateway(messages) — no copy,
8
+ // no spread, no transform — so short sessions and no-profile callers are byte-identical to today.
9
+ //
10
+ // SLOW PATH (profile present AND > MAX_CONTEXT_MESSAGES filtered turns): the older turns that the
11
+ // existing slice HARD-DROPS are folded into a single deterministic, REDACTED, byte-bounded summary
12
+ // segment (role "user", model-agnostic-safe — not a second system turn) placed immediately AFTER
13
+ // the existing system message, accompanied by a validated ContextCompactionRecord. No model call.
14
+ import { CONTEXT_ENGINEERING_SCHEMA_VERSION, estimateTokens, validateContextCompactionRecord, } from "@oscharko-dev/keiko-contracts";
15
+ import { redact } from "@oscharko-dev/keiko-security";
16
+ import { MAX_CONTEXT_MESSAGES, conversationForGateway, usableGatewayMessages, } from "./chat-handlers.js";
17
+ // Per-dropped-message redacted snippet budget (UTF-8 bytes). Bounds a single noisy turn.
18
+ const SNIPPET_BYTE_BUDGET = 200;
19
+ // Total token budget for the whole synthetic summary segment (a few KB at ~3.5 bytes/token).
20
+ const SUMMARY_TOKEN_BUDGET = 1024;
21
+ // Deterministic, offline, predicate-gated wrapper over conversationForGateway. On the fast path it
22
+ // returns the existing function's value verbatim; on the slow path it inserts a redacted summary
23
+ // after the system message so platform instructions remain first.
24
+ export function conversationForGatewayWithCompaction(messages, opts = {}) {
25
+ const filtered = usableGatewayMessages(messages);
26
+ if (opts.contextProfile === undefined || filtered.length <= MAX_CONTEXT_MESSAGES) {
27
+ return { messages: conversationForGateway(messages) };
28
+ }
29
+ return buildCompactedOutcome(messages, filtered);
30
+ }
31
+ function buildCompactedOutcome(messages, filtered) {
32
+ const dropped = toDroppedTurns(filtered.slice(0, filtered.length - MAX_CONTEXT_MESSAGES));
33
+ const summaryContent = buildSummaryContent(dropped);
34
+ const summarySegment = { role: "user", content: summaryContent };
35
+ const record = buildRecord(dropped, summaryContent);
36
+ const gatewayMessages = conversationForGateway(messages);
37
+ const [systemMessage, ...recentMessages] = gatewayMessages;
38
+ return {
39
+ messages: systemMessage === undefined
40
+ ? [summarySegment]
41
+ : [systemMessage, summarySegment, ...recentMessages],
42
+ compaction: record,
43
+ };
44
+ }
45
+ function toDroppedTurns(prefix) {
46
+ return prefix.map((turn, index) => ({
47
+ role: turn.role,
48
+ content: turn.content,
49
+ stableId: `history-msg-${String(index)}`,
50
+ }));
51
+ }
52
+ // Redact + byte-bound a single dropped turn to a one-line snippet. UTF-8-safe truncation.
53
+ function snippetFor(turn) {
54
+ const redacted = redact(turn.content).replace(/\s+/gu, " ").trim();
55
+ const bytes = new TextEncoder().encode(redacted);
56
+ if (bytes.length <= SNIPPET_BYTE_BUDGET) {
57
+ return redacted;
58
+ }
59
+ const slice = bytes.slice(0, SNIPPET_BYTE_BUDGET);
60
+ return new TextDecoder("utf-8", { fatal: false }).decode(slice).trimEnd() + "…";
61
+ }
62
+ const SUMMARY_HEADER = "[Automated summary of earlier conversation turns — older messages were compacted to fit the " +
63
+ "context window. The verbatim recent turns follow below.]";
64
+ function buildSummaryContent(dropped) {
65
+ const lines = [SUMMARY_HEADER, `Dropped ${String(dropped.length)} earlier turn(s):`];
66
+ let omitted = 0;
67
+ for (const turn of dropped) {
68
+ const candidate = `- [${turn.role}] ${snippetFor(turn)}`;
69
+ const next = [...lines, candidate].join("\n");
70
+ if (estimateTokens(next) > SUMMARY_TOKEN_BUDGET) {
71
+ omitted += 1;
72
+ continue;
73
+ }
74
+ lines.push(candidate);
75
+ }
76
+ if (omitted > 0) {
77
+ lines.push(`…and ${String(omitted)} further turn(s) omitted to stay within the summary budget.`);
78
+ }
79
+ return lines.join("\n");
80
+ }
81
+ function sourceSpansFor(dropped) {
82
+ return dropped.map((turn) => ({ kind: "message", stableId: turn.stableId }));
83
+ }
84
+ function buildRecord(dropped, summaryContent) {
85
+ const tokensBefore = dropped.reduce((sum, turn) => sum + estimateTokens(turn.content), 0);
86
+ const record = {
87
+ schemaVersion: CONTEXT_ENGINEERING_SCHEMA_VERSION,
88
+ laneId: "history-summary",
89
+ reason: "history-window",
90
+ itemsBefore: dropped.length,
91
+ itemsAfter: 0,
92
+ tokensBefore,
93
+ tokensAfter: estimateTokens(summaryContent),
94
+ orderedAt: dropped.length,
95
+ sourceSpans: sourceSpansFor(dropped),
96
+ };
97
+ const validation = validateContextCompactionRecord(record);
98
+ if (!validation.ok) {
99
+ throw new Error(`conversation-compaction produced an invalid record: ${validation.reasons.join(", ")}`);
100
+ }
101
+ return record;
102
+ }
package/dist/deps.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type EnvSource, type GatewayConfig } from "@oscharko-dev/keiko-model-gateway";
2
2
  import type { ModelPort } from "@oscharko-dev/keiko-harness";
3
+ import { type ContextProfile } from "@oscharko-dev/keiko-contracts";
3
4
  import type { EvidenceStore } from "@oscharko-dev/keiko-evidence";
4
5
  import type { RunRegistry } from "./runs.js";
5
6
  import { type UiStore } from "./store/index.js";
@@ -49,6 +50,7 @@ export interface UiHandlerDeps {
49
50
  readonly gatewayConfig?: RuntimeGatewayConfig | undefined;
50
51
  readonly gatewaySetupTester?: ((config: GatewayConfig, candidateModelIds: readonly string[]) => Promise<readonly string[]>) | undefined;
51
52
  readonly gatewayModelDiscovery?: ((baseUrl: string, apiKey: string, apiKeyHeaderName?: string, egress?: GatewayEgressConfig) => Promise<GatewayModelDiscoveryOutput>) | undefined;
53
+ readonly gatewayReadinessFetch?: typeof fetch | undefined;
52
54
  readonly figmaCredentialTester?: ((accessToken: string, egress?: GatewayEgressConfig) => Promise<void>) | undefined;
53
55
  readonly editorLanguageRouteOptions?: EditorLanguageRouteOptions | undefined;
54
56
  readonly localKnowledgeEmbeddingRequest?: ((request: OpenAIEmbeddingRequest) => Promise<OpenAIEmbeddingOutcome>) | undefined;
@@ -56,6 +58,7 @@ export interface UiHandlerDeps {
56
58
  readonly relationship?: RelationshipHandlerDeps | undefined;
57
59
  readonly evidenceDir?: string | undefined;
58
60
  readonly localKnowledgeKeyProvider?: KnowledgeStoreKeyProvider | undefined;
61
+ readonly contextProfile?: ContextProfile | undefined;
59
62
  }
60
63
  export interface BuildHandlerDepsOptions {
61
64
  readonly configPath: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAQA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAQ7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAML,KAAK,OAAO,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAkC,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAG7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,+CAA+C,CAAC;AAIvD,MAAM,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAMnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK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,SAAS,CAAC;IAId,QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;CACtD;AA2HD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAEnF;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,eAAe,GAAG,KAAK,GAAG,QAAQ,CAAC,GACvE,mBAAmB,GAAG,SAAS,CAOjC;AA0CD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAG3E;AAGD,YAAY,EAAE,eAAe,EAAE,CAAC;AA8FhC,wBAAgB,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,QAAQ,CAS9E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,MAAM,EAAE,CAE9E;AAED,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,MAAM,EAAE,CAO9F;AAED,wBAAgB,0CAA0C,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAMvF;AA8LD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa,CAiDlF"}
package/dist/deps.js CHANGED
@@ -13,6 +13,7 @@ import { resolveCostClass } from "@oscharko-dev/keiko-model-gateway";
13
13
  import { writeSideFile } from "@oscharko-dev/keiko-evidence";
14
14
  import { deepRedactStrings } from "@oscharko-dev/keiko-evidence";
15
15
  import { keikoApiKeySecretValues } from "@oscharko-dev/keiko-security";
16
+ import { DEFAULT_CONTEXT_PROFILE } from "@oscharko-dev/keiko-contracts";
16
17
  import { nodeWorkspaceFs } from "@oscharko-dev/keiko-workspace/internal/fs";
17
18
  import { createNodeEvidenceStore, resolveEvidenceDir } from "@oscharko-dev/keiko-evidence";
18
19
  import { dirname, join } from "node:path";
@@ -430,7 +431,6 @@ export function buildUiHandlerDeps(options) {
430
431
  const liveRedactor = (value) => deepRedactStrings(value, redactString);
431
432
  const { store: uiStore, relationship } = composePersistence(options.store, resolvedUiDbPath, redactString, options.env);
432
433
  const preferredProjectPath = seedInitialProject(uiStore, resolvedUiDbPath, options.initialProjectPath);
433
- const peripherals = buildPeripherals(options, uiStore, evidenceStore, redactString, liveRedactor);
434
434
  return {
435
435
  config,
436
436
  configPresent,
@@ -450,7 +450,8 @@ export function buildUiHandlerDeps(options) {
450
450
  gatewayModelDiscovery: options.gatewayModelDiscovery,
451
451
  figmaCredentialTester: options.figmaCredentialTester,
452
452
  localKnowledgeKeyProvider: createLocalKnowledgeKeyProvider({ env: options.env }),
453
- ...peripherals,
453
+ contextProfile: DEFAULT_CONTEXT_PROFILE,
454
+ ...buildPeripherals(options, uiStore, evidenceStore, redactString, liveRedactor),
454
455
  consolidationJobs: createConsolidationJobRegistry(),
455
456
  ...(relationship === undefined ? {} : { relationship }),
456
457
  };
package/dist/files.d.ts CHANGED
@@ -35,6 +35,22 @@ export interface FilesTreeResponse {
35
35
  readonly entries: readonly FilesTreeEntry[];
36
36
  readonly truncated: boolean;
37
37
  }
38
+ export interface FilesSearchResult {
39
+ readonly root: string;
40
+ readonly path: string;
41
+ readonly name: string;
42
+ readonly directory: string;
43
+ readonly extension: string | null;
44
+ readonly sizeBytes: number;
45
+ readonly modifiedAt: number;
46
+ }
47
+ export interface FilesSearchResponse {
48
+ readonly root: string;
49
+ readonly query: string;
50
+ readonly results: readonly FilesSearchResult[];
51
+ readonly truncated: boolean;
52
+ readonly scannedFileCount: number;
53
+ }
38
54
  interface FilesPreviewBase {
39
55
  readonly root: string;
40
56
  readonly path: string;
@@ -77,6 +93,7 @@ export declare function runFilesHandler(work: () => Promise<RouteResult> | Route
77
93
  export declare function resolveRoot(store: UiStore, rootInput: string | null, redactor: FilesMetadataRedactor): Promise<ResolvedProjectRoot>;
78
94
  export declare function listFilesDirectories(store: UiStore, rootInput: string | null, pathInput?: string, redactor?: FilesMetadataRedactor): Promise<FilesDirectoryListing>;
79
95
  export declare function readFilesTree(store: UiStore, rootInput: string | null, pathInput: string | null, redactor?: FilesMetadataRedactor): Promise<FilesTreeResponse>;
96
+ export declare function searchFiles(store: UiStore, rootInput: string | null, queryInput: string | null, limitInput?: number, redactor?: FilesMetadataRedactor): Promise<FilesSearchResponse>;
80
97
  export declare function readJsonObject(req: IncomingMessage, maxBytes: number): Promise<Record<string, unknown> | RouteResult>;
81
98
  export declare function readFilesContent(store: UiStore, rootInput: string | null, pathInput: string | null, redactor?: FilesMetadataRedactor): Promise<FilesContentResponse>;
82
99
  export declare function writeFilesContent(args: {
@@ -91,6 +108,7 @@ export declare function writeFilesContent(args: {
91
108
  export declare function readFilesPreview(store: UiStore, rootInput: string | null, pathInput: string | null, redactor?: FilesMetadataRedactor): Promise<FilesPreviewResponse>;
92
109
  export declare function handleFilesDirectories(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
93
110
  export declare function handleFilesTree(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
111
+ export declare function handleFilesSearch(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
94
112
  export declare function handleFilesPreview(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
95
113
  export declare function handleFilesContent(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
96
114
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAgBjD,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAA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