@wenathlan/extension 1.1.55 → 1.1.56

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 CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Devthink is a **consent-first browser-agent bridge** distributed as a TypeScript library and a Chromium Manifest V3 extension. It turns a user-provided browser objective into a bounded, reviewable plan. The user must start the active-tab session and approve the plan before any page action reaches the browser.
4
4
 
5
- Version: **1.1.55**. License: **GPL-3.0-only**. The repository is `wenathlan/extension`; the npm-compatible scoped package identifier is `@wenathlan/extension`.
5
+ Version: **1.1.56**. License: **GPL-3.0-only**. The repository is `wenathlan/extension`; the npm-compatible scoped package identifier is `@wenathlan/extension`.
6
6
 
7
7
  ## What it does
8
8
 
9
- | Capability | Behavior in 1.1.55 |
9
+ | Capability | Behavior in 1.1.56 |
10
10
  | --- | --- |
11
11
  | Active-tab session | The user starts a short-lived session for one HTTPS tab and one origin; the session records its origin grants. |
12
12
  | Page observation | The extension captures the complete semantic inventory: every interactive element, every form control, every select option and the full page text. |
@@ -67,7 +67,7 @@ The endpoint field intentionally has no default URL. Enter a URL such as `https:
67
67
 
68
68
  ```json
