8000 ax-grep/src/types.ts at v0.1.4 · hmmhmmhm/ax-grep · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
3671 lines (3574 loc) · 122 KB

types.ts

File metadata and controls

3671 lines (3574 loc) · 122 KB
export type OutputFormat = "json" | "text";
export type ExtractMode = "full" | "compact" | "interactive";
export type SemanticTreeOptions = {
mode?: ExtractMode;
includeBounds?: boolean;
includeAttributes?: boolean;
includeTextNodes?: boolean;
includeHidden?: boolean;
includeSelectOptions?: boolean;
excludeLikelyAds?: boolean;
excludeLikelyBoilerplate?: boolean;
pruneCustomElementWrappers?: boolean;
pruneCollapsedSubtrees?: boolean;
pruneLikelyClosedOverlays?: boolean;
summarizeLargeSubtrees?: boolean;
summarizeLikelyLinkFarms?: boolean;
summarizeRepeatedSubtrees?: boolean;
maxChildrenPerNode?: number;
maxLinkFarmChildren?: number;
maxRepeatedSubtreeInstances?: number;
maxTextLength?: number;
};
export type SemanticTreeChange = {
tree: SemanticNode;
changedAt: number;
mutationCount: number;
};
export type SemanticTreeObserverOptions = SemanticTreeOptions & {
debounceMs?: number;
};
export type SemanticNodeState = {
hidden?: boolean;
disabled?: boolean;
busy?: boolean;
multiselectable?: boolean;
sort?: string;
grabbed?: boolean;
dropEffect?: string;
checked?: boolean | "mixed";
selected?: boolean;
expanded?: boolean;
pressed?: boolean | "mixed";
focused?: boolean;
required?: boolean;
invalid?: boolean | string;
readonly?: boolean;
current?: boolean | string;
haspopup?: boolean | string;
controls?: string;
live?: string;
modal?: boolean;
orientation?: string;
valueMin?: number;
valueMax?: number;
valueNow?: number;
valueText?: string;
};
export type SemanticNodeBounds = {
x: number;
y: number;
width: number;
height: number;
};
export type SemanticNode = {
id: string;
tag: string;
role: string | null;
name: string;
description?: string;
text?: string;
value?: string;
state?: SemanticNodeState;
interactive: boolean;
focusable: boolean;
selector?: string;
xpath?: string;
bounds?: SemanticNodeBounds;
attributes?: Record<string, string>;
children: SemanticNode[];
unavailableReason?: string;
};
export type ExtractorScriptOptions = SemanticTreeOptions & {
format?: OutputFormat;
};
export type ObserverScriptOptions = SemanticTreeObserverOptions & {
globalName?: string;
};
export type AgentStatus = "ready" | "choose-result" | "verify" | "needs-browser" | "error";
export type AgentBrowserHtmlReasonCode =
| "no-inspectable-content"
| "client-rendered"
| "http-error"
| "fetch-error"
| "challenge"
| "hcaptcha"
| "recaptcha"
| "cloudflare-challenge"
| "akamai-challenge"
| "datadome-challenge"
| "perimeterx-challenge"
| "kasada-challenge"
| "login-required"
| "paywall"
| "blocked-or-empty"
| "retry-action"
| "interaction-required"
| "browser-interaction"
| "unknown";
export type AgentStaticReadiness = "usable-content" | "usable-structured-data" | "usable-hidden-data" | "thin" | "needs-browser" | "error";
export type AgentStaticReadinessReasonCode =
| "browser-required"
| "client-rendered"
| "interaction-required"
| "extraction-error"
| "hidden-data"
| "source-link"
| "form"
| "action-target"
| "structured-data"
| "readable-content"
| "limited-static-payload"
| "thin-content";
export type AgentSourceSearchFailureKind =
| "not-found"
| "http-client-error"
| "http-server-error"
| "http-error"
| "fetch-error"
| "timeout"
| "rate-limited"
| "no-inspectable-content"
| "unknown";
export type AgentRoutingIntent =
| "read-current"
| "open-url"
| "search"
| "browser-html"
| "browser-interaction"
| "inspect-output"
| "none";
export type AgentContinuationMode = "command" | "read" | "browser" | "capture-html" | "inspect" | "stop";
export type AgentExecutionMode = "run-command" | "read-current" | "interact-browser" | "inspect-output";
export type AgentAction = {
action?: string;
execution?: AgentExecutionMode;
priority?: "low" | "medium" | "high";
priorityReason?: string;
reason?: string;
url?: string;
rank?: number;
openResult?: number | "best";
command?: string;
commandArgs?: string[];
afterInteractionCommand?: string;
afterInteractionCommandArgs?: string[];
terminal?: boolean;
readFrom?: string;
sourceLinkRef?: string;
requiresBrowserInteraction?: boolean;
expectedOutcome?: AgentExpectedOutcome["kind"];
expectedOutcomeMessage?: string;
target?: AgentTarget;
source?: string;
primary?: boolean;
index?: number;
path?: string;
};
export type AgentPageMetadata = {
description?: string;
lang?: string;
dir?: string;
siteName?: string;
author?: string;
publishedTime?: string;
modifiedTime?: string;
structuredDataTypes?: string[];
};
export type AgentFindMatch = {
field: string;
text: string;
rank?: number;
url?: string;
selector?: string;
source?: "semantic" | "fallback";
score?: number;
quality?: "low" | "medium" | "high";
qualityReason?: string;
};
export type AgentFindSummary = {
query: string;
found: boolean;
matchCount: number;
matches: AgentFindMatch[];
};
export type AgentPageEvidence = {
id: string;
path: string;
rank: number;
text: string;
role: string;
source: "semantic" | "fallback";
score: number;
quality: "low" | "medium" | "high";
qualityReason: string;
selector?: string;
};
export type AgentPageAction = {
type: string;
text: string;
selector?: string;
};
export type AgentPageDataTable = {
id: string;
path: string;
rank: number;
rowCount: number;
columnCount: number;
headers: string[];
sampleRows: string[][];
text?: string;
caption?: string;
selector?: string;
};
export type AgentPageBarrier = {
id: string;
path: string;
rank: number;
kind: "challenge" | "login" | "paywall" | "cookie-consent" | "age-gate" | "geo-block";
severity: "info" | "warning" | "error";
text?: string;
evidence: string;
diagnosticCode?: string;
source: "diagnostic" | "content" | "action";
selector?: string;
};
export type AgentPageCodeBlock = {
id: string;
path: string;
rank: number;
text?: string;
lineCount: number;
source: "pre" | "code";
language?: string;
commandLike?: boolean;
selector?: string;
};
export type AgentPageMedia = {
id: string;
path: string;
rank: number;
kind: "open-graph" | "figure" | "image";
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
alt?: string;
caption?: string;
title?: string;
width?: number;
height?: number;
selector?: string;
};
export type AgentPageResource = {
id: string;
path: string;
rank: number;
kind: "feed" | "alternate" | "amp" | "license" | "manifest" | "sitemap" | "search" | "document" | "download";
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
title?: string;
rel?: string;
type?: string;
hreflang?: string;
selector?: string;
};
export type AgentPageCitation = {
id: string;
path: string;
rank: number;
source: "blockquote" | "cite" | "footnote" | "reference";
text?: string;
quote?: string;
title?: string;
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageBreadcrumbItem = {
label: string;
url?: string;
urlPath?: string;
urlQuery?: string;
position?: number;
};
export type AgentPageBreadcrumb = {
id: string;
path: string;
rank: number;
source: "json-ld" | "html";
items: AgentPageBreadcrumbItem[];
text?: string;
selector?: string;
};
export type AgentPageSection = {
id: string;
path: string;
rank: number;
heading: string;
level: number;
text?: string;
excerpts: string[];
selector?: string;
};
export type AgentPagePagination = {
id: string;
path: string;
rank: number;
kind: "next" | "prev" | "first" | "last" | "page";
label: string;
text?: string;
source: "link" | "html";
url?: string;
urlPath?: string;
urlQuery?: string;
current?: boolean;
selector?: string;
};
export type AgentPageTocItem = {
label: string;
url?: string;
urlPath?: string;
urlQuery?: string;
level?: number;
};
export type AgentPageToc = {
id: string;
path: string;
rank: number;
items: AgentPageTocItem[];
text?: string;
title?: string;
selector?: string;
};
export type AgentPageAuthorLink = {
id: string;
path: string;
rank: number;
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
source: "json-ld" | "link" | "html";
name?: string;
rel?: string;
selector?: string;
};
export type AgentPageOffer = {
id: string;
path: string;
rank: number;
name?: string;
price?: string;
priceAmount?: number;
currency?: string;
availability?: string;
url?: string;
urlPath?: string;
urlQuery?: string;
brand?: string;
sku?: string;
rating?: string;
reviewCount?: string;
text?: string;
source: "json-ld";
selector?: string;
};
export type AgentPageIdentity = {
id: string;
path: string;
rank: number;
kind: "organization" | "person" | "website" | "brand" | "thing";
name: string;
text?: string;
source: "json-ld" | "meta";
url?: string;
urlPath?: string;
urlQuery?: string;
logoUrl?: string;
logoUrlPath?: string;
logoUrlQuery?: string;
sameAs?: string[];
sameAsUrlPaths?: string[];
sameAsUrlQueries?: string[];
selector?: string;
};
export type AgentPageDataset = {
id: string;
path: string;
rank: number;
kind: "dataset" | "dataCatalog" | "dataDownload";
name: string;
text?: string;
source: "json-ld" | "link";
url?: string;
urlPath?: string;
urlQuery?: string;
distributionUrls?: string[];
distributionUrlPaths?: string[];
distributionUrlQueries?: string[];
encodingFormat?: string;
licenseUrl?: string;
licenseUrlPath?: string;
licenseUrlQuery?: string;
temporalCoverage?: string;
spatialCoverage?: string;
creator?: string;
selector?: string;
};
export type AgentPageTimeline = {
id: string;
path: string;
rank: number;
kind: "published" | "modified" | "created" | "updated" | "start" | "end" | "date";
label: string;
value: string;
isoDate?: string;
unixMs?: number;
text?: string;
source: "meta" | "json-ld" | "time" | "page";
selector?: string;
};
export type AgentPageContactPoint = {
id: string;
path: string;
rank: number;
kind: "email" | "phone" | "address" | "contact-url";
label: string;
value: string;
text?: string;
source: "json-ld" | "html" | "link";
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageFaq = {
id: string;
path: string;
rank: number;
question: string;
answer: string;
text?: string;
source: "details" | "html";
selector?: string;
};
export type AgentPageHydration = {
id: string;
path: string;
rank: number;
kind: "next-data" | "nuxt-data" | "gatsby-data" | "fetch-preload" | "json-script";
label: string;
text?: string;
source: "script" | "link";
framework?: string;
route?: string;
buildId?: string;
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageApiEndpoint = {
id: string;
path: string;
rank: number;
kind: "fetch" | "axios" | "xhr" | "graphql" | "event-stream";
method?: string;
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
source: "script";
selector?: string;
};
export type AgentPageClientState = {
id: string;
path: string;
rank: number;
kind: "local-storage" | "session-storage" | "cookie";
operation: "read" | "write" | "delete";
key: string;
text?: string;
source: "script";
selector?: string;
};
export type AgentPageRuntime = {
id: string;
path: string;
rank: number;
kind: "service-worker" | "web-worker" | "shared-worker" | "worklet" | "dynamic-import" | "module-preload";
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
source: "script" | "link";
selector?: string;
};
export type AgentPageConfig = {
id: string;
path: string;
rank: number;
kind: "app-config" | "initial-state" | "env" | "feature-flags" | "data-layer" | "config";
name: string;
keys: string[];
keyCount: number;
text?: string;
source: "script";
selector?: string;
};
export type AgentPageTopic = {
id: string;
path: string;
rank: number;
kind: "keyword" | "tag" | "section" | "category" | "about" | "mention";
label: string;
value: string;
text?: string;
source: "meta" | "json-ld";
selector?: string;
};
export type AgentPageKeyValue = {
id: string;
path: string;
rank: number;
label: string;
value: string;
text?: string;
source: "definition-list" | "time" | "text";
datetime?: string;
selector?: string;
};
export type AgentPageMetaFact = {
id: string;
path: string;
rank: number;
label: string;
value: string;
text?: string;
source: "meta" | "link";
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageProvenance = {
id: string;
path: string;
rank: number;
kind: "doi" | "pmid" | "arxiv" | "isbn" | "publisher" | "journal" | "license" | "identifier";
label: string;
value: string;
text?: string;
source: "meta" | "link" | "json-ld";
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageHttpPolicy = {
id: string;
path: string;
rank: number;
name: string;
value: string;
text?: string;
source: "header" | "meta";
selector?: string;
};
export type AgentPageSchemaFactValue = {
label: string;
value: string;
};
export type AgentPageSchemaFact = {
id: string;
path: string;
rank: number;
types: string[];
facts: AgentPageSchemaFactValue[];
text?: string;
source: "json-ld";
selector?: string;
};
export type AgentPageAppHint = {
id: string;
path: string;
rank: number;
kind: "manifest" | "app-name" | "icon" | "theme" | "capability";
label: string;
value: string;
text?: string;
source: "link" | "meta";
url?: string;
urlPath?: string;
urlQuery?: string;
sizes?: string;
media?: string;
selector?: string;
};
export type AgentPageMobileHint = {
id: string;
path: string;
rank: number;
kind: "viewport" | "format-detection" | "color-scheme" | "smart-app-banner" | "app-link";
label: string;
value: string;
text?: string;
source: "meta" | "link";
platform?: string;
url?: string;
urlPath?: string;
urlQuery?: string;
selector?: string;
};
export type AgentPageEmbed = {
id: string;
path: string;
rank: number;
kind: "iframe" | "video" | "audio" | "embed" | "object";
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
title?: string;
type?: string;
posterUrl?: string;
posterUrlPath?: string;
posterUrlQuery?: string;
sourceUrls?: string[];
sourceUrlPaths?: string[];
sourceUrlQueries?: string[];
sandbox?: string;
allow?: string;
loading?: string;
selector?: string;
};
export type AgentPageTranscript = {
id: string;
path: string;
rank: number;
kind: "captions" | "subtitles" | "descriptions" | "chapters" | "metadata" | "transcript";
url: string;
urlPath?: string;
urlQuery?: string;
text?: string;
mediaKind?: "video" | "audio";
label?: string;
language?: string;
selector?: string;
};
export type AgentPageCheck = AgentPageMetadata & {
contentEvidence: AgentPageEvidence[];
contentLength: number;
confidence: "low" | "medium" | "high";
readability: {
level: "low" | "medium" | "high";
score: number;
reasons: string[];
};
primaryLinks?: AgentSourceChoice[];
sourceLinks?: AgentSourceChoice[];
actions?: AgentPageAction[];
recommendedAction?: AgentAction;
nextSteps?: AgentAction[];
title?: string;
canonicalUrl?: string;
mainHeading?: string;
dataTables?: AgentPageDataTable[];
barriers?: AgentPageBarrier[];
forms?: AgentPageForm[];
actionTargets?: AgentActionTargetChoice[];
hydration?: AgentPageHydration[];
apiEndpoints?: AgentPageApiEndpoint[];
clientState?: AgentPageClientState[];
runtime?: AgentPageRuntime[];
config?: AgentPageConfig[];
appHints?: AgentPageAppHint[];
mobileHints?: AgentPageMobileHint[];
topics?: AgentPageTopic[];
contactPoints?: AgentPageContactPoint[];
keyValues?: AgentPageKeyValue[];
metaFacts?: AgentPageMetaFact[];
provenance?: AgentPageProvenance[];
httpPolicies?: AgentPageHttpPolicy[];
schemaFacts?: AgentPageSchemaFact[];
offers?: AgentPageOffer[];
identities?: AgentPageIdentity[];
datasets?: AgentPageDataset[];
timeline?: AgentPageTimeline[];
faqs?: AgentPageFaq[];
breadcrumbs?: AgentPageBreadcrumb[];
sections?: AgentPageSection[];
pagination?: AgentPagePagination[];
toc?: AgentPageToc[];
codeBlocks?: AgentPageCodeBlock[];
citations?: AgentPageCitation[];
media?: AgentPageMedia[];
resources?: AgentPageResource[];
embeds?: AgentPageEmbed[];
transcripts?: AgentPageTranscript[];
authorLinks?: AgentPageAuthorLink[];
};
export type AgentVerification = {
status: "matched" | "partial" | "missing";
requestedCount: number;
foundCount: number;
missingCount: number;
evidenceCount: number;
foundQueries?: string[];
missingQueries?: string[];
bestEvidence?: AgentFindMatch;
recommendedAction?: AgentAction;
};
export type AgentSearchDecision = {
decision: "open-result" | "refine-search" | "none";
confidence: "low" | "medium" | "high";
reason: string;
resultCount: number;
highRelevanceCount: number;
mediumRelevanceCount: number;
lowRelevanceCount: number;
officialCount: number;
findMatchCount: number;
recommendedRank?: number;
recommendedPath?: string;
recommendedTitle?: string;
recommendedUrl?: string;
recommendedUrlPath?: string;
recommendedUrlQuery?: string;
recommendedSource?: string;
recommendedSourceScore?: number;
recommendedSourceType?: AgentTarget["sourceType"];
recommendedSourceHints?: string[];
recommendedDateText?: string;
recommendedDateIso?: string;
recommendedDateUnixMs?: number;
recommendedDatePrecision?: "day" | "month" | "year";
recommendedDateSource?: "title" | "snippet";
recommendedRelevance?: "low" | "medium" | "high";
recommendedLikelyOfficial?: boolean;
firstOfficialRank?: number;
firstOfficialPath?: string;
firstOfficialTitle?: string;
firstOfficialUrl?: string;
firstOfficialSource?: string;
firstOfficialSourceScore?: number;
firstOfficialSourceType?: AgentTarget["sourceType"];
firstOfficialSourceHints?: string[];
firstOfficialDateText?: string;
firstOfficialDateIso?: string;
firstOfficialDateUnixMs?: number;
firstOfficialDatePrecision?: "day" | "month" | "year";
firstOfficialDateSource?: "title" | "snippet";
firstOfficialRelevance?: "low" | "medium" | "high";
firstOfficialCommand?: string;
firstOfficialCommandArgs?: string[];
command?: string;
commandArgs?: string[];
};
export type AgentPageDecision = {
decision: "read-content" | "open-source-link" | "open-site-search" | "retry-with-browser-html" | "inspect-actions" | "none";
confidence: "low" | "medium" | "high";
reason: string;
readability: "low" | "medium" | "high";
readabilityScore: number;
evidenceCount: number;
evidenceQualityScore: number;
sourceLinkCount: number;
sourceQualityScore: number;
readFrom?: string;
url?: string;
command?: string;
commandArgs?: string[];
};
export type AgentSemanticSummary = {
nodeCount: number;
namedRoleCount: number;
interactiveCount: number;
focusableCount: number;
headingCount: number;
landmarkCount: number;
linkCount: number;
buttonCount: number;
imageCount: number;
tableCount: number;
listCount: number;
fieldCount: number;
descriptionCount: number;
valueCount: number;
relationCount: number;
choiceCount: number;
stateCount: number;
unavailableCount: number;
roleCounts: Record<string, number>;
topRoles: Array<{ role: string; count: number }>;
landmarks: string[];
headings: string[];
namedRoles: string[];
semanticOutline: Array<{ path: string; kind: "heading" | "landmark"; role: string; text: string; level?: number; depth: number; parentPath?: string; parentRole?: string; parentName?: string; selector?: string }>;
keyboardItems: Array<{ path: string; role: string; name?: string; shortcuts?: string[]; accessKey?: string; tabIndex?: number; focusable: boolean; selector?: string }>;
headingItems: Array<{ path: string; text: string; level?: number; selector?: string }>;
landmarkItems: Array<{ path: string; role: string; name?: string; selector?: string }>;
namedRoleItems: Array<{ path: string; role: string; name: string; roleDescription?: string; selector?: string }>;
interactiveRoles: Array<{ path: string; role: string; name: string; roleDescription?: string; description?: string; value?: string; selector?: string; state?: SemanticNodeState }>;
focusableItems: Array<{ path: string; role: string; name?: string; roleDescription?: string; selector?: string; state?: SemanticNodeState }>;
links: Array<{ path: string; name: string; url?: string; target?: string; rel?: string[]; type?: string; hreflang?: string; state?: string; current?: SemanticNodeState["current"]; download?: string | true; selector?: string }>;
inPageLinks: Array<{ path: string; kind: "skip" | "anchor"; name: string; url: string; targetId?: string; selector?: string }>;
buttons: Array<{ path: string; name: string; roleDescription?: string; description?: string; type?: string; state?: string; disabled?: boolean; pressed?: SemanticNodeState["pressed"]; expanded?: boolean; haspopup?: SemanticNodeState["haspopup"]; controls?: string; formAction?: string; formMethod?: string; formTarget?: string; formEncType?: string; formNoValidate?: boolean; formId?: string; selector?: string }>;
imageItems: Array<{ path: string; name?: string; url?: string; width?: number; height?: number; loading?: string; decoding?: string; srcset?: string; sizes?: string; selector?: string }>;
tableItems: Array<{ path: string; role: string; name?: string; rowCount: number; cellCount: number; declaredRowCount?: number; declaredColumnCount?: number; headers?: string[]; headerRefs?: Array<{ path?: string; text: string; role?: string; rowIndex?: number; columnIndex?: number; sort?: string; selector?: string }>; ownedRefs?: Array<{ target: string; role?: string; name?: string; selector?: string }>; sampleCells?: string[]; sampleCellRefs?: Array<{ path?: string; text: string; rowIndex?: number; columnIndex?: number; rowSpan?: number; columnSpan?: number; headers?: string[]; rowHeaders?: string[]; columnHeaders?: string[]; selected?: boolean; current?: SemanticNodeState["current"]; selector?: string; ownedTarget?: string }>; selector?: string }>;
listItems: Array<{ path: string; role: string; name?: string; itemCount: number; sampleItems?: string[]; itemRefs?: Array<{ text: string; role?: string; level?: number; posInSet?: number; setSize?: number; selected?: boolean; current?: SemanticNodeState["current"]; expanded?: boolean; selector?: string }>; selector?: string }>;
fieldItems: Array<{ path: string; role: string; name?: string; description?: string; value?: string; htmlName?: string; htmlType?: string; placeholder?: string; ariaPlaceholder?: string; autocomplete?: string; ariaAutocomplete?: string; inputMode?: string; pattern?: string; min?: string; max?: string; step?: string; minLength?: number; maxLength?: number; labelledBy?: string; labelledByText?: string; labelledBySelector?: string; describedBy?: string; describedByText?: string; describedBySelector?: string; details?: string; detailsText?: string; detailsSelector?: string; errorMessage?: string; errorMessageText?: string; errorMessageSelector?: string; selector?: string; state?: SemanticNodeState }>;
descriptionItems: Array<{ path: string; role: string; name?: string; description: string; selector?: string }>;
valueItems: Array<{ path: string; role: string; name?: string; value: string; selector?: string }>;
relationItems: Array<{ path: string; role: string; name?: string; relation: "controls" | "owns" | "flowto" | "activeDescendant" | "details" | "errorMessage" | "describedBy" | "labelledBy"; target: string; targetRole?: string; targetName?: string; targetSelector?: string; selector?: string }>;
choiceItems: Array<{ path: string; role: string; name: string; level?: number; posInSet?: number; setSize?: number; selected?: boolean; current?: SemanticNodeState["current"]; selector?: string; state?: SemanticNodeState }>;
stateItems: Array<{ path: string; role: string; name?: string; state: string; stateRaw?: SemanticNodeState; selector?: string }>;
unavailableItems: Array<{ path: string; tag: string; role?: string; name?: string; reason: string; selector?: string }>;
};
export type AgentNext = {
mode: AgentContinuationMode;
reason: string;
loop: AgentLoopDirective;
action?: string;
execution?: AgentExecutionMode;
priority?: "low" | "medium" | "high";
priorityReason?: string;
url?: string;
rank?: number;
openResult?: number | "best";
readFrom?: string;
command?: string;
commandArgs?: string[];
afterInteractionCommand?: string;
afterInteractionCommandArgs?: string[];
requiresBrowserInteraction?: boolean;
terminal?: boolean;
sourceLinkRef?: string;
readTarget?: AgentReadTarget;
readValue?: AgentReadValue;
target?: AgentTarget;
browserHtml?: AgentBrowserHtmlCapture;
};
export type AgentLoopDecision = "return" | "execute" | "browser" | "inspect" | "stop";
export type AgentLoopDirective = {
decision: AgentLoopDecision;
shouldContinue: boolean;
terminal: boolean;
reason: string;
maxSuggestedIterations: number;
};
export type AgentSignalKind =
| "content"
| "verification"
| "search-results"
| "source-links"
| "browser"
| "diagnostic"
| "response";
export type AgentSignalSeverity = "info" | "warning" | "error";
export type AgentSignal = {
kind: AgentSignalKind;
severity: AgentSignalSeverity;
message: string;
};
export type AgentQualityGateKind =
| "fetch"
| "content"
| "source"
| "search"
| "verification"
| "browser"
| "diagnostic"
| "status";
export type AgentQualityGate = {
kind: AgentQualityGateKind;
pass: boolean;
severity: AgentSignalSeverity;
message: string;
score?: number;
path?: string;
};
export type AgentExpectedOutcomeKind =
| "read-evidence"
| "open-result"
| "retry-fetch"
| "run-search"
| "capture-html"
| "browser-inspection"
| "inspect-output"
| "stop";
export type AgentExpectedOutcome = {
kind: AgentExpectedOutcomeKind;
message: string;
};
export type AgentExecutionPlan = {
operation: "return" | "execute-command" | "capture-browser-html" | "inspect-browser" | "inspect-output" | "stop";
confidence: "low" | "medium" | "high";
reason: string;
useFetchedHtml: boolean;
needsBrowserHtml: boolean;
answerReady: boolean;
terminal: boolean;
shouldContinue: boolean;
maxSuggestedIterations: number;
expectedOutcome: AgentExpectedOutcomeKind;
readFrom?: string;
command?: string;
commandArgs?: string[];
afterInteractionCommand?: string;
afterInteractionCommandArgs?: string[];
url?: string;
browserHtml?: AgentBrowserHtmlCapture;
};
export type AgentRunbook = {
decision: AgentLoopDecision;
mode: AgentContinuationMode;
0