@crewx/sdk 0.9.0-rc.78 → 0.9.0-rc.79

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.
@@ -1,6 +1,10 @@
1
- import type { ConversationHighlight, SemanticContinuityContext, TemplateMessage } from '../conversation/types.js';
1
+ import type { ConversationHighlight, ConversationThreadState, SemanticContinuityContext, TemplateMessage } from '../conversation/types.js';
2
2
  export declare const DEFAULT_PROTECTED_TURN_COUNT = 5;
3
3
  export declare const DEFAULT_HIGHLIGHT_BUDGET_PERCENT = 5;
4
+ export declare const MAX_ACTIVE_HIGHLIGHTS = 12;
5
+ export declare const MAX_ACTIVE_HIGHLIGHT_CHARS = 2000;
6
+ export declare const MAX_THREAD_TITLE_CHARS = 200;
7
+ export declare const MAX_THREAD_STATE_VALUE_CHARS = 64;
4
8
  export interface ConversationTurn {
5
9
  taskId?: string;
6
10
  messages: TemplateMessage[];
@@ -28,6 +32,7 @@ export interface SelectConversationTurnsOptions {
28
32
  export interface ConversationHighlightSelection {
29
33
  includedHighlights: ConversationHighlight[];
30
34
  omittedHighlights: ConversationHighlight[];
35
+ truncatedHighlights: number;
31
36
  representedTaskIds: string[];
32
37
  unrepresentedTaskIds: string[];
33
38
  tokenCount: number;
@@ -39,15 +44,18 @@ export interface SelectConversationHighlightsOptions {
39
44
  taskOrder: readonly string[];
40
45
  maxTokenCount: number;
41
46
  countTokens: (text: string) => number;
47
+ applySafetyCap?: boolean;
42
48
  }
43
49
  export declare function getConversationMessageTaskId(message: TemplateMessage): string | undefined;
44
50
  export declare function groupConversationTurns(messages: readonly TemplateMessage[]): GroupedConversationTurns;
45
51
  export declare function materializeConversationTurn(turn: ConversationTurn, includeActivityLog?: boolean): string;
46
52
  export declare function selectConversationTurns(options: SelectConversationTurnsOptions): ConversationTurnSelection;
53
+ export declare function buildThreadStateContext(state: ConversationThreadState | undefined): ConversationThreadState | undefined;
47
54
  export declare function selectConversationHighlights(options: SelectConversationHighlightsOptions): ConversationHighlightSelection;
48
55
  export interface BuildSemanticContinuityContextOptions {
49
56
  highlights: readonly ConversationHighlight[];
50
57
  omittedTaskIds: readonly string[];
51
58
  representedTaskIds: readonly string[];
59
+ applySafetyCap?: boolean;
52
60
  }
53
61
  export declare function buildSemanticContinuityContext(options: BuildSemanticContinuityContextOptions): SemanticContinuityContext;
@@ -93,6 +93,7 @@ export interface ContextBudgetManifest {
93
93
  highlightOriginal: number;
94
94
  highlightIncluded: number;
95
95
  highlightOmitted: number;
96
+ highlightTruncated: number;
96
97
  representedOmittedTurns: number;
97
98
  unrepresentedOmittedTurns: number;
98
99
  activityDegraded: boolean;
@@ -135,5 +136,5 @@ export declare function countFreshProviderInitialInput(input: FreshProviderIniti
135
136
  export declare function createTokenCounter(options?: TokenizerOptions): TokenCounter;
136
137
  export declare function __createTokenCounterForTest(options?: TokenizerOptions, internalOptions?: TokenCounterInternalOptions): TokenCounter;
137
138
  export declare function resolveInputBudget(options: ResolveInputBudgetOptions): ResolveInputBudgetResult;
138
- export { DEFAULT_HIGHLIGHT_BUDGET_PERCENT, DEFAULT_PROTECTED_TURN_COUNT, buildSemanticContinuityContext, getConversationMessageTaskId, groupConversationTurns, materializeConversationTurn, selectConversationHighlights, selectConversationTurns, } from './continuity.js';
139
+ export { DEFAULT_HIGHLIGHT_BUDGET_PERCENT, DEFAULT_PROTECTED_TURN_COUNT, MAX_ACTIVE_HIGHLIGHT_CHARS, MAX_ACTIVE_HIGHLIGHTS, MAX_THREAD_STATE_VALUE_CHARS, MAX_THREAD_TITLE_CHARS, buildSemanticContinuityContext, buildThreadStateContext, getConversationMessageTaskId, groupConversationTurns, materializeConversationTurn, selectConversationHighlights, selectConversationTurns, } from './continuity.js';
139
140
  export type { BuildSemanticContinuityContextOptions, ConversationHighlightSelection, ConversationTurn, ConversationTurnSelection, GroupedConversationTurns, SelectConversationHighlightsOptions, SelectConversationTurnsOptions, } from './continuity.js';
@@ -1,4 +1,4 @@
1
- import type { ConversationHighlight, ConversationThread, FetchHistoryOptions, IConversationHistoryProvider, Platform } from './types';
1
+ import type { ConversationHighlight, ConversationThread, ConversationThreadState, FetchHistoryOptions, IConversationHistoryProvider, Platform } from './types';
2
2
  export declare class SqliteConversationProvider implements IConversationHistoryProvider {
3
3
  private readonly dbPath;
4
4
  constructor(dbPath?: string);
@@ -11,6 +11,7 @@ export declare class SqliteConversationProvider implements IConversationHistoryP
11
11
  created: boolean;
12
12
  }>;
13
13
  fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise<ConversationThread>;
14
+ fetchThreadState(threadId: string): Promise<ConversationThreadState | undefined>;
14
15
  fetchHighlights(threadId: string): Promise<ConversationHighlight[] | undefined>;
15
16
  saveUserMessage(threadId: string, text: string, _userId?: string, _metadata?: Record<string, unknown>): Promise<{
16
17
  id: string;
@@ -22,6 +22,7 @@ export interface ConversationHighlight {
22
22
  }
23
23
  export interface SemanticContinuityContext {
24
24
  highlights: ConversationHighlight[];
25
+ truncatedHighlights?: number;
25
26
  omittedTurns: {
26
27
  count: number;
27
28
  represented: number;
@@ -31,6 +32,17 @@ export interface SemanticContinuityContext {
31
32
  rendered?: string;
32
33
  }
33
34
  export type ConversationSemanticContinuityContext = SemanticContinuityContext;
35
+ export interface ConversationThreadStateValue {
36
+ code: string;
37
+ name: string;
38
+ }
39
+ export interface ConversationThreadState {
40
+ title?: string;
41
+ priority?: ConversationThreadStateValue;
42
+ state?: ConversationThreadStateValue;
43
+ rendered?: string;
44
+ }
45
+ export type ThreadStateContext = ConversationThreadState;
34
46
  export interface ConversationThread {
35
47
  threadId: string;
36
48
  platform: Platform;
@@ -69,6 +81,7 @@ export interface IConversationHistoryProvider {
69
81
  created: boolean;
70
82
  }>;
71
83
  fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise<ConversationThread>;
84
+ fetchThreadState?(threadId: string): Promise<ConversationThreadState | undefined>;
72
85
  fetchHighlights?(threadId: string): Promise<ConversationHighlight[] | undefined>;
73
86
  saveUserMessage(threadId: string, text: string, userId?: string, metadata?: Record<string, unknown>): Promise<{
74
87
  id: string;