69
69
  {
70
- "version": "1.1.55",
70
+ "version": "1.1.56",
71
71
  "objective": "User supplied objective",
72
72
  "session": { "id": "uuid", "tabid": 1, "origin": "https://example.com" },
73
73
  "observation": { "schemaversion": 3, "url": "https://example.com/path", "interactive": [] },
@@ -0,0 +1,155 @@
1
+ import type { callcontext, cancelframe, capabilityset, eventkind, jsonrpcframe, progressnotice, promptdef, protocoleventsubscription, resourcewatch, samplingrequest, streamchunk } from "./types.js";
2
+ /**
3
+ * Agent stream of the 1.1.56 agent protocol part three.
4
+ * Every subscription, resource, sampling, prompt, streaming, progress and cancellation concern lives in this file: the event subscriptions with their kinds and filters, the event notifications that push protocol events to matching subscribers, the resource watchers with their page state baselines and the page state deltas they deliver, the sampling callbacks that ask a client model for a completion behind its declared capabilities and the page content grant, the prompt defs exposed as callable tools with their template rendering, the stream chunks of progressive tool results, the progress notices of long tools with their cancel hints and the cancellation frames that abort an in flight tool call while preserving its partial result.
5
+ * The stream stays pure and consent-first: a subscription never widens what the session grants, a sampling prompt never leaves the browser with ungranted page content and a cancellation never bypasses the audit trail.
6
+ */
7
+ /** The protocol event kinds a client may subscribe to; the callstarted kind mirrors every tool call including calls with side effects. */
8
+ export declare const protocoleventkinds: eventkind[];
9
+ /** The observation event kinds that stay read only: every kind except the callstarted mutation mirror. */
10
+ export declare const readonlyeventkinds: eventkind[];
11
+ /** Registers one client event subscription: the kinds validate against the protocol event kinds while an absent kinds list subscribes the read only observation kinds so a subscription never widens what the session grants. */
12
+ export declare function subscriberegister(input: {
13
+ clientid: string;
14
+ kinds?: string[];
15
+ origin?: string;
16
+ tool?: string;
17
+ now: number;
18
+ id?: string;
19
+ }): {
20
+ subscription?: protocoleventsubscription;
21
+ reason?: string;
22
+ };
23
+ /** Cancels one client event subscription; the record stays for the audit trail with its cancel time. */
24
+ export declare function unsubscriberegister(subscriptions: protocoleventsubscription[], id: string, now: number): protocoleventsubscription[];
25
+ /** Pushes one protocol event to every matching subscriber: active subscriptions whose kinds carry the event kind, whose origin filter matches when set and whose tool filter matches when set receive one notification frame; the delivery stamps the last delivery time. */
26
+ export declare function notifyevent(input: {
27
+ subscriptions: protocoleventsubscription[];
28
+ kind: eventkind;
29
+ origin?: string;
30
+ tool?: string;
31
+ payload?: Record<string, unknown>;
32
+ now: number;
33
+ }): {
34
+ deliveries: Array<{
35
+ subscriptionid: string;
36
+ clientid: string;
37
+ frame: jsonrpcframe;
38
+ }>;
39
+ subscriptions: protocoleventsubscription[];
40
+ };
41
+ /** Starts one page state watcher for a client: the resource names the watched page state and the baseline freezes the page state at watch time so later deltas compare against it. */
42
+ export declare function watchresource(input: {
43
+ clientid: string;
44
+ resource: string;
45
+ state?: Record<string, unknown>;
46
+ now: number;
47
+ id?: string;
48
+ }): {
49
+ watch?: resourcewatch;
50
+ reason?: string;
51
+ };
52
+ /** Cancels one page state watcher; the record stays for the audit trail with its cancel time. */
53
+ export declare function unwatchresource(watches: resourcewatch[], id: string, now: number): resourcewatch[];
54
+ /** Pushes the page state deltas of one resource to its active watchers: every changed key against the baseline lands in the delta, the baseline absorbs the new state and the delivery stamps the last delivery time. */
55
+ export declare function notifyresource(input: {
56
+ watches: resourcewatch[];
57
+ resource: string;
58
+ state: Record<string, unknown>;
59
+ now: number;
60
+ }): {
61
+ deliveries: Array<{
62
+ watchid: string;
63
+ clientid: string;
64
+ delta: Record<string, unknown>;
65
+ }>;
66
+ watches: resourcewatch[];
67
+ };
68
+ /** Sends one sampling callback to a client model: the client must have declared its sampling capability, the page content stays stripped unless the user granted it and the request records its provenance for the round trip. */
69
+ export declare function requestsampling(input: {
70
+ clientid: string;
71
+ capabilities?: capabilityset;
72
+ prompt: string;
73
+ system?: string;
74
+ pagecontent?: string;
75
+ pagegrant?: boolean;
76
+ maxtokens?: number;
77
+ now: number;
78
+ id?: string;
79
+ }): {
80
+ request?: samplingrequest;
81
+ reason?: string;
82
+ };
83
+ /** Completes one sampling round trip: the client answer closes the pending request with its provenance times while answered, refused and unknown requests stay untouched. */
84
+ export declare function answersampling(input: {
85
+ requests: samplingrequest[];
86
+ id: string;
87
+ answer?: string;
88
+ refused?: boolean;
89
+ now: number;
90
+ }): {
91
+ requests: samplingrequest[];
92
+ request?: samplingrequest;
93
+ reason?: string;
94
+ };
95
+ /** Lists the prompt defs the server exposes as callable tools: every prompt carries its name, description, declared arguments and render template. */
96
+ export declare function listprompts(): promptdef[];
97
+ /** Renders one prompt def with its arguments: every double braced placeholder substitutes its argument value while a required argument left empty keeps its placeholder so the review sees the gap. */
98
+ export declare function renderprompt(prompt: promptdef, args: Record<string, unknown>): string;
99
+ /** Calls one prompt: the render validates the declared arguments, substitutes the defaults the prompt reviewed and returns the rendered prompt with its arguments as one tool call the client dispatches behind the consent gates. */
100
+ export declare function callprompt(input: {
101
+ name: string;
102
+ args?: Record<string, unknown>;
103
+ now?: number;
104
+ }): {
105
+ toolcall?: {
106
+ name: string;
107
+ params: Record<string, unknown>;
108
+ };
109
+ rendered?: string;
110
+ reason?: string;
111
+ };
112
+ /** Emits one stream chunk of a progressive tool result: the sequence number orders the chunks while the done marker closes the stream. */
113
+ export declare function streamchunkof(input: {
114
+ callid: string;
115
+ seq: number;
116
+ content: string;
117
+ done?: boolean;
118
+ now: number;
119
+ }): streamchunk;
120
+ /** Splits one tool result content into ordered stream chunks; the final chunk carries the done marker so the client reassembles the progressive result. */
121
+ export declare function chunkcontent(input: {
122
+ callid: string;
123
+ content: string;
124
+ size?: number;
125
+ now: number;
126
+ }): streamchunk[];
127
+ /** Reassembles ordered stream chunks into the progressive result content they carry. */
128
+ export declare function assemblechunks(chunks: streamchunk[]): string;
129
+ /** Emits one progress notice of a long tool call: the percent, the plain language message and the cancel hint the panel renders. */
130
+ export declare function notifyprogress(input: {
131
+ callid: string;
132
+ percent?: number;
133
+ message: string;
134
+ cancellable?: boolean;
135
+ now: number;
136
+ }): progressnotice;
137
+ /** Builds one cancellation frame that aborts an in flight tool call: the call id and the reason in plain language. */
138
+ export declare function cancelframeof(input: {
139
+ callid: string;
140
+ reason?: string;
141
+ now: number;
142
+ }): cancelframe;
143
+ /** Aborts one in flight tool call on its cancellation frame: the call context turns cancelled with its end time while the partial result survives for the answer; a finished or unknown call reports why nothing aborted. */
144
+ export declare function canceltool(input: {
145
+ contexts: callcontext[];
146
+ callid: string;
147
+ reason?: string;
148
+ partial?: callcontext["partial"];
149
+ now: number;
150
+ }): {
151
+ contexts: callcontext[];
152
+ context?: callcontext;
153
+ reason?: string;
154
+ };
155
+ //# sourceMappingURL=agentstream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentstream.d.ts","sourceRoot":"","sources":["../agentstream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,E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+2544,111 @@ var sessionmemory = class {
2544
2544
  async setstreamchannels(channels) {
2545
2545
  return this.adapter.set("mcpchannels", channels);
2546
2546
  }
2547
+ /** Returns every client event subscription with its kinds and filters, newest first. */
2548
+ async geteventsubscriptions() {
2549
+ return await this.adapter.get("mcpeventsubscriptions") ?? [];
2550
+ }
2551
+ /** Replaces the stored event subscription set after one subscribe, unsubscribe or delivery sweep. */
2552
+ async seteventsubscriptions(subscriptions) {
2553
+ return this.adapter.set("mcpeventsubscriptions", subscriptions);
2554
+ }
2555
+ /** Returns every page state resource watcher with its baseline, newest first. */
2556
+ async getresourcewatches() {
2557
+ return await this.adapter.get("mcpresourcewatches") ?? [];
2558
+ }
2559
+ /** Replaces the stored resource watcher set after one watch, unwatch or delta push. */
2560
+ async setresourcewatches(watches) {
2561
+ return this.adapter.set("mcpresourcewatches", watches);
2562
+ }
2563
+ /** Returns every sampling request with its provenance, newest first. */
2564
+ async getsamplingrequests() {
2565
+ return await this.adapter.get("mcpsampling") ?? [];
2566
+ }
2567
+ /** Replaces the stored sampling request set after one request or answer. */
2568
+ async setsamplingrequests(requests) {
2569
+ return this.adapter.set("mcpsampling", requests);
2570
+ }
2571
+ /** Returns every stored idempotency record for replay, newest first. */
2572
+ async getidempotencyrecords() {
2573
+ return await this.adapter.get("mcpidempotency") ?? [];
2574
+ }
2575
+ /** Replaces the stored idempotency record set after one store or expiry sweep. */
2576
+ async setidempotencyrecords(records) {
2577
+ return this.adapter.set("mcpidempotency", records);
2578
+ }
2579
+ /** Returns every per client rate limit counter with its window and budget. */
2580
+ async getcallratelimits() {
2581
+ return await this.adapter.get("mcpcallratelimits") ?? [];
2582
+ }
2583
+ /** Replaces the stored per client rate limit set after one configuration or counted call. */
2584
+ async setcallratelimits(limits) {
2585
+ return this.adapter.set("mcpcallratelimits", limits);
2586
+ }
2587
+ /** Returns every stored batch call with its per item outcomes, newest first. */
2588
+ async getbatchcalls() {
2589
+ return await this.adapter.get("mcpbatchcalls") ?? [];
2590
+ }
2591
+ /** Upserts one batch call by its id with the per item outcomes riding the record. */
2592
+ async setbatchcall(batch) {
2593
+ await this.adapter.set("mcpbatchcalls", [batch, ...(await this.getbatchcalls()).filter((candidate) => candidate.id !== batch.id)]);
2594
+ }
2595
+ /** Returns every call context of the call runtime, newest first. */
2596
+ async getcallcontexts() {
2597
+ return await this.adapter.get("mcpcallcontexts") ?? [];
2598
+ }
2599
+ /** Replaces the stored call context set after one begin, end or cancellation. */
2600
+ async setcallcontexts(contexts) {
2601
+ return this.adapter.set("mcpcallcontexts", contexts);
2602
+ }
2603
+ /** Returns every stored tool mock for client testing. */
2604
+ async gettoolmocks() {
2605
+ return await this.adapter.get("mcptoolmocks") ?? [];
2606
+ }
2607
+ /** Upserts one tool mock by its tool name or removes it when the canned result is absent. */
2608
+ async settoolmock(mock) {
2609
+ await this.adapter.set("mcptoolmocks", [mock, ...(await this.gettoolmocks()).filter((candidate) => candidate.tool !== mock.tool)]);
2610
+ }
2611
+ /** Removes one tool mock so its tool returns to the real gates. */
2612
+ async removetoolmock(tool) {
2613
+ await this.adapter.set("mcptoolmocks", (await this.gettoolmocks()).filter((candidate) => candidate.tool !== tool));
2614
+ }
2615
+ /** Stores one stream chunk of a progressive tool result under the recent chunk window of 25 records. */
2616
+ async addstreamchunk(chunk) {
2617
+ await this.adapter.set("mcpstreamchunks", [chunk, ...(await this.getstreamchunks()).slice(0, 24)]);
2618
+ }
2619
+ /** Returns the recent stream chunks of progressive tool results, newest first. */
2620
+ async getstreamchunks() {
2621
+ return await this.adapter.get("mcpstreamchunks") ?? [];
2622
+ }
2623
+ /** Replaces the recent stream chunk window after one streaming sweep. */
2624
+ async setstreamchunks(chunks) {
2625
+ return this.adapter.set("mcpstreamchunks", chunks);
2626
+ }
2627
+ /** Returns the audited tool call log under the requested filters: the client, the tool, the outcome, the time floor and the newest bound, all optional. */
2628
+ async getcalllog(filters) {
2629
+ let records = await this.listtoolcalls();
2630
+ if (filters?.clientid !== void 0) records = records.filter((record2) => record2.clientid === filters.clientid);
2631
+ if (filters?.tool !== void 0) records = records.filter((record2) => record2.tool === filters.tool);
2632
+ if (filters?.ok !== void 0) records = records.filter((record2) => record2.ok === filters.ok);
2633
+ if (filters?.since !== void 0) records = records.filter((record2) => record2.at >= (filters.since ?? 0));
2634
+ return filters?.limit !== void 0 ? records.slice(0, filters.limit) : records;
2635
+ }
2636
+ /** Stores one progress notice of a long tool call under the recent notice window of 25 records. */
2637
+ async addprogressnotice(notice) {
2638
+ await this.adapter.set("mcpprogressnotices", [notice, ...(await this.getprogressnotices()).slice(0, 24)]);
2639
+ }
2640
+ /** Returns the recent progress notices of long tool calls, newest first. */
2641
+ async getprogressnotices() {
2642
+ return await this.adapter.get("mcpprogressnotices") ?? [];
2643
+ }
2644
+ /** Returns the tool dry run toggle of the next call: true once the user armed the dry run in the panel. */
2645
+ async getdryruntoggle() {
2646
+ return await this.adapter.get("mcpdryruntoggle") === true;
2647
+ }
2648
+ /** Arms or disarms the tool dry run of the next call. */
2649
+ async setdryruntoggle(enabled) {
2650
+ return this.adapter.set("mcpdryruntoggle", enabled);
2651
+ }
2547
2652
  };
