@agenr/openclaw-plugin 1.5.0 → 2026.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +21 -661
  2. package/README.md +1 -0
  3. package/dist/build-before-turn-artifact-NPUHVWFE.js +71 -0
  4. package/dist/build-recall-artifact-F3LS3PZX.js +62 -0
  5. package/dist/chunk-5AXMFBHR.js +14 -0
  6. package/dist/chunk-5AYIXQRF.js +4452 -0
  7. package/dist/chunk-5TIP2EPP.js +6944 -0
  8. package/dist/chunk-GAERET5Q.js +2070 -0
  9. package/dist/chunk-GF3PX3VM.js +41 -0
  10. package/dist/chunk-GKZQ5AG5.js +44 -0
  11. package/dist/chunk-LDJN7CVU.js +3231 -0
  12. package/dist/chunk-MC3C2XM5.js +148 -0
  13. package/dist/chunk-NBS62ES5.js +3012 -0
  14. package/dist/chunk-NSLTJBUC.js +270 -0
  15. package/dist/chunk-OJSIZDZD.js +9 -0
  16. package/dist/chunk-OWGQWQUP.js +45 -0
  17. package/dist/chunk-Q5UTJXHZ.js +1069 -0
  18. package/dist/chunk-SOQW7356.js +2416 -0
  19. package/dist/chunk-VBPYU7GO.js +597 -0
  20. package/dist/chunk-VTHBPXDQ.js +1750 -0
  21. package/dist/chunk-XFJ4S4G2.js +1679 -0
  22. package/dist/chunk-Y5NB3FTH.js +106 -0
  23. package/dist/chunk-ZX55JBV2.js +4451 -0
  24. package/dist/index.js +1905 -15298
  25. package/dist/lifecycle-checkpoint-IAC5FCQU.js +154 -0
  26. package/dist/scan-6JKPOQHD.js +6 -0
  27. package/dist/service-EKFACEN6.js +15 -0
  28. package/dist/service-RHNB5AEQ.js +861 -0
  29. package/dist/sink-AUAAWC5O.js +8 -0
  30. package/openclaw.plugin.json +148 -11
  31. package/package.json +7 -5
  32. package/dist/anthropic-RE4XNAKE.js +0 -5515
  33. package/dist/azure-openai-responses-IQLXOCZS.js +0 -190
  34. package/dist/chunk-6DQXEU2A.js +0 -32306
  35. package/dist/chunk-EAQYK3U2.js +0 -41
  36. package/dist/chunk-HNWLZUWE.js +0 -31
  37. package/dist/chunk-JRUUYSFL.js +0 -262
  38. package/dist/chunk-OLOUBEE5.js +0 -14022
  39. package/dist/chunk-P5HNPYGQ.js +0 -174
  40. package/dist/chunk-RD7BUOBD.js +0 -416
  41. package/dist/chunk-RWWH2U4W.js +0 -7056
  42. package/dist/chunk-SEOMNQGB.js +0 -86
  43. package/dist/chunk-SQLXP7LT.js +0 -4792
  44. package/dist/chunk-URGOKODJ.js +0 -17
  45. package/dist/dist-R6ESEJ6P.js +0 -1244
  46. package/dist/google-NAVXTQLO.js +0 -371
  47. package/dist/google-gemini-cli-NKYJWHX2.js +0 -712
  48. package/dist/google-vertex-ZBJ2EDRH.js +0 -414
  49. package/dist/mistral-SBQYC4J5.js +0 -38407
  50. package/dist/multipart-parser-DV373IRF.js +0 -371
  51. package/dist/openai-codex-responses-XN3T3DEN.js +0 -712
  52. package/dist/openai-completions-75ZFOFU6.js +0 -657
  53. package/dist/openai-responses-DCK4BVNT.js +0 -198
  54. package/dist/src-T5RRS2HN.js +0 -1408
