outcome-cli 1.0.0
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/README.md +261 -0
- package/package.json +95 -0
- package/src/agents/README.md +139 -0
- package/src/agents/adapters/anthropic.adapter.ts +166 -0
- package/src/agents/adapters/dalle.adapter.ts +145 -0
- package/src/agents/adapters/gemini.adapter.ts +134 -0
- package/src/agents/adapters/imagen.adapter.ts +106 -0
- package/src/agents/adapters/nano-banana.adapter.ts +129 -0
- package/src/agents/adapters/openai.adapter.ts +165 -0
- package/src/agents/adapters/veo.adapter.ts +130 -0
- package/src/agents/agent.schema.property.test.ts +379 -0
- package/src/agents/agent.schema.test.ts +148 -0
- package/src/agents/agent.schema.ts +263 -0
- package/src/agents/index.ts +60 -0
- package/src/agents/registered-agent.schema.ts +356 -0
- package/src/agents/registry.ts +97 -0
- package/src/agents/tournament-configs.property.test.ts +266 -0
- package/src/cli/README.md +145 -0
- package/src/cli/commands/define.ts +79 -0
- package/src/cli/commands/list.ts +46 -0
- package/src/cli/commands/logs.ts +83 -0
- package/src/cli/commands/run.ts +416 -0
- package/src/cli/commands/verify.ts +110 -0
- package/src/cli/index.ts +81 -0
- package/src/config/README.md +128 -0
- package/src/config/env.ts +262 -0
- package/src/config/index.ts +19 -0
- package/src/eval/README.md +318 -0
- package/src/eval/ai-judge.test.ts +435 -0
- package/src/eval/ai-judge.ts +368 -0
- package/src/eval/code-validators.ts +414 -0
- package/src/eval/evaluateOutcome.property.test.ts +1174 -0
- package/src/eval/evaluateOutcome.ts +591 -0
- package/src/eval/immigration-validators.ts +122 -0
- package/src/eval/index.ts +90 -0
- package/src/eval/judge-cache.ts +402 -0
- package/src/eval/tournament-validators.property.test.ts +439 -0
- package/src/eval/validators.property.test.ts +1118 -0
- package/src/eval/validators.ts +1199 -0
- package/src/eval/weighted-scorer.ts +285 -0
- package/src/index.ts +17 -0
- package/src/league/README.md +188 -0
- package/src/league/health-check.ts +353 -0
- package/src/league/index.ts +93 -0
- package/src/league/killAgent.ts +151 -0
- package/src/league/league.test.ts +1151 -0
- package/src/league/runLeague.ts +843 -0
- package/src/league/scoreAgent.ts +175 -0
- package/src/modules/omnibridge/__tests__/.gitkeep +1 -0
- package/src/modules/omnibridge/__tests__/auth-tunnel.property.test.ts +524 -0
- package/src/modules/omnibridge/__tests__/deterministic-logger.property.test.ts +965 -0
- package/src/modules/omnibridge/__tests__/ghost-api.property.test.ts +461 -0
- package/src/modules/omnibridge/__tests__/omnibridge-integration.test.ts +542 -0
- package/src/modules/omnibridge/__tests__/parallel-executor.property.test.ts +671 -0
- package/src/modules/omnibridge/__tests__/semantic-normalizer.property.test.ts +521 -0
- package/src/modules/omnibridge/__tests__/semantic-normalizer.test.ts +254 -0
- package/src/modules/omnibridge/__tests__/session-vault.property.test.ts +367 -0
- package/src/modules/omnibridge/__tests__/shadow-session.property.test.ts +523 -0
- package/src/modules/omnibridge/__tests__/triangulation-engine.property.test.ts +292 -0
- package/src/modules/omnibridge/__tests__/verification-engine.property.test.ts +769 -0
- package/src/modules/omnibridge/api/.gitkeep +1 -0
- package/src/modules/omnibridge/api/ghost-api.ts +1087 -0
- package/src/modules/omnibridge/auth/.gitkeep +1 -0
- package/src/modules/omnibridge/auth/auth-tunnel.ts +843 -0
- package/src/modules/omnibridge/auth/session-vault.ts +577 -0
- package/src/modules/omnibridge/core/.gitkeep +1 -0
- package/src/modules/omnibridge/core/semantic-normalizer.ts +702 -0
- package/src/modules/omnibridge/core/triangulation-engine.ts +530 -0
- package/src/modules/omnibridge/core/types.ts +610 -0
- package/src/modules/omnibridge/execution/.gitkeep +1 -0
- package/src/modules/omnibridge/execution/deterministic-logger.ts +629 -0
- package/src/modules/omnibridge/execution/parallel-executor.ts +542 -0
- package/src/modules/omnibridge/execution/shadow-session.ts +794 -0
- package/src/modules/omnibridge/index.ts +212 -0
- package/src/modules/omnibridge/omnibridge.ts +510 -0
- package/src/modules/omnibridge/verification/.gitkeep +1 -0
- package/src/modules/omnibridge/verification/verification-engine.ts +783 -0
- package/src/outcomes/README.md +75 -0
- package/src/outcomes/acquire-pilot-customer.ts +297 -0
- package/src/outcomes/code-delivery-outcomes.ts +89 -0
- package/src/outcomes/code-outcomes.ts +256 -0
- package/src/outcomes/code_review_battle.test.ts +135 -0
- package/src/outcomes/code_review_battle.ts +135 -0
- package/src/outcomes/cold_email_battle.ts +97 -0
- package/src/outcomes/content_creation_battle.ts +160 -0
- package/src/outcomes/f1_stem_opt_compliance.ts +61 -0
- package/src/outcomes/index.ts +107 -0
- package/src/outcomes/lead_gen_battle.test.ts +113 -0
- package/src/outcomes/lead_gen_battle.ts +99 -0
- package/src/outcomes/outcome.schema.property.test.ts +229 -0
- package/src/outcomes/outcome.schema.ts +187 -0
- package/src/outcomes/qualified_sales_interest.ts +118 -0
- package/src/outcomes/swarm_planner.property.test.ts +370 -0
- package/src/outcomes/swarm_planner.ts +96 -0
- package/src/outcomes/web_extraction.ts +234 -0
- package/src/runtime/README.md +220 -0
- package/src/runtime/agentRunner.test.ts +341 -0
- package/src/runtime/agentRunner.ts +746 -0
- package/src/runtime/claudeAdapter.ts +232 -0
- package/src/runtime/costTracker.ts +123 -0
- package/src/runtime/index.ts +34 -0
- package/src/runtime/modelAdapter.property.test.ts +305 -0
- package/src/runtime/modelAdapter.ts +144 -0
- package/src/runtime/openaiAdapter.ts +235 -0
- package/src/utils/README.md +122 -0
- package/src/utils/command-runner.ts +134 -0
- package/src/utils/cost-guard.ts +379 -0
- package/src/utils/errors.test.ts +290 -0
- package/src/utils/errors.ts +442 -0
- package/src/utils/index.ts +37 -0
- package/src/utils/logger.test.ts +361 -0
- package/src/utils/logger.ts +419 -0
- package/src/utils/output-parsers.ts +216 -0
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OmniBridge Core Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the Semantic Engine that powers deterministic
|
|
5
|
+
* web-agency within the WAIESL ecosystem.
|
|
6
|
+
*
|
|
7
|
+
* Requirements: 1.1, 2.1, 3.4
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Intent Document Types (Semantic Normalizer Output)
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Semantic identifier for DOM elements.
|
|
16
|
+
* Replaces CSS selectors with semantic meaning.
|
|
17
|
+
*
|
|
18
|
+
* Example: "ACTION_ID:SUBMIT_PURCHASE" instead of "<button class='blue-400'>"
|
|
19
|
+
*/
|
|
20
|
+
export interface IntentId {
|
|
21
|
+
/** Category of the element's purpose */
|
|
22
|
+
category: 'ACTION' | 'INPUT' | 'DISPLAY' | 'NAV';
|
|
23
|
+
/** Specific purpose (e.g., "SUBMIT_PURCHASE", "LOGIN", "SEARCH") */
|
|
24
|
+
purpose: string;
|
|
25
|
+
/** Confidence score for the assigned intent (0-1) */
|
|
26
|
+
confidence: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A single element in the Intent Document.
|
|
31
|
+
* Contains semantic information only - no CSS selectors.
|
|
32
|
+
*/
|
|
33
|
+
export interface IntentElement {
|
|
34
|
+
/** Semantic identifier (e.g., "ACTION_ID:SUBMIT_PURCHASE") */
|
|
35
|
+
intentId: string;
|
|
36
|
+
/** Role of the element in the page */
|
|
37
|
+
role: 'action' | 'input' | 'display' | 'navigation';
|
|
38
|
+
/** Human-readable label */
|
|
39
|
+
label: string;
|
|
40
|
+
/** ARIA role if present */
|
|
41
|
+
ariaRole?: string;
|
|
42
|
+
/** Nearby text for disambiguation */
|
|
43
|
+
contextHints: string[];
|
|
44
|
+
/** Original element tag name for reference */
|
|
45
|
+
tagName: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Form field information extracted from the DOM.
|
|
51
|
+
*/
|
|
52
|
+
export interface IntentFormField {
|
|
53
|
+
/** Semantic identifier for the field */
|
|
54
|
+
intentId: string;
|
|
55
|
+
/** Field name attribute */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Field type (text, email, password, etc.) */
|
|
58
|
+
type: string;
|
|
59
|
+
/** Human-readable label */
|
|
60
|
+
label: string;
|
|
61
|
+
/** Whether the field is required */
|
|
62
|
+
required: boolean;
|
|
63
|
+
/** Validation rules if present */
|
|
64
|
+
validationRules?: string[];
|
|
65
|
+
/** Placeholder text */
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Form structure extracted from the DOM.
|
|
71
|
+
*/
|
|
72
|
+
export interface IntentForm {
|
|
73
|
+
/** Semantic identifier for the form */
|
|
74
|
+
intentId: string;
|
|
75
|
+
/** Form action URL */
|
|
76
|
+
action?: string;
|
|
77
|
+
/** HTTP method */
|
|
78
|
+
method: 'GET' | 'POST';
|
|
79
|
+
/** Fields in the form */
|
|
80
|
+
fields: IntentFormField[];
|
|
81
|
+
/** Submit button intent ID */
|
|
82
|
+
submitButtonId?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Navigation structure extracted from the DOM.
|
|
87
|
+
*/
|
|
88
|
+
export interface IntentNavigation {
|
|
89
|
+
/** Primary navigation links */
|
|
90
|
+
primaryLinks: Array<{
|
|
91
|
+
intentId: string;
|
|
92
|
+
label: string;
|
|
93
|
+
href: string;
|
|
94
|
+
}>;
|
|
95
|
+
/** Breadcrumb trail if present */
|
|
96
|
+
breadcrumbs?: Array<{
|
|
97
|
+
label: string;
|
|
98
|
+
href?: string;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The complete Intent Document - output of Semantic Normalizer.
|
|
104
|
+
* This is what agents see instead of raw HTML.
|
|
105
|
+
*/
|
|
106
|
+
export interface IntentDocument {
|
|
107
|
+
/** All semantic elements on the page */
|
|
108
|
+
elements: IntentElement[];
|
|
109
|
+
/** Forms extracted from the page */
|
|
110
|
+
forms: IntentForm[];
|
|
111
|
+
/** Navigation structure */
|
|
112
|
+
navigation: IntentNavigation;
|
|
113
|
+
/** Time to build this document in milliseconds (target: <100ms) */
|
|
114
|
+
buildTimeMs: number;
|
|
115
|
+
/** Token reduction percentage achieved (target: 90%) */
|
|
116
|
+
tokenReduction: number;
|
|
117
|
+
/** Original URL of the page */
|
|
118
|
+
sourceUrl: string;
|
|
119
|
+
/** Timestamp when document was created */
|
|
120
|
+
createdAt: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// Triangulation Engine Types (Self-Healing Anchors)
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Spatial anchor - position-based element identification.
|
|
130
|
+
*/
|
|
131
|
+
export interface SpatialAnchor {
|
|
132
|
+
/** Region of the page where element is located */
|
|
133
|
+
region: 'header' | 'main' | 'sidebar' | 'footer';
|
|
134
|
+
/** Normalized position (0-1 for both x and y) */
|
|
135
|
+
relativePosition: { x: number; y: number };
|
|
136
|
+
/** Nearby landmark elements for reference */
|
|
137
|
+
nearbyLandmarks: string[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Semantic anchor - meaning-based element identification.
|
|
142
|
+
*/
|
|
143
|
+
export interface SemanticAnchor {
|
|
144
|
+
/** Semantic identifier */
|
|
145
|
+
intentId: string;
|
|
146
|
+
/** Associated labels */
|
|
147
|
+
labels: string[];
|
|
148
|
+
/** ARIA roles */
|
|
149
|
+
ariaRoles: string[];
|
|
150
|
+
/** Text content of the element */
|
|
151
|
+
textContent: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Functional anchor - behavior-based element identification.
|
|
156
|
+
*/
|
|
157
|
+
export interface FunctionalAnchor {
|
|
158
|
+
/** Event types the element responds to */
|
|
159
|
+
eventTypes: string[];
|
|
160
|
+
/** Form target if element is part of a form */
|
|
161
|
+
formTarget?: string;
|
|
162
|
+
/** Navigation target if element is a link */
|
|
163
|
+
navigationTarget?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Complete anchor set for an element.
|
|
168
|
+
* Used by Triangulation Engine for self-healing.
|
|
169
|
+
*/
|
|
170
|
+
export interface AnchorSet {
|
|
171
|
+
/** Position-based anchor */
|
|
172
|
+
spatial: SpatialAnchor;
|
|
173
|
+
/** Meaning-based anchor */
|
|
174
|
+
semantic: SemanticAnchor;
|
|
175
|
+
/** Behavior-based anchor */
|
|
176
|
+
functional: FunctionalAnchor;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Result of attempting to locate an element using anchors.
|
|
181
|
+
*/
|
|
182
|
+
export interface LocateResult {
|
|
183
|
+
/** Whether the element was found */
|
|
184
|
+
found: boolean;
|
|
185
|
+
/** The located element if found */
|
|
186
|
+
element?: IntentElement;
|
|
187
|
+
/** Number of anchors that matched (0-3) */
|
|
188
|
+
matchedAnchors: number;
|
|
189
|
+
/** Confidence score for the match (0-1) */
|
|
190
|
+
confidence: number;
|
|
191
|
+
/** Whether this result should be flagged for human review */
|
|
192
|
+
flaggedForReview?: boolean;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Result of healing (re-locating) an element after UI changes.
|
|
197
|
+
*/
|
|
198
|
+
export interface HealResult {
|
|
199
|
+
/** Whether healing was successful */
|
|
200
|
+
healed: boolean;
|
|
201
|
+
/** Updated anchors if healing succeeded */
|
|
202
|
+
newAnchors?: AnchorSet;
|
|
203
|
+
/** Description of what changed */
|
|
204
|
+
changeLog: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
// =============================================================================
|
|
209
|
+
// Ghost-API Types (Clean JSON Interface)
|
|
210
|
+
// =============================================================================
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Definition of a goal for the Ghost-API.
|
|
214
|
+
*/
|
|
215
|
+
export interface GoalDefinition {
|
|
216
|
+
/** Name of the goal (e.g., "Fetch_Invoice_Data") */
|
|
217
|
+
name: string;
|
|
218
|
+
/** Target URL to operate on */
|
|
219
|
+
targetUrl: string;
|
|
220
|
+
/** Plain English description of the goal */
|
|
221
|
+
description: string;
|
|
222
|
+
/** Optional output schema (will be inferred if not provided) */
|
|
223
|
+
outputSchema?: Record<string, unknown>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Mapping from a goal to a Ghost-API endpoint.
|
|
228
|
+
*/
|
|
229
|
+
export interface SchemaMapping {
|
|
230
|
+
/** Generated endpoint path (e.g., "/omni-bridge/invoice-portal/latest") */
|
|
231
|
+
endpoint: string;
|
|
232
|
+
/** JSON schema for the response */
|
|
233
|
+
schema: Record<string, unknown>;
|
|
234
|
+
/** Whether authentication is required */
|
|
235
|
+
requiredAuth: boolean;
|
|
236
|
+
/** Estimated number of actions to complete the goal */
|
|
237
|
+
estimatedActions: number;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Response from a Ghost-API call.
|
|
242
|
+
* This is what agents receive - clean JSON, no HTML.
|
|
243
|
+
*/
|
|
244
|
+
export interface GhostResponse {
|
|
245
|
+
/** The extracted/processed data */
|
|
246
|
+
data: Record<string, unknown> | Record<string, unknown>[];
|
|
247
|
+
/** Metadata about the execution */
|
|
248
|
+
metadata: {
|
|
249
|
+
/** Confidence score for the result (0-1) */
|
|
250
|
+
confidence: number;
|
|
251
|
+
/** Time taken to execute in milliseconds */
|
|
252
|
+
executionTimeMs: number;
|
|
253
|
+
/** Number of DOM actions performed */
|
|
254
|
+
actionsPerformed: number;
|
|
255
|
+
/** Number of triangulation heals that occurred */
|
|
256
|
+
triangulationHeals: number;
|
|
257
|
+
};
|
|
258
|
+
/** Cryptographic proof of the action sequence */
|
|
259
|
+
verificationHash: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
// =============================================================================
|
|
264
|
+
// Session and Auth Types
|
|
265
|
+
// =============================================================================
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Device fingerprint for Shadow Sessions.
|
|
269
|
+
* Used to mimic real user devices and avoid bot detection.
|
|
270
|
+
*/
|
|
271
|
+
export interface DeviceFingerprint {
|
|
272
|
+
/** Screen resolution */
|
|
273
|
+
resolution: { width: number; height: number };
|
|
274
|
+
/** User agent string */
|
|
275
|
+
userAgent: string;
|
|
276
|
+
/** Installed fonts */
|
|
277
|
+
fonts: string[];
|
|
278
|
+
/** GPU signature */
|
|
279
|
+
gpuSignature: string;
|
|
280
|
+
/** Timezone */
|
|
281
|
+
timezone: string;
|
|
282
|
+
/** Browser language */
|
|
283
|
+
language: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Configuration for creating a Shadow Session.
|
|
288
|
+
*/
|
|
289
|
+
export interface SessionConfig {
|
|
290
|
+
/** Target domain for the session */
|
|
291
|
+
targetDomain: string;
|
|
292
|
+
/** Device fingerprint to use */
|
|
293
|
+
fingerprint: DeviceFingerprint;
|
|
294
|
+
/** Authentication configuration if needed */
|
|
295
|
+
authConfig?: AuthConfig;
|
|
296
|
+
/** Isolation level for the session */
|
|
297
|
+
isolationLevel: 'strict' | 'shared';
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Authentication configuration.
|
|
302
|
+
*/
|
|
303
|
+
export interface AuthConfig {
|
|
304
|
+
/** Type of authentication */
|
|
305
|
+
type: 'credentials' | 'oauth' | 'api_key';
|
|
306
|
+
/** Vault reference for credentials (never raw credentials) */
|
|
307
|
+
vaultRef: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* A Shadow Session - virtualized browser environment.
|
|
312
|
+
*/
|
|
313
|
+
export interface ShadowSession {
|
|
314
|
+
/** Unique session identifier */
|
|
315
|
+
id: string;
|
|
316
|
+
/** Target domain */
|
|
317
|
+
domain: string;
|
|
318
|
+
/** Current session status */
|
|
319
|
+
status: 'active' | 'expired' | 'mfa_pending';
|
|
320
|
+
/** Creation timestamp */
|
|
321
|
+
createdAt: number;
|
|
322
|
+
/** Last heartbeat timestamp */
|
|
323
|
+
lastHeartbeat: number;
|
|
324
|
+
/** Device fingerprint used */
|
|
325
|
+
fingerprint: DeviceFingerprint;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Encrypted blob for storing sensitive session data.
|
|
330
|
+
*/
|
|
331
|
+
export interface EncryptedBlob {
|
|
332
|
+
/** Encrypted data (base64) */
|
|
333
|
+
data: string;
|
|
334
|
+
/** Initialization vector (base64) */
|
|
335
|
+
iv: string;
|
|
336
|
+
/** Encryption algorithm used */
|
|
337
|
+
algorithm: 'AES-256-GCM';
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Serialized session state for vault storage.
|
|
342
|
+
*/
|
|
343
|
+
export interface SerializedSession {
|
|
344
|
+
/** Encrypted cookies */
|
|
345
|
+
cookies: EncryptedBlob;
|
|
346
|
+
/** Encrypted localStorage */
|
|
347
|
+
localStorage: EncryptedBlob;
|
|
348
|
+
/** Encrypted sessionStorage */
|
|
349
|
+
sessionStorage: EncryptedBlob;
|
|
350
|
+
/** Expiration timestamp */
|
|
351
|
+
expiresAt: number;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
// =============================================================================
|
|
356
|
+
// Capability Token Types (Zero-Knowledge Credentials)
|
|
357
|
+
// =============================================================================
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Scope of actions allowed by a Capability Token.
|
|
361
|
+
*/
|
|
362
|
+
export interface ActionScope {
|
|
363
|
+
/** Actions that are allowed (e.g., ["read_invoice", "pay_invoice"]) */
|
|
364
|
+
allowedActions: string[];
|
|
365
|
+
/** Actions that are blocked (e.g., ["change_password", "delete_account"]) */
|
|
366
|
+
blockedActions: string[];
|
|
367
|
+
/** Maximum number of executions allowed */
|
|
368
|
+
maxExecutions: number;
|
|
369
|
+
/** Expiration timestamp */
|
|
370
|
+
expiresAt: number;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Capability Token - scoped execution token for agents.
|
|
375
|
+
* Contains ONLY capabilities, never raw credentials.
|
|
376
|
+
*/
|
|
377
|
+
export interface CapabilityToken {
|
|
378
|
+
/** Unique token identifier */
|
|
379
|
+
id: string;
|
|
380
|
+
/** Domain this token is valid for */
|
|
381
|
+
domain: string;
|
|
382
|
+
/** Scope of allowed actions */
|
|
383
|
+
scope: ActionScope;
|
|
384
|
+
/** Timestamp when token was issued */
|
|
385
|
+
issuedAt: number;
|
|
386
|
+
/** Number of times this token has been used */
|
|
387
|
+
executionCount: number;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// =============================================================================
|
|
391
|
+
// MFA Types (Auth Tunnel)
|
|
392
|
+
// =============================================================================
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* MFA challenge detected during authentication.
|
|
396
|
+
*/
|
|
397
|
+
export interface MFAChallenge {
|
|
398
|
+
/** Unique challenge identifier */
|
|
399
|
+
id: string;
|
|
400
|
+
/** Associated session ID */
|
|
401
|
+
sessionId: string;
|
|
402
|
+
/** Type of MFA challenge */
|
|
403
|
+
type: 'sms' | 'authenticator' | 'push' | 'email';
|
|
404
|
+
/** Prompt to show the user */
|
|
405
|
+
prompt: string;
|
|
406
|
+
/** Expiration timestamp (5 minute timeout) */
|
|
407
|
+
expiresAt: number;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Result of an authentication attempt.
|
|
412
|
+
*/
|
|
413
|
+
export interface AuthResult {
|
|
414
|
+
/** Whether authentication succeeded */
|
|
415
|
+
success: boolean;
|
|
416
|
+
/** Serialized session state if successful */
|
|
417
|
+
sessionState?: SerializedSession;
|
|
418
|
+
/** Error if authentication failed */
|
|
419
|
+
error?: AuthError;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Authentication error.
|
|
424
|
+
*/
|
|
425
|
+
export interface AuthError {
|
|
426
|
+
/** Error code */
|
|
427
|
+
code: 'invalid_credentials' | 'mfa_failed' | 'timeout' | 'blocked';
|
|
428
|
+
/** Human-readable message */
|
|
429
|
+
message: string;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
// =============================================================================
|
|
434
|
+
// Action Logging Types (Deterministic Verification)
|
|
435
|
+
// =============================================================================
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* A single logged action in the deterministic log.
|
|
439
|
+
*/
|
|
440
|
+
export interface ActionLogEntry {
|
|
441
|
+
/** Timestamp of the action */
|
|
442
|
+
timestamp: number;
|
|
443
|
+
/** Session ID where action occurred */
|
|
444
|
+
sessionId: string;
|
|
445
|
+
/** Type of action performed */
|
|
446
|
+
action: 'click' | 'type' | 'navigate' | 'wait' | 'extract';
|
|
447
|
+
/** Intent ID of the target element */
|
|
448
|
+
intentId: string;
|
|
449
|
+
/** Value associated with the action (e.g., typed text) */
|
|
450
|
+
value?: string;
|
|
451
|
+
/** Result of the action */
|
|
452
|
+
result: 'success' | 'failure';
|
|
453
|
+
/** Screenshot at this point (base64, optional) */
|
|
454
|
+
screenshot?: string;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Cryptographic proof of an action sequence.
|
|
459
|
+
*/
|
|
460
|
+
export interface VerificationProof {
|
|
461
|
+
/** Session ID this proof is for */
|
|
462
|
+
sessionId: string;
|
|
463
|
+
/** Total number of actions */
|
|
464
|
+
actionCount: number;
|
|
465
|
+
/** Cryptographic hash of the action sequence */
|
|
466
|
+
hash: string;
|
|
467
|
+
/** Screenshots at key decision points */
|
|
468
|
+
screenshots: string[];
|
|
469
|
+
/** The result claimed by the agent */
|
|
470
|
+
claimedResult: unknown;
|
|
471
|
+
/** Whether the claimed result matches the action log */
|
|
472
|
+
resultMatchesActions: boolean;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Analysis of differences between two agents' action logs.
|
|
477
|
+
*/
|
|
478
|
+
export interface DiffAnalysis {
|
|
479
|
+
/** Action index where agents diverged */
|
|
480
|
+
divergencePoint: number;
|
|
481
|
+
/** Agent A's action path from divergence */
|
|
482
|
+
agentAPath: ActionLogEntry[];
|
|
483
|
+
/** Agent B's action path from divergence */
|
|
484
|
+
agentBPath: ActionLogEntry[];
|
|
485
|
+
/** Recommendation based on analysis */
|
|
486
|
+
recommendation: 'agent_a' | 'agent_b' | 'tie' | 'both_invalid';
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
// =============================================================================
|
|
491
|
+
// Competition Types (Parallel Execution)
|
|
492
|
+
// =============================================================================
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* A competition between multiple agents.
|
|
496
|
+
*/
|
|
497
|
+
export interface Competition {
|
|
498
|
+
/** Unique competition identifier */
|
|
499
|
+
id: string;
|
|
500
|
+
/** Associated bounty ID */
|
|
501
|
+
bountyId: string;
|
|
502
|
+
/** Shadow sessions for each agent */
|
|
503
|
+
sessions: ShadowSession[];
|
|
504
|
+
/** Identical starting state for all agents */
|
|
505
|
+
startState: SerializedSession;
|
|
506
|
+
/** Timestamp when competition started */
|
|
507
|
+
startedAt?: number;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Result of a single agent in a competition.
|
|
512
|
+
*/
|
|
513
|
+
export interface CompetitionResult {
|
|
514
|
+
/** Agent ID */
|
|
515
|
+
agentId: string;
|
|
516
|
+
/** Session ID used */
|
|
517
|
+
sessionId: string;
|
|
518
|
+
/** Final status */
|
|
519
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
520
|
+
/** Result if completed */
|
|
521
|
+
result?: GhostResponse;
|
|
522
|
+
/** Complete action log */
|
|
523
|
+
actionLog: ActionLogEntry[];
|
|
524
|
+
/** Total execution time in milliseconds */
|
|
525
|
+
executionTimeMs: number;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Complete bounty execution record.
|
|
530
|
+
*/
|
|
531
|
+
export interface BountyExecution {
|
|
532
|
+
/** Bounty ID */
|
|
533
|
+
bountyId: string;
|
|
534
|
+
/** Goal definition */
|
|
535
|
+
goal: GoalDefinition;
|
|
536
|
+
/** Competition details */
|
|
537
|
+
competition: Competition;
|
|
538
|
+
/** Results from all agents */
|
|
539
|
+
results: CompetitionResult[];
|
|
540
|
+
/** Winner details if determined */
|
|
541
|
+
winner?: {
|
|
542
|
+
agentId: string;
|
|
543
|
+
proof: VerificationProof;
|
|
544
|
+
confidence: number;
|
|
545
|
+
};
|
|
546
|
+
/** Current status */
|
|
547
|
+
status: 'pending' | 'running' | 'verifying' | 'completed' | 'disputed';
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
// =============================================================================
|
|
552
|
+
// Error Types
|
|
553
|
+
// =============================================================================
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* All possible OmniBridge errors.
|
|
557
|
+
*/
|
|
558
|
+
export type OmniBridgeError =
|
|
559
|
+
| { type: 'schema_drift'; details: string; confidence: number }
|
|
560
|
+
| { type: 'mfa_timeout'; challengeId: string }
|
|
561
|
+
| { type: 'auth_failed'; reason: string }
|
|
562
|
+
| { type: 'scope_violation'; attemptedAction: string; allowedActions: string[] }
|
|
563
|
+
| { type: 'session_expired'; domain: string }
|
|
564
|
+
| { type: 'triangulation_failed'; anchors: AnchorSet }
|
|
565
|
+
| { type: 'hallucination_detected'; claimedResult: unknown; actualActions: ActionLogEntry[] };
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Recoverable errors that OmniBridge handles automatically.
|
|
569
|
+
*/
|
|
570
|
+
export type RecoverableError =
|
|
571
|
+
| 'session_expired'
|
|
572
|
+
| 'element_moved'
|
|
573
|
+
| 'rate_limited'
|
|
574
|
+
| 'timeout';
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Errors requiring user intervention.
|
|
578
|
+
*/
|
|
579
|
+
export type UserInterventionError =
|
|
580
|
+
| 'mfa_required'
|
|
581
|
+
| 'captcha_required'
|
|
582
|
+
| 'low_confidence';
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Terminal errors that cause bounty failure.
|
|
586
|
+
*/
|
|
587
|
+
export type TerminalError =
|
|
588
|
+
| 'schema_drift'
|
|
589
|
+
| 'auth_failed'
|
|
590
|
+
| 'scope_violation'
|
|
591
|
+
| 'hallucination';
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Recovery configuration for recoverable errors.
|
|
595
|
+
*/
|
|
596
|
+
export interface RecoveryConfig {
|
|
597
|
+
action: 'reauthenticate' | 'triangulate' | 'backoff' | 'retry';
|
|
598
|
+
backoffMs?: number;
|
|
599
|
+
maxRetries: number;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Default recovery strategies.
|
|
604
|
+
*/
|
|
605
|
+
export const DEFAULT_RECOVERY_CONFIG: Record<RecoverableError, RecoveryConfig> = {
|
|
606
|
+
session_expired: { action: 'reauthenticate', maxRetries: 2 },
|
|
607
|
+
element_moved: { action: 'triangulate', maxRetries: 3 },
|
|
608
|
+
rate_limited: { action: 'backoff', backoffMs: 60000, maxRetries: 5 },
|
|
609
|
+
timeout: { action: 'retry', backoffMs: 5000, maxRetries: 3 },
|
|
610
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Execution module - Shadow Sessions, Parallel Executor, Deterministic Logger
|