autokap 1.0.2 → 1.0.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 (83) hide show
  1. package/dist/cli-config.d.ts +13 -0
  2. package/dist/cli-config.js +42 -0
  3. package/dist/cli-utils.d.ts +0 -19
  4. package/dist/cli-utils.js +2 -65
  5. package/dist/cli.d.ts +0 -1
  6. package/dist/cli.js +266 -305
  7. package/package.json +26 -19
  8. package/assets/chrome/ios-statusbar-comparison-reference.jpg +0 -0
  9. package/assets/chrome/ios-statusbar-dark-reference.jpg +0 -0
  10. package/assets/chrome/ios-statusbar-light-reference.jpg +0 -0
  11. package/assets/devices/ipad-pro-11-m4.json +0 -52
  12. package/assets/devices/iphone-16-pro.json +0 -53
  13. package/assets/devices/macbook-air-13.json +0 -45
  14. package/assets/frames/MacBook Air 13.svg +0 -242
  15. package/assets/frames/Status bar - iPhone.png +0 -0
  16. package/assets/frames/Status bar and Menu bar- iPad.png +0 -0
  17. package/assets/frames/iPad Pro M4 11_.png +0 -0
  18. package/assets/frames/iPhone 16 Pro.png +0 -0
  19. package/assets/icons/Cellular Connection.svg +0 -3
  20. package/assets/icons/Union.svg +0 -6
  21. package/assets/icons/Wifi.svg +0 -3
  22. package/assets/icons/battery.svg +0 -5
  23. package/assets/icons/battery_charging.svg +0 -8
  24. package/dist/abort.d.ts +0 -5
  25. package/dist/abort.js +0 -44
  26. package/dist/agent.d.ts +0 -142
  27. package/dist/agent.js +0 -4504
  28. package/dist/browser-bar.d.ts +0 -40
  29. package/dist/browser-bar.js +0 -147
  30. package/dist/clip-orchestrator.d.ts +0 -148
  31. package/dist/clip-orchestrator.js +0 -950
  32. package/dist/clip-postprocess.d.ts +0 -42
  33. package/dist/clip-postprocess.js +0 -192
  34. package/dist/credential-templates.d.ts +0 -5
  35. package/dist/credential-templates.js +0 -60
  36. package/dist/element-capture.d.ts +0 -53
  37. package/dist/element-capture.js +0 -766
  38. package/dist/hybrid-navigator.d.ts +0 -138
  39. package/dist/hybrid-navigator.js +0 -468
  40. package/dist/index.d.ts +0 -15
  41. package/dist/index.js +0 -11
  42. package/dist/llm-usage.d.ts +0 -17
  43. package/dist/llm-usage.js +0 -45
  44. package/dist/mockup-html.d.ts +0 -119
  45. package/dist/mockup-html.js +0 -253
  46. package/dist/mockup.d.ts +0 -94
  47. package/dist/mockup.js +0 -604
  48. package/dist/mouse-animation.d.ts +0 -46
  49. package/dist/mouse-animation.js +0 -100
  50. package/dist/overlay-utils.d.ts +0 -14
  51. package/dist/overlay-utils.js +0 -13
  52. package/dist/posthog.d.ts +0 -4
  53. package/dist/posthog.js +0 -26
  54. package/dist/prompt-cache.d.ts +0 -10
  55. package/dist/prompt-cache.js +0 -24
  56. package/dist/prompts.d.ts +0 -167
  57. package/dist/prompts.js +0 -1165
  58. package/dist/security.d.ts +0 -20
  59. package/dist/security.js +0 -569
  60. package/dist/session-profile.d.ts +0 -86
  61. package/dist/session-profile.js +0 -1471
  62. package/dist/sf-pro-fonts.d.ts +0 -4
  63. package/dist/sf-pro-fonts.js +0 -7
  64. package/dist/status-bar-l10n.d.ts +0 -14
  65. package/dist/status-bar-l10n.js +0 -177
  66. package/dist/status-bar.d.ts +0 -44
  67. package/dist/status-bar.js +0 -336
  68. package/dist/tools.d.ts +0 -4
  69. package/dist/tools.js +0 -578
  70. package/dist/video-agent.d.ts +0 -143
  71. package/dist/video-agent.js +0 -4783
  72. package/dist/video-observation.d.ts +0 -36
  73. package/dist/video-observation.js +0 -192
  74. package/dist/video-planner.d.ts +0 -12
  75. package/dist/video-planner.js +0 -500
  76. package/dist/video-prompts.d.ts +0 -37
  77. package/dist/video-prompts.js +0 -554
  78. package/dist/video-tools.d.ts +0 -3
  79. package/dist/video-tools.js +0 -59
  80. package/dist/video-variant-state.d.ts +0 -29
  81. package/dist/video-variant-state.js +0 -80
  82. package/dist/vision-model.d.ts +0 -17
  83. package/dist/vision-model.js +0 -74
