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.
@@ -0,0 +1,24 @@
1
+ export interface ClipboardImage {
2
+ base64: string;
3
+ mimeType: string;
4
+ }
5
+ /**
6
+ * Best-effort helper to read an image from the system clipboard and return it
7
+ * as a base64 string.
8
+ *
9
+ * Strategy on macOS:
10
+ * - First, try `pngpaste` if it is available on the system PATH. This is very
11
+ * robust for typical PNG clipboard contents.
12
+ * - If `pngpaste` is not available or fails, fall back to an AppleScript that
13
+ * writes the clipboard image (PNG/TIFF/JPEG) to a file in a user/project
14
+ * context directory (instead of /tmp), which we then read from Node.
15
+ *
16
+ * Other platforms currently return null (no-op) until we implement proper
17
+ * portable support.
18
+ */
19
+ export declare function readClipboardImageAsBase64(baseDir?: string): Promise<ClipboardImage | null>;
20
+ /**
21
+ * Best-effort cleanup: remove old clipboard image files created by this
22
+ * service. Files are identified by the `clipboard-` prefix and `maxAgeMs`.
23
+ */
24
+ export declare function cleanupOldClipboardImages(baseDir?: string, maxAgeMs?: number): Promise<void>;
@@ -1,12 +1,14 @@
1
- import axios from 'axios';
2
1
  import { execSync } from 'child_process';
2
+ export type HttpGet = <T = unknown>(url: string) => Promise<{
3
+ data: T;
4
+ }>;
3
5
  export type VersionCheckDeps = {
4
- axiosGet: typeof axios.get;
6
+ httpGet: HttpGet;
5
7
  execSync: typeof execSync;
6
8
  exit: (code: number) => never;
7
9
  log: typeof console.log;
8
10
  error: typeof console.error;
9
11
  env: NodeJS.ProcessEnv;
10
12
  };
11
- export declare function checkCliVersionWithDeps({ axiosGet, execSync, exit, log, error: logError, env, }: VersionCheckDeps): Promise<void>;
13
+ export declare function checkCliVersionWithDeps({ httpGet, execSync, exit, log, error: logError, env, }: VersionCheckDeps): Promise<void>;
12
14
  export declare function checkCliVersion(): Promise<void>;
@@ -1,2 +1,3 @@
1
1
  import { ChildProcess } from 'child_process';
2
- export declare const runShellCommand: (command: string, cwd: string) => ChildProcess;
2
+ export type ShellProcess = ChildProcess;
3
+ export declare const runShellCommand: (command: string, cwd: string) => ShellProcess;
@@ -1,6 +1,6 @@
1
1
  export interface ConversationMessage {
2
- id: number;
3
- sender: 'user' | 'agent' | 'tool' | 'agent_thought' | 'agent_error' | 'system';
2
+ id: string;
3
+ sender: 'user' | 'agent' | 'tool_execution' | 'agent_thought' | 'agent_error' | 'system' | 'shell';
4
4
  text: string;
5
5
  toolName?: string;
6
6
  toolParams?: Record<string, any>;
@@ -9,11 +9,6 @@ export interface ConversationMessage {
9
9
  status: 'streaming' | 'finished';
10
10
  content?: string;
11
11
  };
12
- filePath?: string;
13
- action?: string;
14
- oldContent?: string;
15
- newContent?: string;
16
- onComplete?: (action: 'accept' | 'reject' | 'edit', editedContent?: string) => void;
17
12
  }
18
13
  export interface PendingShellCommand {
19
14
  tool_name: string;
@@ -59,6 +54,10 @@ export interface UserMessage {
59
54
  type: 'user_message';
60
55
  payload: {
61
56
  prompt: string;
57
+ images?: {
58
+ base64: string;
59
+ mimeType: string;
60
+ }[];
62
61
  };
63
62
  }
64
63
  export interface MagicCommand {
@@ -0,0 +1,53 @@
1
+ import { CoreState } from '../../core/agent/types.js';
2
+ export interface StaticMessageView {
3
+ id: string;
4
+ role: 'user' | 'agent' | 'tool_execution' | 'shell' | 'system' | 'agent_error' | 'agent_thought';
5
+ text: string;
6
+ toolName?: string;
7
+ toolParams?: Record<string, any>;
8
+ status?: 'running' | 'finished' | 'error';
9
+ isBootstrap?: boolean;
10
+ }
11
+ export interface ShellRunView {
12
+ id: string;
13
+ command: string;
14
+ status: 'pending' | 'running' | 'finished' | 'error' | 'cancelled';
15
+ stdout: string;
16
+ stderr: string;
17
+ /**
18
+ * Saída agregada (stdout + stderr) em forma já limpa para
19
+ * renderização, potencialmente truncada apenas do ponto de
20
+ * vista visual (o CoreState continua contendo a saída completa).
21
+ */
22
+ visibleOutput: string;
23
+ /**
24
+ * Indica se a saída visual foi truncada em relação à saída real.
25
+ */
26
+ isVisuallyTruncated: boolean;
27
+ /**
28
+ * Número total de linhas de saída (stdout + stderr) no core.
29
+ */
30
+ totalLines: number;
31
+ /**
32
+ * Número de linhas efetivamente renderizadas na UI.
33
+ */
34
+ visibleLinesCount: number;
35
+ }
36
+ export interface DiffReviewView {
37
+ id: string;
38
+ title?: string;
39
+ toolName?: string;
40
+ toolParams?: Record<string, any>;
41
+ oldContent: string;
42
+ newContent: string;
43
+ status: 'pending' | 'accepted' | 'rejected';
44
+ }
45
+ export interface InkViewModel {
46
+ staticMessages: StaticMessageView[];
47
+ liveAgentMessage?: StaticMessageView;
48
+ activeShellRun?: ShellRunView;
49
+ activeDiffReview?: DiffReviewView;
50
+ agentStatusLabel: string;
51
+ agentStatusPhase: string;
52
+ }
53
+ export declare function buildInkViewModel(state: CoreState): InkViewModel;
@@ -0,0 +1,7 @@
1
+ import { CoreMessage } from '../../core/agent/types.js';
2
+ import { ConversationMessage } from '../../types/index.js';
3
+ /**
4
+ * Helper centralizado para mapear mensagens do core para o formato
5
+ * usado atualmente pelos componentes de conversa.
6
+ */
7
+ export declare function mapCoreMessageToConversation(message: CoreMessage): ConversationMessage;
@@ -1 +1 @@
1
- export declare const getToolDisplayMessage: (toolName: string, parameters: any) => string;
1
+ export declare const buildFriendlyLabel: (toolName: string, toolParams?: Record<string, any>) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stk-codegen",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A CLI executor for the autonomous agent.",
5
5
  "main": "index.js",
6
6
  "bin": {