2548
2653
  function mediakindof(record2) {
2549
2654
  if ("pages" in record2) return "pdf";
@@ -4663,7 +4768,7 @@ async function callgraphql(input) {
4663
4768
  }
4664
4769
 
4665
4770
  // version.ts
4666
- var packageversion = "1.1.55";
4771
+ var packageversion = "1.1.56";
4667
4772
 
4668
4773
  // types.ts
4669
4774
  var protocolversion = packageversion;
@@ -8880,6 +8985,48 @@ function approvaltimeoutvalid(timeout) {
8880
8985
  return { allowed: true };
8881
8986
  }
8882
8987
 
8988
+ // agentstream.ts
8989
+ function listprompts() {
8990
+ return [
8991
+ { name: "runreview", description: "Renders the run review prompt that asks the user model to summarize the executed steps of the approved plan behind the consent gates.", arguments: [{ name: "objective", description: "The objective of the approved plan under review.", required: true }, { name: "steps", description: "The executed step summaries the review covers.", required: true }, { name: "tone", description: "The tone of the summary.", default: "plain" }], template: "Review the run of the objective {{objective}}. Summarize the executed steps: {{steps}}. Keep the tone {{tone}} and state every refusal the consent gates raised." },
8992
+ { name: "pagesummary", description: "Renders the page summary prompt that condenses the observed page state of the session tab into the summary the client model asked for.", arguments: [{ name: "url", description: "The url of the observed page.", required: true }, { name: "observations", description: "The observed page state sections the summary condenses.", required: true }], template: "Summarize the page at {{url}} from the observations: {{observations}}. Name nothing the observations leave out." },
8993
+ { name: "failuretriage", description: "Renders the failure triage prompt that classifies a failed tool call through the retry hints of the structured error it produced.", arguments: [{ name: "tool", description: "The namespaced tool that failed.", required: true }, { name: "error", description: "The structured error of the failed call.", required: true }], template: "Triage the failure of the {{tool}} tool: {{error}}. Classify it as retryable, a busy window or a consent refusal and propose the next reviewed step." }
8994
+ ];
8995
+ }
8996
+ function renderprompt(prompt, args) {
8997
+ return prompt.template.replace(/\{\{\s*([a-z0-9]+)\s*\}\}/g, (whole, name) => {
8998
+ const value = args[name];
8999
+ if (value === void 0 || value === null) return whole;
9000
+ return typeof value === "string" ? value : JSON.stringify(value);
9001
+ });
9002
+ }
9003
+ function callprompt(input) {
9004
+ const prompt = listprompts().find((candidate) => candidate.name === input.name);
9005
+ if (prompt === void 0) return { reason: `The server exposes no prompt named ${input.name}.` };
9006
+ const args = input.args ?? {};
9007
+ const findings = [];
9008
+ const resolved = {};
9009
+ for (const argument of prompt.arguments) {
9010
+ const value = args[argument.name];
9011
+ if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") {
9012
+ if (argument.default !== void 0) resolved[argument.name] = argument.default;
9013
+ else if (argument.required === true) findings.push(`The prompt argument ${argument.name} is required and stays empty.`);
9014
+ else resolved[argument.name] = "";
9015
+ } else {
9016
+ resolved[argument.name] = value;
9017
+ }
9018
+ }
9019
+ if (findings.length > 0) return { reason: findings.join(" ") };
9020
+ return { rendered: renderprompt(prompt, resolved), toolcall: { name: `prompts.${prompt.name}`, params: { prompt: prompt.name, arguments: resolved, rendered: renderprompt(prompt, resolved) } } };
9021
+ }
9022
+ function canceltool(input) {
9023
+ const match = input.contexts.find((context2) => context2.callid === input.callid);
9024
+ if (match === void 0) return { contexts: input.contexts, reason: `The cancellation frame names no call context ${input.callid}.` };
9025
+ if (match.state !== "inflight") return { contexts: input.contexts, reason: `The call ${input.callid} already left the in flight state.` };
9026
+ const context = { ...match, state: "cancelled", endedat: input.now, ...input.partial !== void 0 ? { partial: input.partial } : {} };
9027
+ return { contexts: input.contexts.map((candidate) => candidate.callid === input.callid ? context : candidate), context };
9028
+ }
9029
+
8883
9030
  // mcpserver.ts
