@adaptiqai/deepseek-harness 0.2.5 → 0.2.6

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.
@@ -0,0 +1,10 @@
1
+ import type { SessionView } from '@adaptiqai/core/types';
2
+ import type { Kit } from './actions.ts';
3
+ import { type T } from './ui.tsx';
4
+ export declare function AttachPicker({ t, kit, view, modelName, disabled }: {
5
+ t: T;
6
+ kit: Kit;
7
+ view: SessionView;
8
+ modelName: string | null;
9
+ disabled: boolean;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,52 @@
1
+ /** What the memory pill's "Add" list shows and the pill's "+ added" moment, kept apart from React so they can be tested. */
2
+ import type { ConversationItem, KnowledgeItem, SessionView } from '@adaptiqai/core/types';
3
+ type T = (key: string, params?: Record<string, unknown>) => string;
4
+ /** One row of the pill's add list: a conversation or a collection, on or off. */
5
+ export interface AttachRow {
6
+ readonly id: string;
7
+ readonly kind: 'conversation' | 'collection';
8
+ readonly name: string;
9
+ readonly updatedAt: number | null;
10
+ readonly tokens: number | null;
11
+ /** Attached to this conversation. */
12
+ readonly on: boolean;
13
+ /** Readiness of an attached item; a collection not ready yet cannot be added. */
14
+ readonly status: 'ready' | 'preparing' | 'failed' | 'not-ready';
15
+ }
16
+ /**
17
+ * The add list: recent conversations on this model (newest first, as the
18
+ * server pages them), then this model's collections; what is attached shows
19
+ * as on, with its readiness.
20
+ * @param view - the conversation.
21
+ * @param conversations - conversations on its model, or null while loading.
22
+ * @param collections - collections, or null while loading.
23
+ * @param query - search text.
24
+ * @returns the rows.
25
+ */
26
+ export declare function attachRows(view: SessionView, conversations: readonly ConversationItem[] | null, collections: readonly KnowledgeItem[] | null, query: string): AttachRow[];
27
+ /** How long the pill says what a mention just added. */
28
+ export declare const ADDED_MS = 5000;
29
+ /**
30
+ * The pill's words after a mention: what was added, and what stays text because it is on another model.
31
+ * @param t - translate.
32
+ * @param added - the conversation's "just added" mark.
33
+ * @returns e.g. "+ Novel A, Novel B".
34
+ */
35
+ export declare function addedText(t: T, added: {
36
+ readonly names: readonly string[];
37
+ readonly otherModel: readonly string[];
38
+ }): string;
39
+ /**
40
+ * Follows a conversation's "just added" mark and reports a new one for
41
+ * {@link ADDED_MS}. A mark already there when the view first arrives is history.
42
+ */
43
+ export declare class AddedFlash {
44
+ private readonly onChange;
45
+ private readonly ms;
46
+ private baseline;
47
+ private timer;
48
+ constructor(onChange: (added: NonNullable<SessionView['added']> | null) => void, ms?: number);
49
+ seen(added: SessionView['added'] | undefined): void;
50
+ dispose(): void;
51
+ }
52
+ export {};
@@ -7,6 +7,7 @@
7
7
  import { LlmAdapter, LlmError } from '@deepseek-ai/dsh-llm';
8
8
  import type { GenerateOptions, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, PreparedAdapterCall, ResolvedRetryPolicy, StreamChunk } from '@deepseek-ai/dsh-llm';
9
9
  import { type AdaptiqFailure, type AuthManager, type CatalogModel, type RequestEvents } from '@adaptiqai/core';
10
+ import { type ReferencedSession } from './wire.ts';
10
11
  /** What the adapter tells the rest of the plugin about each request. */
11
12
  export interface AdapterDeps {
12
13
  readonly route: string;
@@ -26,7 +27,17 @@ export interface AdapterDeps {
26
27
  remember(sessionId: string | undefined): boolean;
27
28
  /** Whether the server already stores this conversation (may look it up first). */
28
29
  stored(sessionId: string | undefined): boolean | Promise<boolean>;
30
+ /**
31
+ * Attach the sessions a message mentioned with `@` to this conversation, when
32
+ * they are AdaptiqAI conversations on the same model.
33
+ * @returns session id → name of those attached and ready to read from memory.
34
+ */
35
+ recall?(sessionId: string, model: string, references: readonly ReferencedSession[], signal: AbortSignal): Promise<ReadonlyMap<string, string>>;
36
+ /** What the person wrote in this conversation (their own messages), for the tools' guards. */
37
+ noteUserTexts?(sessionId: string, texts: readonly string[]): void;
29
38
  readonly events: RequestEvents;
39
+ /** Diagnostics for one request (no content), when a debug log is on. */
40
+ debug?(message: string): void;
30
41
  readonly fetch?: typeof fetch;
31
42
  }
32
43
  /** The harness retries busy and preparing answers itself, honouring Retry-After. */
@@ -3,7 +3,7 @@
3
3
  * (thinking field and values, sampling defaults) comes only from the
4
4
  * model's catalog entry.
5
5
  */
6
- import type { GenerateOptions } from '@deepseek-ai/dsh-llm';
6
+ import type { GenerateOptions, RequestMessage } from '@deepseek-ai/dsh-llm';
7
7
  import { type CatalogModel } from '@adaptiqai/core';
8
8
  /** One Chat Completions message. */
9
9
  export type WireMessage = {
@@ -38,13 +38,58 @@ export interface WireExtras {
38
38
  readonly stored?: boolean;
39
39
  /** Ask for streamed usage (always on for the adapter). */
40
40
  readonly includeUsage?: boolean;
41
+ /** Referenced sessions attached to this conversation and ready, by session id → name. */
42
+ readonly recalled?: ReadonlyMap<string, string>;
41
43
  }
44
+ /** One session another message mentioned with `@`, as the harness snapshot records it. */
45
+ export interface ReferencedSession {
46
+ readonly sessionId: string;
47
+ readonly label: string;
48
+ }
49
+ /**
50
+ * The sessions a harness `## Referenced sessions` snapshot carries, read from
51
+ * the message's structured source (`kind: 'session-reference'`), never its text.
52
+ * @param message - one request message.
53
+ * @returns the referenced sessions, or null when the message is not a snapshot.
54
+ */
55
+ export declare function sessionReferences(message: RequestMessage): ReferencedSession[] | null;
56
+ /**
57
+ * Every session the request's history mentions, first mention first.
58
+ * @param messages - the request history.
59
+ * @returns unique referenced sessions.
60
+ */
61
+ export declare function referencedSessions(messages: readonly RequestMessage[]): ReferencedSession[];
62
+ /**
63
+ * The line that stands in for transcripts the conversation now reads from memory.
64
+ * @param names - the attached conversations' names.
65
+ * @returns one short line for the model.
66
+ */
67
+ export declare function recallLine(names: readonly string[]): string;
68
+ /**
69
+ * A snapshot with the sessions read from memory taken out: one line names them,
70
+ * and the transcripts of any other referenced sessions stay as the harness wrote them.
71
+ * When the snapshot cannot be split safely it is kept whole.
72
+ * @param text - the snapshot text.
73
+ * @param references - the sessions it carries.
74
+ * @param recalled - session id → name of the sessions attached and ready.
75
+ * @returns the text to send.
76
+ */
77
+ export declare function recallSnapshot(text: string, references: readonly ReferencedSession[], recalled: ReadonlyMap<string, string>): string;
78
+ /**
79
+ * What the person wrote in the request history: their own messages (typed, or
80
+ * answered to a question of the model) only, not the harness's snapshots,
81
+ * runtime context or tool output.
82
+ * @param messages - the request history.
83
+ * @returns the text of each of the person's messages, oldest first.
84
+ */
85
+ export declare function userTexts(messages: readonly RequestMessage[]): string[];
42
86
  /**
43
87
  * Convert the harness history to Chat Completions messages.
44
88
  * @param options - the harness request.
89
+ * @param recalled - referenced sessions read from memory: their snapshots become one line.
45
90
  * @returns the wire messages in order.
46
91
  */
47
- export declare function wireMessages(options: Pick<GenerateOptions, 'messages' | 'system'>): WireMessage[];
92
+ export declare function wireMessages(options: Pick<GenerateOptions, 'messages' | 'system'>, recalled?: ReadonlyMap<string, string>): WireMessage[];
48
93
  /**
49
94
  * Build the request body for one call.
50
95
  * @param options - the harness request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptiqai/deepseek-harness",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "AdaptiqAI for DeepSeek Harness: models with 5M-token native memory and Knowledge. Sign up, get a model and work without leaving the harness",
5
5
  "keywords": [
6
6
  "dsh-plugin",
@@ -89,7 +89,7 @@
89
89
  "react-dom": "~18.3.1",
90
90
  "typescript": "~5.9.3",
91
91
  "vitest": "~3.2.7",
92
- "@adaptiqai/core": "0.2.5"
92
+ "@adaptiqai/core": "0.2.6"
93
93
  },
94
94
  "repository": {
95
95
  "type": "git",