@openclaw/acpx 2026.11.3 → 2026.11.5-beta.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.
- package/dist/.setup/{config-D0ATuiVJ.mjs → config-DZaY96RI.mjs} +15 -23
- package/dist/.setup/{harness-attempt-lu4_bMfd.mjs → harness-attempt-CR7gvC_C.mjs} +5 -4
- package/dist/.setup/{pi-session-catalog-runtime-BAM1pEMw.mjs → pi-session-catalog-runtime-hFy095NF.mjs} +35 -57
- package/dist/.setup/{pi-session-paths-CIvyk6KB.mjs → pi-session-paths-Cn5bsvi0.mjs} +2 -2
- package/dist/.setup/{service-D_e2JAUG.mjs → service-By25n8eI.mjs} +135 -373
- package/dist/.setup/{session-owner-migration-BA3DJKb2.mjs → session-owner-migration-BmfOUj9h.mjs} +3 -3
- package/dist/.setup/{session-resource-DKJsUJPu.mjs → session-resource-BI93OF1C.mjs} +2 -2
- package/dist/.source-module-urls/9369b1b274d2ba70ea21d859abb3415ad8d63d0a1022a301763b953a5798469e.json +1 -0
- package/dist/doctor-contract-api.js +17 -11
- package/dist/index.js +207 -21
- package/openclaw.plugin.json +28 -1
- package/package.json +9 -9
- package/dist/.setup/register.runtime-D685iYx-.mjs +0 -197
- package/dist/register.runtime.js +0 -2
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { getAcpRuntimeBackend, registerAcpRuntimeBackend, unregisterAcpRuntimeBackend } from "openclaw/plugin-sdk/acp-runtime-backend";
|
|
2
|
-
import { createLazyRuntimeMethodBinder, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
|
-
//#region extensions/acpx/src/runtime-proxy.ts
|
|
4
|
-
/** Start an ACP turn through a lazy runtime resolver without awaiting resolution up front. */
|
|
5
|
-
function lazyStartRuntimeTurn(resolveRuntime, input) {
|
|
6
|
-
const turnPromise = resolveRuntime().then((runtime) => runtime.startTurn(input));
|
|
7
|
-
return {
|
|
8
|
-
requestId: input.requestId,
|
|
9
|
-
get promptStarted() {
|
|
10
|
-
return turnPromise.then((turn) => turn.promptStarted);
|
|
11
|
-
},
|
|
12
|
-
events: { async *[Symbol.asyncIterator]() {
|
|
13
|
-
yield* (await turnPromise).events;
|
|
14
|
-
} },
|
|
15
|
-
result: turnPromise.then((turn) => turn.result),
|
|
16
|
-
cancel(inputArgs) {
|
|
17
|
-
return turnPromise.then((turn) => turn.cancel(inputArgs));
|
|
18
|
-
},
|
|
19
|
-
closeStream(inputArgs) {
|
|
20
|
-
return turnPromise.then((turn) => turn.closeStream(inputArgs));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/** Create an ACP runtime facade backed by an async runtime resolver. */
|
|
25
|
-
function createLazyAcpRuntimeProxy(resolveRuntime) {
|
|
26
|
-
const bind = createLazyRuntimeMethodBinder(resolveRuntime);
|
|
27
|
-
return {
|
|
28
|
-
ownerAwareSessions: 1,
|
|
29
|
-
findSession: bind((runtime) => runtime.findSession.bind(runtime)),
|
|
30
|
-
shutdown: bind((runtime) => runtime.shutdown.bind(runtime)),
|
|
31
|
-
ensureSession: bind((runtime) => runtime.ensureSession.bind(runtime)),
|
|
32
|
-
startTurn(input) {
|
|
33
|
-
return lazyStartRuntimeTurn(resolveRuntime, input);
|
|
34
|
-
},
|
|
35
|
-
async *runTurn(input) {
|
|
36
|
-
yield* (await resolveRuntime()).runTurn(input);
|
|
37
|
-
},
|
|
38
|
-
getCapabilities: bind((runtime) => runtime.getCapabilities.bind(runtime)),
|
|
39
|
-
getStatus: bind((runtime) => runtime.getStatus.bind(runtime)),
|
|
40
|
-
setMode: bind((runtime) => runtime.setMode.bind(runtime)),
|
|
41
|
-
setModel: bind((runtime) => runtime.setModel.bind(runtime)),
|
|
42
|
-
setConfigOption: bind((runtime) => runtime.setConfigOption.bind(runtime)),
|
|
43
|
-
doctor: bind((runtime) => runtime.doctor.bind(runtime)),
|
|
44
|
-
prepareFreshSession: bind((runtime) => runtime.prepareFreshSession.bind(runtime)),
|
|
45
|
-
cancel: bind((runtime) => runtime.cancel.bind(runtime)),
|
|
46
|
-
close: bind((runtime) => runtime.close.bind(runtime))
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region extensions/acpx/register.runtime.ts
|
|
51
|
-
/**
|
|
52
|
-
* Lazy ACPX runtime service registration. The plugin exposes an ACP backend
|
|
53
|
-
* immediately, then imports the heavier service only when a session needs it.
|
|
54
|
-
*/
|
|
55
|
-
const ACPX_BACKEND_ID = "acpx";
|
|
56
|
-
const loadServiceModule = createLazyRuntimeModule(() => import("./service-D_e2JAUG.mjs"));
|
|
57
|
-
function unregisterOwnedRuntime(runtime) {
|
|
58
|
-
if (runtime && getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime === runtime) unregisterAcpRuntimeBackend(ACPX_BACKEND_ID);
|
|
59
|
-
}
|
|
60
|
-
async function startRealService(state, lifecycleRevision, deferredRuntime, purpose = "gateway", probeAtStartup = purpose === "gateway") {
|
|
61
|
-
if (state.lifecycleRevision !== lifecycleRevision || !state.ctx) throw new Error("ACPX runtime service is not started");
|
|
62
|
-
if (state.startPromise) return await state.startPromise;
|
|
63
|
-
const ctx = state.ctx;
|
|
64
|
-
state.startPromise = (async () => {
|
|
65
|
-
let publishedRuntime = null;
|
|
66
|
-
const { createAcpxRuntimeService: createAcpxRuntimeServiceLocal } = await loadServiceModule();
|
|
67
|
-
const service = createAcpxRuntimeServiceLocal({
|
|
68
|
-
...state.params,
|
|
69
|
-
probeAtStartup,
|
|
70
|
-
startupPurpose: purpose,
|
|
71
|
-
assertCurrent: () => {
|
|
72
|
-
if (state.lifecycleRevision !== lifecycleRevision || state.ctx !== ctx || state.published && getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime !== state.ownedRuntime) throw new Error("ACPX runtime service lost recovery ownership");
|
|
73
|
-
},
|
|
74
|
-
backendLifecycle: {
|
|
75
|
-
publish(backend) {
|
|
76
|
-
if (state.lifecycleRevision !== lifecycleRevision || state.ctx !== ctx) throw new Error("ACPX runtime service stopped during activation");
|
|
77
|
-
if (state.published && getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime !== deferredRuntime) throw new Error("ACPX runtime service lost registry ownership during activation");
|
|
78
|
-
if (state.published) registerAcpRuntimeBackend({
|
|
79
|
-
id: ACPX_BACKEND_ID,
|
|
80
|
-
...backend,
|
|
81
|
-
runtime: deferredRuntime
|
|
82
|
-
});
|
|
83
|
-
publishedRuntime = backend.runtime;
|
|
84
|
-
},
|
|
85
|
-
retract() {}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
state.realService = service;
|
|
89
|
-
await service.start(ctx);
|
|
90
|
-
if (state.lifecycleRevision !== lifecycleRevision || state.ctx !== ctx) throw new Error("ACPX runtime service stopped during activation");
|
|
91
|
-
if (!publishedRuntime) throw new Error("ACPX runtime service did not register an ACP backend");
|
|
92
|
-
if (state.published && getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime !== deferredRuntime) throw new Error("ACPX runtime service lost registry ownership during activation");
|
|
93
|
-
return publishedRuntime;
|
|
94
|
-
})();
|
|
95
|
-
try {
|
|
96
|
-
return await state.startPromise;
|
|
97
|
-
} catch (error) {
|
|
98
|
-
if (state.lifecycleRevision === lifecycleRevision) {
|
|
99
|
-
state.startPromise = null;
|
|
100
|
-
state.realService = null;
|
|
101
|
-
}
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function createDeferredRuntime(state, lifecycleRevision) {
|
|
106
|
-
const deferredRuntime = createLazyAcpRuntimeProxy(() => startRealService(state, lifecycleRevision, deferredRuntime));
|
|
107
|
-
return deferredRuntime;
|
|
108
|
-
}
|
|
109
|
-
/** Creates the plugin service that registers ACPX as an ACP runtime backend. */
|
|
110
|
-
function createAcpxRuntimeService(params = {}) {
|
|
111
|
-
const state = {
|
|
112
|
-
ctx: null,
|
|
113
|
-
published: false,
|
|
114
|
-
lifecycleRevision: 0,
|
|
115
|
-
ownedRuntime: null,
|
|
116
|
-
params,
|
|
117
|
-
realService: null,
|
|
118
|
-
startPromise: null,
|
|
119
|
-
stopPromise: null
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
id: "acpx-runtime",
|
|
123
|
-
async getRuntime(ctx) {
|
|
124
|
-
if (state.stopPromise) await state.stopPromise;
|
|
125
|
-
if (!state.ctx) {
|
|
126
|
-
state.ctx = ctx;
|
|
127
|
-
state.lifecycleRevision += 1;
|
|
128
|
-
state.ownedRuntime = createDeferredRuntime(state, state.lifecycleRevision);
|
|
129
|
-
}
|
|
130
|
-
if (!state.ownedRuntime) throw new Error("ACPX runtime service lost its runtime owner");
|
|
131
|
-
return await startRealService(state, state.lifecycleRevision, state.ownedRuntime, state.published ? "gateway" : "inspection", false);
|
|
132
|
-
},
|
|
133
|
-
async start(ctx) {
|
|
134
|
-
if (process.env.OPENCLAW_SKIP_ACPX_RUNTIME === "1") {
|
|
135
|
-
ctx.logger.info("skipping embedded acpx runtime backend (OPENCLAW_SKIP_ACPX_RUNTIME=1)");
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (state.stopPromise) await state.stopPromise;
|
|
139
|
-
if (state.ctx && state.ownedRuntime) {
|
|
140
|
-
const revision = state.lifecycleRevision;
|
|
141
|
-
const previous = getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime;
|
|
142
|
-
const assertCurrent = () => {
|
|
143
|
-
const current = getAcpRuntimeBackend(ACPX_BACKEND_ID)?.runtime;
|
|
144
|
-
if (state.lifecycleRevision !== revision || !state.ctx || current !== previous && current !== state.ownedRuntime) throw new Error("ACPX runtime service lost promotion ownership");
|
|
145
|
-
};
|
|
146
|
-
await state.startPromise;
|
|
147
|
-
assertCurrent();
|
|
148
|
-
await state.realService?.promote(ctx, assertCurrent);
|
|
149
|
-
assertCurrent();
|
|
150
|
-
state.published = true;
|
|
151
|
-
registerAcpRuntimeBackend({
|
|
152
|
-
id: ACPX_BACKEND_ID,
|
|
153
|
-
runtime: state.ownedRuntime
|
|
154
|
-
});
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
state.published = true;
|
|
158
|
-
state.lifecycleRevision += 1;
|
|
159
|
-
const lifecycleRevision = state.lifecycleRevision;
|
|
160
|
-
state.ctx = ctx;
|
|
161
|
-
const deferredRuntime = createDeferredRuntime(state, lifecycleRevision);
|
|
162
|
-
state.ownedRuntime = deferredRuntime;
|
|
163
|
-
registerAcpRuntimeBackend({
|
|
164
|
-
id: ACPX_BACKEND_ID,
|
|
165
|
-
runtime: deferredRuntime
|
|
166
|
-
});
|
|
167
|
-
ctx.logger.info("embedded acpx runtime backend registered lazily");
|
|
168
|
-
},
|
|
169
|
-
async stop(ctx) {
|
|
170
|
-
if (state.stopPromise) return await state.stopPromise;
|
|
171
|
-
state.lifecycleRevision += 1;
|
|
172
|
-
state.ctx = null;
|
|
173
|
-
state.published = false;
|
|
174
|
-
const ownedRuntime = state.ownedRuntime;
|
|
175
|
-
unregisterOwnedRuntime(ownedRuntime);
|
|
176
|
-
const startPromise = state.startPromise;
|
|
177
|
-
state.stopPromise = (async () => {
|
|
178
|
-
await startPromise?.catch(() => void 0);
|
|
179
|
-
try {
|
|
180
|
-
await state.realService?.stop?.(ctx);
|
|
181
|
-
} finally {
|
|
182
|
-
unregisterOwnedRuntime(ownedRuntime);
|
|
183
|
-
state.ownedRuntime = null;
|
|
184
|
-
state.realService = null;
|
|
185
|
-
state.startPromise = null;
|
|
186
|
-
}
|
|
187
|
-
})();
|
|
188
|
-
try {
|
|
189
|
-
await state.stopPromise;
|
|
190
|
-
} finally {
|
|
191
|
-
state.stopPromise = null;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
//#endregion
|
|
197
|
-
export { createAcpxRuntimeService as t };
|
package/dist/register.runtime.js
DELETED