8884
9031
  var localhostbind = "127.0.0.1";
8885
9032
  var defaultmcpport = 7436;
@@ -8934,7 +9081,10 @@ function servermethods() {
8934
9081
  { method: "ping", handler: "ping", description: "Answers keepalive frames with pong." },
8935
9082
  { method: "tools/list", handler: "listtools", description: "Returns every tool with its version and json schema inputs." },
8936
9083
  { method: "negotiate", handler: "negotiate", description: "Exchanges capability sets with the client." },
8937
- { method: "tools/call", handler: "dispatch", description: "Invokes one tool behind the consent gates." }
9084
+ { method: "tools/call", handler: "dispatch", description: "Invokes one tool behind the consent gates." },
9085
+ { method: "prompts/list", handler: "listprompts", description: "Lists the prompt defs the server exposes as callable tools." },
9086
+ { method: "prompts/call", handler: "callprompt", description: "Renders one prompt and returns its arguments as a tool call." },
9087
+ { method: "calls/cancel", handler: "cancel", description: "Aborts one in flight tool call and preserves its partial result." }
8938
9088
  ];
8939
9089
  }
8940
9090
  function servercapabilities(input) {
@@ -9029,6 +9179,22 @@ async function handleframe(input) {
9029
9179
  const outcome = negotiate({ ...clientcaps !== void 0 ? { client: clientcaps } : {}, server });
9030
9180
  return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, ...outcome.agreed ? { result: outcome.capabilities } : { error: rpcerrorof("params", outcome.mismatch ?? "The capability negotiation did not agree.") } });
