stk-codegen 1.0.5 → 1.0.6

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 CHANGED
@@ -1,2 +1,4 @@
1
- import React from 'react';
2
- export declare const App: () => React.JSX.Element;
1
+ import { FC } from 'react';
2
+ export declare const App: FC<{
3
+ autonomous?: boolean;
4
+ }>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const BootstrapStatus: () => React.JSX.Element;
3
+ export default BootstrapStatus;
@@ -1,13 +1,20 @@
1
- import React from 'react';
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
- conversation: ConversationMessage[];
6
- activeShellCommand: any;
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
- handleShellCompletion: (result: any) => void;
9
- pendingShellCommand: PendingShellCommand | null;
10
- isFullReviewView: boolean;
15
+ sendInputToShell: (input: string) => void;
16
+ onApproveDiff: (editedContent?: string) => void;
17
+ onRejectDiff: () => void;
11
18
  }
12
- export declare const Conversation: React.FC<ConversationProps>;
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: string;
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
- onComplete?: (action: 'accept' | 'reject' | 'edit', editedContent?: string) => void;
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>;
@@ -8,6 +8,7 @@ interface Props {
8
8
  }) => Promise<string[]>;
9
9
  isShellActive?: boolean;
10
10
  setShowEscapeClear: (show: boolean) => void;
11
+ isActive: boolean;
11
12
  }
12
- declare const _default: React.MemoExoticComponent<({ value, onChange, onSubmit, searchFiles, isShellActive, setShowEscapeClear, }: Props) => React.JSX.Element>;
13
+ declare const _default: React.MemoExoticComponent<({ value, onChange, onSubmit, searchFiles, isShellActive, setShowEscapeClear, isActive, }: Props) => React.JSX.Element>;
13
14
  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
- isFullReviewView: boolean;
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,12 @@ 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
+ };
7
13
  }
8
14
  declare const ShellExecution: React.FC<ShellExecutionProps>;
9
15
  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,65 @@
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
+ diffText: string;
54
+ } | {
55
+ type: 'DIFF_REVIEW_RESOLVED';
56
+ reviewId: DiffReviewId;
57
+ result: 'accepted' | 'rejected';
58
+ } | {
59
+ type: 'ERROR_OCCURRED';
60
+ message: string;
61
+ } | {
62
+ type: 'BOOTSTRAP_STARTED';
63
+ } | {
64
+ type: 'BOOTSTRAP_FINISHED';
65
+ };
@@ -0,0 +1,4 @@
1
+ import { CoreState } from './types.js';
2
+ import { CoreEvent } from './events.js';
3
+ export declare const initialCoreState: CoreState;
4
+ export declare function reduceCoreState(state: CoreState, event: CoreEvent): CoreState;
@@ -0,0 +1,53 @@
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
+ diffText: string;
33
+ status: 'pending' | 'accepted' | 'rejected';
34
+ }
35
+ export interface CoreAgentStatus {
36
+ label: string;
37
+ detail?: string;
38
+ phase: 'idle' | 'thinking' | 'streaming' | 'waiting_tool' | 'running_tool';
39
+ }
40
+ export interface CoreStreamState {
41
+ currentMessageId?: CoreMessageId;
42
+ buffer: string;
43
+ status: 'idle' | 'streaming' | 'finished';
44
+ }
45
+ export interface CoreState {
46
+ messages: CoreMessage[];
47
+ shellRuns: CoreShellRun[];
48
+ diffReviews: CoreDiffReview[];
49
+ agentStatus: CoreAgentStatus;
50
+ stream: CoreStreamState;
51
+ isBootstrapping: boolean;
52
+ bootstrapFinished: boolean;
53
+ }
Binary file
@@ -1,7 +1,8 @@
1
1
  import { ChildProcess } from 'child_process';
2
- import { ConversationMessage, PendingShellCommand } from '../types/index.js';
3
- export declare const useAgent: () => {
4
- conversation: ConversationMessage[];
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;
@@ -28,5 +29,7 @@ export declare const useAgent: () => {
28
29
  resetHistory: () => void;
29
30
  cancelCurrentInteraction: () => void;
30
31
  activeGenerationId: string | null;
32
+ coreState: import("../core/agent/types.js").CoreState;
33
+ coreViewModel: import("../ui/agent/buildInkViewModel.js").InkViewModel;
31
34
  hasCodegenSpec: boolean;
32
35
  };