@codex-native/sdk 0.0.22 → 0.0.24

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/dist/index.d.mts CHANGED
@@ -284,6 +284,79 @@ type TurnOptions = {
284
284
  modelProvider?: string;
285
285
  };
286
286
 
287
+ type NativeUserInputItem = {
288
+ type: "text";
289
+ text: string;
290
+ } | {
291
+ type: "local_image";
292
+ path: string;
293
+ } | {
294
+ type: "skill_inline";
295
+ name: string;
296
+ contents: string;
297
+ };
298
+ type NativeRunRequest = {
299
+ prompt: string;
300
+ threadId?: string;
301
+ inputItems?: NativeUserInputItem[];
302
+ images?: string[];
303
+ model?: string;
304
+ modelProvider?: string;
305
+ oss?: boolean;
306
+ sandboxMode?: SandboxMode;
307
+ approvalMode?: ApprovalMode;
308
+ workspaceWriteOptions?: WorkspaceWriteOptions;
309
+ workingDirectory?: string;
310
+ skipGitRepoCheck?: boolean;
311
+ outputSchema?: unknown;
312
+ baseUrl?: string;
313
+ apiKey?: string;
314
+ linuxSandboxPath?: string;
315
+ reasoningEffort?: ReasoningEffort;
316
+ reasoningSummary?: ReasoningSummary;
317
+ /** @deprecated Use sandboxMode and approvalMode instead */
318
+ fullAuto?: boolean;
319
+ reviewMode?: boolean;
320
+ reviewHint?: string;
321
+ };
322
+ type NativeForkRequest = {
323
+ threadId: string;
324
+ nthUserMessage: number;
325
+ model?: string;
326
+ modelProvider?: string;
327
+ oss?: boolean;
328
+ sandboxMode?: SandboxMode;
329
+ approvalMode?: ApprovalMode;
330
+ workspaceWriteOptions?: WorkspaceWriteOptions;
331
+ workingDirectory?: string;
332
+ skipGitRepoCheck?: boolean;
333
+ baseUrl?: string;
334
+ apiKey?: string;
335
+ linuxSandboxPath?: string;
336
+ fullAuto?: boolean;
337
+ };
338
+ type NativeConversationConfig = {
339
+ model?: string;
340
+ modelProvider?: string;
341
+ oss?: boolean;
342
+ sandboxMode?: SandboxMode;
343
+ approvalMode?: ApprovalMode;
344
+ workspaceWriteOptions?: WorkspaceWriteOptions;
345
+ workingDirectory?: string;
346
+ skipGitRepoCheck?: boolean;
347
+ baseUrl?: string;
348
+ apiKey?: string;
349
+ linuxSandboxPath?: string;
350
+ reasoningEffort?: ReasoningEffort;
351
+ reasoningSummary?: ReasoningSummary;
352
+ fullAuto?: boolean;
353
+ };
354
+ type NativeConversationListRequest = {
355
+ config?: NativeConversationConfig;
356
+ pageSize?: number;
357
+ cursor?: string;
358
+ modelProviders?: string[];
359
+ };
287
360
  type NativeConversationSummary = {
288
361
  id: string;
289
362
  path: string;
@@ -296,6 +369,17 @@ type NativeConversationListPage = {
296
369
  numScannedFiles: number;
297
370
  reachedScanCap: boolean;
298
371
  };
372
+ type NativeDeleteConversationRequest = {
373
+ id: string;
374
+ config?: NativeConversationConfig;
375
+ };
376
+ type NativeDeleteConversationResult = {
377
+ deleted: boolean;
378
+ };
379
+ type NativeResumeFromRolloutRequest = {
380
+ rolloutPath: string;
381
+ config?: NativeConversationConfig;
382
+ };
299
383
  type NativeTuiRequest = {
300
384
  prompt?: string;
301
385
  images?: string[];
@@ -320,6 +404,47 @@ type NativeTuiRequest = {
320
404
  reasoningEffort?: ReasoningEffort;
321
405
  reasoningSummary?: ReasoningSummary;
322
406
  };
407
+ type PlanStatus = "pending" | "in_progress" | "completed";
408
+ type NativeEmitBackgroundEventRequest = {
409
+ threadId: string;
410
+ message: string;
411
+ };
412
+ type NativeEmitPlanUpdateRequest = {
413
+ threadId: string;
414
+ explanation?: string;
415
+ plan: Array<{
416
+ step: string;
417
+ status: PlanStatus;
418
+ }>;
419
+ };
420
+ type NativeModifyPlanRequest = {
421
+ threadId: string;
422
+ operations: PlanOperation[];
423
+ };
424
+ type PlanOperation = {
425
+ type: "add";
426
+ item: {
427
+ step: string;
428
+ status?: PlanStatus;
429
+ };
430
+ } | {
431
+ type: "update";
432
+ index: number;
433
+ updates: {
434
+ step?: string;
435
+ status?: PlanStatus;
436
+ };
437
+ } | {
438
+ type: "remove";
439
+ index: number;
440
+ } | {
441
+ type: "reorder";
442
+ newOrder: number[];
443
+ };
444
+ type NativeToolInterceptorNativeContext = {
445
+ invocation: NativeToolInvocation;
446
+ token: string;
447
+ };
323
448
  type NativeTokenUsage = {
324
449
  inputTokens: number;
325
450
  cachedInputTokens: number;
@@ -337,6 +462,11 @@ type NativeTuiExitInfo = {
337
462
  conversationId?: string;
338
463
  updateAction?: NativeUpdateActionInfo;
339
464
  };
465
+ type NativeTuiSession = {
466
+ wait(): Promise<NativeTuiExitInfo>;
467
+ shutdown(): void;
468
+ readonly closed: boolean;
469
+ };
340
470
  type RepoDiffFileChange = {
341
471
  path: string;
342
472
  status: string;
@@ -420,6 +550,62 @@ type TokenizerOptions = {
420
550
  type TokenizerEncodeOptions = TokenizerOptions & {
421
551
  withSpecialTokens?: boolean;
422
552
  };
553
+ type NativeBinding = {
554
+ runThread(request: NativeRunRequest): Promise<string[]>;
555
+ runThreadStream(request: NativeRunRequest, onEvent: (err: unknown, eventJson?: string) => void): Promise<void>;
556
+ compactThread(request: NativeRunRequest): Promise<string[]>;
557
+ forkThread(request: NativeForkRequest): Promise<NativeForkResult>;
558
+ listConversations(request: NativeConversationListRequest): Promise<NativeConversationListPage>;
559
+ deleteConversation(request: NativeDeleteConversationRequest): Promise<NativeDeleteConversationResult>;
560
+ resumeConversationFromRollout(request: NativeResumeFromRolloutRequest): Promise<NativeForkResult>;
561
+ runTui(request: NativeTuiRequest): Promise<NativeTuiExitInfo>;
562
+ tuiTestRun?(request: {
563
+ width: number;
564
+ height: number;
565
+ viewport: {
566
+ x: number;
567
+ y: number;
568
+ width: number;
569
+ height: number;
570
+ };
571
+ lines: string[];
572
+ }): Promise<string[]>;
573
+ callToolBuiltin(token: string, invocation?: NativeToolInvocation): Promise<NativeToolResult>;
574
+ callRegisteredToolForTest?(toolName: string, invocation: NativeToolInvocation): Promise<NativeToolResult>;
575
+ clearRegisteredTools(): void;
576
+ registerTool(info: NativeToolInfo, handler: (call: NativeToolInvocation) => Promise<NativeToolResult> | NativeToolResult): void;
577
+ registerToolInterceptor(toolName: string, handler: (context: NativeToolInterceptorNativeContext) => Promise<NativeToolResult> | NativeToolResult): void;
578
+ listRegisteredTools(): NativeToolInfo[];
579
+ registerApprovalCallback?(handler: (request: ApprovalRequest) => boolean | Promise<boolean>): void;
580
+ emitBackgroundEvent(request: NativeEmitBackgroundEventRequest): Promise<void>;
581
+ emitPlanUpdate(request: NativeEmitPlanUpdateRequest): Promise<void>;
582
+ modifyPlan(request: NativeModifyPlanRequest): Promise<void>;
583
+ startTui?(request: NativeTuiRequest): NativeTuiSession;
584
+ ev_completed(id: string): string;
585
+ ev_response_created(id: string): string;
586
+ ev_assistant_message(id: string, text: string): string;
587
+ ev_function_call(callId: string, name: string, args: string): string;
588
+ sse(events: string[]): string;
589
+ ensureTokioRuntime?: () => void;
590
+ isTokioRuntimeAvailable?: () => boolean;
591
+ cloudTasksList?(env?: string, baseUrl?: string, apiKey?: string): Promise<string>;
592
+ cloudTasksGetDiff?(taskId: string, baseUrl?: string, apiKey?: string): Promise<string>;
593
+ cloudTasksApplyPreflight?(taskId: string, diffOverride?: string, baseUrl?: string, apiKey?: string): Promise<string>;
594
+ cloudTasksApply?(taskId: string, diffOverride?: string, baseUrl?: string, apiKey?: string): Promise<string>;
595
+ cloudTasksCreate?(envId: string, prompt: string, gitRef?: string, qaMode?: boolean, bestOfN?: number, baseUrl?: string, apiKey?: string): Promise<string>;
596
+ reverieListConversations(codexHomePath: string, limit?: number, offset?: number): Promise<ReverieConversation[]>;
597
+ reverieSearchConversations(codexHomePath: string, query: string, limit?: number): Promise<ReverieSearchResult[]>;
598
+ reverieSearchSemantic?(codexHomePath: string, context: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSearchResult[]>;
599
+ reverieIndexSemantic?(codexHomePath: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSemanticIndexStats>;
600
+ reverieGetConversationInsights(conversationPath: string, query?: string): Promise<string[]>;
601
+ toonEncode(value: unknown): string;
602
+ fastEmbedInit?(options: FastEmbedInitOptions): Promise<void>;
603
+ fastEmbedEmbed?(request: FastEmbedEmbedRequest): Promise<number[][]>;
604
+ tokenizerCount(text: string, options?: TokenizerOptions): number;
605
+ tokenizerEncode(text: string, options?: TokenizerEncodeOptions): number[];
606
+ tokenizerDecode(tokens: number[], options?: TokenizerOptions): string;
607
+ collectRepoDiffSummary?(cwd: string, baseBranchOverride?: string, options?: NativeRepoDiffOptions): Promise<RepoDiffSummary>;
608
+ };
423
609
  type NativeToolInfo = {
424
610
  name: string;
425
611
  description?: string;
@@ -447,6 +633,12 @@ type ApprovalRequest = {
447
633
  details?: unknown;
448
634
  context?: string;
449
635
  };
636
+ type NativeRepoDiffOptions = {
637
+ maxFiles?: number;
638
+ diffContextLines?: number;
639
+ diffCharLimit?: number;
640
+ };
641
+ declare function getNativeBinding(): NativeBinding | null;
450
642
  declare function reverieListConversations(codexHomePath: string, limit?: number, offset?: number): Promise<ReverieConversation[]>;
451
643
  declare function reverieSearchConversations(codexHomePath: string, query: string, limit?: number): Promise<ReverieSearchResult[]>;
452
644
  declare function reverieSearchSemantic(codexHomePath: string, context: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSearchResult[]>;
@@ -2306,4 +2498,4 @@ declare function evAssistantMessage(id: string, text: string): string;
2306
2498
  declare function evFunctionCall(callId: string, name: string, args: string): string;
2307
2499
  declare function sse(events: string[]): string;
2308
2500
 
2309
- export { type AgentMessageItem, type AgentRunner, type ApprovalMode, type ApprovalRequest, type BranchLevelContext, type BranchReview, type CloudApplyOutcome, type CloudApplyStatus, type DiffSummary as CloudDiffSummary, type CloudTaskStatus, type CloudTaskSummary, CloudTasks, type CloudTasksOptions, Codex, type CodexOptions, CodexProvider, type CodexProviderOptions, type CodexToolOptions, type CommandExecutionItem, type CommandExecutionStatus, type CommitReview, type ConversationListOptions, type ConversationListPage, type ConversationSummary, type CurrentChangesReview, type CustomReview, DEFAULT_RERANKER_BATCH_SIZE, DEFAULT_RERANKER_TOP_K, DEFAULT_REVERIE_LIMIT, DEFAULT_REVERIE_MAX_CANDIDATES, DEFAULT_SERVERS, type DelegationResult, type DiagnosticSeverity, type ErrorItem, type FastEmbedEmbedRequest, type FastEmbedInitOptions, type FastEmbedRerankerModelCode, type FileChangeItem, type FileDiagnostics, type FileLevelContext, type FileUpdateChange, type ForkOptions, type FormatStreamOptions, type FormattedStream, type GradingOptions, type Input, type ItemCompletedEvent, type ItemStartedEvent, type ItemUpdatedEvent, type LogEntry, LogLevel, type LogOutput, type LogScope, Logger, type LoggerConfig, type LspDiagnosticSeverity, LspDiagnosticsBridge, LspManager, type LspManagerOptions, type LspServerConfig, type McpToolCallItem, type McpToolCallStatus, type NativeForkResult, type NativeTokenUsage, type NativeToolDefinition, type NativeToolInterceptorContext, type NativeToolInvocation, type NativeToolResult, type NativeTuiExitInfo, type NativeTuiRequest, type NativeUpdateActionInfo, type NativeUpdateActionKind, type NormalizedDiagnostic, OpenCodeAgent, type OpenCodeAgentOptions, type PatchApplyStatus, type PatchChangeKind, type PermissionDecision, type PermissionRequest, type ProjectLevelContext, type QualityFilterStats, REVERIE_CANDIDATE_MULTIPLIER, REVERIE_EMBED_MODEL, REVERIE_LLM_GRADE_THRESHOLD, REVERIE_RERANKER_MODEL, type ReasoningItem, type RepoDiffFileChange, type RepoDiffSummary, type RepoDiffSummaryOptions, type ReverieContext, type ReverieEpisodeSummary, type ReverieFilterStats, type ReverieInsight$1 as ReverieInsight, type ReveriePipelineOptions, type ReveriePipelineResult, type ReverieResult, type ReverieSearchLevel, type ReverieSearchOptions, type ReverieSemanticIndexStats, type ReverieSemanticSearchOptions, type ReviewInvocationOptions, type ReviewTarget, type RunResult, type RunStreamedResult, type RunTuiOptions, type SandboxMode, ScopedLogger, type SkillDefinition, type SkillMentionTrigger, Thread, type ThreadError, type ThreadErrorEvent, type ThreadEvent, type ThreadItem, type ThreadLoggingSink, type ThreadOptions, type ThreadStartedEvent, type TodoItem, type TodoListItem, type TokenizerEncodeOptions, type TokenizerOptions, type ToolCallEvent, type ToolExecutionContext, type ToolExecutor, type ToolExecutorResult, type TuiSession, type TurnCompletedEvent, type TurnFailedEvent, type TurnOptions, type TurnStartedEvent, type Usage, type UserInput, type WebSearchItem, type WorkspaceLocator, applyFileReveriePipeline, applyQualityPipeline, applyReveriePipeline, attachLspDiagnostics, buildBranchContext, buildFileContext, buildProjectContext, clearCodexToolExecutors, codexTool, collectRepoDiffSummary, contextToQuery, createThreadLogger, deduplicateReverieInsights, encodeToToon, evAssistantMessage, evCompleted, evFunctionCall, evResponseCreated, extractKeySymbols, fastEmbedEmbed, fastEmbedInit, filterBySeverity, findServerForFile, formatDiagnosticsForBackgroundEvent, formatDiagnosticsForTool, formatDiagnosticsWithSummary, formatFileList, formatStream, getCodexToolExecutor, gradeReverieRelevance, gradeReveriesInParallel, isValidReverieExcerpt, logApprovedReveries, logLLMGrading, logLevelResults, logMultiLevelSearch, logMultiLevelSummary, logReverieFiltering, logReverieHintQuality, logReverieInsights, logReverieSearch, logger, registerCodexToolExecutor, resolveWorkspaceRoot, reverieGetConversationInsights, reverieIndexSemantic, reverieListConversations, reverieSearchConversations, reverieSearchSemantic, runThreadTurnWithLogs, runTui, searchBranchLevel, searchFileLevel, searchMultiLevel, searchProjectLevel, searchReveries, sse, startTui, summarizeDiagnostics, tokenizerCount, tokenizerDecode, tokenizerEncode, truncate as truncateText };
2501
+ export { type AgentMessageItem, type AgentRunner, type ApprovalMode, type ApprovalRequest, type BranchLevelContext, type BranchReview, type CloudApplyOutcome, type CloudApplyStatus, type DiffSummary as CloudDiffSummary, type CloudTaskStatus, type CloudTaskSummary, CloudTasks, type CloudTasksOptions, Codex, type CodexOptions, CodexProvider, type CodexProviderOptions, type CodexToolOptions, type CommandExecutionItem, type CommandExecutionStatus, type CommitReview, type ConversationListOptions, type ConversationListPage, type ConversationSummary, type CurrentChangesReview, type CustomReview, DEFAULT_RERANKER_BATCH_SIZE, DEFAULT_RERANKER_TOP_K, DEFAULT_REVERIE_LIMIT, DEFAULT_REVERIE_MAX_CANDIDATES, DEFAULT_SERVERS, type DelegationResult, type DiagnosticSeverity, type ErrorItem, type FastEmbedEmbedRequest, type FastEmbedInitOptions, type FastEmbedRerankerModelCode, type FileChangeItem, type FileDiagnostics, type FileLevelContext, type FileUpdateChange, type ForkOptions, type FormatStreamOptions, type FormattedStream, type GradingOptions, type Input, type ItemCompletedEvent, type ItemStartedEvent, type ItemUpdatedEvent, type LogEntry, LogLevel, type LogOutput, type LogScope, Logger, type LoggerConfig, type LspDiagnosticSeverity, LspDiagnosticsBridge, LspManager, type LspManagerOptions, type LspServerConfig, type McpToolCallItem, type McpToolCallStatus, type NativeForkResult, type NativeTokenUsage, type NativeToolDefinition, type NativeToolInterceptorContext, type NativeToolInvocation, type NativeToolResult, type NativeTuiExitInfo, type NativeTuiRequest, type NativeUpdateActionInfo, type NativeUpdateActionKind, type NormalizedDiagnostic, OpenCodeAgent, type OpenCodeAgentOptions, type PatchApplyStatus, type PatchChangeKind, type PermissionDecision, type PermissionRequest, type ProjectLevelContext, type QualityFilterStats, REVERIE_CANDIDATE_MULTIPLIER, REVERIE_EMBED_MODEL, REVERIE_LLM_GRADE_THRESHOLD, REVERIE_RERANKER_MODEL, type ReasoningItem, type RepoDiffFileChange, type RepoDiffSummary, type RepoDiffSummaryOptions, type ReverieContext, type ReverieEpisodeSummary, type ReverieFilterStats, type ReverieInsight$1 as ReverieInsight, type ReveriePipelineOptions, type ReveriePipelineResult, type ReverieResult, type ReverieSearchLevel, type ReverieSearchOptions, type ReverieSemanticIndexStats, type ReverieSemanticSearchOptions, type ReviewInvocationOptions, type ReviewTarget, type RunResult, type RunStreamedResult, type RunTuiOptions, type SandboxMode, ScopedLogger, type SkillDefinition, type SkillMentionTrigger, Thread, type ThreadError, type ThreadErrorEvent, type ThreadEvent, type ThreadItem, type ThreadLoggingSink, type ThreadOptions, type ThreadStartedEvent, type TodoItem, type TodoListItem, type TokenizerEncodeOptions, type TokenizerOptions, type ToolCallEvent, type ToolExecutionContext, type ToolExecutor, type ToolExecutorResult, type TuiSession, type TurnCompletedEvent, type TurnFailedEvent, type TurnOptions, type TurnStartedEvent, type Usage, type UserInput, type WebSearchItem, type WorkspaceLocator, applyFileReveriePipeline, applyQualityPipeline, applyReveriePipeline, attachLspDiagnostics, buildBranchContext, buildFileContext, buildProjectContext, clearCodexToolExecutors, codexTool, collectRepoDiffSummary, contextToQuery, createThreadLogger, deduplicateReverieInsights, encodeToToon, evAssistantMessage, evCompleted, evFunctionCall, evResponseCreated, extractKeySymbols, fastEmbedEmbed, fastEmbedInit, filterBySeverity, findServerForFile, formatDiagnosticsForBackgroundEvent, formatDiagnosticsForTool, formatDiagnosticsWithSummary, formatFileList, formatStream, getCodexToolExecutor, getNativeBinding, gradeReverieRelevance, gradeReveriesInParallel, isValidReverieExcerpt, logApprovedReveries, logLLMGrading, logLevelResults, logMultiLevelSearch, logMultiLevelSummary, logReverieFiltering, logReverieHintQuality, logReverieInsights, logReverieSearch, logger, registerCodexToolExecutor, resolveWorkspaceRoot, reverieGetConversationInsights, reverieIndexSemantic, reverieListConversations, reverieSearchConversations, reverieSearchSemantic, runThreadTurnWithLogs, runTui, searchBranchLevel, searchFileLevel, searchMultiLevel, searchProjectLevel, searchReveries, sse, startTui, summarizeDiagnostics, tokenizerCount, tokenizerDecode, tokenizerEncode, truncate as truncateText };
package/dist/index.d.ts CHANGED
@@ -284,6 +284,79 @@ type TurnOptions = {
284
284
  modelProvider?: string;
285
285
  };
286
286
 
287
+ type NativeUserInputItem = {
288
+ type: "text";
289
+ text: string;
290
+ } | {
291
+ type: "local_image";
292
+ path: string;
293
+ } | {
294
+ type: "skill_inline";
295
+ name: string;
296
+ contents: string;
297
+ };
298
+ type NativeRunRequest = {
299
+ prompt: string;
300
+ threadId?: string;
301
+ inputItems?: NativeUserInputItem[];
302
+ images?: string[];
303
+ model?: string;
304
+ modelProvider?: string;
305
+ oss?: boolean;
306
+ sandboxMode?: SandboxMode;
307
+ approvalMode?: ApprovalMode;
308
+ workspaceWriteOptions?: WorkspaceWriteOptions;
309
+ workingDirectory?: string;
310
+ skipGitRepoCheck?: boolean;
311
+ outputSchema?: unknown;
312
+ baseUrl?: string;
313
+ apiKey?: string;
314
+ linuxSandboxPath?: string;
315
+ reasoningEffort?: ReasoningEffort;
316
+ reasoningSummary?: ReasoningSummary;
317
+ /** @deprecated Use sandboxMode and approvalMode instead */
318
+ fullAuto?: boolean;
319
+ reviewMode?: boolean;
320
+ reviewHint?: string;
321
+ };
322
+ type NativeForkRequest = {
323
+ threadId: string;
324
+ nthUserMessage: number;
325
+ model?: string;
326
+ modelProvider?: string;
327
+ oss?: boolean;
328
+ sandboxMode?: SandboxMode;
329
+ approvalMode?: ApprovalMode;
330
+ workspaceWriteOptions?: WorkspaceWriteOptions;
331
+ workingDirectory?: string;
332
+ skipGitRepoCheck?: boolean;
333
+ baseUrl?: string;
334
+ apiKey?: string;
335
+ linuxSandboxPath?: string;
336
+ fullAuto?: boolean;
337
+ };
338
+ type NativeConversationConfig = {
339
+ model?: string;
340
+ modelProvider?: string;
341
+ oss?: boolean;
342
+ sandboxMode?: SandboxMode;
343
+ approvalMode?: ApprovalMode;
344
+ workspaceWriteOptions?: WorkspaceWriteOptions;
345
+ workingDirectory?: string;
346
+ skipGitRepoCheck?: boolean;
347
+ baseUrl?: string;
348
+ apiKey?: string;
349
+ linuxSandboxPath?: string;
350
+ reasoningEffort?: ReasoningEffort;
351
+ reasoningSummary?: ReasoningSummary;
352
+ fullAuto?: boolean;
353
+ };
354
+ type NativeConversationListRequest = {
355
+ config?: NativeConversationConfig;
356
+ pageSize?: number;
357
+ cursor?: string;
358
+ modelProviders?: string[];
359
+ };
287
360
  type NativeConversationSummary = {
288
361
  id: string;
289
362
  path: string;
@@ -296,6 +369,17 @@ type NativeConversationListPage = {
296
369
  numScannedFiles: number;
297
370
  reachedScanCap: boolean;
298
371
  };
372
+ type NativeDeleteConversationRequest = {
373
+ id: string;
374
+ config?: NativeConversationConfig;
375
+ };
376
+ type NativeDeleteConversationResult = {
377
+ deleted: boolean;
378
+ };
379
+ type NativeResumeFromRolloutRequest = {
380
+ rolloutPath: string;
381
+ config?: NativeConversationConfig;
382
+ };
299
383
  type NativeTuiRequest = {
300
384
  prompt?: string;
301
385
  images?: string[];
@@ -320,6 +404,47 @@ type NativeTuiRequest = {
320
404
  reasoningEffort?: ReasoningEffort;
321
405
  reasoningSummary?: ReasoningSummary;
322
406
  };
407
+ type PlanStatus = "pending" | "in_progress" | "completed";
408
+ type NativeEmitBackgroundEventRequest = {
409
+ threadId: string;
410
+ message: string;
411
+ };
412
+ type NativeEmitPlanUpdateRequest = {
413
+ threadId: string;
414
+ explanation?: string;
415
+ plan: Array<{
416
+ step: string;
417
+ status: PlanStatus;
418
+ }>;
419
+ };
420
+ type NativeModifyPlanRequest = {
421
+ threadId: string;
422
+ operations: PlanOperation[];
423
+ };
424
+ type PlanOperation = {
425
+ type: "add";
426
+ item: {
427
+ step: string;
428
+ status?: PlanStatus;
429
+ };
430
+ } | {
431
+ type: "update";
432
+ index: number;
433
+ updates: {
434
+ step?: string;
435
+ status?: PlanStatus;
436
+ };
437
+ } | {
438
+ type: "remove";
439
+ index: number;
440
+ } | {
441
+ type: "reorder";
442
+ newOrder: number[];
443
+ };
444
+ type NativeToolInterceptorNativeContext = {
445
+ invocation: NativeToolInvocation;
446
+ token: string;
447
+ };
323
448
  type NativeTokenUsage = {
324
449
  inputTokens: number;
325
450
  cachedInputTokens: number;
@@ -337,6 +462,11 @@ type NativeTuiExitInfo = {
337
462
  conversationId?: string;
338
463
  updateAction?: NativeUpdateActionInfo;
339
464
  };
465
+ type NativeTuiSession = {
466
+ wait(): Promise<NativeTuiExitInfo>;
467
+ shutdown(): void;
468
+ readonly closed: boolean;
469
+ };
340
470
  type RepoDiffFileChange = {
341
471
  path: string;
342
472
  status: string;
@@ -420,6 +550,62 @@ type TokenizerOptions = {
420
550
  type TokenizerEncodeOptions = TokenizerOptions & {
421
551
  withSpecialTokens?: boolean;
422
552
  };
553
+ type NativeBinding = {
554
+ runThread(request: NativeRunRequest): Promise<string[]>;
555
+ runThreadStream(request: NativeRunRequest, onEvent: (err: unknown, eventJson?: string) => void): Promise<void>;
556
+ compactThread(request: NativeRunRequest): Promise<string[]>;
557
+ forkThread(request: NativeForkRequest): Promise<NativeForkResult>;
558
+ listConversations(request: NativeConversationListRequest): Promise<NativeConversationListPage>;
559
+ deleteConversation(request: NativeDeleteConversationRequest): Promise<NativeDeleteConversationResult>;
560
+ resumeConversationFromRollout(request: NativeResumeFromRolloutRequest): Promise<NativeForkResult>;
561
+ runTui(request: NativeTuiRequest): Promise<NativeTuiExitInfo>;
562
+ tuiTestRun?(request: {
563
+ width: number;
564
+ height: number;
565
+ viewport: {
566
+ x: number;
567
+ y: number;
568
+ width: number;
569
+ height: number;
570
+ };
571
+ lines: string[];
572
+ }): Promise<string[]>;
573
+ callToolBuiltin(token: string, invocation?: NativeToolInvocation): Promise<NativeToolResult>;
574
+ callRegisteredToolForTest?(toolName: string, invocation: NativeToolInvocation): Promise<NativeToolResult>;
575
+ clearRegisteredTools(): void;
576
+ registerTool(info: NativeToolInfo, handler: (call: NativeToolInvocation) => Promise<NativeToolResult> | NativeToolResult): void;
577
+ registerToolInterceptor(toolName: string, handler: (context: NativeToolInterceptorNativeContext) => Promise<NativeToolResult> | NativeToolResult): void;
578
+ listRegisteredTools(): NativeToolInfo[];
579
+ registerApprovalCallback?(handler: (request: ApprovalRequest) => boolean | Promise<boolean>): void;
580
+ emitBackgroundEvent(request: NativeEmitBackgroundEventRequest): Promise<void>;
581
+ emitPlanUpdate(request: NativeEmitPlanUpdateRequest): Promise<void>;
582
+ modifyPlan(request: NativeModifyPlanRequest): Promise<void>;
583
+ startTui?(request: NativeTuiRequest): NativeTuiSession;
584
+ ev_completed(id: string): string;
585
+ ev_response_created(id: string): string;
586
+ ev_assistant_message(id: string, text: string): string;
587
+ ev_function_call(callId: string, name: string, args: string): string;
588
+ sse(events: string[]): string;
589
+ ensureTokioRuntime?: () => void;
590
+ isTokioRuntimeAvailable?: () => boolean;
591
+ cloudTasksList?(env?: string, baseUrl?: string, apiKey?: string): Promise<string>;
592
+ cloudTasksGetDiff?(taskId: string, baseUrl?: string, apiKey?: string): Promise<string>;
593
+ cloudTasksApplyPreflight?(taskId: string, diffOverride?: string, baseUrl?: string, apiKey?: string): Promise<string>;
594
+ cloudTasksApply?(taskId: string, diffOverride?: string, baseUrl?: string, apiKey?: string): Promise<string>;
595
+ cloudTasksCreate?(envId: string, prompt: string, gitRef?: string, qaMode?: boolean, bestOfN?: number, baseUrl?: string, apiKey?: string): Promise<string>;
596
+ reverieListConversations(codexHomePath: string, limit?: number, offset?: number): Promise<ReverieConversation[]>;
597
+ reverieSearchConversations(codexHomePath: string, query: string, limit?: number): Promise<ReverieSearchResult[]>;
598
+ reverieSearchSemantic?(codexHomePath: string, context: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSearchResult[]>;
599
+ reverieIndexSemantic?(codexHomePath: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSemanticIndexStats>;
600
+ reverieGetConversationInsights(conversationPath: string, query?: string): Promise<string[]>;
601
+ toonEncode(value: unknown): string;
602
+ fastEmbedInit?(options: FastEmbedInitOptions): Promise<void>;
603
+ fastEmbedEmbed?(request: FastEmbedEmbedRequest): Promise<number[][]>;
604
+ tokenizerCount(text: string, options?: TokenizerOptions): number;
605
+ tokenizerEncode(text: string, options?: TokenizerEncodeOptions): number[];
606
+ tokenizerDecode(tokens: number[], options?: TokenizerOptions): string;
607
+ collectRepoDiffSummary?(cwd: string, baseBranchOverride?: string, options?: NativeRepoDiffOptions): Promise<RepoDiffSummary>;
608
+ };
423
609
  type NativeToolInfo = {
424
610
  name: string;
425
611
  description?: string;
@@ -447,6 +633,12 @@ type ApprovalRequest = {
447
633
  details?: unknown;
448
634
  context?: string;
449
635
  };
636
+ type NativeRepoDiffOptions = {
637
+ maxFiles?: number;
638
+ diffContextLines?: number;
639
+ diffCharLimit?: number;
640
+ };
641
+ declare function getNativeBinding(): NativeBinding | null;
450
642
  declare function reverieListConversations(codexHomePath: string, limit?: number, offset?: number): Promise<ReverieConversation[]>;
451
643
  declare function reverieSearchConversations(codexHomePath: string, query: string, limit?: number): Promise<ReverieSearchResult[]>;
452
644
  declare function reverieSearchSemantic(codexHomePath: string, context: string, options?: ReverieSemanticSearchOptions): Promise<ReverieSearchResult[]>;
@@ -2306,4 +2498,4 @@ declare function evAssistantMessage(id: string, text: string): string;
2306
2498
  declare function evFunctionCall(callId: string, name: string, args: string): string;
2307
2499
  declare function sse(events: string[]): string;
2308
2500
 
2309
- export { type AgentMessageItem, type AgentRunner, type ApprovalMode, type ApprovalRequest, type BranchLevelContext, type BranchReview, type CloudApplyOutcome, type CloudApplyStatus, type DiffSummary as CloudDiffSummary, type CloudTaskStatus, type CloudTaskSummary, CloudTasks, type CloudTasksOptions, Codex, type CodexOptions, CodexProvider, type CodexProviderOptions, type CodexToolOptions, type CommandExecutionItem, type CommandExecutionStatus, type CommitReview, type ConversationListOptions, type ConversationListPage, type ConversationSummary, type CurrentChangesReview, type CustomReview, DEFAULT_RERANKER_BATCH_SIZE, DEFAULT_RERANKER_TOP_K, DEFAULT_REVERIE_LIMIT, DEFAULT_REVERIE_MAX_CANDIDATES, DEFAULT_SERVERS, type DelegationResult, type DiagnosticSeverity, type ErrorItem, type FastEmbedEmbedRequest, type FastEmbedInitOptions, type FastEmbedRerankerModelCode, type FileChangeItem, type FileDiagnostics, type FileLevelContext, type FileUpdateChange, type ForkOptions, type FormatStreamOptions, type FormattedStream, type GradingOptions, type Input, type ItemCompletedEvent, type ItemStartedEvent, type ItemUpdatedEvent, type LogEntry, LogLevel, type LogOutput, type LogScope, Logger, type LoggerConfig, type LspDiagnosticSeverity, LspDiagnosticsBridge, LspManager, type LspManagerOptions, type LspServerConfig, type McpToolCallItem, type McpToolCallStatus, type NativeForkResult, type NativeTokenUsage, type NativeToolDefinition, type NativeToolInterceptorContext, type NativeToolInvocation, type NativeToolResult, type NativeTuiExitInfo, type NativeTuiRequest, type NativeUpdateActionInfo, type NativeUpdateActionKind, type NormalizedDiagnostic, OpenCodeAgent, type OpenCodeAgentOptions, type PatchApplyStatus, type PatchChangeKind, type PermissionDecision, type PermissionRequest, type ProjectLevelContext, type QualityFilterStats, REVERIE_CANDIDATE_MULTIPLIER, REVERIE_EMBED_MODEL, REVERIE_LLM_GRADE_THRESHOLD, REVERIE_RERANKER_MODEL, type ReasoningItem, type RepoDiffFileChange, type RepoDiffSummary, type RepoDiffSummaryOptions, type ReverieContext, type ReverieEpisodeSummary, type ReverieFilterStats, type ReverieInsight$1 as ReverieInsight, type ReveriePipelineOptions, type ReveriePipelineResult, type ReverieResult, type ReverieSearchLevel, type ReverieSearchOptions, type ReverieSemanticIndexStats, type ReverieSemanticSearchOptions, type ReviewInvocationOptions, type ReviewTarget, type RunResult, type RunStreamedResult, type RunTuiOptions, type SandboxMode, ScopedLogger, type SkillDefinition, type SkillMentionTrigger, Thread, type ThreadError, type ThreadErrorEvent, type ThreadEvent, type ThreadItem, type ThreadLoggingSink, type ThreadOptions, type ThreadStartedEvent, type TodoItem, type TodoListItem, type TokenizerEncodeOptions, type TokenizerOptions, type ToolCallEvent, type ToolExecutionContext, type ToolExecutor, type ToolExecutorResult, type TuiSession, type TurnCompletedEvent, type TurnFailedEvent, type TurnOptions, type TurnStartedEvent, type Usage, type UserInput, type WebSearchItem, type WorkspaceLocator, applyFileReveriePipeline, applyQualityPipeline, applyReveriePipeline, attachLspDiagnostics, buildBranchContext, buildFileContext, buildProjectContext, clearCodexToolExecutors, codexTool, collectRepoDiffSummary, contextToQuery, createThreadLogger, deduplicateReverieInsights, encodeToToon, evAssistantMessage, evCompleted, evFunctionCall, evResponseCreated, extractKeySymbols, fastEmbedEmbed, fastEmbedInit, filterBySeverity, findServerForFile, formatDiagnosticsForBackgroundEvent, formatDiagnosticsForTool, formatDiagnosticsWithSummary, formatFileList, formatStream, getCodexToolExecutor, gradeReverieRelevance, gradeReveriesInParallel, isValidReverieExcerpt, logApprovedReveries, logLLMGrading, logLevelResults, logMultiLevelSearch, logMultiLevelSummary, logReverieFiltering, logReverieHintQuality, logReverieInsights, logReverieSearch, logger, registerCodexToolExecutor, resolveWorkspaceRoot, reverieGetConversationInsights, reverieIndexSemantic, reverieListConversations, reverieSearchConversations, reverieSearchSemantic, runThreadTurnWithLogs, runTui, searchBranchLevel, searchFileLevel, searchMultiLevel, searchProjectLevel, searchReveries, sse, startTui, summarizeDiagnostics, tokenizerCount, tokenizerDecode, tokenizerEncode, truncate as truncateText };
2501
+ export { type AgentMessageItem, type AgentRunner, type ApprovalMode, type ApprovalRequest, type BranchLevelContext, type BranchReview, type CloudApplyOutcome, type CloudApplyStatus, type DiffSummary as CloudDiffSummary, type CloudTaskStatus, type CloudTaskSummary, CloudTasks, type CloudTasksOptions, Codex, type CodexOptions, CodexProvider, type CodexProviderOptions, type CodexToolOptions, type CommandExecutionItem, type CommandExecutionStatus, type CommitReview, type ConversationListOptions, type ConversationListPage, type ConversationSummary, type CurrentChangesReview, type CustomReview, DEFAULT_RERANKER_BATCH_SIZE, DEFAULT_RERANKER_TOP_K, DEFAULT_REVERIE_LIMIT, DEFAULT_REVERIE_MAX_CANDIDATES, DEFAULT_SERVERS, type DelegationResult, type DiagnosticSeverity, type ErrorItem, type FastEmbedEmbedRequest, type FastEmbedInitOptions, type FastEmbedRerankerModelCode, type FileChangeItem, type FileDiagnostics, type FileLevelContext, type FileUpdateChange, type ForkOptions, type FormatStreamOptions, type FormattedStream, type GradingOptions, type Input, type ItemCompletedEvent, type ItemStartedEvent, type ItemUpdatedEvent, type LogEntry, LogLevel, type LogOutput, type LogScope, Logger, type LoggerConfig, type LspDiagnosticSeverity, LspDiagnosticsBridge, LspManager, type LspManagerOptions, type LspServerConfig, type McpToolCallItem, type McpToolCallStatus, type NativeForkResult, type NativeTokenUsage, type NativeToolDefinition, type NativeToolInterceptorContext, type NativeToolInvocation, type NativeToolResult, type NativeTuiExitInfo, type NativeTuiRequest, type NativeUpdateActionInfo, type NativeUpdateActionKind, type NormalizedDiagnostic, OpenCodeAgent, type OpenCodeAgentOptions, type PatchApplyStatus, type PatchChangeKind, type PermissionDecision, type PermissionRequest, type ProjectLevelContext, type QualityFilterStats, REVERIE_CANDIDATE_MULTIPLIER, REVERIE_EMBED_MODEL, REVERIE_LLM_GRADE_THRESHOLD, REVERIE_RERANKER_MODEL, type ReasoningItem, type RepoDiffFileChange, type RepoDiffSummary, type RepoDiffSummaryOptions, type ReverieContext, type ReverieEpisodeSummary, type ReverieFilterStats, type ReverieInsight$1 as ReverieInsight, type ReveriePipelineOptions, type ReveriePipelineResult, type ReverieResult, type ReverieSearchLevel, type ReverieSearchOptions, type ReverieSemanticIndexStats, type ReverieSemanticSearchOptions, type ReviewInvocationOptions, type ReviewTarget, type RunResult, type RunStreamedResult, type RunTuiOptions, type SandboxMode, ScopedLogger, type SkillDefinition, type SkillMentionTrigger, Thread, type ThreadError, type ThreadErrorEvent, type ThreadEvent, type ThreadItem, type ThreadLoggingSink, type ThreadOptions, type ThreadStartedEvent, type TodoItem, type TodoListItem, type TokenizerEncodeOptions, type TokenizerOptions, type ToolCallEvent, type ToolExecutionContext, type ToolExecutor, type ToolExecutorResult, type TuiSession, type TurnCompletedEvent, type TurnFailedEvent, type TurnOptions, type TurnStartedEvent, type Usage, type UserInput, type WebSearchItem, type WorkspaceLocator, applyFileReveriePipeline, applyQualityPipeline, applyReveriePipeline, attachLspDiagnostics, buildBranchContext, buildFileContext, buildProjectContext, clearCodexToolExecutors, codexTool, collectRepoDiffSummary, contextToQuery, createThreadLogger, deduplicateReverieInsights, encodeToToon, evAssistantMessage, evCompleted, evFunctionCall, evResponseCreated, extractKeySymbols, fastEmbedEmbed, fastEmbedInit, filterBySeverity, findServerForFile, formatDiagnosticsForBackgroundEvent, formatDiagnosticsForTool, formatDiagnosticsWithSummary, formatFileList, formatStream, getCodexToolExecutor, getNativeBinding, gradeReverieRelevance, gradeReveriesInParallel, isValidReverieExcerpt, logApprovedReveries, logLLMGrading, logLevelResults, logMultiLevelSearch, logMultiLevelSummary, logReverieFiltering, logReverieHintQuality, logReverieInsights, logReverieSearch, logger, registerCodexToolExecutor, resolveWorkspaceRoot, reverieGetConversationInsights, reverieIndexSemantic, reverieListConversations, reverieSearchConversations, reverieSearchSemantic, runThreadTurnWithLogs, runTui, searchBranchLevel, searchFileLevel, searchMultiLevel, searchProjectLevel, searchReveries, sse, startTui, summarizeDiagnostics, tokenizerCount, tokenizerDecode, tokenizerEncode, truncate as truncateText };
package/dist/index.mjs CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  tokenizerCount,
28
28
  tokenizerDecode,
29
29
  tokenizerEncode
30
- } from "./chunk-LFJNLOFF.mjs";
30
+ } from "./chunk-ZAYUMM55.mjs";
31
31
 
32
32
  // src/agents/toolRegistry.ts
33
33
  var executors = /* @__PURE__ */ new Map();
@@ -2663,6 +2663,7 @@ export {
2663
2663
  formatFileList,
2664
2664
  formatStream,
2665
2665
  getCodexToolExecutor,
2666
+ getNativeBinding,
2666
2667
  gradeReverieRelevance,
2667
2668
  gradeReveriesInParallel,
2668
2669
  isValidReverieExcerpt,