9031
9181
  }
9182
+ if (entry.handler === "listprompts") return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, result: { prompts: listprompts() } });
9183
+ if (entry.handler === "callprompt") {
9184
+ const name = typeof params?.name === "string" ? params.name : "";
9185
+ const args = params?.arguments && typeof params.arguments === "object" && !Array.isArray(params.arguments) ? params.arguments : void 0;
9186
+ const called = name === "" ? { reason: "The prompt call needs the prompt name." } : callprompt({ name, ...args !== void 0 ? { args } : {} });
9187
+ if (called.toolcall === void 0) return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, error: rpcerrorof("params", called.reason ?? "The prompt call did not render.") });
9188
+ return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, result: { toolcall: called.toolcall, rendered: called.rendered } });
9189
+ }
9190
+ if (entry.handler === "cancel") {
9191
+ const callid = typeof params?.callid === "string" ? params.callid : "";
9192
+ const reason = typeof params?.reason === "string" ? params.reason : void 0;
9193
+ if (callid.trim() === "") return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, error: rpcerrorof("params", "The cancellation frame needs the call id it aborts.") });
9194
+ const aborted = canceltool({ contexts: input.contexts ?? [], callid, ...reason !== void 0 ? { reason } : {}, now: input.now });
9195
+ if (aborted.context === void 0) return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, error: rpcerrorof("params", aborted.reason ?? "The cancellation frame named no in flight tool call.") });
9196
+ return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, result: { cancelled: true, callid, ...reason !== void 0 ? { reason } : {}, ...aborted.context.partial !== void 0 ? { partial: aborted.context.partial } : {} } });
9197
+ }
9032
9198
  const dispatched = await dispatchtool({ ...params !== void 0 ? { params } : {}, client: input.client, catalog: input.catalog, ...input.session !== void 0 ? { session: input.session } : {}, ...input.plan !== void 0 ? { plan: input.plan } : {}, ...input.scopes !== void 0 ? { scopes: input.scopes } : {}, origin: input.origin, now: input.now, execute: input.execute });
