fix: 清理 main 分支的 stub .js 文件,恢复有 .ts 源文件的命令模块
This commit is contained in:
parent
3bfc695cb4
commit
c2eb6bff90
68
packages/@ant/ink/src/types/ink-elements.d.ts
vendored
68
packages/@ant/ink/src/types/ink-elements.d.ts
vendored
|
|
@ -1,49 +1,49 @@
|
||||||
// Type declarations for custom Ink JSX elements
|
// Type declarations for custom Ink JSX elements
|
||||||
// Note: The detailed prop types are defined in ink-jsx.d.ts via React module augmentation.
|
// Note: The detailed prop types are defined in ink-jsx.d.ts via React module augmentation.
|
||||||
// This file provides the global JSX namespace fallback declarations.
|
// This file provides the global JSX namespace fallback declarations.
|
||||||
import type { ReactNode, Ref } from 'react'
|
import type { ReactNode, Ref } from 'react';
|
||||||
import type { ClickEvent } from '../core/events/click-event.js'
|
import type { ClickEvent } from '../core/events/click-event.js';
|
||||||
import type { FocusEvent } from '../core/events/focus-event.js'
|
import type { FocusEvent } from '../core/events/focus-event.js';
|
||||||
import type { KeyboardEvent } from '../core/events/keyboard-event.js'
|
import type { KeyboardEvent } from '../core/events/keyboard-event.js';
|
||||||
import type { Styles, TextStyles } from '../core/styles.js'
|
import type { Styles, TextStyles } from '../core/styles.js';
|
||||||
import type { DOMElement } from '../core/dom.js'
|
import type { DOMElement } from '../core/dom.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
'ink-box': {
|
'ink-box': {
|
||||||
ref?: Ref<DOMElement>
|
ref?: Ref<DOMElement>;
|
||||||
tabIndex?: number
|
tabIndex?: number;
|
||||||
autoFocus?: boolean
|
autoFocus?: boolean;
|
||||||
onClick?: (event: ClickEvent) => void
|
onClick?: (event: ClickEvent) => void;
|
||||||
onFocus?: (event: FocusEvent) => void
|
onFocus?: (event: FocusEvent) => void;
|
||||||
onFocusCapture?: (event: FocusEvent) => void
|
onFocusCapture?: (event: FocusEvent) => void;
|
||||||
onBlur?: (event: FocusEvent) => void
|
onBlur?: (event: FocusEvent) => void;
|
||||||
onBlurCapture?: (event: FocusEvent) => void
|
onBlurCapture?: (event: FocusEvent) => void;
|
||||||
onMouseEnter?: () => void
|
onMouseEnter?: () => void;
|
||||||
onMouseLeave?: () => void
|
onMouseLeave?: () => void;
|
||||||
onKeyDown?: (event: KeyboardEvent) => void
|
onKeyDown?: (event: KeyboardEvent) => void;
|
||||||
onKeyDownCapture?: (event: KeyboardEvent) => void
|
onKeyDownCapture?: (event: KeyboardEvent) => void;
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
stickyScroll?: boolean
|
stickyScroll?: boolean;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-text': {
|
'ink-text': {
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
textStyles?: TextStyles
|
textStyles?: TextStyles;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-link': {
|
'ink-link': {
|
||||||
href?: string
|
href?: string;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-raw-ansi': {
|
'ink-raw-ansi': {
|
||||||
rawText?: string
|
rawText?: string;
|
||||||
rawWidth?: number
|
rawWidth?: number;
|
||||||
rawHeight?: number
|
rawHeight?: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {}
|
export {};
|
||||||
|
|
|
||||||
66
packages/@ant/ink/src/types/ink-jsx.d.ts
vendored
66
packages/@ant/ink/src/types/ink-jsx.d.ts
vendored
|
|
@ -8,47 +8,47 @@
|
||||||
* This file must be a module (have an import/export) for `declare module`
|
* This file must be a module (have an import/export) for `declare module`
|
||||||
* augmentation to work correctly.
|
* augmentation to work correctly.
|
||||||
*/
|
*/
|
||||||
import type { ReactNode, Ref } from 'react'
|
import type { ReactNode, Ref } from 'react';
|
||||||
import type { ClickEvent } from '../core/events/click-event.js'
|
import type { ClickEvent } from '../core/events/click-event.js';
|
||||||
import type { FocusEvent } from '../core/events/focus-event.js'
|
import type { FocusEvent } from '../core/events/focus-event.js';
|
||||||
import type { KeyboardEvent } from '../core/events/keyboard-event.js'
|
import type { KeyboardEvent } from '../core/events/keyboard-event.js';
|
||||||
import type { Styles, TextStyles } from '../core/styles.js'
|
import type { Styles, TextStyles } from '../core/styles.js';
|
||||||
import type { DOMElement } from '../core/dom.js'
|
import type { DOMElement } from '../core/dom.js';
|
||||||
|
|
||||||
declare module 'react' {
|
declare module 'react' {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
'ink-box': {
|
'ink-box': {
|
||||||
ref?: Ref<DOMElement>
|
ref?: Ref<DOMElement>;
|
||||||
tabIndex?: number
|
tabIndex?: number;
|
||||||
autoFocus?: boolean
|
autoFocus?: boolean;
|
||||||
onClick?: (event: ClickEvent) => void
|
onClick?: (event: ClickEvent) => void;
|
||||||
onFocus?: (event: FocusEvent) => void
|
onFocus?: (event: FocusEvent) => void;
|
||||||
onFocusCapture?: (event: FocusEvent) => void
|
onFocusCapture?: (event: FocusEvent) => void;
|
||||||
onBlur?: (event: FocusEvent) => void
|
onBlur?: (event: FocusEvent) => void;
|
||||||
onBlurCapture?: (event: FocusEvent) => void
|
onBlurCapture?: (event: FocusEvent) => void;
|
||||||
onMouseEnter?: () => void
|
onMouseEnter?: () => void;
|
||||||
onMouseLeave?: () => void
|
onMouseLeave?: () => void;
|
||||||
onKeyDown?: (event: KeyboardEvent) => void
|
onKeyDown?: (event: KeyboardEvent) => void;
|
||||||
onKeyDownCapture?: (event: KeyboardEvent) => void
|
onKeyDownCapture?: (event: KeyboardEvent) => void;
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
stickyScroll?: boolean
|
stickyScroll?: boolean;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-text': {
|
'ink-text': {
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
textStyles?: TextStyles
|
textStyles?: TextStyles;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-link': {
|
'ink-link': {
|
||||||
href?: string
|
href?: string;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-raw-ansi': {
|
'ink-raw-ansi': {
|
||||||
rawText?: string
|
rawText?: string;
|
||||||
rawWidth?: number
|
rawWidth?: number;
|
||||||
rawHeight?: number
|
rawHeight?: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
120
scripts/auto-rebase.ts
Normal file
120
scripts/auto-rebase.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
import { execSync } from 'child_process'
|
||||||
|
import { readFileSync, writeFileSync } from 'fs'
|
||||||
|
|
||||||
|
function run(cmd: string): string {
|
||||||
|
try {
|
||||||
|
return execSync(cmd, { encoding: 'utf-8', env: { ...process.env, GIT_EDITOR: 'true' } })
|
||||||
|
} catch (e: any) {
|
||||||
|
return (e.stdout || '') + (e.stderr || '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getConflictedFiles(): string[] {
|
||||||
|
const out = run('git diff --name-only --diff-filter=U')
|
||||||
|
return out.trim().split('\n').filter(Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveConflictMarkers(content: string): string {
|
||||||
|
if (!content.includes('<<<<<<<')) return content
|
||||||
|
const lines = content.split('\n')
|
||||||
|
const result: string[] = []
|
||||||
|
let state: 'normal' | 'ours' | 'theirs' = 'normal'
|
||||||
|
let oursLines: string[] = []
|
||||||
|
let theirsLines: string[] = []
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith('<<<<<<<')) {
|
||||||
|
state = 'ours'
|
||||||
|
oursLines = []
|
||||||
|
theirsLines = []
|
||||||
|
} else if (line === '=======') {
|
||||||
|
state = 'theirs'
|
||||||
|
} else if (line.startsWith('>>>>>>>')) {
|
||||||
|
state = 'normal'
|
||||||
|
result.push(...oursLines, ...theirsLines)
|
||||||
|
} else if (state === 'ours') {
|
||||||
|
oursLines.push(line)
|
||||||
|
} else if (state === 'theirs') {
|
||||||
|
theirsLines.push(line)
|
||||||
|
} else {
|
||||||
|
result.push(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.join('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveConflicts(): boolean {
|
||||||
|
const files = getConflictedFiles()
|
||||||
|
if (files.length === 0) return true
|
||||||
|
console.log(` Conflicted files: ${files.join(', ')}`)
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
if (file === 'bun.lock') {
|
||||||
|
run(`git checkout --theirs "${file}"`)
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
const content = readFileSync(file, 'utf-8')
|
||||||
|
const resolved = resolveConflictMarkers(content)
|
||||||
|
writeFileSync(file, resolved, 'utf-8')
|
||||||
|
} catch {
|
||||||
|
run(`git checkout --theirs "${file}"`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(`git add "${file}"`)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Starting automated rebase...\n')
|
||||||
|
|
||||||
|
let conflictCount = 0
|
||||||
|
let iterations = 0
|
||||||
|
const maxIterations = 300
|
||||||
|
|
||||||
|
// Start the rebase
|
||||||
|
let output = run('git rebase origin/main')
|
||||||
|
console.log(output.substring(0, 500))
|
||||||
|
|
||||||
|
while (iterations++ < maxIterations) {
|
||||||
|
const status = run('git status')
|
||||||
|
|
||||||
|
if (!status.includes('rebasing') && !status.includes('rebase')) {
|
||||||
|
console.log('\nRebase completed!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
const conflicted = getConflictedFiles()
|
||||||
|
if (conflicted.length > 0) {
|
||||||
|
conflictCount++
|
||||||
|
const commitMatch = status.match(/Could not apply (\w+)/)
|
||||||
|
const commitInfo = commitMatch ? commitMatch[1] : 'unknown'
|
||||||
|
console.log(`\n[${iterations}] Conflict #${conflictCount} (${commitInfo}): ${conflicted.join(', ')}`)
|
||||||
|
|
||||||
|
// Handle delete/modify conflicts
|
||||||
|
for (const file of conflicted) {
|
||||||
|
const diffOutput = run(`git diff --diff-filter=D -- "${file}"`)
|
||||||
|
if (diffOutput.includes('deleted in')) {
|
||||||
|
// If file was deleted in the commit being applied, accept the deletion
|
||||||
|
run(`git rm "${file}" 2>/dev/null || git checkout --theirs "${file}" && git add "${file}"`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resolveConflicts()
|
||||||
|
}
|
||||||
|
|
||||||
|
output = run('git rebase --continue')
|
||||||
|
if (output.includes('successfully rebased')) {
|
||||||
|
console.log('\nRebase completed successfully!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (output.includes('CONFLICT') || output.includes('could not apply')) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (output.includes('fatal') || output.includes('error: failed')) {
|
||||||
|
console.error('Fatal error:', output)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
console.log(output.substring(0, 300))
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`\nTotal conflicts resolved: ${conflictCount}`)
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { name: 'agents-platform', type: 'local', isEnabled: () => false }
|
|
||||||
3
src/commands/autofix-pr/index.d.ts
vendored
3
src/commands/autofix-pr/index.d.ts
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
import type { Command } from '../../types/command.js'
|
|
||||||
declare const _default: Command
|
|
||||||
export default _default
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
3
src/commands/ctx_viz/index.d.ts
vendored
3
src/commands/ctx_viz/index.d.ts
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
import type { Command } from '../../types/command.js'
|
|
||||||
declare const _default: Command
|
|
||||||
export default _default
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
1
src/commands/env/index.js
vendored
1
src/commands/env/index.js
vendored
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
3
src/commands/onboarding/index.d.ts
vendored
3
src/commands/onboarding/index.d.ts
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
import type { Command } from '../../types/command.js'
|
|
||||||
declare const _default: Command
|
|
||||||
export default _default
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
const stub = { isEnabled: () => false, isHidden: true, name: 'stub' }
|
|
||||||
export default stub
|
|
||||||
export const resetLimits = stub
|
|
||||||
export const resetLimitsNonInteractive = stub
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export default { isEnabled: () => false, isHidden: true, name: 'stub' };
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
// Auto-generated type stub — replace with real implementation
|
|
||||||
export type StdoutMessage = any
|
|
||||||
export type SDKControlInitializeRequest = any
|
|
||||||
export type SDKControlInitializeResponse = any
|
|
||||||
export type SDKControlMcpSetServersResponse = any
|
|
||||||
export type SDKControlReloadPluginsResponse = any
|
|
||||||
export type StdinMessage = any
|
|
||||||
export type SDKPartialAssistantMessage = any
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
// Auto-generated type stub — replace with real implementation
|
|
||||||
export type EffortLevel = 'low' | 'medium' | 'high' | 'xhigh' | 'max'
|
|
||||||
18
src/types/global.d.ts
vendored
18
src/types/global.d.ts
vendored
|
|
@ -9,7 +9,6 @@
|
||||||
declare namespace MACRO {
|
declare namespace MACRO {
|
||||||
export const VERSION: string
|
export const VERSION: string
|
||||||
export const BUILD_TIME: string
|
export const BUILD_TIME: string
|
||||||
export const COMMIT: string
|
|
||||||
export const FEEDBACK_CHANNEL: string
|
export const FEEDBACK_CHANNEL: string
|
||||||
export const ISSUES_EXPLAINER: string
|
export const ISSUES_EXPLAINER: string
|
||||||
export const NATIVE_PACKAGE_URL: string
|
export const NATIVE_PACKAGE_URL: string
|
||||||
|
|
@ -22,9 +21,7 @@ declare namespace MACRO {
|
||||||
// These are referenced inside `MACRO(() => ...)` or `false && ...` blocks.
|
// These are referenced inside `MACRO(() => ...)` or `false && ...` blocks.
|
||||||
|
|
||||||
// Model resolution (internal)
|
// Model resolution (internal)
|
||||||
declare function resolveAntModel(
|
declare function resolveAntModel(model: string): import('../utils/model/antModels.js').AntModel | undefined
|
||||||
model: string,
|
|
||||||
): import('../utils/model/antModels.js').AntModel | undefined
|
|
||||||
declare function getAntModels(): import('../utils/model/antModels.js').AntModel[]
|
declare function getAntModels(): import('../utils/model/antModels.js').AntModel[]
|
||||||
declare function getAntModelOverrideConfig(): {
|
declare function getAntModelOverrideConfig(): {
|
||||||
defaultSystemPromptSuffix?: string
|
defaultSystemPromptSuffix?: string
|
||||||
|
|
@ -34,13 +31,7 @@ declare function getAntModelOverrideConfig(): {
|
||||||
// Companion reactions handled by src/buddy/companionReact.ts (direct import)
|
// Companion reactions handled by src/buddy/companionReact.ts (direct import)
|
||||||
|
|
||||||
// Metrics (internal)
|
// Metrics (internal)
|
||||||
type ApiMetricEntry = {
|
type ApiMetricEntry = { ttftMs: number; firstTokenTime: number; lastTokenTime: number; responseLengthBaseline: number; endResponseLength: number }
|
||||||
ttftMs: number
|
|
||||||
firstTokenTime: number
|
|
||||||
lastTokenTime: number
|
|
||||||
responseLengthBaseline: number
|
|
||||||
endResponseLength: number
|
|
||||||
}
|
|
||||||
declare const apiMetricsRef: React.RefObject<ApiMetricEntry[]> | null
|
declare const apiMetricsRef: React.RefObject<ApiMetricEntry[]> | null
|
||||||
declare function computeTtftText(metrics: ApiMetricEntry[]): string
|
declare function computeTtftText(metrics: ApiMetricEntry[]): string
|
||||||
|
|
||||||
|
|
@ -62,10 +53,7 @@ declare const HOOK_TIMING_DISPLAY_THRESHOLD_MS: number
|
||||||
declare type T = unknown
|
declare type T = unknown
|
||||||
|
|
||||||
// Tungsten (internal)
|
// Tungsten (internal)
|
||||||
declare function TungstenPill(props?: {
|
declare function TungstenPill(props?: { key?: string; selected?: boolean }): JSX.Element | null
|
||||||
key?: string
|
|
||||||
selected?: boolean
|
|
||||||
}): JSX.Element | null
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Build-time constants BUILD_TARGET/BUILD_ENV/INTERFACE_TYPE — removed (zero runtime usage)
|
// Build-time constants BUILD_TARGET/BUILD_ENV/INTERFACE_TYPE — removed (zero runtime usage)
|
||||||
|
|
|
||||||
67
src/types/ink-elements.d.ts
vendored
67
src/types/ink-elements.d.ts
vendored
|
|
@ -1,52 +1,45 @@
|
||||||
// Type declarations for custom Ink JSX elements
|
// Type declarations for custom Ink JSX elements
|
||||||
// Note: The detailed prop types are defined in ink-jsx.d.ts via React module augmentation.
|
// Note: The detailed prop types are defined in ink-jsx.d.ts via React module augmentation.
|
||||||
// This file provides the global JSX namespace fallback declarations.
|
// This file provides the global JSX namespace fallback declarations.
|
||||||
import type { ReactNode, Ref } from 'react'
|
import type { ReactNode, Ref } from 'react';
|
||||||
import type {
|
import type { ClickEvent, FocusEvent, KeyboardEvent, Styles, TextStyles, DOMElement } from '@anthropic/ink';
|
||||||
ClickEvent,
|
|
||||||
FocusEvent,
|
|
||||||
KeyboardEvent,
|
|
||||||
Styles,
|
|
||||||
TextStyles,
|
|
||||||
DOMElement,
|
|
||||||
} from '@anthropic/ink'
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
'ink-box': {
|
'ink-box': {
|
||||||
ref?: Ref<DOMElement>
|
ref?: Ref<DOMElement>;
|
||||||
tabIndex?: number
|
tabIndex?: number;
|
||||||
autoFocus?: boolean
|
autoFocus?: boolean;
|
||||||
onClick?: (event: ClickEvent) => void
|
onClick?: (event: ClickEvent) => void;
|
||||||
onFocus?: (event: FocusEvent) => void
|
onFocus?: (event: FocusEvent) => void;
|
||||||
onFocusCapture?: (event: FocusEvent) => void
|
onFocusCapture?: (event: FocusEvent) => void;
|
||||||
onBlur?: (event: FocusEvent) => void
|
onBlur?: (event: FocusEvent) => void;
|
||||||
onBlurCapture?: (event: FocusEvent) => void
|
onBlurCapture?: (event: FocusEvent) => void;
|
||||||
onMouseEnter?: () => void
|
onMouseEnter?: () => void;
|
||||||
onMouseLeave?: () => void
|
onMouseLeave?: () => void;
|
||||||
onKeyDown?: (event: KeyboardEvent) => void
|
onKeyDown?: (event: KeyboardEvent) => void;
|
||||||
onKeyDownCapture?: (event: KeyboardEvent) => void
|
onKeyDownCapture?: (event: KeyboardEvent) => void;
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
stickyScroll?: boolean
|
stickyScroll?: boolean;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-text': {
|
'ink-text': {
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
textStyles?: TextStyles
|
textStyles?: TextStyles;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-link': {
|
'ink-link': {
|
||||||
href?: string
|
href?: string;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-raw-ansi': {
|
'ink-raw-ansi': {
|
||||||
rawText?: string
|
rawText?: string;
|
||||||
rawWidth?: number
|
rawWidth?: number;
|
||||||
rawHeight?: number
|
rawHeight?: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {}
|
export {};
|
||||||
|
|
|
||||||
65
src/types/ink-jsx.d.ts
vendored
65
src/types/ink-jsx.d.ts
vendored
|
|
@ -8,50 +8,43 @@
|
||||||
* This file must be a module (have an import/export) for `declare module`
|
* This file must be a module (have an import/export) for `declare module`
|
||||||
* augmentation to work correctly.
|
* augmentation to work correctly.
|
||||||
*/
|
*/
|
||||||
import type { ReactNode, Ref } from 'react'
|
import type { ReactNode, Ref } from 'react';
|
||||||
import type {
|
import type { ClickEvent, FocusEvent, KeyboardEvent, Styles, TextStyles, DOMElement } from '@anthropic/ink';
|
||||||
ClickEvent,
|
|
||||||
FocusEvent,
|
|
||||||
KeyboardEvent,
|
|
||||||
Styles,
|
|
||||||
TextStyles,
|
|
||||||
DOMElement,
|
|
||||||
} from '@anthropic/ink'
|
|
||||||
|
|
||||||
declare module 'react' {
|
declare module 'react' {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
'ink-box': {
|
'ink-box': {
|
||||||
ref?: Ref<DOMElement>
|
ref?: Ref<DOMElement>;
|
||||||
tabIndex?: number
|
tabIndex?: number;
|
||||||
autoFocus?: boolean
|
autoFocus?: boolean;
|
||||||
onClick?: (event: ClickEvent) => void
|
onClick?: (event: ClickEvent) => void;
|
||||||
onFocus?: (event: FocusEvent) => void
|
onFocus?: (event: FocusEvent) => void;
|
||||||
onFocusCapture?: (event: FocusEvent) => void
|
onFocusCapture?: (event: FocusEvent) => void;
|
||||||
onBlur?: (event: FocusEvent) => void
|
onBlur?: (event: FocusEvent) => void;
|
||||||
onBlurCapture?: (event: FocusEvent) => void
|
onBlurCapture?: (event: FocusEvent) => void;
|
||||||
onMouseEnter?: () => void
|
onMouseEnter?: () => void;
|
||||||
onMouseLeave?: () => void
|
onMouseLeave?: () => void;
|
||||||
onKeyDown?: (event: KeyboardEvent) => void
|
onKeyDown?: (event: KeyboardEvent) => void;
|
||||||
onKeyDownCapture?: (event: KeyboardEvent) => void
|
onKeyDownCapture?: (event: KeyboardEvent) => void;
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
stickyScroll?: boolean
|
stickyScroll?: boolean;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-text': {
|
'ink-text': {
|
||||||
style?: Styles
|
style?: Styles;
|
||||||
textStyles?: TextStyles
|
textStyles?: TextStyles;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-link': {
|
'ink-link': {
|
||||||
href?: string
|
href?: string;
|
||||||
children?: ReactNode
|
children?: ReactNode;
|
||||||
}
|
};
|
||||||
'ink-raw-ansi': {
|
'ink-raw-ansi': {
|
||||||
rawText?: string
|
rawText?: string;
|
||||||
rawWidth?: number
|
rawWidth?: number;
|
||||||
rawHeight?: number
|
rawHeight?: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
src/types/internal-modules.d.ts
vendored
42
src/types/internal-modules.d.ts
vendored
|
|
@ -7,53 +7,25 @@
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// bun:bundle — compile-time macros
|
// bun:bundle — compile-time macros
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
declare module 'bun:bundle' {
|
declare module "bun:bundle" {
|
||||||
export function feature(name: string): boolean
|
export function feature(name: string): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'bun:ffi' {
|
declare module "bun:ffi" {
|
||||||
export function dlopen<
|
export function dlopen<T extends Record<string, { args: readonly string[]; returns: string }>>(path: string, symbols: T): { symbols: { [K in keyof T]: (...args: unknown[]) => unknown }; close(): void };
|
||||||
T extends Record<string, { args: readonly string[]; returns: string }>,
|
|
||||||
>(
|
|
||||||
path: string,
|
|
||||||
symbols: T,
|
|
||||||
): {
|
|
||||||
symbols: { [K in keyof T]: (...args: unknown[]) => unknown }
|
|
||||||
close(): void
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third-party modules without @types packages
|
// Third-party modules without @types packages
|
||||||
declare module 'bidi-js' {
|
declare module 'bidi-js' {
|
||||||
function getEmbeddingLevels(
|
function getEmbeddingLevels(text: string, defaultDirection?: string): { paragraphLevel: number; levels: Uint8Array }
|
||||||
text: string,
|
function getReorderSegments(text: string, embeddingLevels: { paragraphLevel: number; levels: Uint8Array }, start?: number, end?: number): [number, number][]
|
||||||
defaultDirection?: string,
|
|
||||||
): { paragraphLevel: number; levels: Uint8Array }
|
|
||||||
function getReorderSegments(
|
|
||||||
text: string,
|
|
||||||
embeddingLevels: { paragraphLevel: number; levels: Uint8Array },
|
|
||||||
start?: number,
|
|
||||||
end?: number,
|
|
||||||
): [number, number][]
|
|
||||||
function getVisualOrder(reorderSegments: [number, number][]): number[]
|
function getVisualOrder(reorderSegments: [number, number][]): number[]
|
||||||
export { getEmbeddingLevels, getReorderSegments, getVisualOrder }
|
export { getEmbeddingLevels, getReorderSegments, getVisualOrder }
|
||||||
export default { getEmbeddingLevels, getReorderSegments, getVisualOrder }
|
export default { getEmbeddingLevels, getReorderSegments, getVisualOrder }
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'asciichart' {
|
declare module 'asciichart' {
|
||||||
function plot(
|
function plot(series: number[] | number[][], config?: Record<string, unknown>): string
|
||||||
series: number[] | number[][],
|
|
||||||
config?: Record<string, unknown>,
|
|
||||||
): string
|
|
||||||
export { plot }
|
export { plot }
|
||||||
export default { plot }
|
export default { plot }
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@napi-rs/keyring' {
|
|
||||||
export class Entry {
|
|
||||||
constructor(service: string, account: string)
|
|
||||||
getPassword(): string | null
|
|
||||||
setPassword(password: string): void
|
|
||||||
deletePassword(): boolean
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
73
src/types/sdk-stubs.d.ts
vendored
73
src/types/sdk-stubs.d.ts
vendored
|
|
@ -9,7 +9,7 @@
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// coreTypes.generated.js — Generated from coreSchemas.ts Zod schemas
|
// coreTypes.generated.js — Generated from coreSchemas.ts Zod schemas
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
declare module '*/sdk/coreTypes.generated.js' {
|
declare module "*/sdk/coreTypes.generated.js" {
|
||||||
// Usage & Model
|
// Usage & Model
|
||||||
export type ModelUsage = {
|
export type ModelUsage = {
|
||||||
inputTokens: number
|
inputTokens: number
|
||||||
|
|
@ -32,20 +32,20 @@ declare module '*/sdk/coreTypes.generated.js' {
|
||||||
export type McpServerConfigForProcessTransport = {
|
export type McpServerConfigForProcessTransport = {
|
||||||
command: string
|
command: string
|
||||||
args: string[]
|
args: string[]
|
||||||
type?: 'stdio'
|
type?: "stdio"
|
||||||
env?: Record<string, string>
|
env?: Record<string, string>
|
||||||
} & { scope: string; pluginSource?: string }
|
} & { scope: string; pluginSource?: string }
|
||||||
export type McpServerStatus = {
|
export type McpServerStatus = {
|
||||||
name: string
|
name: string
|
||||||
status: 'connected' | 'disconnected' | 'error'
|
status: "connected" | "disconnected" | "error"
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
export type PermissionMode = string
|
export type PermissionMode = string
|
||||||
export type PermissionResult =
|
export type PermissionResult =
|
||||||
| { behavior: 'allow' }
|
| { behavior: "allow" }
|
||||||
| { behavior: 'deny'; message?: string }
|
| { behavior: "deny"; message?: string }
|
||||||
export type PermissionUpdate = {
|
export type PermissionUpdate = {
|
||||||
path: string
|
path: string
|
||||||
permission: string
|
permission: string
|
||||||
|
|
@ -91,56 +91,21 @@ declare module '*/sdk/coreTypes.generated.js' {
|
||||||
|
|
||||||
// SDK Message types
|
// SDK Message types
|
||||||
export type SDKMessage = { type: string; [key: string]: unknown }
|
export type SDKMessage = { type: string; [key: string]: unknown }
|
||||||
export type SDKUserMessage = {
|
export type SDKUserMessage = { type: "user"; content: unknown; uuid: string; [key: string]: unknown }
|
||||||
type: 'user'
|
|
||||||
content: unknown
|
|
||||||
uuid: string
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKUserMessageReplay = SDKUserMessage
|
export type SDKUserMessageReplay = SDKUserMessage
|
||||||
export type SDKAssistantMessage = {
|
export type SDKAssistantMessage = { type: "assistant"; content: unknown; [key: string]: unknown }
|
||||||
type: 'assistant'
|
export type SDKAssistantErrorMessage = { type: "assistant_error"; error: unknown; [key: string]: unknown }
|
||||||
content: unknown
|
export type SDKAssistantMessageError = 'authentication_failed' | 'billing_error' | 'rate_limit' | 'invalid_request' | 'server_error' | 'unknown' | 'max_output_tokens'
|
||||||
[key: string]: unknown
|
export type SDKPartialAssistantMessage = { type: "partial_assistant"; [key: string]: unknown }
|
||||||
}
|
export type SDKResultMessage = { type: "result"; [key: string]: unknown }
|
||||||
export type SDKAssistantErrorMessage = {
|
export type SDKResultSuccess = { type: "result_success"; [key: string]: unknown }
|
||||||
type: 'assistant_error'
|
export type SDKSystemMessage = { type: "system"; [key: string]: unknown }
|
||||||
error: unknown
|
export type SDKStatusMessage = { type: "status"; [key: string]: unknown }
|
||||||
[key: string]: unknown
|
export type SDKToolProgressMessage = { type: "tool_progress"; [key: string]: unknown }
|
||||||
}
|
export type SDKCompactBoundaryMessage = { type: "compact_boundary"; [key: string]: unknown }
|
||||||
export type SDKAssistantMessageError =
|
export type SDKPermissionDenial = { type: "permission_denial"; [key: string]: unknown }
|
||||||
| 'authentication_failed'
|
export type SDKRateLimitInfo = { type: "rate_limit"; [key: string]: unknown }
|
||||||
| 'billing_error'
|
export type SDKStatus = "active" | "idle" | "error" | string
|
||||||
| 'rate_limit'
|
|
||||||
| 'invalid_request'
|
|
||||||
| 'server_error'
|
|
||||||
| 'unknown'
|
|
||||||
| 'max_output_tokens'
|
|
||||||
export type SDKPartialAssistantMessage = {
|
|
||||||
type: 'partial_assistant'
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKResultMessage = { type: 'result'; [key: string]: unknown }
|
|
||||||
export type SDKResultSuccess = {
|
|
||||||
type: 'result_success'
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKSystemMessage = { type: 'system'; [key: string]: unknown }
|
|
||||||
export type SDKStatusMessage = { type: 'status'; [key: string]: unknown }
|
|
||||||
export type SDKToolProgressMessage = {
|
|
||||||
type: 'tool_progress'
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKCompactBoundaryMessage = {
|
|
||||||
type: 'compact_boundary'
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKPermissionDenial = {
|
|
||||||
type: 'permission_denial'
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
export type SDKRateLimitInfo = { type: 'rate_limit'; [key: string]: unknown }
|
|
||||||
export type SDKStatus = 'active' | 'idle' | 'error' | string
|
|
||||||
export type SDKSessionInfo = {
|
export type SDKSessionInfo = {
|
||||||
sessionId: string
|
sessionId: string
|
||||||
summary?: string
|
summary?: string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user