@ebowwa/coder 0.7.64 → 0.7.65

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 (101) hide show
  1. package/dist/index.js +36168 -32
  2. package/dist/interfaces/ui/terminal/cli/index.js +34253 -158
  3. package/dist/interfaces/ui/terminal/native/README.md +53 -0
  4. package/dist/interfaces/ui/terminal/native/claude_code_native.darwin-x64.node +0 -0
  5. package/dist/interfaces/ui/terminal/native/claude_code_native.dylib +0 -0
  6. package/dist/interfaces/ui/terminal/native/index.d.ts +0 -0
  7. package/dist/interfaces/ui/terminal/native/index.darwin-arm64.node +0 -0
  8. package/dist/interfaces/ui/terminal/native/index.js +43 -0
  9. package/dist/interfaces/ui/terminal/native/index.node +0 -0
  10. package/dist/interfaces/ui/terminal/native/package.json +34 -0
  11. package/dist/native/README.md +53 -0
  12. package/dist/native/claude_code_native.darwin-x64.node +0 -0
  13. package/dist/native/claude_code_native.dylib +0 -0
  14. package/dist/native/index.d.ts +0 -480
  15. package/dist/native/index.darwin-arm64.node +0 -0
  16. package/dist/native/index.js +43 -1625
  17. package/dist/native/index.node +0 -0
  18. package/dist/native/package.json +34 -0
  19. package/native/index.darwin-arm64.node +0 -0
  20. package/native/index.js +33 -19
  21. package/package.json +3 -2
  22. package/packages/src/core/agent-loop/__tests__/compaction.test.ts +17 -14
  23. package/packages/src/core/agent-loop/compaction.ts +6 -2
  24. package/packages/src/core/agent-loop/index.ts +2 -0
  25. package/packages/src/core/agent-loop/loop-state.ts +1 -1
  26. package/packages/src/core/agent-loop/turn-executor.ts +4 -0
  27. package/packages/src/core/agent-loop/types.ts +4 -0
  28. package/packages/src/core/api-client-impl.ts +283 -173
  29. package/packages/src/core/cognitive-security/hooks.ts +2 -1
  30. package/packages/src/core/config/todo +7 -0
  31. package/packages/src/core/context/__tests__/integration.test.ts +334 -0
  32. package/packages/src/core/context/compaction.ts +170 -0
  33. package/packages/src/core/context/constants.ts +58 -0
  34. package/packages/src/core/context/extraction.ts +85 -0
  35. package/packages/src/core/context/index.ts +66 -0
  36. package/packages/src/core/context/summarization.ts +251 -0
  37. package/packages/src/core/context/token-estimation.ts +98 -0
  38. package/packages/src/core/context/types.ts +59 -0
  39. package/packages/src/core/models.ts +81 -4
  40. package/packages/src/core/normalizers/todo +5 -1
  41. package/packages/src/core/providers/README.md +230 -0
  42. package/packages/src/core/providers/__tests__/providers.test.ts +135 -0
  43. package/packages/src/core/providers/index.ts +419 -0
  44. package/packages/src/core/providers/types.ts +132 -0
  45. package/packages/src/core/retry.ts +10 -0
  46. package/packages/src/ecosystem/tools/index.ts +174 -0
  47. package/packages/src/index.ts +23 -2
  48. package/packages/src/interfaces/ui/index.ts +17 -20
  49. package/packages/src/interfaces/ui/spinner.ts +2 -2
  50. package/packages/src/interfaces/ui/terminal/bridge/index.ts +370 -0
  51. package/packages/src/interfaces/ui/terminal/bridge/ipc.ts +829 -0
  52. package/packages/src/interfaces/ui/terminal/bridge/screen-export.ts +968 -0
  53. package/packages/src/interfaces/ui/terminal/bridge/types.ts +226 -0
  54. package/packages/src/interfaces/ui/terminal/bridge/useBridge.ts +210 -0
  55. package/packages/src/interfaces/ui/terminal/cli/bootstrap.ts +132 -0
  56. package/packages/src/interfaces/ui/terminal/cli/index.ts +200 -13
  57. package/packages/src/interfaces/ui/terminal/cli/interactive/index.ts +110 -0
  58. package/packages/src/interfaces/ui/terminal/cli/interactive/input-handler.ts +393 -0
  59. package/packages/src/interfaces/ui/terminal/cli/interactive/interactive-runner.ts +820 -0
  60. package/packages/src/interfaces/ui/terminal/cli/interactive/message-store.ts +299 -0
  61. package/packages/src/interfaces/ui/terminal/cli/interactive/types.ts +274 -0
  62. package/packages/src/interfaces/ui/terminal/shared/index.ts +13 -0
  63. package/packages/src/interfaces/ui/terminal/shared/query.ts +9 -3
  64. package/packages/src/interfaces/ui/terminal/shared/setup.ts +5 -1
  65. package/packages/src/interfaces/ui/terminal/shared/spinner-frames.ts +73 -0
  66. package/packages/src/interfaces/ui/terminal/shared/status-line.ts +10 -2
  67. package/packages/src/native/index.ts +404 -27
  68. package/packages/src/native/tui_v2_types.ts +39 -0
  69. package/packages/src/teammates/coordination.test.ts +279 -0
  70. package/packages/src/teammates/coordination.ts +646 -0
  71. package/packages/src/teammates/index.ts +95 -25
  72. package/packages/src/teammates/integration.test.ts +272 -0
  73. package/packages/src/teammates/runner.test.ts +235 -0
  74. package/packages/src/teammates/runner.ts +750 -0
  75. package/packages/src/teammates/schemas.ts +673 -0
  76. package/packages/src/types/index.ts +1 -0
  77. package/packages/src/core/context-compaction.ts +0 -578
  78. package/packages/src/interfaces/ui/Screenshot 2026-03-02 at 9.23.10/342/200/257PM.png +0 -0
  79. package/packages/src/interfaces/ui/Screenshot 2026-03-03 at 10.55.11/342/200/257AM.png +0 -0
  80. package/packages/src/interfaces/ui/terminal/tui/HelpPanel.tsx +0 -262
  81. package/packages/src/interfaces/ui/terminal/tui/InputContext.tsx +0 -232
  82. package/packages/src/interfaces/ui/terminal/tui/InputField.tsx +0 -62
  83. package/packages/src/interfaces/ui/terminal/tui/InteractiveTUI.tsx +0 -537
  84. package/packages/src/interfaces/ui/terminal/tui/MessageArea.tsx +0 -107
  85. package/packages/src/interfaces/ui/terminal/tui/MessageStore.tsx +0 -240
  86. package/packages/src/interfaces/ui/terminal/tui/StatusBar.tsx +0 -54
  87. package/packages/src/interfaces/ui/terminal/tui/commands.ts +0 -438
  88. package/packages/src/interfaces/ui/terminal/tui/components/InteractiveElements.tsx +0 -584
  89. package/packages/src/interfaces/ui/terminal/tui/components/MultilineInput.tsx +0 -614
  90. package/packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx +0 -333
  91. package/packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx +0 -604
  92. package/packages/src/interfaces/ui/terminal/tui/components/index.ts +0 -118
  93. package/packages/src/interfaces/ui/terminal/tui/console.ts +0 -49
  94. package/packages/src/interfaces/ui/terminal/tui/index.ts +0 -90
  95. package/packages/src/interfaces/ui/terminal/tui/run.tsx +0 -42
  96. package/packages/src/interfaces/ui/terminal/tui/spinner.ts +0 -69
  97. package/packages/src/interfaces/ui/terminal/tui/tui-app.tsx +0 -390
  98. package/packages/src/interfaces/ui/terminal/tui/tui-footer.ts +0 -422
  99. package/packages/src/interfaces/ui/terminal/tui/types.ts +0 -186
  100. package/packages/src/interfaces/ui/terminal/tui/useInputHandler.ts +0 -104
  101. package/packages/src/interfaces/ui/terminal/tui/useNativeInput.ts +0 -239