9033
9199
  return respond({ ...frame.id !== void 0 ? { id: frame.id } : {}, ...dispatched.error !== void 0 ? { error: dispatched.error } : { result: dispatched.result } });
9034
9200
  }
@@ -9049,7 +9215,7 @@ function framedlog(event, at, fields) {
9049
9215
  return JSON.stringify({ at, event, ...fields ?? {} });
9050
9216
  }
9051
9217
  function toolcallevent(input) {
9052
- return { id: input.id, clientid: input.clientid, tool: input.tool, origin: input.origin, ok: input.ok, ...input.code !== void 0 ? { code: input.code } : {}, at: input.now };
9218
+ return { id: input.id, clientid: input.clientid, tool: input.tool, origin: input.origin, ok: input.ok, ...input.code !== void 0 ? { code: input.code } : {}, at: input.now, ...input.callid !== void 0 ? { callid: input.callid } : {}, ...input.idempotencykey !== void 0 && input.idempotencykey.trim() !== "" ? { idempotencykey: input.idempotencykey } : {}, ...input.dryrun === true ? { dryrun: true } : {}, ...input.mocked === true ? { mocked: true } : {}, ...input.batchid !== void 0 ? { batchid: input.batchid } : {}, ...input.replayed === true ? { replayed: true } : {} };
9053
9219
  }
9054
9220
 
9055
9221
  // httpstream.ts
@@ -10065,6 +10231,66 @@ function heartbeatreport(input) {
10065
10231
  const open = input.channels.filter((channel) => channel.closedat === void 0 && input.now - channel.lastbeatat < (input.idlewindow ?? defaultidlewindowms));
10066
10232
  return { version: protocolversion, beats: input.channels.filter((channel) => channel.lastbeatat > channel.openedat).length, open: open.length, dead: input.channels.length - open.length };
10067
10233
  }
