stk-codegen 1.0.5 → 1.0.7
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/App.d.ts +4 -2
- package/dist/components/BootstrapStatus.d.ts +3 -0
- package/dist/components/Conversation.d.ts +15 -8
- package/dist/components/DiffView.d.ts +9 -2
- package/dist/components/Input.d.ts +8 -2
- package/dist/components/Message.d.ts +1 -1
- package/dist/components/ShellConfirmation.d.ts +3 -1
- package/dist/components/ShellExecution.d.ts +10 -0
- package/dist/components/ToolExecution.d.ts +2 -1
- package/dist/core/agent/events.d.ts +66 -0
- package/dist/core/agent/reducer.d.ts +4 -0
- package/dist/core/agent/types.d.ts +54 -0
- package/dist/hooks/useAgent.core.d.ts +16 -0
- package/dist/hooks/useAgent.d.ts +19 -5
- package/dist/hooks/useTerminalLayout.d.ts +2 -2
- package/dist/index.js +44 -25
- package/dist/services/clipboardImage.d.ts +24 -0
- package/dist/services/versionCheck.d.ts +5 -3
- package/dist/tools/runShellCommandAsync.d.ts +2 -1
- package/dist/types/index.d.ts +6 -7
- package/dist/ui/agent/buildInkViewModel.d.ts +53 -0
- package/dist/ui/agent/mapMessages.d.ts +7 -0
- package/dist/utils/display.d.ts +1 -1
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ConversationMessage, PendingShellCommand } from '../types/index.js';
|
|
1
|
+
import { FC } from 'react';
|
|
3
2
|
import { ChildProcess } from 'child_process';
|
|
3
|
+
import { DiffReviewView, ShellRunView, StaticMessageView } from "../ui/agent/buildInkViewModel.js";
|
|
4
4
|
interface ConversationProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
messages: StaticMessageView[];
|
|
6
|
+
liveAgentMessage?: StaticMessageView;
|
|
7
|
+
activeShellRun?: ShellRunView;
|
|
8
|
+
activeDiffReview?: DiffReviewView;
|
|
9
|
+
onShellComplete: (result: {
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
exitCode: number | null;
|
|
13
|
+
}) => void;
|
|
7
14
|
childProcess: ChildProcess | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
sendInputToShell: (input: string) => void;
|
|
16
|
+
onApproveDiff: (editedContent?: string) => void;
|
|
17
|
+
onRejectDiff: () => void;
|
|
11
18
|
}
|
|
12
|
-
export declare const Conversation:
|
|
19
|
+
export declare const Conversation: FC<ConversationProps>;
|
|
13
20
|
export {};
|
|
@@ -2,13 +2,20 @@ import React from 'react';
|
|
|
2
2
|
export interface DiffViewStaticProps {
|
|
3
3
|
oldContent: string;
|
|
4
4
|
newContent: string;
|
|
5
|
-
filePath
|
|
5
|
+
filePath?: string;
|
|
6
|
+
toolName?: string;
|
|
7
|
+
toolParams?: Record<string, any>;
|
|
6
8
|
isCompleted: boolean;
|
|
7
9
|
action?: string;
|
|
8
10
|
maxVisibleLines?: number;
|
|
9
11
|
}
|
|
10
12
|
interface DiffViewProps extends DiffViewStaticProps {
|
|
11
|
-
|
|
13
|
+
onApprove: (editedContent?: string) => void;
|
|
14
|
+
onReject: () => void;
|
|
15
|
+
coreDiffReview?: {
|
|
16
|
+
id: string;
|
|
17
|
+
status: 'pending' | 'accepted' | 'rejected';
|
|
18
|
+
};
|
|
12
19
|
}
|
|
13
20
|
export declare const DiffDecisionHint: React.FC;
|
|
14
21
|
export declare const DiffViewStatic: React.FC<DiffViewStaticProps>;
|
|
@@ -2,12 +2,18 @@ import React from 'react';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
|
-
onSubmit: (value: string
|
|
5
|
+
onSubmit: (value: string, extra?: {
|
|
6
|
+
images?: {
|
|
7
|
+
base64: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
}[];
|
|
10
|
+
}) => void;
|
|
6
11
|
searchFiles: (pattern: string, options?: {
|
|
7
12
|
ignore?: string[];
|
|
8
13
|
}) => Promise<string[]>;
|
|
9
14
|
isShellActive?: boolean;
|
|
10
15
|
setShowEscapeClear: (show: boolean) => void;
|
|
16
|
+
isActive: boolean;
|
|
11
17
|
}
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ value, onChange, onSubmit, searchFiles, isShellActive, setShowEscapeClear, }: Props) => React.JSX.Element>;
|
|
18
|
+
declare const _default: React.MemoExoticComponent<({ value, onChange, onSubmit, searchFiles, isShellActive, setShowEscapeClear, isActive, }: Props) => React.JSX.Element>;
|
|
13
19
|
export default _default;
|
|
@@ -6,7 +6,7 @@ interface MessageProps {
|
|
|
6
6
|
activeShellCommand: any;
|
|
7
7
|
childProcess: ChildProcess | null;
|
|
8
8
|
handleShellCompletion: (result: any) => void;
|
|
9
|
-
|
|
9
|
+
context?: 'static' | 'live';
|
|
10
10
|
}
|
|
11
11
|
export declare const MemoizedMessage: React.NamedExoticComponent<MessageProps>;
|
|
12
12
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ShellConfirmationProps {
|
|
3
3
|
command: string;
|
|
4
|
+
onApprove: () => void;
|
|
5
|
+
onReject: () => void;
|
|
4
6
|
}
|
|
5
|
-
declare const ShellConfirmation: ({ command }: ShellConfirmationProps) => React.JSX.Element;
|
|
7
|
+
declare const ShellConfirmation: ({ command, onApprove, onReject }: ShellConfirmationProps) => React.JSX.Element;
|
|
6
8
|
export default ShellConfirmation;
|
|
@@ -4,6 +4,16 @@ interface ShellExecutionProps {
|
|
|
4
4
|
command: string;
|
|
5
5
|
childProcess: ChildProcess | null;
|
|
6
6
|
onComplete: (result: any) => void;
|
|
7
|
+
coreShellRun?: {
|
|
8
|
+
id: string;
|
|
9
|
+
status: 'pending' | 'running' | 'finished' | 'error' | 'cancelled';
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
visibleOutput?: string;
|
|
13
|
+
isVisuallyTruncated?: boolean;
|
|
14
|
+
totalLines?: number;
|
|
15
|
+
visibleLinesCount?: number;
|
|
16
|
+
};
|
|
7
17
|
}
|
|
8
18
|
declare const ShellExecution: React.FC<ShellExecutionProps>;
|
|
9
19
|
export default ShellExecution;
|
|
@@ -3,6 +3,7 @@ interface ToolExecutionProps {
|
|
|
3
3
|
toolName: string;
|
|
4
4
|
displayMessage?: string;
|
|
5
5
|
toolParams?: Record<string, any>;
|
|
6
|
+
status?: 'running' | 'finished' | 'error' | 'completed' | undefined;
|
|
6
7
|
}
|
|
7
|
-
declare const ToolExecution: ({ toolName, toolParams }: ToolExecutionProps) => React.JSX.Element;
|
|
8
|
+
declare const ToolExecution: ({ toolName, toolParams, status }: ToolExecutionProps) => React.JSX.Element;
|
|
8
9
|
export default ToolExecution;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CoreMessageId, DiffReviewId, ShellRunId } from './types.js';
|
|
2
|
+
export type CoreEvent = {
|
|
3
|
+
type: 'USER_SENT_MESSAGE';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'AGENT_STREAM_STARTED';
|
|
7
|
+
messageId: CoreMessageId;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'AGENT_DELTA_RECEIVED';
|
|
10
|
+
delta: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'AGENT_STREAM_FLUSH';
|
|
13
|
+
} | {
|
|
14
|
+
type: 'AGENT_STREAM_FINISHED';
|
|
15
|
+
} | {
|
|
16
|
+
type: 'TOOL_RESULT_MESSAGE';
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'TOOL_EXECUTION_STARTED';
|
|
20
|
+
toolId: string;
|
|
21
|
+
toolName: string;
|
|
22
|
+
toolParams: Record<string, any>;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'TOOL_EXECUTION_FINISHED';
|
|
25
|
+
toolId: string;
|
|
26
|
+
toolName: string;
|
|
27
|
+
toolParams: Record<string, any>;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'TOOL_EXECUTION_ERROR';
|
|
30
|
+
toolId: string;
|
|
31
|
+
toolName: string;
|
|
32
|
+
toolParams: Record<string, any>;
|
|
33
|
+
error: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'SHELL_RUN_STARTED';
|
|
36
|
+
runId: ShellRunId;
|
|
37
|
+
command: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'SHELL_OUTPUT_RECEIVED';
|
|
40
|
+
runId: ShellRunId;
|
|
41
|
+
stdoutDelta?: string;
|
|
42
|
+
stderrDelta?: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'SHELL_RUN_FINISHED';
|
|
45
|
+
runId: ShellRunId;
|
|
46
|
+
exitCode: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'DIFF_REVIEW_OPENED';
|
|
49
|
+
reviewId: DiffReviewId;
|
|
50
|
+
title?: string;
|
|
51
|
+
toolName?: string;
|
|
52
|
+
toolParams?: Record<string, any>;
|
|
53
|
+
oldContent: string;
|
|
54
|
+
newContent: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'DIFF_REVIEW_RESOLVED';
|
|
57
|
+
reviewId: DiffReviewId;
|
|
58
|
+
result: 'accepted' | 'rejected';
|
|
59
|
+
} | {
|
|
60
|
+
type: 'ERROR_OCCURRED';
|
|
61
|
+
message: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'BOOTSTRAP_STARTED';
|
|
64
|
+
} | {
|
|
65
|
+
type: 'BOOTSTRAP_FINISHED';
|
|
66
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type CoreRole = 'user' | 'agent' | 'tool_execution' | 'shell' | 'system' | 'agent_error' | 'agent_thought';
|
|
2
|
+
export type CoreMessageId = string;
|
|
3
|
+
export interface CoreMessage {
|
|
4
|
+
id: CoreMessageId;
|
|
5
|
+
role: CoreRole;
|
|
6
|
+
text: string;
|
|
7
|
+
createdAt: number;
|
|
8
|
+
isStreaming?: boolean;
|
|
9
|
+
isFinal?: boolean;
|
|
10
|
+
toolId?: string;
|
|
11
|
+
toolName?: string;
|
|
12
|
+
toolParams?: Record<string, any>;
|
|
13
|
+
status?: 'running' | 'finished' | 'error';
|
|
14
|
+
isBootstrap?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type ShellRunId = string;
|
|
17
|
+
export interface CoreShellRun {
|
|
18
|
+
id: ShellRunId;
|
|
19
|
+
command: string;
|
|
20
|
+
status: 'pending' | 'running' | 'finished' | 'error' | 'cancelled';
|
|
21
|
+
stdout: string;
|
|
22
|
+
stderr: string;
|
|
23
|
+
startedAt?: number;
|
|
24
|
+
finishedAt?: number;
|
|
25
|
+
}
|
|
26
|
+
export type DiffReviewId = string;
|
|
27
|
+
export interface CoreDiffReview {
|
|
28
|
+
id: DiffReviewId;
|
|
29
|
+
title?: string;
|
|
30
|
+
toolName?: string;
|
|
31
|
+
toolParams?: Record<string, any>;
|
|
32
|
+
oldContent: string;
|
|
33
|
+
newContent: string;
|
|
34
|
+
status: 'pending' | 'accepted' | 'rejected';
|
|
35
|
+
}
|
|
36
|
+
export interface CoreAgentStatus {
|
|
37
|
+
label: string;
|
|
38
|
+
detail?: string;
|
|
39
|
+
phase: 'idle' | 'thinking' | 'streaming' | 'waiting_tool' | 'running_tool';
|
|
40
|
+
}
|
|
41
|
+
export interface CoreStreamState {
|
|
42
|
+
currentMessageId?: CoreMessageId;
|
|
43
|
+
buffer: string;
|
|
44
|
+
status: 'idle' | 'streaming' | 'finished';
|
|
45
|
+
}
|
|
46
|
+
export interface CoreState {
|
|
47
|
+
messages: CoreMessage[];
|
|
48
|
+
shellRuns: CoreShellRun[];
|
|
49
|
+
diffReviews: CoreDiffReview[];
|
|
50
|
+
agentStatus: CoreAgentStatus;
|
|
51
|
+
stream: CoreStreamState;
|
|
52
|
+
isBootstrapping: boolean;
|
|
53
|
+
bootstrapFinished: boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CoreEvent } from '../core/agent/events.js';
|
|
2
|
+
import { CoreState } from '../core/agent/types.js';
|
|
3
|
+
import { InkViewModel } from '../ui/agent/buildInkViewModel.js';
|
|
4
|
+
export interface UseAgentCoreResult {
|
|
5
|
+
coreState: CoreState;
|
|
6
|
+
dispatchCore: (event: CoreEvent) => void;
|
|
7
|
+
viewModel: InkViewModel;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook fino, sem dependência de Ink, que expõe o core de agente e um view model básico.
|
|
11
|
+
*
|
|
12
|
+
* A ideia é que `useAgent` (hook principal usado pela UI Ink) passe a delegar
|
|
13
|
+
* estado de domínio para este hook, mantendo apenas integração com backend,
|
|
14
|
+
* teclado e ferramentas.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAgentCore(): UseAgentCoreResult;
|
package/dist/hooks/useAgent.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import {
|
|
3
|
-
export declare const useAgent: (
|
|
4
|
-
|
|
2
|
+
import { PendingShellCommand } from '../types/index.js';
|
|
3
|
+
export declare const useAgent: ({ autonomous }: {
|
|
4
|
+
autonomous?: boolean;
|
|
5
|
+
}) => {
|
|
5
6
|
agentStatus: {
|
|
6
7
|
isVisible: boolean;
|
|
7
8
|
text: string;
|
|
@@ -11,14 +12,25 @@ export declare const useAgent: () => {
|
|
|
11
12
|
rejectShellCommand: () => void;
|
|
12
13
|
approveDiff: (editedContent?: string) => void;
|
|
13
14
|
rejectDiff: () => void;
|
|
14
|
-
submitUserInput: (text: string
|
|
15
|
+
submitUserInput: (text: string, extra?: {
|
|
16
|
+
images?: {
|
|
17
|
+
base64: string;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
}[];
|
|
20
|
+
}) => void;
|
|
15
21
|
navigateHistoryUp: () => string | undefined;
|
|
16
22
|
navigateHistoryDown: () => string | undefined;
|
|
17
23
|
searchFiles: (pattern: string, options?: {
|
|
18
24
|
ignore?: string[];
|
|
19
25
|
}) => Promise<any>;
|
|
20
26
|
activeShellCommand: any;
|
|
21
|
-
handleShellCompletion: (result: any
|
|
27
|
+
handleShellCompletion: (result: any, meta?: {
|
|
28
|
+
messageId: number;
|
|
29
|
+
tool_name: string;
|
|
30
|
+
tool_id: string;
|
|
31
|
+
generation_id: string;
|
|
32
|
+
parameters?: any;
|
|
33
|
+
}) => void;
|
|
22
34
|
childProcess: ChildProcess | null;
|
|
23
35
|
sendInputToShell: (input: string) => void;
|
|
24
36
|
inputText: string;
|
|
@@ -28,5 +40,7 @@ export declare const useAgent: () => {
|
|
|
28
40
|
resetHistory: () => void;
|
|
29
41
|
cancelCurrentInteraction: () => void;
|
|
30
42
|
activeGenerationId: string | null;
|
|
43
|
+
coreState: import("../core/agent/types.js").CoreState;
|
|
44
|
+
coreViewModel: import("../ui/agent/buildInkViewModel.js").InkViewModel;
|
|
31
45
|
hasCodegenSpec: boolean;
|
|
32
46
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const AGENT_STREAM_RATIO = 0.5;
|
|
2
2
|
export declare const DIFF_REVIEW_RATIO = 0.5;
|
|
3
|
-
export declare const SHELL_OUTPUT_RATIO = 0.
|
|
3
|
+
export declare const SHELL_OUTPUT_RATIO = 0.4;
|
|
4
4
|
export declare const FOOTER_RESERVED_LINES = 4;
|
|
5
5
|
export declare const useTerminalLayout: () => {
|
|
6
6
|
readonly rows: any;
|
|
@@ -10,7 +10,7 @@ export declare const useTerminalLayout: () => {
|
|
|
10
10
|
readonly layoutConstants: {
|
|
11
11
|
readonly AGENT_STREAM_RATIO: 0.5;
|
|
12
12
|
readonly DIFF_REVIEW_RATIO: 0.5;
|
|
13
|
-
readonly SHELL_OUTPUT_RATIO: 0.
|
|
13
|
+
readonly SHELL_OUTPUT_RATIO: 0.4;
|
|
14
14
|
readonly FOOTER_RESERVED_LINES: 4;
|
|
15
15
|
};
|
|
16
16
|
};
|