@@ -0,0 +1,53 @@
1
+ # @ebowwa/coder-native
2
+
3
+ Native Rust modules for [@ebowwa/coder](https://github.com/ebowwa/coder).
4
+
5
+ ## Features
6
+
7
+ - **Fast Search**: Ripgrep-based file and content search
8
+ - **Token Counting**: Efficient token counting for LLM contexts
9
+ - **Diff Calculation**: Fast diff generation and application
10
+ - **Content Compaction**: Smart content compaction for context windows
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ bun add @ebowwa/coder-native
16
+ # or
17
+ npm install @ebowwa/coder-native
18
+ ```
19
+
20
+ ## Supported Platforms
21
+
22
+ - macOS x64 (Intel)
23
+ - macOS arm64 (Apple Silicon)
24
+ - Linux x64 (GNU)
25
+ - Windows x64 (MSVC)
26
+
27
+ ## Usage
28
+
29
+ ```javascript
30
+ const native = require('@ebowwa/coder-native');
31
+
32
+ // Search files
33
+ const results = native.searchFiles('pattern', '/path/to/search');
34
+
35
+ // Count tokens
36
+ const tokens = native.countTokens('some text content');
37
+
38
+ // Compute diff
39
+ const diff = native.computeDiff(oldText, newText);
40
+ ```
41
+
42
+ ## Building from Source
43
+
44
+ Requires Rust and Cargo:
45
+
46
+ ```bash
47
+ cd rust
48
+ cargo build --release
49
+ ```
50
+
51
+ ## License
52
+
53
+ MIT
File without changes
@@ -0,0 +1,43 @@
1
+ // Native module loader for claude-code-native
2
+ // Loads the appropriate .node file based on platform
3
+
4
+ const { platform, arch } = process;
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ // List all .node files in the native directory
9
+ const nativeDir = __dirname;
10
+ const nodeFiles = fs.readdirSync(nativeDir).filter(f => f.endsWith('.node'));
11
+
12
+ // Find the matching file for current platform
13
+ let nativeBinding = null;
14
+
15
+ // Try to find a file matching our platform
16
+ for (const file of nodeFiles) {
17
+ // Check for darwin-arm64
18
+ if (platform === 'darwin' && arch === 'arm64' && file.includes('darwin') && file.includes('arm64')) {
19
+ nativeBinding = require(path.join(nativeDir, file));
20
+ break;
21
+ }
22
+ // Check for darwin-x64
23
+ if (platform === 'darwin' && arch === 'x64' && file.includes('darwin') && (file.includes('x64') && !file.includes('arm64'))) {
24
+ nativeBinding = require(path.join(nativeDir, file));
25
+ break;
26
+ }
27
+ // Check for linux-x64
28
+ if (platform === 'linux' && arch === 'x64' && file.includes('linux') && file.includes('x64')) {
29
+ nativeBinding = require(path.join(nativeDir, file));
30
+ break;
31
+ }
32
+ // Check for win32-x64
33
+ if (platform === 'win32' && arch === 'x64' && file.includes('win32') && file.includes('x64')) {
34
+ nativeBinding = require(path.join(nativeDir, file));
35
+ break;
36
+ }
37
+ }
38
+
39
+ if (!nativeBinding) {
40
+ throw new Error(`Unsupported platform: ${platform}-${arch}. Available files: ${nodeFiles.join(', ')}`);
41
+ }
42
+
43
+ module.exports = nativeBinding;
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@ebowwa/coder-native",
3
+ "version": "0.2.1",
4
+ "description": "Native Rust modules for @ebowwa/coder - provides high-performance search, token counting, and diff operations",
5
+ "author": "ebowwa",
6
+ "license": "MIT",
7
+ "keywords": ["coder", "native", "rust", "napi", "search", "tokens"],
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ebowwa/coder"
11
+ },
12
+ "main": "index.js",
13
+ "types": "index.d.ts",
14
+ "files": [
15
+ "*.node",
16
+ "index.js",
17
+ "index.d.ts"
18
+ ],
19
+ "napi": {
20
+ "name": "coder_native",
21
+ "triples": {
22
+ "defaults": false,
23
+ "additional": [
24
+ "x86_64-apple-darwin",
25
+ "aarch64-apple-darwin",
26
+ "x86_64-unknown-linux-gnu",
27
+ "x86_64-pc-windows-msvc"
28
+ ]
29
+ }
30
+ },
31
+ "engines": {
32
+ "node": ">= 16"
33
+ }
34
+ }
@@ -0,0 +1,53 @@
1
+ # @ebowwa/coder-native
2
+
3
+ Native Rust modules for [@ebowwa/coder](https://github.com/ebowwa/coder).
4
+
5
+ ## Features
6
+
7
+ - **Fast Search**: Ripgrep-based file and content search
8
+ - **Token Counting**: Efficient token counting for LLM contexts
9
+ - **Diff Calculation**: Fast diff generation and application
10
+ - **Content Compaction**: Smart content compaction for context windows
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ bun add @ebowwa/coder-native
16
+ # or
17
+ npm install @ebowwa/coder-native
18
+ ```
19
+
20
+ ## Supported Platforms
21
+
22
+ - macOS x64 (Intel)
23
+ - macOS arm64 (Apple Silicon)
24
+ - Linux x64 (GNU)
25
+ - Windows x64 (MSVC)
26
+
27
+ ## Usage
28
+
29
+ ```javascript
30
+ const native = require('@ebowwa/coder-native');
31
+
32
+ // Search files
33
+ const results = native.searchFiles('pattern', '/path/to/search');
34
+
35
+ // Count tokens
36
+ const tokens = native.countTokens('some text content');
37
+
38
+ // Compute diff
39
+ const diff = native.computeDiff(oldText, newText);
40
+ ```
41
+
42
+ ## Building from Source
43
+
44
+ Requires Rust and Cargo:
45
+
46
+ ```bash
47
+ cd rust
48
+ cargo build --release
49
+ ```
50
+
51
+ ## License
52
+
53
+ MIT
@@ -1,480 +0,0 @@
1
- /**
2
- * Native module loader
3
- * Loads Rust-compiled native modules for performance-critical operations
4
- */
5
- export interface HighlightResult {
6
- /** ANSI-colored text (for terminal display) */
7
- html: string;
8
- /** Theme used for highlighting */
9
- theme: string;
10
- }
11
- export interface HighlightDiffResult {
12
- /** ANSI-colored diff output */
13
- output: string;
14
- /** Number of added lines */
15
- additions: number;
16
- /** Number of deleted lines */
17
- deletions: number;
18
- /** Number of hunks */
19
- hunks: number;
20
- }
21
- export interface DiffOptions {
22
- /** File path to display in header */
23
- file_path?: string;
24
- /** Number of context lines around changes (default: 3) */
25
- context_lines?: number;
26
- }
27
- /** A single edit operation for multi-file editing */
28
- export interface MultiEditEntry {
29
- /** File path to edit (absolute path) */
30
- filePath: string;
31
- /** String to find and replace */
32
- oldString: string;
33
- /** Replacement string */
34
- newString: string;
35
- /** Replace all occurrences (default: false) */
36
- replaceAll?: boolean;
37
- }
38
- /** Result of an atomic multi-file edit operation */
39
- export interface MultiEditResult {
40
- /** Whether all edits succeeded */
41
- success: boolean;
42
- /** List of files that were modified */
43
- filesModified: string[];
44
- /** Total number of string replacements made */
45
- totalReplacements: number;
46
- /** Error message if operation failed */
47
- error?: string;
48
- /** Whether changes were rolled back due to failure */
49
- rolledBack: boolean;
50
- }
51
- /** Preview result for a single file */
52
- export interface MultiEditPreviewEntry {
53
- /** File path */
54
- filePath: string;
55
- /** Number of replacements that would be made */
56
- replacementCount: number;
57
- }
58
- /** OHLCV candlestick data */
59
- export interface OHLCV {
60
- timestamp: number;
61
- open: number;
62
- high: number;
63
- low: number;
64
- close: number;
65
- volume: number;
66
- }
67
- /** AMM state for constant-product AMMs */
68
- export interface AMMState {
69
- pool_yes: number;
70
- pool_no: number;
71
- k: number;
72
- fee: number;
73
- price_yes: number;
74
- price_no: number;
75
- }
76
- /** AMM cost calculation result */
77
- export interface AMMCostResult {
78
- cost: number;
79
- avg_price: number;
80
- }
81
- /** AMM price impact result */
82
- export interface AMMPriceImpactResult {
83
- price_before: number;
84
- price_after: number;
85
- price_impact: number;
86
- slippage: number;
87
- }
88
- /** LMSR price result */
89
- export interface LMSRPriceResult {
90
- yes_price: number;
91
- no_price: number;
92
- spread: number;
93
- }
94
- /** Arbitrage detection result */
95
- export interface ArbitrageResult {
96
- has_arbitrage: boolean;
97
- yes_price: number;
98
- no_price: number;
99
- total: number;
100
- profit_per_share: number;
101
- }
102
- /** Odds conversion result */
103
- export interface OddsConversion {
104
- probability: number;
105
- decimal_odds: number;
106
- american_odds: number;
107
- }
108
- /** Value at Risk result */
109
- export interface VaRResult {
110
- var: number;
111
- cvar: number;
112
- confidence_level: number;
113
- }
114
- /** Drawdown analysis result */
115
- export interface DrawdownResult {
116
- max_drawdown: number;
117
- max_duration: number;
118
- current_drawdown: number;
119
- recovery_factor: number;
120
- }
121
- /** Sharpe ratio result */
122
- export interface SharpeResult {
123
- sharpe_ratio: number;
124
- annualized_sharpe: number;
125
- risk_free_rate: number;
126
- avg_return: number;
127
- std_dev: number;
128
- }
129
- /** Native key event from terminal */
130
- export interface NativeKeyEvent {
131
- /** The key code (character or special key name) */
132
- code: string;
133
- /** Whether this is a special key (arrow, function, etc.) */
134
- is_special: boolean;
135
- /** Ctrl modifier */
136
- ctrl: boolean;
137
- /** Alt/Meta modifier */
138
- alt: boolean;
139
- /** Shift modifier */
140
- shift: boolean;
141
- /** Event kind: "press", "release", "repeat" */
142
- kind: "press" | "release" | "repeat";
143
- }
144
- /** Terminal handle for raw mode input */
145
- export interface TerminalHandle {
146
- /** Enter raw terminal mode */
147
- enterRawMode(): void;
148
- /** Exit raw terminal mode */
149
- exitRawMode(): void;
150
- /** Check if in raw mode (getter) */
151
- readonly isRawMode: boolean;
152
- /** Poll for a key event (non-blocking), returns null if no event */
153
- pollEvent(timeoutMs?: number): NativeKeyEvent | null;
154
- /** Read next key event (blocking, async) */
155
- readEvent(): Promise<NativeKeyEvent>;
156
- }
157
- /** Message for display in the native TUI */
158
- export interface TuiMessage {
159
- id: string;
160
- role: "user" | "assistant" | "system";
161
- content: string;
162
- timestamp?: number;
163
- subType?: string;
164
- toolName?: string;
165
- isError?: boolean;
166
- }
167
- /** TUI state for rendering */
168
- export interface TuiState {
169
- messages: TuiMessage[];
170
- inputValue: string;
171
- cursorPos: number;
172
- isLoading: boolean;
173
- spinnerFrame: number;
174
- model: string;
175
- tokensUsed: number;
176
- permissionMode: string;
177
- streamingText: string;
178
- scrollOffset: number;
179
- contextWarning?: string;
180
- }
181
- /** Result of handling input in native TUI */
182
- export interface InputResult {
183
- submitted: boolean;
184
- text?: string;
185
- exitRequested: boolean;
186
- command?: string;
187
- scrollUp: boolean;
188
- scrollDown: boolean;
189
- inputValue: string;
190
- cursorPos: number;
191
- historyNavigated: boolean;
192
- historyDirection: number;
193
- }
194
- /** Native TUI handle from Rust */
195
- export interface NativeTuiHandle {
196
- init(): void;
197
- cleanup(): void;
198
- render(state: TuiState): void;
199
- pollInput(state: TuiState, timeoutMs?: number): InputResult;
200
- addToHistory(input: string): void;
201
- }
202
- export interface NativeModule {
203
- /** Syntax highlight code with ANSI escape codes */
204
- highlight_code: (code: string, language: string) => HighlightResult;
205
- /** Highlight markdown with nested code block syntax highlighting */
206
- highlight_markdown: (markdown: string) => HighlightResult;
207
- /** Highlight a diff with ANSI colors */
208
- highlight_diff: (oldText: string, newText: string, options?: DiffOptions) => HighlightDiffResult;
209
- search_files: (pattern: string, path: string, options: {
210
- case_insensitive?: boolean;
211
- hidden?: boolean;
212
- glob?: string;
213
- max_results?: number;
214
- }) => {
215
- matches: Array<{
216
- file_path: string;
217
- line_number: number;
218
- column: number;
219
- line_content: string;
220
- match_text: string;
221
- }>;
222
- total_count: number;
223
- files_searched: number;
224
- };
225
- count_tokens: (text: string) => number;
226
- calculate_diff: (oldText: string, newText: string) => Array<{
227
- oldStart: number;
228
- oldLines: number;
229
- newStart: number;
230
- newLines: number;
231
- content: string;
232
- }>;
233
- compact_content: (content: string, maxTokens: number, strategy?: "truncate" | "summarize" | "extract") => string;
234
- count_tool_use: (messages: Array<{
235
- role: string;
236
- tool_use?: Array<{
237
- name: string;
238
- input?: any;
239
- }>;
240
- tool_result?: Array<any>;
241
- }>) => Record<string, number>;
242
- find_tool_pairs: (messages: Array<{
243
- role: string;
244
- tool_use?: Array<{
245
- name: string;
246
- input?: any;
247
- }>;
248
- tool_result?: Array<any>;
249
- }>, window_size: number) => Record<string, Record<string, number>>;
250
- find_common_patterns: (messages: Array<{
251
- role: string;
252
- tool_use?: Array<{
253
- name: string;
254
- input?: any;
255
- }>;
256
- tool_result?: Array<any>;
257
- }>) => Array<{
258
- tools: [string, string];
259
- count: number;
260
- percentage: number;
261
- }>;
262
- /** Validate multi-file edits without applying them */
263
- validate_multi_edits: (edits: MultiEditEntry[]) => string[];
264
- /** Preview what edits would be applied without making changes */
265
- preview_multi_edits: (edits: MultiEditEntry[]) => MultiEditPreviewEntry[];
266
- /** Apply multiple file edits atomically with rollback on failure */
267
- apply_multi_edits: (edits: MultiEditEntry[]) => MultiEditResult;
268
- /** Get library version */
269
- quant_version: () => string;
270
- quant_ohlcv_new: (timestamp: bigint, open: number, high: number, low: number, close: number, volume: number) => string;
271
- quant_amm_new: (poolYes: number, poolNo: number, fee: number) => string;
272
- quant_amm_calculate_cost: (poolYes: number, poolNo: number, buyYes: boolean, shares: number) => string;
273
- quant_amm_price_impact: (poolYes: number, poolNo: number, buyYes: boolean, shares: number) => string;
274
- quant_lmsr_price: (yesShares: number, noShares: number, b: number) => string;
275
- quant_lmsr_cost: (yesShares: number, noShares: number, b: number, buyYes: boolean, shares: number) => string;
276
- quant_detect_arbitrage: (yesPrice: number, noPrice: number) => string;
277
- quant_convert_odds: (value: number, fromType: number) => string;
278
- quant_mean: (data: Float64Array) => number;
279
- quant_std_dev: (data: Float64Array) => number;
280
- quant_variance: (data: Float64Array) => number;
281
- quant_correlation: (x: Float64Array, y: Float64Array) => number;
282
- /** Classify an operation into an action type */
283
- classify_operation: (operation: string, domain: string, target?: string | null, reasoning?: string | null) => any;
284
- /** Get all supported action types */
285
- get_action_types: () => string[];
286
- /** Get risk levels for all action types */
287
- get_action_risk_levels: () => Array<{
288
- actionType: string;
289
- riskLevel: number;
290
- }>;
291
- /** Create a deny-all policy */
292
- create_deny_all_policy: () => any;
293
- /** Create an observe-only policy */
294
- create_observe_only_policy: () => any;
295
- /** Create a transfer approval policy */
296
- create_transfer_approval_policy: () => any;
297
- /** Generate a new Ed25519 keypair for signing intents */
298
- cs_generate_keypair: () => {
299
- privateKey: string;
300
- publicKey: string;
301
- };
302
- /** Sign an agent intent with a private key */
303
- cs_sign_intent: (intent: any, privateKey: string) => any;
304
- /** Verify an intent's signature */
305
- cs_verify_intent: (intent: any) => any;
306
- /** Hash an intent for comparison */
307
- cs_hash_intent: (intent: any) => string;
308
- /** Check if two intents are equivalent */
309
- cs_intents_equivalent: (intent1: any, intent2: any) => boolean;
310
- /** Score how well an action aligns with an intent */
311
- cs_score_alignment: (action: any, intent: any) => any;
312
- /** Batch score multiple actions against an intent */
313
- cs_batch_score_alignment: (actions: any[], intent: any) => any[];
314
- /** Check if any action in a sequence would violate intent */
315
- cs_check_sequence_violations: (actions: any[], intent: any) => number[];
316
- /** Load intent from a JSON file */
317
- cs_load_intent: (path: string) => any;
318
- /** Save intent to a JSON file */
319
- cs_save_intent: (intent: any, path: string) => void;
320
- /** Parse intent from JSON string */
321
- cs_parse_intent: (json: string) => any;
322
- /** Serialize intent to JSON string */
323
- cs_serialize_intent: (intent: any) => string;
324
- /** Validate intent structure */
325
- cs_validate_intent: (intent: any) => any;
326
- /** Create a default data collector intent */
327
- cs_create_data_collector_intent: (name: string, description: string) => any;
328
- /** Merge two intents (child overrides parent) */
329
- cs_merge_intents: (base: any, override: any) => any;
330
- /** Analyze behavior for signs of intent corruption */
331
- cs_analyze_corruption: (snapshot: any, intent: any) => any;
332
- /** Detect behavioral drift between two snapshots */
333
- cs_detect_drift: (baseline: any, current: any) => any;
334
- /** Create an empty behavior snapshot */
335
- cs_create_empty_snapshot: () => any;
336
- /** Update a snapshot with a new action result */
337
- cs_update_snapshot: (snapshot: any, action: any, alignment: any) => any;
338
- /** Classify data based on content and source */
339
- classify_data: (content: string, source: string, tags: string[]) => any;
340
- /** Check if content contains sensitive data */
341
- contains_sensitive_data: (content: string) => boolean;
342
- /** Redact sensitive content */
343
- redact_sensitive: (content: string, replacement?: string | null) => string;
344
- /** Get sensitivity levels */
345
- get_sensitivity_levels: () => Array<{
346
- name: string;
347
- value: number;
348
- description: string;
349
- }>;
350
- /** Get data categories */
351
- get_data_categories: () => Array<{
352
- name: string;
353
- description: string;
354
- }>;
355
- /** Create a flow policy engine */
356
- create_flow_policy_engine: () => any;
357
- /** Create an allow-all flow policy */
358
- create_allow_all_flow_policy: () => any;
359
- /** Create a deny-all flow policy */
360
- create_deny_all_flow_policy: () => any;
361
- /** Create a strict flow policy */
362
- create_strict_flow_policy: () => any;
363
- /** Create a flow tracker */
364
- create_flow_tracker: () => any;
365
- /** Create a leak prevention engine */
366
- create_leak_prevention: () => any;
367
- /** Check content for leaks */
368
- check_for_leaks: (content: string, channel: string) => any;
369
- /** Sanitize content */
370
- sanitize_content: (content: string) => string;
371
- /** Create a taint tracker */
372
- create_taint_tracker: () => any;
373
- /** Create a terminal handle for raw mode input */
374
- create_terminal: () => TerminalHandle;
375
- /** Create a native TUI handle */
376
- create_tui: () => NativeTuiHandle;
377
- /** Check if native TUI is available */
378
- is_native_tui_available: () => boolean;
379
- }
380
- /**
381
- * Load the native module
382
- */
383
- export declare function loadNative(): NativeModule;
384
- /**
385
- * Check if native module is available
386
- */
387
- export declare function isNativeAvailable(): boolean;
388
- export declare const native: NativeModule;
389
- /**
390
- * Syntax highlight code with ANSI escape codes for terminal display
391
- * Uses native Rust module if available, falls back to JS implementation
392
- */
393
- export declare function highlight_code(code: string, language: string): HighlightResult;
394
- /**
395
- * Highlight markdown with nested code block syntax highlighting
396
- * Parses markdown for code fences and highlights code blocks with their language
397
- */
398
- export declare function highlight_markdown(markdown: string): HighlightResult;
399
- /**
400
- * List all supported languages for syntax highlighting
401
- */
402
- export declare function list_highlight_languages(): string[];
403
- /**
404
- * Highlight a diff with ANSI colors
405
- * Uses native Rust module if available, falls back to JS implementation
406
- */
407
- export declare function highlight_diff(oldText: string, newText: string, options?: DiffOptions): HighlightDiffResult;
408
- /**
409
- * Calculate diff hunks with hunk headers for LLM context
410
- * Returns structured diff with @@ headers included in content
411
- */
412
- export declare function calculate_diff(oldText: string, newText: string): Array<{
413
- oldStart: number;
414
- oldLines: number;
415
- newStart: number;
416
- newLines: number;
417
- content: string;
418
- }>;
419
- /**
420
- * Validate multi-file edits without applying them
421
- * Returns an array of error messages (empty if valid)
422
- */
423
- export declare function validate_multi_edits(edits: MultiEditEntry[]): string[];
424
- /**
425
- * Preview what edits would be applied without making changes
426
- * Returns an array of { file_path, replacement_count } for each file
427
- */
428
- export declare function preview_multi_edits(edits: MultiEditEntry[]): MultiEditPreviewEntry[];
429
- /**
430
- * Apply multiple file edits atomically with rollback on failure
431
- *
432
- * This function:
433
- * 1. Validates all edits can be applied (files exist, strings found)
434
- * 2. Creates backups of all affected files
435
- * 3. Applies all edits
436
- * 4. Rolls back on any failure
437
- *
438
- * @param edits Array of edit operations
439
- * @returns Result with success status and list of modified files
440
- */
441
- export declare function apply_multi_edits(edits: MultiEditEntry[]): MultiEditResult;
442
- /**
443
- * Quant module interface for financial calculations
444
- * Loads from @ebowwa/quant-rust native library
445
- */
446
- interface QuantModule {
447
- quant_version: () => string;
448
- quant_last_error: () => string;
449
- quant_clear_error: () => void;
450
- quant_ohlcv_new: (timestamp: bigint, open: number, high: number, low: number, close: number, volume: number) => string;
451
- quant_amm_new: (poolYes: number, poolNo: number, fee: number) => string;
452
- quant_amm_calculate_cost: (poolYes: number, poolNo: number, buyYes: boolean, shares: number) => string;
453
- quant_amm_price_impact: (poolYes: number, poolNo: number, buyYes: boolean, shares: number) => string;
454
- quant_lmsr_price: (yesShares: number, noShares: number, b: number) => string;
455
- quant_lmsr_cost: (yesShares: number, noShares: number, b: number, buyYes: boolean, shares: number) => string;
456
- quant_detect_arbitrage: (yesPrice: number, noPrice: number) => string;
457
- quant_convert_odds: (value: number, fromType: number) => string;
458
- quant_mean: (ptr: number, len: number) => number;
459
- quant_std_dev: (ptr: number, len: number) => number;
460
- quant_variance: (ptr: number, len: number) => number;
461
- quant_correlation: (ptrX: number, ptrY: number, len: number) => number;
462
- quant_free_string: (ptr: number) => void;
463
- }
464
- export declare const quant: QuantModule | null;
465
- export declare function quantVersion(): string;
466
- export declare function isQuantAvailable(): boolean;
467
- export declare function createOHLCV(timestamp: number, open: number, high: number, low: number, close: number, volume: number): OHLCV;
468
- export declare function createAMM(poolYes: number, poolNo: number, fee: number): AMMState;
469
- export declare function ammCalculateCost(poolYes: number, poolNo: number, outcome: "yes" | "no" | boolean, shares: number): number;
470
- export declare function ammPriceImpact(poolYes: number, poolNo: number, outcome: "yes" | "no" | boolean, shares: number): AMMPriceImpactResult;
471
- export declare function lmsrPrice(yesShares: number, noShares: number, b: number): LMSRPriceResult;
472
- export declare function lmsrCost(yesShares: number, noShares: number, b: number, outcome: "yes" | "no" | boolean, shares: number): AMMCostResult;
473
- export declare function detectArbitrage(yesPrice: number, noPrice: number): ArbitrageResult;
474
- export declare function convertOdds(value: number, fromType: "probability" | "decimal" | "american"): OddsConversion;
475
- export declare function quantMean(data: number[]): number;
476
- export declare function quantStdDev(data: number[]): number;
477
- export declare function quantVariance(data: number[]): number;
478
- export declare function quantCorrelation(x: number[], y: number[]): number;
479
- export {};
480
- //# sourceMappingURL=index.d.ts.map