10234
+ function subscriptionframes(input) {
10235
+ const subscribe = { jsonrpc: "2.0", id: input.id, method: "events/subscribe", params: { subscriptionid: input.subscription.id, kinds: input.subscription.kinds, ...input.subscription.origin !== void 0 ? { origin: input.subscription.origin } : {}, ...input.subscription.tool !== void 0 ? { tool: input.subscription.tool } : {} } };
10236
+ const unsubscribe = { jsonrpc: "2.0", id: input.id, method: "events/unsubscribe", params: { subscriptionid: input.subscription.id } };
10237
+ return { subscribe, unsubscribe };
10238
+ }
10239
+ function eventnotification(input) {
10240
+ return { jsonrpc: "2.0", method: "events/notify", params: { subscriptionid: input.subscriptionid, kind: input.kind, ...input.origin !== void 0 ? { origin: input.origin } : {}, ...input.tool !== void 0 ? { tool: input.tool } : {}, ...input.payload !== void 0 ? { payload: input.payload } : {}, at: input.now } };
10241
+ }
10242
+ function resourcedeltareport(input) {
10243
+ return { version: protocolversion, watchid: input.watchid, clientid: input.clientid, resource: input.resource, delta: input.delta, at: input.now };
10244
+ }
10245
+ function samplingframes(input) {
10246
+ const request = { jsonrpc: "2.0", id: input.id, method: "sampling/request", params: { samplingid: input.request.id, prompt: input.request.prompt, ...input.request.system !== void 0 ? { system: input.request.system } : {}, ...input.request.pagecontent !== void 0 ? { pagecontent: input.request.pagecontent } : {}, ...input.request.maxtokens !== void 0 ? { maxtokens: input.request.maxtokens } : {} } };
10247
+ const answer = input.request.state === "answered" ? { jsonrpc: "2.0", id: input.id, method: "sampling/answer", params: { samplingid: input.request.id, answer: input.request.answer ?? "" } } : input.request.state === "refused" ? { jsonrpc: "2.0", id: input.id, method: "sampling/answer", params: { samplingid: input.request.id, refused: true } } : { jsonrpc: "2.0", id: input.id, method: "sampling/answer", params: { samplingid: input.request.id, state: "pending" } };
10248
+ return { request, answer };
10249
+ }
10250
+ function promptreport(input) {
10251
+ return { version: protocolversion, prompts: input.prompts.map((prompt) => ({ name: prompt.name, description: prompt.description, arguments: prompt.arguments, template: prompt.template })) };
10252
+ }
10253
+ function promptcallframe(input) {
10254
+ return { jsonrpc: "2.0", id: input.id, method: "prompts/call", params: { name: input.name, arguments: input.args } };
10255
+ }
10256
+ function streamchunkframe(chunk) {
10257
+ return { jsonrpc: "2.0", method: "calls/stream", params: { callid: chunk.callid, seq: chunk.seq, content: chunk.content, done: chunk.done, at: chunk.at } };
10258
+ }
10259
+ function progressnoticeframe(notice) {
10260
+ return { jsonrpc: "2.0", method: "calls/progress", params: { callid: notice.callid, ...notice.percent !== void 0 ? { percent: notice.percent } : {}, message: notice.message, cancellable: notice.cancellable, at: notice.at } };
10261
+ }
10262
+ function cancelframes(input) {
10263
+ const cancel = { jsonrpc: "2.0", id: input.id, method: "calls/cancel", params: { callid: input.frame.callid, ...input.frame.reason !== void 0 ? { reason: input.frame.reason } : {} } };
10264
+ const cancelled = { jsonrpc: "2.0", id: input.id, result: { cancelled: true, callid: input.frame.callid, ...input.frame.reason !== void 0 ? { reason: input.frame.reason } : {}, ...input.partial !== void 0 ? { partial: input.partial } : {} } };
10265
+ return { cancel, cancelled };
10266
+ }
10267
+ function structurederrorreport(input) {
10268
+ return { version: protocolversion, code: input.error.code, message: input.error.message, retryhint: input.error.retryhint, ...input.error.retryafter !== void 0 ? { retryafter: input.error.retryafter } : {}, ...input.usage !== void 0 ? { usage: input.usage } : {} };
10269
+ }
10270
+ function idempotencyreplayframe(input) {
10271
+ return { jsonrpc: "2.0", id: input.id, result: { replayed: true, idempotencykey: input.key, originalat: input.originalat, result: input.result } };
10272
+ }
10273
+ function batchreport(input) {
10274
+ return { version: protocolversion, batchid: input.batch.id, clientid: input.batch.clientid, state: input.batch.state, stoponerror: input.batch.stoponerror, done: input.batch.outcomes.length, total: input.batch.calls.length, outcomes: input.batch.outcomes };
10275
+ }
10276
+ function ratelimitreport(input) {
10277
+ return { version: protocolversion, limits: input.limits.map((limit) => ({ clientid: limit.clientid, windowms: limit.windowms, ...limit.budget !== void 0 ? { budget: limit.budget } : {}, used: limit.used, unbounded: limit.budget === void 0, resetat: limit.windowstartedat + limit.windowms })) };
10278
+ }
10279
+ function calllogreport(input) {
10280
+ return { version: protocolversion, calls: input.calls, filters: input.filters ?? {} };
10281
+ }
10282
+ function inflightreport(input) {
10283
+ return { version: protocolversion, inflight: input.contexts.filter((context) => context.state === "inflight").map((context) => ({ callid: context.callid, clientid: context.clientid, tool: context.tool, startedat: context.startedat, msopen: input.now - context.startedat, chunks: context.chunks, ...context.dryrun === true ? { dryrun: true } : {}, ...context.batchid !== void 0 ? { batchid: context.batchid } : {}, ...context.idempotencykey !== void 0 ? { idempotencykey: context.idempotencykey } : {} })) };
10284
+ }
10285
+ function dryrunreport(dryrun) {
10286
+ return { version: protocolversion, callid: dryrun.callid, tool: dryrun.tool, argsvalid: dryrun.argsvalid, consentok: dryrun.consentok, findings: dryrun.findings, executed: dryrun.executed, mutations: dryrun.mutations };
10287
+ }
10288
+ function mockreport(mocks) {
10289
+ return { version: protocolversion, mocks: mocks.map((mock) => ({ tool: mock.tool, content: mock.result.content, testcontext: mock.testcontext, createdat: mock.createdat })) };
10290
+ }
10291
+ function idempotencyreport(records, now) {
10292
+ return { version: protocolversion, records: records.map((record2) => ({ key: record2.key, clientid: record2.clientid, tool: record2.tool, createdat: record2.createdat, expiresat: record2.expiresat, live: now < record2.expiresat })) };
10293
+ }
10068
10294
 
