@kooka/agent-sdk 0.1.0 → 0.1.4

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.
Files changed (35) hide show
  1. package/README.md +143 -2
  2. package/dist/agent/agent.d.ts +11 -0
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/agent.js +132 -7
  5. package/dist/agent/agent.js.map +1 -1
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +14 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/persistence/index.d.ts +5 -0
  11. package/dist/persistence/index.d.ts.map +1 -0
  12. package/dist/persistence/index.js +3 -0
  13. package/dist/persistence/index.js.map +1 -0
  14. package/dist/persistence/sessionSnapshot.d.ts +37 -0
  15. package/dist/persistence/sessionSnapshot.d.ts.map +1 -0
  16. package/dist/persistence/sessionSnapshot.js +53 -0
  17. package/dist/persistence/sessionSnapshot.js.map +1 -0
  18. package/dist/persistence/sqliteSessionStore.d.ts +38 -0
  19. package/dist/persistence/sqliteSessionStore.d.ts.map +1 -0
  20. package/dist/persistence/sqliteSessionStore.js +75 -0
  21. package/dist/persistence/sqliteSessionStore.js.map +1 -0
  22. package/dist/tools/agentBrowser.d.ts +131 -0
  23. package/dist/tools/agentBrowser.d.ts.map +1 -0
  24. package/dist/tools/agentBrowser.js +747 -0
  25. package/dist/tools/agentBrowser.js.map +1 -0
  26. package/dist/tools/builtin/index.d.ts +3 -0
  27. package/dist/tools/builtin/index.d.ts.map +1 -1
  28. package/dist/tools/builtin/index.js.map +1 -1
  29. package/dist/tools/builtin/skill.d.ts.map +1 -1
  30. package/dist/tools/builtin/skill.js +5 -7
  31. package/dist/tools/builtin/skill.js.map +1 -1
  32. package/dist/types.d.ts +12 -0
  33. package/dist/types.d.ts.map +1 -1
  34. package/package.json +19 -12
  35. package/LICENSE +0 -201
@@ -0,0 +1,131 @@
1
+ import type { ToolContext, ToolDefinition, ToolProvider, ToolResult } from '../types.js';
2
+ import type { Disposable, ToolRegistry } from './registry.js';
3
+ export type AgentBrowserRunAction = {
4
+ type: 'open';
5
+ url: string;
6
+ } | {
7
+ type: 'back';
8
+ } | {
9
+ type: 'forward';
10
+ } | {
11
+ type: 'reload';
12
+ } | {
13
+ type: 'click';
14
+ selector: string;
15
+ } | {
16
+ type: 'dblclick';
17
+ selector: string;
18
+ } | {
19
+ type: 'focus';
20
+ selector: string;
21
+ } | {
22
+ type: 'hover';
23
+ selector: string;
24
+ } | {
25
+ type: 'fill';
26
+ selector: string;
27
+ text: string;
28
+ } | {
29
+ type: 'type';
30
+ selector: string;
31
+ text: string;
32
+ } | {
33
+ type: 'press';
34
+ key: string;
35
+ } | {
36
+ type: 'select';
37
+ selector: string;
38
+ value: string;
39
+ } | {
40
+ type: 'check';
41
+ selector: string;
42
+ } | {
43
+ type: 'uncheck';
44
+ selector: string;
45
+ } | {
46
+ type: 'scroll';
47
+ direction: 'up' | 'down' | 'left' | 'right';
48
+ px?: number;
49
+ } | {
50
+ type: 'scrollIntoView';
51
+ selector: string;
52
+ } | {
53
+ type: 'wait';
54
+ ms?: number;
55
+ selector?: string;
56
+ text?: string;
57
+ url?: string;
58
+ load?: 'load' | 'domcontentloaded' | 'networkidle';
59
+ fn?: string;
60
+ } | {
61
+ type: 'get';
62
+ kind: 'text' | 'html' | 'value' | 'attr' | 'title' | 'url';
63
+ selector?: string;
64
+ attr?: string;
65
+ maxChars?: number;
66
+ } | {
67
+ type: 'screenshot';
68
+ name?: string;
69
+ fullPage?: boolean;
70
+ } | {
71
+ type: 'pdf';
72
+ name?: string;
73
+ } | {
74
+ type: 'traceStart';
75
+ name?: string;
76
+ } | {
77
+ type: 'traceStop';
78
+ name?: string;
79
+ };
80
+ export type AgentBrowserToolsOptions = {
81
+ enabled?: boolean;
82
+ timeoutMs?: number;
83
+ maxSnapshotChars?: number;
84
+ maxTextChars?: number;
85
+ defaultTtlMs?: number;
86
+ artifactsDir?: string;
87
+ allowHttp?: boolean;
88
+ allowPrivateHosts?: boolean;
89
+ agentBrowserBin?: string;
90
+ runner?: AgentBrowserRunner;
91
+ };
92
+ type AgentBrowserJson<T> = {
93
+ success: boolean;
94
+ data: T | null;
95
+ error: string | null;
96
+ };
97
+ export type AgentBrowserRunner = (args: string[], options: {
98
+ timeoutMs: number;
99
+ cwd: string;
100
+ bin: string;
101
+ }) => Promise<AgentBrowserJson<unknown>>;
102
+ export declare class AgentBrowserToolProvider implements ToolProvider {
103
+ private readonly options;
104
+ readonly id = "agent-browser";
105
+ readonly name = "Agent Browser";
106
+ private readonly enabled;
107
+ private readonly timeoutMs;
108
+ private readonly maxSnapshotChars;
109
+ private readonly maxTextChars;
110
+ private readonly artifactsDir;
111
+ private readonly allowHttp;
112
+ private readonly allowPrivateHosts;
113
+ private readonly runner;
114
+ private readonly sessions;
115
+ private readonly startSessionTool;
116
+ private readonly closeSessionTool;
117
+ private readonly snapshotTool;
118
+ private readonly runTool;
119
+ constructor(options?: AgentBrowserToolsOptions);
120
+ getTools(): ToolDefinition[];
121
+ dispose(): void;
122
+ executeTool(toolId: string, args: Record<string, unknown>, context: ToolContext): Promise<ToolResult>;
123
+ private handleStartSession;
124
+ private handleCloseSession;
125
+ private handleSnapshot;
126
+ private handleRun;
127
+ }
128
+ export declare function createAgentBrowserToolProvider(options?: AgentBrowserToolsOptions): AgentBrowserToolProvider;
129
+ export declare function registerAgentBrowserTools(registry: ToolRegistry, options?: AgentBrowserToolsOptions): Disposable;
130
+ export {};
131
+ //# sourceMappingURL=agentBrowser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentBrowser.d.ts","sourceRoot":"","sources":["../../src/tools/agentBrowser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG9D,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