@wenathlan/extension 1.1.55 → 1.1.57
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 +4 -3
- package/dist/agentstream.d.ts +155 -0
- package/dist/agentstream.d.ts.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +945 -22
- package/dist/index.js.map +4 -4
- package/dist/llm.d.ts +238 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/mcpserver.d.ts +11 -4
- package/dist/mcpserver.d.ts.map +1 -1
- package/dist/memory.d.ts +122 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/modelroute.d.ts +43 -0
- package/dist/modelroute.d.ts.map +1 -0
- package/dist/policy.d.ts +57 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/promptlibrary.d.ts +33 -0
- package/dist/promptlibrary.d.ts.map +1 -0
- package/dist/protocol.d.ts +259 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +388 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +1604 -39
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js.map +1 -1
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +14 -1
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +3 -1
- package/extension/dist/sidepanel.js +610 -5
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const protocolversion: "1.1.
|
|
1
|
+
export declare const protocolversion: "1.1.57";
|
|
2
2
|
/** Every reviewed action kind. Read kinds observe, interaction kinds move focus, sensitive kinds change page or browser state. */
|
|
3
3
|
export type actionkind = "observe" | "inspect" | "extract" | "wait" | "waitfor" | "waittext" | "readattribute" | "readstyle" | "readgeometry" | "readvalue" | "readtext" | "readhtml" | "countelements" | "readtable" | "readlinks" | "readimages" | "readmeta" | "readforms" | "readstorage" | "highlight" | "tablist" | "windowlist" | "tabsnapshot" | "focus" | "scroll" | "hover" | "clickdeep" | "rightclick" | "doubleclick" | "scrollpage" | "scrollby" | "scrollend" | "scrolltop" | "fullscreen" | "zoomset" | "click" | "type" | "navigate" | "select" | "presskey" | "drag" | "drop" | "upload" | "clear" | "check" | "uncheck" | "toggle" | "submit" | "reload" | "back" | "forward" | "writestorage" | "setattribute" | "removeattribute" | "evaluate" | "tabcreate" | "tabactivate" | "tabclose" | "tabreload" | "windowcreate" | "windowclose" | "windowresize" | "downloadfile" | "movepointer" | "clickpoint" | "shiftclick" | "clicktext" | "clickaria" | "clickname" | "resolvexpath" | "typetime" | "appendtext" | "setvalue" | "typeedit" | "keyhold" | "keyrelease" | "submitsearch" | "selectmulti" | "chooseradio" | "setslider" | "setdate" | "setcolor" | "expanddetails" | "dismissdialog" | "pierceshadow" | "enterframe" | "retryaction" | "mapclicks" | "verifyvisible" | "verifyenabled" | "a11ytree" | "readvisible" | "readertree" | "detectlists" | "detecttables" | "readjson" | "watchmutate" | "waitquiet" | "watchbanner" | "detectinfinitescroll" | "detectvirtual" | "detectlazy" | "readscrollpos" | "readlang" | "readoutline" | "countpages" | "listshadow" | "listframes" | "classifypage" | "fingerprintsection" | "diffsnapshots" | "readselection" | "watchfocus" | "detectsticky" | "detectscrolllock" | "readopengraph" | "detectlanguage" | "deriveselector" | "openlink" | "openprivate" | "reloadcache" | "stopnav" | "waitload" | "waiturl" | "followlink" | "spanav" | "spawait" | "rewritequery" | "setfragment" | "navlist" | "navprofile" | "detecthttp" | "readredirects" | "readfinalurl" | "handleauth" | "printpdf" | "prefetch" | "preconnect" | "deeplink" | "reopentab" | "trailaudit" | "pausenav" | "navintent" | "navrate" | "openclipboard" | "checksafe" | "batchopen" | "querytabs" | "duplicatetab" | "closepattern" | "pintab" | "mutetab" | "movetab" | "movetabwindow" | "grouptabs" | "colorgroup" | "collapsegroup" | "discardtab" | "reloadtabs" | "zoomin" | "zoomout" | "watchtab" | "switchtab" | "maximizewindow" | "minimizewindow" | "restorewindow" | "focuswindow" | "scratchwindow" | "incognitowindow" | "restoretab" | "savelayout" | "restorelayout" | "findclones" | "searchtabs" | "badgetab" | "attachmeta" | "listaudio" | "reopenrun" | "snapshotsession" | "fillform" | "filllabel" | "fillplaceholder" | "detectfields" | "generatevalues" | "saveprofiles" | "asksubmit" | "submitform" | "readerrors" | "retryform" | "runwizard" | "selectchain" | "picktypeahead" | "pickdate" | "attachfile" | "handoffcaptcha" | "fillcard" | "fillcode" | "consentpassword" | "skiphoneypot" | "detectlogin" | "detecttemplate" | "scrapetable" | "exportcsv" | "exportjson" | "exportexcel" | "copytable" | "pushsheets" | "importcsv" | "looprows" | "transformvalues" | "deduperows" | "paginateextract" | "mergepages" | "stamplerows" | "previewgrid" | "streamdisk" | "resumeextract" | "logprovenance" | "batchdownload" | "pausedownload" | "resumedownload" | "verifydownload" | "interceptmime" | "exportnetlog" | "readclipboard" | "writeclipboard" | "copyscreen" | "quarantinedownload" | "scanvirus" | "namecaptures" | "cleanupartifacts" | "shotview" | "shotfullpage" | "shotelement" | "shotregion" | "contactsheet" | "capturepdf" | "recordscreen" | "captureaudio" | "captureframe" | "downloadimages" | "shotcanvas" | "probestream" | "readmedia" | "readassets" | "timelapse" | "convertimage" | "makethumbs" | "fetchurl" | "parsejson" | "parsehtml" | "callrest" | "callgraphql" | "opensocket" | "sendmessage" | "waitmessage" | "watchrequests" | "readheaders" | "capturebodies" | "subscribesse" | "longpoll" | "mapapi" | "extractapi" | "blockrequest" | "mockresponse" | "rewriteheaders" | "setcookies" | "readcookies" | "clearcookies" | "authflow" | "saveapikey" | "routeproxy" | "postform" | "postfiles" | "watchconsole" | "watcherrors" | "watchtasks" | "attachcdp" | "detachcdp" | "cdpcmd" | "watchcdp" | "setbreakpoint" | "stepcode" | "watchexpr" | "overridescript" | "measureflow" | "heapshot" | "trackmemory" | "profilecpu" | "watchshifts" | "traceload" | "annotatetrace" | "replaytrace" | "capturesourcemaps" | "emulatedevice" | "emulatenetwork" | "emulatelocate" | "setuseragent" | "overridepermission" | "blackboxscripts" | "persiststate" | "capturesession" | "restoresession" | "namedsessions" | "diffsessions" | "searchsessions" | "exportsessions" | "importsessions" | "composeworkflow" | "savetemplate" | "runworkflow" | "dryrun" | "delay" | "waitelement" | "compute" | "extractvars" | "listruns" | "condition" | "branch" | "loop" | "repeatuntil" | "whileloop" | "foreach" | "parallel" | "trycatch" | "visitrule" | "urlrule" | "menurule" | "keyrule" | "buttonrule" | "cronrule" | "intervalrule" | "urllistrule" | "webhookrule" | "eventrule";
|
|
4
4
|
export type actionrisk = "read" | "interaction" | "sensitive";
|
|
5
5
|
export type planstate = "draft" | "pending" | "approved" | "rejected" | "expired" | "completed" | "cancelled";
|
|
6
|
-
export type auditkind = "configure" | "session" | "observe" | "proposal" | "approval" | "action" | "error" | "stop" | "pause" | "resume" | "complete" | "capability" | "tab" | "window" | "download" | "pointer" | "dialog" | "hold" | "retry" | "observation" | "watch" | "diff" | "navigation" | "redirect" | "auth" | "prefetch" | "rate" | "group" | "layout" | "discard" | "badge" | "fill" | "submit" | "consent" | "handoff" | "scrape" | "export" | "stream" | "provenance" | "resume" | "intercept" | "clipboard" | "quarantine" | "cleanup" | "capture" | "media" | "call" | "socket" | "replay" | "control" | "timeline" | "debugger" | "profile" | "emulation" | "workflow" | "trigger" | "protocol" | "tool";
|
|
6
|
+
export type auditkind = "configure" | "session" | "observe" | "proposal" | "approval" | "action" | "error" | "stop" | "pause" | "resume" | "complete" | "capability" | "tab" | "window" | "download" | "pointer" | "dialog" | "hold" | "retry" | "observation" | "watch" | "diff" | "navigation" | "redirect" | "auth" | "prefetch" | "rate" | "group" | "layout" | "discard" | "badge" | "fill" | "submit" | "consent" | "handoff" | "scrape" | "export" | "stream" | "provenance" | "resume" | "intercept" | "clipboard" | "quarantine" | "cleanup" | "capture" | "media" | "call" | "socket" | "replay" | "control" | "timeline" | "debugger" | "profile" | "emulation" | "workflow" | "trigger" | "protocol" | "tool" | "model";
|
|
7
7
|
/** Observation mode classes: passive capture, watched lifetimes and diffing passes. */
|
|
8
8
|
export type observationmode = "passive" | "watching" | "diffing";
|
|
9
9
|
export interface toolstep {
|
|
@@ -3047,7 +3047,7 @@ export interface toolresult {
|
|
|
3047
3047
|
payload?: Record<string, unknown>;
|
|
3048
3048
|
iserror: boolean;
|
|
3049
3049
|
}
|
|
3050
|
-
/** The capability set exchanged during negotiation: the protocol version, the server identity, the tool compatibility floor, the offered tool count, the namespaces and the allowed transports. */
|
|
3050
|
+
/** The capability set exchanged during negotiation: the protocol version, the server identity, the tool compatibility floor, the offered tool count, the namespaces and the allowed transports; the 1.1.56 family adds the client declared model capabilities of sampling, prompt rendering and streaming. */
|
|
3051
3051
|
export interface capabilityset {
|
|
3052
3052
|
protocolversion: string;
|
|
3053
3053
|
name: string;
|
|
@@ -3057,6 +3057,12 @@ export interface capabilityset {
|
|
|
3057
3057
|
tools: number;
|
|
3058
3058
|
namespaces: toolnamespace[];
|
|
3059
3059
|
transports: transportkind[];
|
|
3060
|
+
/** True when the client model accepts sampling callbacks. */
|
|
3061
|
+
sampling?: boolean;
|
|
3062
|
+
/** True when the client renders prompt tools. */
|
|
3063
|
+
prompts?: boolean;
|
|
3064
|
+
/** True when the client consumes streamed result chunks. */
|
|
3065
|
+
streaming?: boolean;
|
|
3060
3066
|
}
|
|
3061
3067
|
/** One connected mcp client: the id, the transport it rides, the negotiated capability set, the pairing state the user approves and the connection timestamps. */
|
|
3062
3068
|
export interface clientrecord {
|
|
@@ -3079,7 +3085,7 @@ export interface clientrecord {
|
|
|
3079
3085
|
/** One entry of the mcp server routing table: the json rpc method name, the plain language description and the internal handler the server routes matching frames to. */
|
|
3080
3086
|
export interface methodentry {
|
|
3081
3087
|
method: string;
|
|
3082
|
-
handler: "initialize" | "ping" | "listtools" | "negotiate" | "dispatch";
|
|
3088
|
+
handler: "initialize" | "ping" | "listtools" | "negotiate" | "dispatch" | "listprompts" | "callprompt" | "cancel";
|
|
3083
3089
|
description: string;
|
|
3084
3090
|
}
|
|
3085
3091
|
/** The user configured mcp server state: the bind address with localhost as the documented default, the port, the allowed transports, the user configured frame size and queue depth with no code ceiling, the explicit user enablement flag and the reviewed flag a remote bind requires. */
|
|
@@ -3133,7 +3139,7 @@ export interface bridgelaunch {
|
|
|
3133
3139
|
restart: boolean;
|
|
3134
3140
|
at: number;
|
|
3135
3141
|
}
|
|
3136
|
-
/** One mcp tool call record: the calling client, the namespaced tool name, the origin the call ran under, the outcome flag, the json rpc error code when the call was refused and the time. */
|
|
3142
|
+
/** One mcp tool call record: the calling client, the namespaced tool name, the origin the call ran under, the outcome flag, the json rpc error code when the call was refused and the time; the 1.1.56 family adds the call id, the idempotency key, the dry run, mock and batch markers and the replay marker so the audit trail names every call without exception. */
|
|
3137
3143
|
export interface toolcallrecord {
|
|
3138
3144
|
id: string;
|
|
3139
3145
|
clientid: string;
|
|
@@ -3142,6 +3148,18 @@ export interface toolcallrecord {
|
|
|
3142
3148
|
ok: boolean;
|
|
3143
3149
|
code?: rpcerrorcode;
|
|
3144
3150
|
at: number;
|
|
3151
|
+
/** The call context id of the 1.1.56 family when the call ran through the call runtime. */
|
|
3152
|
+
callid?: string;
|
|
3153
|
+
/** The idempotency key the client attached; a repeated key replays the stored result. */
|
|
3154
|
+
idempotencykey?: idempotencykey;
|
|
3155
|
+
/** True when the call ran as a tool dry run with no side effects. */
|
|
3156
|
+
dryrun?: boolean;
|
|
3157
|
+
/** True when a tool mock answered the call without touching the browser. */
|
|
3158
|
+
mocked?: boolean;
|
|
3159
|
+
/** The batch call id when the call ran as a batch member. */
|
|
3160
|
+
batchid?: string;
|
|
3161
|
+
/** True when the answer replayed a stored idempotent result instead of executing. */
|
|
3162
|
+
replayed?: boolean;
|
|
3145
3163
|
}
|
|
3146
3164
|
/**
|
|
3147
3165
|
* Agent protocol part two contracts of the 1.1.55 family: the http stream transport with tls, session tokens, pairing codes, client allowlists, approval gates and the auth handshake for remote clients.
|
|
@@ -3274,4 +3292,369 @@ export interface streamchannel {
|
|
|
3274
3292
|
lasteventat?: number;
|
|
3275
3293
|
closedat?: number;
|
|
3276
3294
|
}
|
|
3295
|
+
/**
|
|
3296
|
+
* Agent protocol part three contracts of the 1.1.56 family: event subscriptions, resource watchers, sampling callbacks, prompt tools, streaming chunks, progress notices, in flight cancellation, per client rate limits, structured errors with retry hints, idempotency keys, batch calls, tool dry runs, tool mocks and the call contexts that isolate concurrent clients.
|
|
3297
|
+
* Every frame still passes the same consent gates — the protocol layer never bypasses review — and every window, budget and ceiling stays a user choice with no code ceiling and no hardcoded endpoint, provider or key.
|
|
3298
|
+
*/
|
|
3299
|
+
/** The protocol event kinds a client may subscribe to: callstarted mirrors every tool call including calls with side effects while the rest stay observation kinds. */
|
|
3300
|
+
export type eventkind = "callstarted" | "callresult" | "streamchunk" | "progress" | "resourcedelta" | "sampling" | "cancellation";
|
|
3301
|
+
/** One event subscription of a paired client: the event kinds it listens to, the optional origin and tool filters that narrow delivery and the lifecycle times. */
|
|
3302
|
+
export interface protocoleventsubscription {
|
|
3303
|
+
id: string;
|
|
3304
|
+
clientid: string;
|
|
3305
|
+
kinds: eventkind[];
|
|
3306
|
+
/** Optional origin filter: only events of this origin reach the subscriber. */
|
|
3307
|
+
origin?: string;
|
|
3308
|
+
/** Optional tool name filter: only events of this namespaced tool reach the subscriber. */
|
|
3309
|
+
tool?: string;
|
|
3310
|
+
createdat: number;
|
|
3311
|
+
lastdeliveredat?: number;
|
|
3312
|
+
canceledat?: number;
|
|
3313
|
+
}
|
|
3314
|
+
/** One resource watcher of a paired client: the watched page state resource, the page state baseline at watch time and the lifecycle times. */
|
|
3315
|
+
export interface resourcewatch {
|
|
3316
|
+
id: string;
|
|
3317
|
+
clientid: string;
|
|
3318
|
+
/** The watched resource name of the page state, for example the page snapshot resource of the session tab. */
|
|
3319
|
+
resource: string;
|
|
3320
|
+
/** The page state baseline captured at watch time; deltas compare against it. */
|
|
3321
|
+
baseline: Record<string, unknown>;
|
|
3322
|
+
createdat: number;
|
|
3323
|
+
lastdeliveredat?: number;
|
|
3324
|
+
canceledat?: number;
|
|
3325
|
+
}
|
|
3326
|
+
/** One sampling callback to a client model: the prompt that leaves the browser, the optional system text, the page content the user granted, the lifecycle state and the provenance times. */
|
|
3327
|
+
export interface samplingrequest {
|
|
3328
|
+
id: string;
|
|
3329
|
+
clientid: string;
|
|
3330
|
+
prompt: string;
|
|
3331
|
+
system?: string;
|
|
3332
|
+
/** Page content the user granted for this callback; stripped before the prompt leaves when the user granted none. */
|
|
3333
|
+
pagecontent?: string;
|
|
3334
|
+
/** User granted maximum tokens of the callback completion; an absent value leaves the size to the client. */
|
|
3335
|
+
maxtokens?: number;
|
|
3336
|
+
state: "pending" | "answered" | "refused";
|
|
3337
|
+
requestedat: number;
|
|
3338
|
+
answeredat?: number;
|
|
3339
|
+
/** The client answer once it arrives; the provenance records the client and the times. */
|
|
3340
|
+
answer?: string;
|
|
3341
|
+
}
|
|
3342
|
+
/** One prompt def exposed as a callable tool: the prompt name, the plain language description, the declared arguments and the render template. */
|
|
3343
|
+
export interface promptdef {
|
|
3344
|
+
name: string;
|
|
3345
|
+
description: string;
|
|
3346
|
+
/** Declared arguments of the prompt with their descriptions, required markers and reviewed defaults. */
|
|
3347
|
+
arguments: Array<{
|
|
3348
|
+
name: string;
|
|
3349
|
+
description: string;
|
|
3350
|
+
required?: boolean;
|
|
3351
|
+
default?: string;
|
|
3352
|
+
}>;
|
|
3353
|
+
/** The render template; every double braced argument placeholder substitutes its value. */
|
|
3354
|
+
template: string;
|
|
3355
|
+
}
|
|
3356
|
+
/** One stream chunk of a progressive tool result: the call it belongs to, the sequence number, the content slice, the done marker and the time. */
|
|
3357
|
+
export interface streamchunk {
|
|
3358
|
+
callid: string;
|
|
3359
|
+
seq: number;
|
|
3360
|
+
content: string;
|
|
3361
|
+
done: boolean;
|
|
3362
|
+
at: number;
|
|
3363
|
+
}
|
|
3364
|
+
/** One progress notice of a long tool call: the call it belongs to, the optional percent, the plain language message, the cancellable hint and the time. */
|
|
3365
|
+
export interface progressnotice {
|
|
3366
|
+
callid: string;
|
|
3367
|
+
percent?: number;
|
|
3368
|
+
message: string;
|
|
3369
|
+
/** True when the user may cancel the in flight call. */
|
|
3370
|
+
cancellable: boolean;
|
|
3371
|
+
at: number;
|
|
3372
|
+
}
|
|
3373
|
+
/** One cancellation frame that aborts an in flight tool call: the call id, the reason in plain language and the time. */
|
|
3374
|
+
export interface cancelframe {
|
|
3375
|
+
callid: string;
|
|
3376
|
+
reason?: string;
|
|
3377
|
+
at: number;
|
|
3378
|
+
}
|
|
3379
|
+
/** One per client rate limit of tool calls: the counting window, the user configured call budget inside it and the live counters; an absent budget keeps the client unbounded. */
|
|
3380
|
+
export interface callratelimit {
|
|
3381
|
+
clientid: string;
|
|
3382
|
+
windowms: number;
|
|
3383
|
+
/** User configured call budget per window; an absent value documents the unbounded choice instead of a silent default. */
|
|
3384
|
+
budget?: number;
|
|
3385
|
+
windowstartedat: number;
|
|
3386
|
+
used: number;
|
|
3387
|
+
}
|
|
3388
|
+
/** The retry hints of a structured error: retry marks retryable failures, wait marks busy windows with their retry after and none marks consent refusals that never retry. */
|
|
3389
|
+
export type retryhint = "retry" | "wait" | "none";
|
|
3390
|
+
/** One structured error answer of a tool call: the error code, the message in plain language, the retry hint and the optional retry after window. */
|
|
3391
|
+
export interface structurederror {
|
|
3392
|
+
code: string;
|
|
3393
|
+
message: string;
|
|
3394
|
+
retryhint: retryhint;
|
|
3395
|
+
retryafter?: number;
|
|
3396
|
+
}
|
|
3397
|
+
/** The idempotency key of a tool call: the client chosen key that replays the stored result for a repeated call. */
|
|
3398
|
+
export type idempotencykey = string;
|
|
3399
|
+
/** One stored idempotency record: the key, the calling client, the tool, the stored result for replay and the expiry of the user configured window. */
|
|
3400
|
+
export interface idempotencyrecord {
|
|
3401
|
+
key: idempotencykey;
|
|
3402
|
+
clientid: string;
|
|
3403
|
+
tool: string;
|
|
3404
|
+
result: toolresult;
|
|
3405
|
+
createdat: number;
|
|
3406
|
+
expiresat: number;
|
|
3407
|
+
}
|
|
3408
|
+
/** One member of a batch call: the member id, the namespaced tool name and the call arguments. */
|
|
3409
|
+
export interface batchmember {
|
|
3410
|
+
id: string;
|
|
3411
|
+
name: string;
|
|
3412
|
+
params: Record<string, unknown>;
|
|
3413
|
+
}
|
|
3414
|
+
/** One batch call of a paired client: the ordered tool calls, the stop on first error flag, the per call outcomes and the lifecycle times. */
|
|
3415
|
+
export interface batchcall {
|
|
3416
|
+
id: string;
|
|
3417
|
+
clientid: string;
|
|
3418
|
+
calls: batchmember[];
|
|
3419
|
+
stoponerror: boolean;
|
|
3420
|
+
state: "pending" | "running" | "done" | "stopped";
|
|
3421
|
+
createdat: number;
|
|
3422
|
+
finishedat?: number;
|
|
3423
|
+
outcomes: batchoutcome[];
|
|
3424
|
+
}
|
|
3425
|
+
/** One outcome of a batch member: the member id, the tool, the outcome flag, the result or the structured error and the time. */
|
|
3426
|
+
export interface batchoutcome {
|
|
3427
|
+
callid: string;
|
|
3428
|
+
tool: string;
|
|
3429
|
+
ok: boolean;
|
|
3430
|
+
result?: toolresult;
|
|
3431
|
+
error?: structurederror;
|
|
3432
|
+
at: number;
|
|
3433
|
+
}
|
|
3434
|
+
/** One tool dry run result: the tool, the argument validation findings, the consent evaluation, the executed marker that stays false and the mutation list that stays empty. */
|
|
3435
|
+
export interface tooldryrun {
|
|
3436
|
+
callid: string;
|
|
3437
|
+
tool: string;
|
|
3438
|
+
argsvalid: boolean;
|
|
3439
|
+
consentok: boolean;
|
|
3440
|
+
findings: string[];
|
|
3441
|
+
/** A dry run never executes anything; the purity gate refuses any record that claims otherwise. */
|
|
3442
|
+
executed: boolean;
|
|
3443
|
+
/** A dry run leaves no page mutation; the purity gate refuses any record that claims one. */
|
|
3444
|
+
mutations: string[];
|
|
3445
|
+
at: number;
|
|
3446
|
+
}
|
|
3447
|
+
/** One tool mock for client testing: the namespaced tool it stands in for, the canned result it returns, the test context flag and the creation time. */
|
|
3448
|
+
export interface toolmock {
|
|
3449
|
+
tool: string;
|
|
3450
|
+
result: toolresult;
|
|
3451
|
+
/** True only in test contexts; policy refuses mocks outside them. */
|
|
3452
|
+
testcontext: boolean;
|
|
3453
|
+
createdat: number;
|
|
3454
|
+
}
|
|
3455
|
+
/** One call context that isolates concurrent client state: the call id, the client, the tool, the lifecycle state, the idempotency key, the dry run and batch markers, the chunk counter and the partial result a cancellation preserves. */
|
|
3456
|
+
export interface callcontext {
|
|
3457
|
+
callid: string;
|
|
3458
|
+
clientid: string;
|
|
3459
|
+
tool: string;
|
|
3460
|
+
state: "inflight" | "done" | "cancelled" | "failed";
|
|
3461
|
+
startedat: number;
|
|
3462
|
+
endedat?: number;
|
|
3463
|
+
idempotencykey?: idempotencykey;
|
|
3464
|
+
dryrun?: boolean;
|
|
3465
|
+
batchid?: string;
|
|
3466
|
+
chunks: number;
|
|
3467
|
+
errorcode?: string;
|
|
3468
|
+
/** The partial result preserved when a cancellation aborts the call in flight. */
|
|
3469
|
+
partial?: toolresult;
|
|
3470
|
+
}
|
|
3471
|
+
/**
|
|
3472
|
+
* Llm integration contracts of the 1.1.57 family: provider configs with endpoint url, auth reference and model list, model routes that map task kinds to provider models, local model endpoints, openapi style tool briefs, natural language command parsing with intents, model drafted plans with replans and reflection, cost budgets with usage records, the prompt template library and the parse guardrails that keep model output honest.
|
|
3473
|
+
* Nothing here hardcodes a provider, an endpoint, a model or a key: every gateway url, base url, model name and parameter is a user configured value, the protocol styles are wire shapes the user picks for interoperability, api keys live behind storage id references and every model drafted plan still passes the same human review the local plans pass.
|
|
3474
|
+
*/
|
|
3475
|
+
/** The protocol request shapes a user may pick for a provider endpoint: the openai compatible chat completions shape, the openai responses shape, the anthropic messages shape and the google gemini shape. These are wire shapes for interoperability, never provider names, and any gateway speaking one of them works. */
|
|
3476
|
+
export type protocolstyle = "chatcompletions" | "responses" | "messages" | "gemini";
|
|
3477
|
+
/** One message of a model conversation: the system, user or assistant role with its content. */
|
|
3478
|
+
export interface modelmessage {
|
|
3479
|
+
role: "system" | "user" | "assistant";
|
|
3480
|
+
content: string;
|
|
3481
|
+
}
|
|
3482
|
+
/** One user configured provider of model completions: the endpoint url the user typed, the protocol shape it speaks, the model list the user maintains, the api key reference (never the key material), the extra headers the user reviewed and the availability status of the last test call. */
|
|
3483
|
+
export interface providerconfig {
|
|
3484
|
+
id: string;
|
|
3485
|
+
name: string;
|
|
3486
|
+
/** The user configured endpoint url; no default and no built-in provider endpoint ever applies. */
|
|
3487
|
+
endpoint: string;
|
|
3488
|
+
style: protocolstyle;
|
|
3489
|
+
/** The user configured model list; every entry is a free text model name. */
|
|
3490
|
+
models: string[];
|
|
3491
|
+
/** Reference to the stored api key record; the key material lives in the browser credential store behind its storage id, never in memory files or audit trails. */
|
|
3492
|
+
authref?: apikeyref;
|
|
3493
|
+
/** Extra headers the user reviewed for gateways that need them; merged over the protocol shape headers. */
|
|
3494
|
+
headers?: Record<string, string>;
|
|
3495
|
+
status: "available" | "unavailable";
|
|
3496
|
+
lastcheckedat?: number;
|
|
3497
|
+
/** Optional user configured price per million tokens and its currency unit for the cost accounting of the usage records; absent pricing keeps the recorded cost at zero. */
|
|
3498
|
+
costpermilliontokens?: number;
|
|
3499
|
+
currency?: string;
|
|
3500
|
+
createdat: number;
|
|
3501
|
+
}
|
|
3502
|
+
/** One model route entry: the task kind it routes, the provider and model it prefers and the user configured fallback pair for refusals and outages; the revision history tracks every change. */
|
|
3503
|
+
export interface modelroute {
|
|
3504
|
+
id: string;
|
|
3505
|
+
/** The task kind of the route: the internal kinds parsecommand, classifyintent, draftplan, replan, reflect and summarize plus any user defined task kind. */
|
|
3506
|
+
kind: string;
|
|
3507
|
+
providerid: string;
|
|
3508
|
+
model: string;
|
|
3509
|
+
fallbackproviderid?: string;
|
|
3510
|
+
fallbackmodel?: string;
|
|
3511
|
+
revision: number;
|
|
3512
|
+
updatedat: number;
|
|
3513
|
+
}
|
|
3514
|
+
/** One browser reachable local model endpoint: the endpoint url, the model name, the protocol shape and the optional key reference of gateways that ask one; the health block carries the last check. */
|
|
3515
|
+
export interface localmodelconfig {
|
|
3516
|
+
endpoint: string;
|
|
3517
|
+
model: string;
|
|
3518
|
+
style: protocolstyle;
|
|
3519
|
+
authref?: apikeyref;
|
|
3520
|
+
health?: {
|
|
3521
|
+
checkedat: number;
|
|
3522
|
+
ok: boolean;
|
|
3523
|
+
detail?: string;
|
|
3524
|
+
};
|
|
3525
|
+
}
|
|
3526
|
+
/** One openapi style tool brief for model consumption: the tool name, the summary, the description, the risk class and the typed parameter list. */
|
|
3527
|
+
export interface toolbrief {
|
|
3528
|
+
tool: string;
|
|
3529
|
+
summary: string;
|
|
3530
|
+
description: string;
|
|
3531
|
+
risk: string;
|
|
3532
|
+
parameters: Array<{
|
|
3533
|
+
name: string;
|
|
3534
|
+
type: string;
|
|
3535
|
+
description: string;
|
|
3536
|
+
required: boolean;
|
|
3537
|
+
}>;
|
|
3538
|
+
}
|
|
3539
|
+
/** The intent kinds a natural language command may carry: navigate, extract, fill, monitor, automate and ask. */
|
|
3540
|
+
export type intentkind = "navigate" | "extract" | "fill" | "monitor" | "automate" | "ask";
|
|
3541
|
+
/** One entity of a parsed command: the entity name and its value. */
|
|
3542
|
+
export interface commandentity {
|
|
3543
|
+
name: string;
|
|
3544
|
+
value: string;
|
|
3545
|
+
}
|
|
3546
|
+
/** One parsed natural language command: the source text, the classified intent, the extracted entities, the confidence between zero and one, the model that parsed it and the parse time. */
|
|
3547
|
+
export interface commandparse {
|
|
3548
|
+
text: string;
|
|
3549
|
+
intent: intentkind;
|
|
3550
|
+
entities: commandentity[];
|
|
3551
|
+
confidence: number;
|
|
3552
|
+
model?: string;
|
|
3553
|
+
providerid?: string;
|
|
3554
|
+
parsedat: number;
|
|
3555
|
+
}
|
|
3556
|
+
/** One model drafted step: the action kind, the optional target and value, the summary and the fresh review marker a replan sets on revised steps. */
|
|
3557
|
+
export interface draftstep {
|
|
3558
|
+
id: string;
|
|
3559
|
+
kind: string;
|
|
3560
|
+
target?: string;
|
|
3561
|
+
value?: string;
|
|
3562
|
+
summary: string;
|
|
3563
|
+
/** True on the revised steps of a replan; every marked step needs the fresh human review before it executes. */
|
|
3564
|
+
freshreview?: boolean;
|
|
3565
|
+
}
|
|
3566
|
+
/** One model drafted plan: the goal, the drafted steps, the open questions the model could not resolve, the lint findings of the grammar check, the model provenance and the review state. A draft never executes until the human review approves it and the plan review approves the plan it produces. */
|
|
3567
|
+
export interface plandraft {
|
|
3568
|
+
id: string;
|
|
3569
|
+
goal: string;
|
|
3570
|
+
steps: draftstep[];
|
|
3571
|
+
openquestions: string[];
|
|
3572
|
+
providerid: string;
|
|
3573
|
+
model: string;
|
|
3574
|
+
state: "draft" | "approved" | "rejected";
|
|
3575
|
+
lintfindings: string[];
|
|
3576
|
+
createdat: number;
|
|
3577
|
+
}
|
|
3578
|
+
/** One replan record of a failed run: the draft it revises, the completed steps it keeps, the failed steps it replaces, the revised tail that needs fresh review, the failure reason and the model provenance. */
|
|
3579
|
+
export interface replanrecord {
|
|
3580
|
+
id: string;
|
|
3581
|
+
draftid: string;
|
|
3582
|
+
completedstepids: string[];
|
|
3583
|
+
failedstepids: string[];
|
|
3584
|
+
tail: draftstep[];
|
|
3585
|
+
reason: string;
|
|
3586
|
+
providerid: string;
|
|
3587
|
+
model: string;
|
|
3588
|
+
state: "pending" | "approved" | "rejected";
|
|
3589
|
+
createdat: number;
|
|
3590
|
+
}
|
|
3591
|
+
/** One reflection note of an executed step: the step outcome, the lesson learned, the advice for the next step and the model provenance; the running lessons feed the next prompt. */
|
|
3592
|
+
export interface reflectnote {
|
|
3593
|
+
id: string;
|
|
3594
|
+
runid: string;
|
|
3595
|
+
stepid: string;
|
|
3596
|
+
outcome: string;
|
|
3597
|
+
lesson: string;
|
|
3598
|
+
advice: string;
|
|
3599
|
+
providerid: string;
|
|
3600
|
+
model: string;
|
|
3601
|
+
createdat: number;
|
|
3602
|
+
}
|
|
3603
|
+
/** One cost budget of a run: the optional token ceiling, the optional currency ceiling with its currency and the configuration time; every ceiling is a user choice and an absent ceiling stays unbounded. */
|
|
3604
|
+
export interface costbudget {
|
|
3605
|
+
runid?: string;
|
|
3606
|
+
maxtokens?: number;
|
|
3607
|
+
maxcost?: number;
|
|
3608
|
+
currency?: string;
|
|
3609
|
+
configuredat: number;
|
|
3610
|
+
}
|
|
3611
|
+
/** One usage record of a model call: the run and step it belongs to, the provider, the endpoint and the model called, the prompt, completion and total token counts, the cost in the user configured currency and the local marker. */
|
|
3612
|
+
export interface usagerecord {
|
|
3613
|
+
id: string;
|
|
3614
|
+
runid?: string;
|
|
3615
|
+
stepid?: string;
|
|
3616
|
+
providerid: string;
|
|
3617
|
+
endpoint: string;
|
|
3618
|
+
model: string;
|
|
3619
|
+
prompttokens: number;
|
|
3620
|
+
completiontokens: number;
|
|
3621
|
+
totaltokens: number;
|
|
3622
|
+
cost: number;
|
|
3623
|
+
/** True when the call went to the local model endpoint. */
|
|
3624
|
+
local?: boolean;
|
|
3625
|
+
at: number;
|
|
3626
|
+
}
|
|
3627
|
+
/** One prompt template of the library: the name, the body with double braced variables, the declared variable list, the version and the change notes of the version. */
|
|
3628
|
+
export interface prompttemplate {
|
|
3629
|
+
id: string;
|
|
3630
|
+
name: string;
|
|
3631
|
+
body: string;
|
|
3632
|
+
variables: string[];
|
|
3633
|
+
version: number;
|
|
3634
|
+
notes?: string;
|
|
3635
|
+
createdat: number;
|
|
3636
|
+
}
|
|
3637
|
+
/** One parse guard of model output: the expected schema of the parsed payload, the retry count before refusal and the refusal markers the user reviews. */
|
|
3638
|
+
export interface parseguard {
|
|
3639
|
+
schema: Record<string, {
|
|
3640
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
3641
|
+
required?: boolean;
|
|
3642
|
+
}>;
|
|
3643
|
+
retries: number;
|
|
3644
|
+
refusalmarkers?: string[];
|
|
3645
|
+
}
|
|
3646
|
+
/** One model output after the guardrails: the raw text, the parsed payload when it validated, the guard verdict of valid, invalid or refused, the verdict reason and the attempt count. */
|
|
3647
|
+
export interface modeloutput {
|
|
3648
|
+
raw: string;
|
|
3649
|
+
parsed?: Record<string, unknown>;
|
|
3650
|
+
verdict: "valid" | "invalid" | "refused";
|
|
3651
|
+
reason?: string;
|
|
3652
|
+
attempts: number;
|
|
3653
|
+
}
|
|
3654
|
+
/** One token of a streamed model answer: the sequence number, the token text and the done marker. */
|
|
3655
|
+
export interface tokenstream {
|
|
3656
|
+
seq: number;
|
|
3657
|
+
text: string;
|
|
3658
|
+
done: boolean;
|
|
3659
|
+
}
|
|
3277
3660
|
//# sourceMappingURL=types.d.ts.map
|