@@ -1,198 +0,0 @@
1
- import {
2
- buildCopilotDynamicHeaders,
3
- hasCopilotVisionInput
4
- } from "./chunk-HNWLZUWE.js";
5
- import {
6
- convertResponsesMessages,
7
- convertResponsesTools,
8
- processResponsesStream
9
- } from "./chunk-RD7BUOBD.js";
10
- import "./chunk-URGOKODJ.js";
11
- import {
12
- OpenAI
13
- } from "./chunk-RWWH2U4W.js";
14
- import "./chunk-JRUUYSFL.js";
15
- import {
16
- getEnvApiKey
17
- } from "./chunk-SEOMNQGB.js";
18
- import {
19
- buildBaseOptions,
20
- clampReasoning
21
- } from "./chunk-P5HNPYGQ.js";
22
- import {
23
- AssistantMessageEventStream,
24
- supportsXhigh
25
- } from "./chunk-OLOUBEE5.js";
26
- import "./chunk-EAQYK3U2.js";
27
-
28
- // ../../node_modules/.pnpm/@mariozechner+pi-ai@0.63.2_@modelcontextprotocol+sdk@1.27.1_zod@4.3.6__ws@8.20.0_zod@4.3.6/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses.js
29
- var OPENAI_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode"]);
30
- function resolveCacheRetention(cacheRetention) {
31
- if (cacheRetention) {
32
- return cacheRetention;
33
- }
34
- if (typeof process !== "undefined" && process.env.PI_CACHE_RETENTION === "long") {
35
- return "long";
36
- }
37
- return "short";
38
- }
39
- function getPromptCacheRetention(baseUrl, cacheRetention) {
40
- if (cacheRetention !== "long") {
41
- return void 0;
42
- }
43
- if (baseUrl.includes("api.openai.com")) {
44
- return "24h";
45
- }
46
- return void 0;
47
- }
48
- var streamOpenAIResponses = (model, context, options) => {
49
- const stream = new AssistantMessageEventStream();
50
- (async () => {
51
- const output = {
52
- role: "assistant",
53
- content: [],
54
- api: model.api,
55
- provider: model.provider,
56
- model: model.id,
57
- usage: {
58
- input: 0,
59
- output: 0,
60
- cacheRead: 0,
61
- cacheWrite: 0,
62
- totalTokens: 0,
63
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
64
- },
65
- stopReason: "stop",
66
- timestamp: Date.now()
67
- };
68
- try {
69
- const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
70
- const client = createClient(model, context, apiKey, options?.headers);
71
- let params = buildParams(model, context, options);
72
- const nextParams = await options?.onPayload?.(params, model);
73
- if (nextParams !== void 0) {
74
- params = nextParams;
75
- }
76
- const openaiStream = await client.responses.create(params, options?.signal ? { signal: options.signal } : void 0);
77
- stream.push({ type: "start", partial: output });
78
- await processResponsesStream(openaiStream, output, stream, model, {
79
- serviceTier: options?.serviceTier,
80
- applyServiceTierPricing
81
- });
82
- if (options?.signal?.aborted) {
83
- throw new Error("Request was aborted");
84
- }
85
- if (output.stopReason === "aborted" || output.stopReason === "error") {
86
- throw new Error("An unknown error occurred");
87
- }
88
- stream.push({ type: "done", reason: output.stopReason, message: output });
89
- stream.end();
90
- } catch (error) {
91
- for (const block of output.content)
92
- delete block.index;
93
- output.stopReason = options?.signal?.aborted ? "aborted" : "error";
94
- output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
95
- stream.push({ type: "error", reason: output.stopReason, error: output });
96
- stream.end();
97
- }
98
- })();
99
- return stream;
100
- };
101
- var streamSimpleOpenAIResponses = (model, context, options) => {
102
- const apiKey = options?.apiKey || getEnvApiKey(model.provider);
103
- if (!apiKey) {
104
- throw new Error(`No API key for provider: ${model.provider}`);
105
- }
106
- const base = buildBaseOptions(model, options, apiKey);
107
- const reasoningEffort = supportsXhigh(model) ? options?.reasoning : clampReasoning(options?.reasoning);
108
- return streamOpenAIResponses(model, context, {
109
- ...base,
110
- reasoningEffort
111
- });
112
- };
113
- function createClient(model, context, apiKey, optionsHeaders) {
114
- if (!apiKey) {
115
- if (!process.env.OPENAI_API_KEY) {
116
- throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");
117
- }
118
- apiKey = process.env.OPENAI_API_KEY;
119
- }
120
- const headers = { ...model.headers };
121
- if (model.provider === "github-copilot") {
122
- const hasImages = hasCopilotVisionInput(context.messages);
123
- const copilotHeaders = buildCopilotDynamicHeaders({
124
- messages: context.messages,
125
- hasImages
126
- });
127
- Object.assign(headers, copilotHeaders);
128
- }
129
- if (optionsHeaders) {
130
- Object.assign(headers, optionsHeaders);
131
- }
132
- return new OpenAI({
133
- apiKey,
134
- baseURL: model.baseUrl,
135
- dangerouslyAllowBrowser: true,
136
- defaultHeaders: headers
137
- });
138
- }
139
- function buildParams(model, context, options) {
140
- const messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS);
141
- const cacheRetention = resolveCacheRetention(options?.cacheRetention);
142
- const params = {
143
- model: model.id,
144
- input: messages,
145
- stream: true,
146
- prompt_cache_key: cacheRetention === "none" ? void 0 : options?.sessionId,
147
- prompt_cache_retention: getPromptCacheRetention(model.baseUrl, cacheRetention),
148
- store: false
149
- };
150
- if (options?.maxTokens) {
151
- params.max_output_tokens = options?.maxTokens;
152
- }
153
- if (options?.temperature !== void 0) {
154
- params.temperature = options?.temperature;
155
- }
156
- if (options?.serviceTier !== void 0) {
157
- params.service_tier = options.serviceTier;
158
- }
159
- if (context.tools) {
160
- params.tools = convertResponsesTools(context.tools);
161
- }
162
- if (model.reasoning) {
163
- if (options?.reasoningEffort || options?.reasoningSummary) {
164
- params.reasoning = {
165
- effort: options?.reasoningEffort || "medium",
166
- summary: options?.reasoningSummary || "auto"
167
- };
168
- params.include = ["reasoning.encrypted_content"];
169
- } else if (model.provider !== "github-copilot") {
170
- params.reasoning = { effort: "none" };
171
- }
172
- }
173
- return params;
174
- }
175
- function getServiceTierCostMultiplier(serviceTier) {
176
- switch (serviceTier) {
177
- case "flex":
178
- return 0.5;
179
- case "priority":
180
- return 2;
181
- default:
182
- return 1;
183
- }
184
- }
185
- function applyServiceTierPricing(usage, serviceTier) {
186
- const multiplier = getServiceTierCostMultiplier(serviceTier);
187
- if (multiplier === 1)
188
- return;
189
- usage.cost.input *= multiplier;
190
- usage.cost.output *= multiplier;
191
- usage.cost.cacheRead *= multiplier;
192
- usage.cost.cacheWrite *= multiplier;
193
- usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
194
- }
195
- export {
196
- streamOpenAIResponses,
197
- streamSimpleOpenAIResponses
198
- };