@aionis/openclaw-adapter 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/PRODUCT.md +30 -0
- package/README.md +341 -0
- package/dist/adapter/heuristics.d.ts +4 -0
- package/dist/adapter/heuristics.js +52 -0
- package/dist/adapter/loop-control-adapter.d.ts +35 -0
- package/dist/adapter/loop-control-adapter.js +347 -0
- package/dist/adapter/state.d.ts +47 -0
- package/dist/adapter/state.js +53 -0
- package/dist/binding/openclaw-hook-binding.d.ts +3 -0
- package/dist/binding/openclaw-hook-binding.js +36 -0
- package/dist/client/aionis-http-client.d.ts +108 -0
- package/dist/client/aionis-http-client.js +216 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/plugin.d.ts +15 -0
- package/dist/plugin.js +100 -0
- package/dist/types/aionis.d.ts +129 -0
- package/dist/types/aionis.js +1 -0
- package/dist/types/config.d.ts +36 -0
- package/dist/types/config.js +10 -0
- package/dist/types/openclaw.d.ts +81 -0
- package/dist/types/openclaw.js +1 -0
- package/examples/openclaw.json +34 -0
- package/openclaw.plugin.json +54 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
Initial standalone adapter release surface.
|
|
6
|
+
|
|
7
|
+
Included:
|
|
8
|
+
|
|
9
|
+
1. real OpenClaw plugin entry and manifest
|
|
10
|
+
2. Aionis HTTP client for context, policy, replay, feedback, evidence, and handoff endpoints
|
|
11
|
+
3. tool-loop control adapter with policy gating, no-progress tracking, replay dispatch, and handoff fallback
|
|
12
|
+
4. load smoke, activity probe, live-task benchmark, token benchmark, completion benchmark, and runtime-backed Google benchmark
|
|
13
|
+
5. install and configuration examples for OpenClaw local-agent use
|
package/PRODUCT.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# OpenClaw Aionis Adapter
|
|
2
|
+
|
|
3
|
+
`openclaw-aionis-adapter` is a standalone OpenClaw integration layer for Aionis.
|
|
4
|
+
|
|
5
|
+
It is a dedicated adapter that uses OpenClaw's host hook surface to add:
|
|
6
|
+
|
|
7
|
+
1. tool-loop control
|
|
8
|
+
2. policy gating
|
|
9
|
+
3. decision/feedback persistence
|
|
10
|
+
4. replay dispatch escape hatches
|
|
11
|
+
5. handoff fallback
|
|
12
|
+
|
|
13
|
+
## Product Boundary
|
|
14
|
+
|
|
15
|
+
This package owns:
|
|
16
|
+
|
|
17
|
+
1. OpenClaw hook binding
|
|
18
|
+
2. adapter state machine
|
|
19
|
+
3. loop heuristics
|
|
20
|
+
4. Aionis call orchestration
|
|
21
|
+
|
|
22
|
+
This package does not own:
|
|
23
|
+
|
|
24
|
+
1. Aionis runtime bootstrap
|
|
25
|
+
2. OpenClaw planner internals
|
|
26
|
+
3. generic memory-slot concerns
|
|
27
|
+
|
|
28
|
+
## Positioning
|
|
29
|
+
|
|
30
|
+
Use this package when you want OpenClaw to run with explicit execution control rather than uncontrolled ReAct-style tool looping.
|
package/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# OpenClaw Aionis Adapter
|
|
2
|
+
|
|
3
|
+
A standalone adapter for connecting OpenClaw to Aionis execution control.
|
|
4
|
+
|
|
5
|
+
## Quickstart
|
|
6
|
+
|
|
7
|
+
1. Start Aionis Lite:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @aionis/sdk@0.2.19 dev
|
|
11
|
+
npx @aionis/sdk@0.2.19 health
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Install the adapter into OpenClaw from npm:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
openclaw plugins install @aionis/openclaw-adapter
|
|
18
|
+
openclaw plugins info openclaw-aionis-adapter --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. Add the plugin config shown below.
|
|
22
|
+
|
|
23
|
+
Reference files:
|
|
24
|
+
|
|
25
|
+
- `examples/openclaw.json`
|
|
26
|
+
- `docs/2026-03-14-install-and-config.md`
|
|
27
|
+
|
|
28
|
+
Expected Aionis endpoint:
|
|
29
|
+
|
|
30
|
+
- `http://127.0.0.1:3321`
|
|
31
|
+
|
|
32
|
+
Minimum plugin config:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"plugins": {
|
|
37
|
+
"allow": ["openclaw-aionis-adapter"],
|
|
38
|
+
"entries": {
|
|
39
|
+
"openclaw-aionis-adapter": {
|
|
40
|
+
"enabled": true,
|
|
41
|
+
"config": {
|
|
42
|
+
"baseUrl": "http://127.0.0.1:3321",
|
|
43
|
+
"tenantId": "default",
|
|
44
|
+
"actor": "openclaw",
|
|
45
|
+
"scopeMode": "project",
|
|
46
|
+
"strictToolBlocking": true,
|
|
47
|
+
"replayDispatchEnabled": true,
|
|
48
|
+
"handoffFallbackEnabled": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Release Status
|
|
57
|
+
|
|
58
|
+
Current package metadata is prepared for publish:
|
|
59
|
+
|
|
60
|
+
1. `CHANGELOG.md` exists
|
|
61
|
+
2. install/config example exists
|
|
62
|
+
3. package `files` includes `CHANGELOG.md` and `examples/`
|
|
63
|
+
4. package metadata includes `repository`, `bugs`, and `homepage`
|
|
64
|
+
|
|
65
|
+
Current boundary:
|
|
66
|
+
|
|
67
|
+
1. plugin id remains `openclaw-aionis-adapter` for compatibility
|
|
68
|
+
2. publish workflow is not set up in this repo yet
|
|
69
|
+
|
|
70
|
+
## What it is
|
|
71
|
+
|
|
72
|
+
This project provides:
|
|
73
|
+
|
|
74
|
+
1. a reusable `AionisLoopControlAdapter`
|
|
75
|
+
2. an `OpenClaw` host binding
|
|
76
|
+
3. loop-control heuristics for high-cost tool paths
|
|
77
|
+
4. replay and handoff escape-hatch orchestration
|
|
78
|
+
|
|
79
|
+
## What it is not
|
|
80
|
+
|
|
81
|
+
1. not a generic memory package
|
|
82
|
+
2. not a planner-internal reasoning controller
|
|
83
|
+
|
|
84
|
+
## Current hook coverage
|
|
85
|
+
|
|
86
|
+
1. `session_start`
|
|
87
|
+
2. `session_end`
|
|
88
|
+
3. `before_agent_start`
|
|
89
|
+
4. `before_tool_call`
|
|
90
|
+
5. `after_tool_call`
|
|
91
|
+
6. `agent_end`
|
|
92
|
+
7. `tool_result_persist`
|
|
93
|
+
8. `before_message_write`
|
|
94
|
+
|
|
95
|
+
## Current capabilities
|
|
96
|
+
|
|
97
|
+
1. pre-tool policy gating
|
|
98
|
+
2. repeated-tool blocking
|
|
99
|
+
3. duplicate/no-progress tracking
|
|
100
|
+
4. broad scan and broad test suppression
|
|
101
|
+
5. replay dispatch escape hatch
|
|
102
|
+
6. handoff fallback
|
|
103
|
+
7. structured stop reasons
|
|
104
|
+
|
|
105
|
+
## Boundary
|
|
106
|
+
|
|
107
|
+
This adapter controls the tool loop boundary.
|
|
108
|
+
It does not control planner-internal reasoning steps that never emit tools.
|
|
109
|
+
|
|
110
|
+
## Project structure
|
|
111
|
+
|
|
112
|
+
1. `src/adapter/`
|
|
113
|
+
2. `src/binding/`
|
|
114
|
+
3. `src/types/`
|
|
115
|
+
|
|
116
|
+
## Verification
|
|
117
|
+
|
|
118
|
+
1. `npm run test`
|
|
119
|
+
2. `npm run smoke:openclaw-load`
|
|
120
|
+
3. `npm run bench:openclaw-ab`
|
|
121
|
+
4. `npm run bench:live-task`
|
|
122
|
+
5. `npm run bench:semi-live-token`
|
|
123
|
+
6. `npm run bench:loader-backed-semi-live-token`
|
|
124
|
+
7. `npm run smoke:gateway-backed-feasibility`
|
|
125
|
+
8. `npm run smoke:adapter-activity`
|
|
126
|
+
9. `npm run bench:google-runtime`
|
|
127
|
+
10. `npm run bench:google-runtime-ab`
|
|
128
|
+
|
|
129
|
+
`bench:live-task` is the first scenario-backed benchmark layer:
|
|
130
|
+
|
|
131
|
+
1. keepalive poll churn
|
|
132
|
+
2. transport retry churn
|
|
133
|
+
3. real-repo broad-search / broad-test drift
|
|
134
|
+
|
|
135
|
+
## Current Evidence
|
|
136
|
+
|
|
137
|
+
Benchmark overview:
|
|
138
|
+
- `docs/2026-03-14-benchmark-evidence-overview.md`
|
|
139
|
+
- `docs/2026-03-14-openclaw-aionis-benchmark-summary.md`
|
|
140
|
+
- `docs/2026-03-14-openclaw-completion-benchmark.md`
|
|
141
|
+
- `docs/2026-03-14-openclaw-loader-backed-semi-live-token-benchmark.md`
|
|
142
|
+
- `docs/2026-03-14-openclaw-adapter-activity-probe.md`
|
|
143
|
+
- `docs/2026-03-14-openclaw-gateway-backed-feasibility.md`
|
|
144
|
+
- `docs/2026-03-14-openclaw-google-runtime-benchmark.md`
|
|
145
|
+
- `docs/2026-03-14-openclaw-google-runtime-case-study.md`
|
|
146
|
+
- `docs/2026-03-14-openclaw-gateway-backed-benchmark-plan.md`
|
|
147
|
+
|
|
148
|
+
### Live-task A/B
|
|
149
|
+
|
|
150
|
+
Artifact:
|
|
151
|
+
- `evidence/openclaw-live-task-benchmark/20260314061733/summary.json`
|
|
152
|
+
|
|
153
|
+
Current result:
|
|
154
|
+
|
|
155
|
+
- baseline:
|
|
156
|
+
- `avg_executed_steps = 7.33`
|
|
157
|
+
- `controlled_stop_rate = 0`
|
|
158
|
+
- `avg_broad_tool_calls = 1.33`
|
|
159
|
+
- treatment:
|
|
160
|
+
- `avg_executed_steps = 3`
|
|
161
|
+
- `controlled_stop_rate = 0.6667`
|
|
162
|
+
- `replay_dispatch_rate = 0.3333`
|
|
163
|
+
- `handoff_store_rate = 0.3333`
|
|
164
|
+
- `avg_broad_tool_calls = 0`
|
|
165
|
+
|
|
166
|
+
This currently supports:
|
|
167
|
+
|
|
168
|
+
- Aionis reduces uncontrolled tool-loop churn
|
|
169
|
+
- Aionis suppresses broad repo search and broad test drift
|
|
170
|
+
- Aionis can escape through replay or handoff
|
|
171
|
+
|
|
172
|
+
### GLM-5 Semi-Live Token Benchmark
|
|
173
|
+
|
|
174
|
+
Artifact:
|
|
175
|
+
- `evidence/openclaw-semi-live-token-benchmark/20260314064242/summary.json`
|
|
176
|
+
|
|
177
|
+
Current 3-scenario result:
|
|
178
|
+
|
|
179
|
+
- baseline:
|
|
180
|
+
- `avg_total_tokens = 1893`
|
|
181
|
+
- `avg_executed_steps = 5.67`
|
|
182
|
+
- `completed_rate = 0.3333`
|
|
183
|
+
- treatment:
|
|
184
|
+
- `avg_total_tokens = 865.33`
|
|
185
|
+
- `avg_executed_steps = 2`
|
|
186
|
+
- `completed_rate = 0.3333`
|
|
187
|
+
- `avg_broad_tool_calls = 0`
|
|
188
|
+
|
|
189
|
+
This currently supports:
|
|
190
|
+
|
|
191
|
+
- Aionis can reduce token burn in semi-live OpenClaw tasks
|
|
192
|
+
- the current token win comes from context and policy shaping plus focused-path execution
|
|
193
|
+
- this result does not yet prove that hard stops or replay are the dominant source of token savings
|
|
194
|
+
|
|
195
|
+
### Hard-Stop / Replay-Driven Token Slice
|
|
196
|
+
|
|
197
|
+
Artifact:
|
|
198
|
+
- `evidence/openclaw-semi-live-token-benchmark/20260314070306/summary.json`
|
|
199
|
+
|
|
200
|
+
Single-scenario result:
|
|
201
|
+
|
|
202
|
+
- baseline:
|
|
203
|
+
- `avg_total_tokens = 1659`
|
|
204
|
+
- `avg_executed_steps = 6`
|
|
205
|
+
- `controlled_stop_rate = 0`
|
|
206
|
+
- treatment:
|
|
207
|
+
- `avg_total_tokens = 1267`
|
|
208
|
+
- `avg_executed_steps = 3`
|
|
209
|
+
- `controlled_stop_rate = 1`
|
|
210
|
+
- `replay_dispatch_rate = 1`
|
|
211
|
+
|
|
212
|
+
This currently supports:
|
|
213
|
+
|
|
214
|
+
- Aionis can also save tokens through hard-stop and replay-driven control
|
|
215
|
+
- the adapter is not limited to soft context shaping
|
|
216
|
+
|
|
217
|
+
### Loader-Backed Semi-Live Token Benchmark
|
|
218
|
+
|
|
219
|
+
Current artifact:
|
|
220
|
+
- `evidence/openclaw-loader-backed-semi-live-token-benchmark/20260314073214/summary.json`
|
|
221
|
+
|
|
222
|
+
Current result:
|
|
223
|
+
|
|
224
|
+
- baseline:
|
|
225
|
+
- `avg_total_tokens = 1836`
|
|
226
|
+
- `avg_executed_steps = 5.75`
|
|
227
|
+
- `completed_rate = 0.25`
|
|
228
|
+
- treatment:
|
|
229
|
+
- `avg_total_tokens = 968.25`
|
|
230
|
+
- `avg_executed_steps = 2.25`
|
|
231
|
+
- `completed_rate = 0.25`
|
|
232
|
+
- `controlled_stop_rate = 0.25`
|
|
233
|
+
- `replay_dispatch_rate = 0.25`
|
|
234
|
+
- `handoff_store_rate = 0.5`
|
|
235
|
+
- `avg_broad_tool_calls = 0`
|
|
236
|
+
|
|
237
|
+
This currently supports:
|
|
238
|
+
|
|
239
|
+
- the token reduction result survives a real OpenClaw install/discovery path
|
|
240
|
+
- the adapter still reduces churn and token burn when executed from the installed plugin source path
|
|
241
|
+
|
|
242
|
+
### Gateway-Backed Runtime Feasibility
|
|
243
|
+
|
|
244
|
+
Current artifact:
|
|
245
|
+
- `evidence/openclaw-gateway-backed-feasibility/summary.json`
|
|
246
|
+
|
|
247
|
+
Current result:
|
|
248
|
+
|
|
249
|
+
- `provider = zai`
|
|
250
|
+
- `model = glm-5`
|
|
251
|
+
- `runtime_path_reached_model = true`
|
|
252
|
+
- `outcome = rate_limited_timeout`
|
|
253
|
+
|
|
254
|
+
This currently supports:
|
|
255
|
+
|
|
256
|
+
- the real `openclaw agent --local` runtime path now reaches `zai/glm-5`
|
|
257
|
+
- the earlier Anthropic default-model blocker is resolved
|
|
258
|
+
- the remaining blocker for a full gateway-backed benchmark is provider-side runtime rate limiting
|
|
259
|
+
|
|
260
|
+
### Adapter Activity Probe
|
|
261
|
+
|
|
262
|
+
Current artifact:
|
|
263
|
+
- `evidence/openclaw-adapter-activity-probe/summary.json`
|
|
264
|
+
|
|
265
|
+
Current result:
|
|
266
|
+
|
|
267
|
+
- `provider = zai`
|
|
268
|
+
- `model = glm-5`
|
|
269
|
+
- `runtime_path_reached_model = true`
|
|
270
|
+
- `mock_paths = ["/v1/memory/context/assemble", "/v1/handoff/store"]`
|
|
271
|
+
- `outcome = adapter_active`
|
|
272
|
+
|
|
273
|
+
This probe is narrower than a full runtime-backed benchmark.
|
|
274
|
+
|
|
275
|
+
It is designed to show:
|
|
276
|
+
|
|
277
|
+
- the installed adapter is active inside a real `openclaw agent --local` turn
|
|
278
|
+
- the runtime emits real Aionis requests such as `context/assemble`
|
|
279
|
+
|
|
280
|
+
This helps separate:
|
|
281
|
+
|
|
282
|
+
- plugin activity proof
|
|
283
|
+
- from the still-open provider-side rate-limit blocker on the live runtime path
|
|
284
|
+
|
|
285
|
+
### Google Runtime-Backed Completion A/B
|
|
286
|
+
|
|
287
|
+
Current artifact:
|
|
288
|
+
- `evidence/openclaw-google-runtime-benchmark/20260314084010/summary.json`
|
|
289
|
+
|
|
290
|
+
Current result:
|
|
291
|
+
|
|
292
|
+
- provider:
|
|
293
|
+
- `google/gemini-3-flash-preview`
|
|
294
|
+
- baseline:
|
|
295
|
+
- `completed_rate = 0`
|
|
296
|
+
- `avg_total_tokens = 4319`
|
|
297
|
+
- `timed_out_count = 1`
|
|
298
|
+
- treatment:
|
|
299
|
+
- `completed_rate = 0.8`
|
|
300
|
+
- `avg_total_tokens = 4287`
|
|
301
|
+
- `avg_mock_request_count = 1`
|
|
302
|
+
- `timed_out_count = 0`
|
|
303
|
+
- delta:
|
|
304
|
+
- `completion_gain = +0.8`
|
|
305
|
+
- `avg_token_delta = -26.5`
|
|
306
|
+
- `token_win_rate = 0.5`
|
|
307
|
+
- `token_pair_count = 4`
|
|
308
|
+
|
|
309
|
+
This currently supports:
|
|
310
|
+
|
|
311
|
+
- a real OpenClaw local agent path now has a repeated `baseline vs adapter` runtime-backed completion benchmark
|
|
312
|
+
- adapter-driven externalized context lifts completion on a stable provider-backed path
|
|
313
|
+
- this repo no longer depends only on the `zai/glm-5` feasibility line for runtime evidence
|
|
314
|
+
|
|
315
|
+
### Completion-Oriented Benchmark
|
|
316
|
+
|
|
317
|
+
Current artifact:
|
|
318
|
+
- `evidence/openclaw-completion-benchmark/20260314072335/summary.json`
|
|
319
|
+
|
|
320
|
+
Current result:
|
|
321
|
+
|
|
322
|
+
- baseline:
|
|
323
|
+
- `completed_rate = 0`
|
|
324
|
+
- `avg_executed_steps = 3.67`
|
|
325
|
+
- `avg_total_tokens = 1125`
|
|
326
|
+
- treatment:
|
|
327
|
+
- `completed_rate = 1`
|
|
328
|
+
- `avg_executed_steps = 2`
|
|
329
|
+
- `avg_total_tokens = 882.67`
|
|
330
|
+
- `replay_dispatch_success_rate = 0.3333`
|
|
331
|
+
- `handoff_resume_success_rate = 0.3333`
|
|
332
|
+
|
|
333
|
+
This currently supports:
|
|
334
|
+
|
|
335
|
+
- Aionis can improve completion on replay-eligible repeated workflows
|
|
336
|
+
- Aionis can improve completion on tight-budget real-repo focused tasks
|
|
337
|
+
- Aionis can also improve completion on interrupted handoff-resume tasks
|
|
338
|
+
|
|
339
|
+
## Entry point
|
|
340
|
+
|
|
341
|
+
Use `createOpenClawAionisAdapter(...)` to attach the adapter to an OpenClaw host API implementation.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function classifyBroadScan(toolName: string, params: Record<string, unknown>): boolean;
|
|
2
|
+
export declare function classifyBroadTest(toolName: string, params: Record<string, unknown>): boolean;
|
|
3
|
+
export declare function summarizeToolResult(result: unknown, error?: string): string;
|
|
4
|
+
export declare function inferProgress(toolName: string, summary: string): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function classifyBroadScan(toolName, params) {
|
|
2
|
+
const normalized = toolName.toLowerCase();
|
|
3
|
+
if (normalized.includes("grep") || normalized.includes("find") || normalized.includes("glob"))
|
|
4
|
+
return true;
|
|
5
|
+
const query = String(params.query ?? params.pattern ?? params.command ?? "").toLowerCase();
|
|
6
|
+
return query.includes("-r") || query.includes("--recursive") || query.includes("**/*");
|
|
7
|
+
}
|
|
8
|
+
export function classifyBroadTest(toolName, params) {
|
|
9
|
+
const normalized = toolName.toLowerCase();
|
|
10
|
+
const cmd = String(params.command ?? params.cmd ?? params.argv ?? "").toLowerCase();
|
|
11
|
+
if (normalized.includes("pytest-all") ||
|
|
12
|
+
normalized.includes("test-broad") ||
|
|
13
|
+
normalized.includes("jest-broad") ||
|
|
14
|
+
normalized.includes("vitest-broad")) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (cmd.includes("pytest")) {
|
|
18
|
+
return !cmd.includes("tests/") && !cmd.includes("::");
|
|
19
|
+
}
|
|
20
|
+
if (cmd.includes("npm test"))
|
|
21
|
+
return true;
|
|
22
|
+
if (cmd.includes("node --test")) {
|
|
23
|
+
return cmd.includes("*") || !cmd.includes("test/");
|
|
24
|
+
}
|
|
25
|
+
if (cmd.includes("jest")) {
|
|
26
|
+
return !cmd.includes("test/") && !cmd.includes("--run");
|
|
27
|
+
}
|
|
28
|
+
if (cmd.includes("vitest")) {
|
|
29
|
+
return !cmd.includes("test/") && !cmd.includes("--run");
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
export function summarizeToolResult(result, error) {
|
|
34
|
+
if (error)
|
|
35
|
+
return `error:${error}`;
|
|
36
|
+
if (typeof result === "string")
|
|
37
|
+
return result.slice(0, 4000);
|
|
38
|
+
return JSON.stringify(result ?? null).slice(0, 4000);
|
|
39
|
+
}
|
|
40
|
+
export function inferProgress(toolName, summary) {
|
|
41
|
+
const normalized = toolName.toLowerCase();
|
|
42
|
+
const text = summary.toLowerCase();
|
|
43
|
+
if (text.startsWith("error:"))
|
|
44
|
+
return false;
|
|
45
|
+
if (normalized.includes("edit") || normalized.includes("write") || normalized.includes("patch")) {
|
|
46
|
+
return text.length > 0 && !text.includes("no changes");
|
|
47
|
+
}
|
|
48
|
+
if (normalized.includes("pytest") || normalized.includes("test")) {
|
|
49
|
+
return text.includes("passed") || text.includes("failed") || text.includes("collected");
|
|
50
|
+
}
|
|
51
|
+
return text.length > 0 && !text.includes("no result") && !text.includes("not found");
|
|
52
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AgentEndEvent, AfterToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartResult, BeforeToolCallEvent, BeforeToolCallResult, OpenClawAgentRunContext, OpenClawToolCallContext } from "../types/openclaw.js";
|
|
2
|
+
import type { AionisLoopControlClient } from "../types/aionis.js";
|
|
3
|
+
import { type AdapterConfig, type LoopStopReasonCode } from "../types/config.js";
|
|
4
|
+
import { type LoopRunState } from "./state.js";
|
|
5
|
+
export type AdapterDecision = {
|
|
6
|
+
continue: boolean;
|
|
7
|
+
stopReason?: LoopStopReasonCode;
|
|
8
|
+
blockReason?: string;
|
|
9
|
+
rewriteParams?: Record<string, unknown>;
|
|
10
|
+
selectedTool?: string;
|
|
11
|
+
deniedTools?: string[];
|
|
12
|
+
explain?: string | null;
|
|
13
|
+
};
|
|
14
|
+
export declare class AionisLoopControlAdapter {
|
|
15
|
+
private readonly client;
|
|
16
|
+
private readonly config;
|
|
17
|
+
private readonly states;
|
|
18
|
+
constructor(client: AionisLoopControlClient, config: Partial<AdapterConfig> & Pick<AdapterConfig, "tenantId" | "actor" | "scopeResolver">);
|
|
19
|
+
sessionStart(ctx: OpenClawAgentRunContext & {
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}): LoopRunState;
|
|
22
|
+
sessionEnd(sessionId: string): void;
|
|
23
|
+
beforeAgentStart(event: BeforeAgentStartEvent, ctx: OpenClawAgentRunContext): Promise<BeforeAgentStartResult | undefined>;
|
|
24
|
+
beforeToolCall(event: BeforeToolCallEvent, ctx: OpenClawToolCallContext): Promise<BeforeToolCallResult | undefined>;
|
|
25
|
+
afterToolCall(event: AfterToolCallEvent, ctx: OpenClawToolCallContext): Promise<void>;
|
|
26
|
+
agentEnd(event: AgentEndEvent, ctx: OpenClawAgentRunContext): Promise<void>;
|
|
27
|
+
decorateStopMessage(message: Record<string, unknown>, reason: LoopStopReasonCode | undefined): Record<string, unknown>;
|
|
28
|
+
private ensureState;
|
|
29
|
+
private findState;
|
|
30
|
+
private captureDecision;
|
|
31
|
+
private extractCandidateTools;
|
|
32
|
+
private resolveReplayHint;
|
|
33
|
+
private checkThresholds;
|
|
34
|
+
private makeStopResult;
|
|
35
|
+
}
|