@nexus-cortex/types 4.26.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ Nexus Cortex
2
+ Copyright 2026 Spitfire-Products
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @nexus-cortex/types
2
+
3
+ Shared TypeScript types for Nexus Cortex - breaks circular dependency between core and executors
4
+
5
+ Part of **[Nexus Cortex](https://github.com/Spitfire-Products/nexus-cortex)** — a multi-provider AI agent harness (direct library, optional HTTP server, terminal UIs).
6
+
7
+ ```bash
8
+ npm install @nexus-cortex/types
9
+ ```
10
+
11
+ See the [main README](https://github.com/Spitfire-Products/nexus-cortex#readme) for usage, architecture, and the full package list.
12
+
13
+ Apache-2.0 © Spitfire-Products
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Adapter Interface Type Definitions
3
+ *
4
+ * @packageDocumentation
5
+ * @module @nexus-cortex/types/adapters
6
+ *
7
+ * This module contains adapter interface types for the Nexus Cortex system.
8
+ * These are contract definitions for bidirectional conversion between canonical
9
+ * and provider-specific formats.
10
+ *
11
+ * Phase 1.5: Multi-Provider Architecture
12
+ */
13
+ import type { CanonicalTool, CanonicalToolUse, CanonicalToolResult } from './tools';
14
+ import type { CanonicalMessage } from './messages';
15
+ import type { ModelConfig } from './models';
16
+ /**
17
+ * FormatAdapter Interface
18
+ *
19
+ * Bidirectional conversion between canonical and provider-specific formats.
20
+ *
21
+ * Each adapter handles one API pattern:
22
+ * - GeminiGenerativeAIToolsAdapter: parametersJsonSchema, snake_case
23
+ * - AnthropicMessagesToolsAdapter: input_schema, snake_case
24
+ * - OpenAIFunctionsToolsAdapter: parameters, PascalCase/snake_case
25
+ */
26
+ export interface FormatAdapter {
27
+ /**
28
+ * Adapter name (matches ModelConfig.tools.adapter)
29
+ */
30
+ readonly name: string;
31
+ /**
32
+ * API patterns this adapter supports
33
+ */
34
+ readonly apiPatterns: string[];
35
+ /**
36
+ * Convert canonical messages to provider-specific format
37
+ *
38
+ * @param messages - Canonical messages
39
+ * @param modelConfig - Model configuration
40
+ * @returns Provider-specific message format
41
+ */
42
+ toProviderMessages(messages: CanonicalMessage[], modelConfig: ModelConfig): unknown[];
43
+ /**
44
+ * Convert provider-specific messages to canonical format
45
+ *
46
+ * @param providerMessages - Provider-specific messages
47
+ * @param modelConfig - Model configuration
48
+ * @param sessionContext - Session context for timeline tracking
49
+ * @returns Canonical messages
50
+ */
51
+ fromProviderMessages(providerMessages: unknown[], modelConfig: ModelConfig, sessionContext: {
52
+ sessionId: string;
53
+ conversationId: string;
54
+ turnNumber: number;
55
+ }): CanonicalMessage[];
56
+ /**
57
+ * Convert canonical tools to provider-specific format
58
+ *
59
+ * @param tools - Canonical tool definitions
60
+ * @param modelConfig - Model configuration (for naming convention, etc.)
61
+ * @returns Provider-specific tool format
62
+ */
63
+ toProviderTools(tools: CanonicalTool[], modelConfig: ModelConfig): unknown[];
64
+ /**
65
+ * Convert provider-specific tools to canonical format
66
+ *
67
+ * @param providerTools - Provider-specific tool definitions
68
+ * @param modelConfig - Model configuration
69
+ * @returns Canonical tool definitions
70
+ */
71
+ fromProviderTools(providerTools: unknown[], modelConfig: ModelConfig): CanonicalTool[];
72
+ /**
73
+ * Convert canonical tool use to provider-specific format
74
+ *
75
+ * @param toolUse - Canonical tool use
76
+ * @param modelConfig - Model configuration
77
+ * @returns Provider-specific tool use format
78
+ */
79
+ toProviderToolUse(toolUse: CanonicalToolUse, modelConfig: ModelConfig): unknown;
80
+ /**
81
+ * Convert provider-specific tool use to canonical format
82
+ *
83
+ * @param providerToolUse - Provider-specific tool use
84
+ * @param modelConfig - Model configuration
85
+ * @returns Canonical tool use
86
+ */
87
+ fromProviderToolUse(providerToolUse: unknown, modelConfig: ModelConfig): CanonicalToolUse;
88
+ /**
89
+ * Convert canonical tool result to provider-specific format
90
+ *
91
+ * @param toolResult - Canonical tool result
92
+ * @param modelConfig - Model configuration
93
+ * @returns Provider-specific tool result format
94
+ */
95
+ toProviderToolResult(toolResult: CanonicalToolResult, modelConfig: ModelConfig): unknown;
96
+ /**
97
+ * Convert provider-specific tool result to canonical format
98
+ *
99
+ * @param providerToolResult - Provider-specific tool result
100
+ * @param modelConfig - Model configuration
101
+ * @returns Canonical tool result
102
+ */
103
+ fromProviderToolResult(providerToolResult: unknown, modelConfig: ModelConfig): CanonicalToolResult;
104
+ /**
105
+ * Validate tool schema for this adapter
106
+ *
107
+ * @param tool - Tool to validate
108
+ * @param modelConfig - Model configuration
109
+ * @returns Validation result with errors if invalid
110
+ */
111
+ validateTool(tool: CanonicalTool, modelConfig: ModelConfig): {
112
+ valid: boolean;
113
+ errors?: string[];
114
+ };
115
+ /**
116
+ * Get maximum number of tools supported
117
+ *
118
+ * @param modelConfig - Model configuration
119
+ * @returns Maximum tool count (or Infinity if unlimited)
120
+ */
121
+ getMaxTools(modelConfig: ModelConfig): number;
122
+ /**
123
+ * Check if parallel tool calls are supported
124
+ *
125
+ * @param modelConfig - Model configuration
126
+ * @returns true if parallel tool calls supported
127
+ */
128
+ supportsParallelToolCalls(modelConfig: ModelConfig): boolean;
129
+ }
130
+ /**
131
+ * Adapter Registry Interface
132
+ *
133
+ * Registry for managing format adapters.
134
+ */
135
+ export interface AdapterRegistry {
136
+ /**
137
+ * Register a format adapter
138
+ *
139
+ * @param adapter - The adapter to register
140
+ */
141
+ registerAdapter(adapter: FormatAdapter): void;
142
+ /**
143
+ * Get an adapter by name
144
+ *
145
+ * @param adapterName - Adapter name
146
+ * @returns The adapter
147
+ * @throws Error if adapter not found
148
+ */
149
+ getAdapter(adapterName: string): FormatAdapter;
150
+ /**
151
+ * Get adapter for model
152
+ *
153
+ * @param modelConfig - Model configuration
154
+ * @returns Adapter implementation
155
+ * @throws Error if adapter not found
156
+ */
157
+ getAdapterForModel(modelConfig: ModelConfig): FormatAdapter;
158
+ /**
159
+ * Check if an adapter is registered
160
+ *
161
+ * @param adapterName - Adapter name
162
+ * @returns true if the adapter is registered
163
+ */
164
+ hasAdapter(adapterName: string): boolean;
165
+ /**
166
+ * List all registered adapter names
167
+ *
168
+ * @returns Array of adapter names
169
+ */
170
+ listAdapters(): string[];
171
+ }
172
+ //# sourceMappingURL=adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAE/B;;;;;;OAMG;IACH,kBAAkB,CAChB,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,WAAW,EAAE,WAAW,GACvB,OAAO,EAAE,CAAC;IAEb;;;;;;;OAOG;IACH,oBAAoB,CAClB,gBAAgB,EAAE,OAAO,EAAE,EAC3B,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACpB,GACA,gBAAgB,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH,eAAe,CACb,KAAK,EAAE,aAAa,EAAE,EACtB,WAAW,EAAE,WAAW,GACvB,OAAO,EAAE,CAAC;IAEb;;;;;;OAMG;IACH,iBAAiB,CACf,aAAa,EAAE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@packageDocumentation
5
+ * @module @nexus-cortex/types/adapters
6
+ *
7
+ * This module contains adapter interface types for the Nexus Cortex system.
8
+ * These are contract definitions for bidirectional conversion between canonical
9
+ * and provider-specific formats.
10
+ *
11
+ * Phase 1.5: Multi-Provider Architecture
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Historical Tool Types
3
+ *
4
+ * Type definitions for historical context and conversation tools.
5
+ * Extracted from @nexus-cortex/core to eliminate circular dependencies.
6
+ *
7
+ * These types are COPIED from the core implementations to maintain compatibility.
8
+ */
9
+ /**
10
+ * Input schema for GetConversationSegment tool
11
+ */
12
+ export interface GetConversationSegmentInput {
13
+ /** Turn range to retrieve */
14
+ turnRange?: {
15
+ start: number;
16
+ end: number;
17
+ };
18
+ /** Checkpoint ID to retrieve from */
19
+ checkpointId?: string;
20
+ /** Format of the returned segment */
21
+ format?: 'full' | 'summary' | 'compressed';
22
+ }
23
+ /**
24
+ * Conversation segment result
25
+ * NOTE: Uses 'any' for messages to avoid circular dependency with Message types
26
+ */
27
+ export interface ConversationSegment {
28
+ /** Messages in the segment (if full format) */
29
+ messages?: any[];
30
+ /** Summary of the segment (if summary/compressed format) */
31
+ summary?: string;
32
+ /** Metadata about the segment */
33
+ metadata: {
34
+ /** Total estimated tokens in segment */
35
+ totalTokens: number;
36
+ /** Turn range of the segment */
37
+ turnRange: {
38
+ start: number;
39
+ end: number;
40
+ };
41
+ /** Whether segment includes compacted messages */
42
+ hasCompactions: boolean;
43
+ /** Number of messages in segment */
44
+ messageCount: number;
45
+ };
46
+ }
47
+ /**
48
+ * Input schema for ListCompactionBoundaries tool
49
+ */
50
+ export interface ListCompactionBoundariesInput {
51
+ /** Include detailed metadata in response */
52
+ includeMetadata?: boolean;
53
+ }
54
+ /**
55
+ * Compaction boundary information
56
+ */
57
+ export interface CompactionBoundary {
58
+ /** Unique identifier for the compaction */
59
+ id: string;
60
+ /** Timestamp when compaction occurred */
61
+ timestamp: Date;
62
+ /** Turn range that was compacted */
63
+ turnRange: {
64
+ start: number;
65
+ end: number;
66
+ };
67
+ /** Token counts */
68
+ tokens: {
69
+ /** Original token count before compaction */
70
+ original: number;
71
+ /** Compressed token count after compaction */
72
+ compressed: number;
73
+ /** Tokens saved by compaction */
74
+ saved: number;
75
+ };
76
+ /** Type of compaction */
77
+ type: 'auto' | 'manual' | 'helper-fallback';
78
+ /** Optional metadata if requested */
79
+ metadata?: {
80
+ /** Topics covered in this segment */
81
+ topics: string[];
82
+ /** Main decisions or outcomes */
83
+ decisions: string[];
84
+ /** Tools used in this segment */
85
+ toolsUsed: string[];
86
+ /** Model used for compaction */
87
+ helperModel: string;
88
+ /** Cost of compaction operation */
89
+ cost: number;
90
+ /** Summary of the compacted section */
91
+ summary: string;
92
+ };
93
+ }
94
+ /**
95
+ * Input schema for RequestHistoricalContext tool
96
+ */
97
+ export interface RequestHistoricalContextInput {
98
+ /** Query describing what historical context is needed */
99
+ query: string;
100
+ /** Detail level for the response */
101
+ detailLevel?: 'brief' | 'standard' | 'detailed';
102
+ /** Maximum tokens for the response */
103
+ maxTokens?: number;
104
+ /** Whether to use helper model (vs main model) */
105
+ useHelperModel?: boolean;
106
+ }
107
+ /**
108
+ * Historical context result
109
+ */
110
+ export interface HistoricalContextResult {
111
+ /** Generated context based on the query */
112
+ context: string;
113
+ /** Sources used to generate the context */
114
+ sources: Array<{
115
+ /** Turn number in conversation */
116
+ turnNumber: number;
117
+ /** Timestamp of the source */
118
+ timestamp: Date;
119
+ /** Whether source is from compacted section */
120
+ isCompacted: boolean;
121
+ /** Compaction ID if applicable */
122
+ compactionId?: string;
123
+ }>;
124
+ /** Estimated tokens used */
125
+ tokensUsed: number;
126
+ /** Model used to generate context */
127
+ modelUsed: string;
128
+ /** Processing cost (usually $0 for Gemma) */
129
+ cost: number;
130
+ /** Processing time in milliseconds */
131
+ processingTime: number;
132
+ }
133
+ /**
134
+ * Input schema for SearchConversationHistory tool
135
+ */
136
+ export interface SearchConversationHistoryInput {
137
+ /** Search query string */
138
+ query: string;
139
+ /** Maximum number of results to return */
140
+ maxResults?: number;
141
+ /** Time range filter */
142
+ timeRange?: {
143
+ start: Date;
144
+ end: Date;
145
+ };
146
+ /** Include compacted messages in search */
147
+ includeCompacted?: boolean;
148
+ }
149
+ /**
150
+ * Search result from conversation history
151
+ */
152
+ export interface SearchResult {
153
+ /** Session ID this result came from */
154
+ sessionId: string;
155
+ /** Turn number in conversation */
156
+ turnNumber: number;
157
+ /** Timestamp of the message */
158
+ timestamp: Date;
159
+ /** Preview of the content */
160
+ preview: string;
161
+ /** Relevance score (0-100) */
162
+ relevanceScore: number;
163
+ /** Whether this result is from a compacted section */
164
+ isCompacted: boolean;
165
+ /** Compaction ID if applicable */
166
+ compactionId?: string;
167
+ /** Message ID */
168
+ messageId?: string;
169
+ }
170
+ /**
171
+ * Input schema for ListSessions tool
172
+ */
173
+ export interface ListSessionsInput {
174
+ /** Maximum number of sessions to return (default: 50) */
175
+ limit?: number;
176
+ /** Filter by minimum age in days */
177
+ minAgeDays?: number;
178
+ /** Filter by maximum age in days */
179
+ maxAgeDays?: number;
180
+ /** Sort order: 'newest' or 'oldest' */
181
+ sortBy?: 'newest' | 'oldest';
182
+ }
183
+ /**
184
+ * Session summary information
185
+ */
186
+ export interface SessionSummary {
187
+ /** Unique session identifier */
188
+ sessionId: string;
189
+ /** When session was created */
190
+ createdAt: string;
191
+ /** Last activity timestamp */
192
+ lastModified: string;
193
+ /** Number of messages in session */
194
+ messageCount: number;
195
+ /** File size in bytes */
196
+ fileSize: number;
197
+ /** Number of compactions in this session */
198
+ compactionCount: number;
199
+ /** Age in days */
200
+ ageDays: number;
201
+ /** Auto-generated session title (from helper model) */
202
+ title?: string;
203
+ }
204
+ /**
205
+ * Input schema for LoadSession tool
206
+ */
207
+ export interface LoadSessionInput {
208
+ /** Session ID to load */
209
+ sessionId: string;
210
+ /** Maximum number of messages to return (default: 100) */
211
+ limit?: number;
212
+ /** Start from message offset (for pagination) */
213
+ offset?: number;
214
+ /** Include system messages */
215
+ includeSystemMessages?: boolean;
216
+ }
217
+ /**
218
+ * Session load result
219
+ */
220
+ export interface SessionLoadResult {
221
+ /** Session ID */
222
+ sessionId: string;
223
+ /** Messages from the session */
224
+ messages: any[];
225
+ /** Total message count in session */
226
+ totalMessageCount: number;
227
+ /** Number of messages returned */
228
+ returnedMessageCount: number;
229
+ /** Whether there are more messages */
230
+ hasMore: boolean;
231
+ /** Session metadata */
232
+ metadata: {
233
+ createdAt: string;
234
+ lastModified: string;
235
+ compactionCount: number;
236
+ };
237
+ }
238
+ //# sourceMappingURL=historical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historical.d.ts","sourceRoot":"","sources":["../src/historical.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,6BAA6B;IAC7B,SAAS,CAAC,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IAEF,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAEjB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iCAAiC;IACjC,QAAQ,EAAE;QACR,wCAAwC;QACxC,WAAW,EAAE,MAAM,CAAC;QAEpB,gCAAgC;QAChC,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC;YACd,GAAG,EAAE,MAAM,CAAC;SACb,CAAC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M,CAAC;IAE7B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IAEjB,uBAAuB;IACvB,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Historical Tool Types
3
+ *
4
+ * Type definitions for historical context and conversation tools.
5
+ * Extracted from @nexus-cortex/core to eliminate circular dependencies.
6
+ *
7
+ * These types are COPIED from the core implementations to maintain compatibility.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=historical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historical.js","sourceRoot":"","sources":["../src/historical.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}