package/dist/agent.d.ts DELETED
@@ -1,142 +0,0 @@
1
- import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
2
- import { Browser } from './browser.js';
3
- import type { BrowserObservation, BrowserVerificationBundle } from './browser.js';
4
- import type { AgentConfig, AgentResult, ExecutedAction, ActionType, InteractiveElement, PageState, VariantCaptureManifest, VerificationResult } from './types.js';
5
- export declare function inferVariantIdentityFailure(params: {
6
- pageId?: string | null;
7
- prompt: string;
8
- currentUrl: string;
9
- visibleText: string;
10
- dialogCount: number;
11
- pageIdentity?: VariantCaptureManifest["currentPageIdentity"];
12
- }): string | null;
13
- export declare function inferDeterministicReadyDecision(params: {
14
- observation: BrowserObservation;
15
- assessment: string;
16
- targetUrl: string;
17
- skipDialogCheck?: boolean;
18
- allowSuccess?: boolean;
19
- }): {
20
- verified: boolean;
21
- reason?: string;
22
- } | null;
23
- export declare function inferManifestReadyDecision(params: {
24
- observation: BrowserObservation;
25
- assessment: string;
26
- config: AgentConfig;
27
- bundle: BrowserVerificationBundle;
28
- }): {
29
- verified: boolean;
30
- reason?: string;
31
- } | null;
32
- /**
33
- * Page-signal deterministic verification: accepts when ALL of the following hold:
34
- * 1. Assessment text parses as positive (caller already believes ready)
35
- * 2. inferVariantIdentityFailure finds no identity mismatch
36
- * 3. No loading indicators, readyState === 'complete'
37
- * 4. No hard variant (lang/theme) mismatch
38
- * 5. No unexpected dialog blocking the page (unless dialog is the target)
39
- *
40
- * Returns { verified: true } when confident, null when inconclusive (→ LLM).
41
- * NEVER returns { verified: false } — absence of evidence is not evidence of absence.
42
- */
43
- export declare function inferPageSignalReadyDecision(params: {
44
- observation: BrowserObservation;
45
- assessment: string;
46
- config: AgentConfig;
47
- bundle: BrowserVerificationBundle;
48
- identityFailure: string | null;
49
- }): {
50
- verified: boolean;
51
- } | null;
52
- /**
53
- * Fast-path optimization: extract a PASS/FAIL verdict from LLM text output
54
- * using keyword matching, avoiding a separate LLM call when the signal is clear.
55
- *
56
- * Returns null when uncertain — the caller MUST fall back to an LLM vision call.
57
- * Do not add more patterns here; expand LLM fallback coverage instead.
58
- */
59
- export declare function parseVerificationDecisionText(content: string): {
60
- verified: boolean;
61
- reason?: string;
62
- } | null;
63
- export declare function inferActionFromAssistantText(content: string): {
64
- name: ActionType;
65
- args: Record<string, unknown>;
66
- } | null;
67
- export declare function executeAction(browser: Browser, action: ActionType, args: Record<string, unknown>): Promise<{
68
- success: boolean;
69
- error?: string;
70
- outcome?: string;
71
- stateChanged?: boolean;
72
- }>;
73
- export declare function verifyCaptureReadiness(browser: Browser, config: AgentConfig, apiKey: string, options?: {
74
- assessment?: string;
75
- stepNumber?: number;
76
- }): Promise<VerificationResult>;
77
- export declare function getLivePreviewScreenshot(pageState: Pick<PageState, 'cleanScreenshot' | 'screenshot'>): Buffer;
78
- export declare function analyzeReplayCandidate(recordedActions: ExecutedAction[], params?: {
79
- currentUrl?: string;
80
- targetUrl?: string;
81
- currentViewport?: {
82
- width: number;
83
- height: number;
84
- } | null;
85
- isAuthenticated?: boolean;
86
- currentDialogCount?: number | null;
87
- pageIdentity?: VariantCaptureManifest['currentPageIdentity'] | null;
88
- }): {
89
- replayableActions: ExecutedAction[];
90
- skipReason: string | null;
91
- };
92
- export declare function matchRecordedActionToElement(action: Pick<ExecutedAction, 'params'>, interactiveElements: InteractiveElement[]): InteractiveElement | null;
93
- export declare function resolveReplayActionArgs(action: ExecutedAction, interactiveElements: InteractiveElement[]): {
94
- args: Record<string, unknown> | null;
95
- reason: string | null;
96
- };
97
- export declare function compactReplayActions(recordedActions: ExecutedAction[], params?: {
98
- currentUrl?: string;
99
- targetUrl?: string;
100
- currentViewport?: {
101
- width: number;
102
- height: number;
103
- } | null;
104
- /** When true, filter out login/auth actions (session already active). */
105
- isAuthenticated?: boolean;
106
- }): ExecutedAction[];
107
- export declare function countRecentNoEffectActions(actionHistory: ExecutedAction[]): number;
108
- export declare function shouldTriggerRecovery(actionHistory: ExecutedAction[]): boolean;
109
- export declare function inferPrematureGiveUpCorrection(params: {
110
- reason: string;
111
- actionHistory: ExecutedAction[];
112
- lastVerificationFailure?: string;
113
- iteration: number;
114
- maxIterations: number;
115
- }): string | null;
116
- export declare function inferRepeatedActionGuard(params: {
117
- actionHistory: ExecutedAction[];
118
- action: ActionType;
119
- args: Record<string, unknown>;
120
- currentUrl?: string;
121
- }): string | null;
122
- export interface WorkflowCacheEntry {
123
- subgoalName: string;
124
- actionSummary: string;
125
- selectors: string[];
126
- }
127
- export declare function findReusableWorkflow(workflowCache: WorkflowCacheEntry[], subgoalName: string): WorkflowCacheEntry | null;
128
- /**
129
- * Trim the conversation thread to avoid context window overflow.
130
- * Always preserves the first `preservedPrefixMessages` entries, then the last maxMessages messages.
131
- * Also compresses old screenshots and DOM blocks to save tokens.
132
- */
133
- export declare function trimConversationHistory(messages: ChatCompletionMessageParam[], maxMessages?: number, preservedPrefixMessages?: number): void;
134
- export declare function runAgent(browser: Browser, config: AgentConfig, apiKey: string): Promise<AgentResult>;
135
- /**
136
- * Replay a previous successful capture's recorded actions instead of running the full AI agent.
137
- * Falls back to a full runAgent if replay fails or verification doesn't pass.
138
- * Much cheaper than a full agent run: only 1 verification call vs. N agent iterations.
139
- */
140
- export declare function replayAgent(browser: Browser, config: AgentConfig, apiKey: string, recordedActions: ExecutedAction[], options?: {
141
- allowFullAgentFallback?: boolean;
142
- }): Promise<AgentResult>;