10069
10295
  // workfloweditor.ts
10070
10296
  var palettecategories = ["actions", "controlflow", "waits", "variables", "triggers"];
@@ -10805,6 +11031,7 @@ export {
10805
11031
  authreport,
10806
11032
  autointervalof,
10807
11033
  backoffdelay,
11034
+ batchreport,
10808
11035
  bindlocalhost,
10809
11036
  bindparam,
10810
11037
  bindvariables,
@@ -10830,8 +11057,10 @@ export {
10830
11057
  buildstitchplan,
10831
11058
  buildtoolcatalog,
10832
11059
  callgraphql,
11060
+ calllogreport,
10833
11061
  callrest,
10834
11062
  callsreport,
11063
+ cancelframes,
10835
11064
  cancellederror,
10836
11065
  cancelrun,
10837
11066
  canexecute,
@@ -10920,6 +11149,7 @@ export {
10920
11149
  downloadreport,
10921
11150
  drainqueue,
10922
11151
  dryrunprojection,
11152
+ dryrunreport,
10923
11153
  dryrunworkflow,
10924
11154
  editorsavegate,
10925
11155
  editorstate,
@@ -10936,6 +11166,7 @@ export {
10936
11166
  errorreportresponse,
10937
11167
  evaluatecondition,
10938
11168
  evaluatetrigger,
11169
+ eventnotification,
10939
11170
  eventresponse,
10940
11171
  eventrulematches,
10941
11172
  exchangesreport,
@@ -10992,12 +11223,15 @@ export {
10992
11223
  httpframepipeline,
10993
11224
  httpkinds,
10994
11225
  httpstreamreport,
11226
+ idempotencyreplayframe,
11227
+ idempotencyreport,
10995
11228
  imagefilterof,
10996
11229
  imagematches,
10997
11230
  imagenames,
10998
11231
  importpresetlibrary,
10999
11232
  importsessionfile,
11000
11233
  importworkflow,
11234
+ inflightreport,
11001
11235
  initialize,
11002
11236
  iscdpkind,
11003
11237
  iscontrolflowkind,
@@ -11053,6 +11287,7 @@ export {
11053
11287
  methoddomain,
11054
11288
  minimapfocus,
11055
11289
  mockfor,
11290
+ mockreport,
11056
11291
  mockspecof,
11057
11292
  multipartchunks,
11058
11293
  multipartpayloadof,
@@ -11127,6 +11362,9 @@ export {
11127
11362
  profilereport,
11128
11363
  profileretentionwindow,
11129
11364
  profilerkinds,
11365
+ progressnoticeframe,
11366
+ promptcallframe,
11367
+ promptreport,
11130
11368
  protocolversion,
11131
11369
  provenancereport,
11132
11370
  proxygate,
@@ -11139,6 +11377,7 @@ export {
11139
11377
  rankapis,
11140
11378
  ratelimitbudgetallowed,
11141
11379
  ratelimitreadof,
11380
+ ratelimitreport,
11142
11381
  ratelimitwait,
11143
11382
  readpath,
11144
11383
  readstream,
@@ -11170,6 +11409,7 @@ export {
11170
11409
  resolvedrisk,
11171
11410
  resolvetool,
11172
11411
  resolvevariable,
11412
+ resourcedeltareport,
11173
11413
  resourcefacts,
11174
11414
  respond,
11175
11415
  restartbridge,
@@ -11209,6 +11449,7 @@ export {
11209
11449
  runwhile,
11210
11450
  runworkflow,
11211
11451
  safetyresponse,
11452
+ samplingframes,
11212
11453
  saveworkflow,
11213
11454
  scaledrect,
11214
11455
  schedulecron,
@@ -11262,9 +11503,12 @@ export {
11262
11503
  stepmodeof,
11263
11504
  steptemplateof,
11264
11505
  stepwindows,
11506
+ streamchunkframe,
11265
11507
  streamsummaries,
11266
11508
  streamwindowof,
11509
+ structurederrorreport,
11267
11510
  submitreviewgranted,
11511
+ subscriptionframes,
11268
11512
  subscriptionoptionsof,
11269
11513
  tabreportresponse,
11270
11514
  targetgate,