@xmoxmo/bncr 0.3.6 → 0.3.7
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 +5 -0
- package/dist/index.js +28 -5
- package/index.ts +55 -721
- package/package.json +8 -4
- package/scripts/check-pack.mjs +93 -18
- package/scripts/check-register-drift.mjs +35 -13
- package/scripts/selfcheck.mjs +80 -11
- package/src/bootstrap/channel-plugin-runtime.ts +81 -0
- package/src/bootstrap/cli.ts +97 -0
- package/src/bootstrap/register-runtime-gateway.ts +129 -0
- package/src/bootstrap/register-runtime-helpers.ts +140 -0
- package/src/bootstrap/register-runtime-singleton.ts +137 -0
- package/src/bootstrap/register-runtime.ts +201 -0
- package/src/bootstrap/runtime-discovery.ts +187 -0
- package/src/bootstrap/runtime-loader.ts +54 -0
- package/src/channel.ts +1590 -4967
- package/src/core/accounts.ts +23 -4
- package/src/core/dead-letter-diagnostics.ts +37 -5
- package/src/core/diagnostics.ts +31 -15
- package/src/core/downlink-health.ts +3 -11
- package/src/core/extended-diagnostics.ts +78 -36
- package/src/core/file-transfer-payloads.ts +1 -1
- package/src/core/logging.ts +1 -0
- package/src/core/outbox-enqueue.ts +13 -2
- package/src/core/outbox-entry-builders.ts +2 -0
- package/src/core/outbox-summary.ts +75 -3
- package/src/core/permissions.ts +15 -2
- package/src/core/persisted-outbox-entry.ts +21 -6
- package/src/core/policy.ts +45 -4
- package/src/core/probe.ts +3 -15
- package/src/core/register-trace.ts +3 -3
- package/src/core/status.ts +43 -4
- package/src/core/targets.ts +216 -205
- package/src/core/types.ts +221 -0
- package/src/core/value-sanitize.ts +29 -0
- package/src/messaging/inbound/commands.ts +147 -172
- package/src/messaging/inbound/context-facts.ts +4 -2
- package/src/messaging/inbound/contracts.ts +70 -0
- package/src/messaging/inbound/dispatch-prep.ts +303 -0
- package/src/messaging/inbound/dispatch.ts +49 -462
- package/src/messaging/inbound/gate.ts +18 -5
- package/src/messaging/inbound/last-route.ts +10 -4
- package/src/messaging/inbound/media-url-download.ts +109 -0
- package/src/messaging/inbound/native-command-runtime.ts +225 -0
- package/src/messaging/inbound/parse.ts +2 -1
- package/src/messaging/inbound/remote-media.ts +49 -0
- package/src/messaging/inbound/reply-config.ts +16 -4
- package/src/messaging/inbound/reply-dispatch.ts +162 -0
- package/src/messaging/inbound/runtime-compat.ts +31 -10
- package/src/messaging/inbound/session-label.ts +15 -7
- package/src/messaging/inbound/turn-context.ts +131 -0
- package/src/messaging/outbound/actions.ts +24 -10
- package/src/messaging/outbound/diagnostics-debug-builders.ts +365 -0
- package/src/messaging/outbound/diagnostics.ts +31 -355
- package/src/messaging/outbound/durable-message-adapter.ts +20 -16
- package/src/messaging/outbound/durable-queue-adapter.ts +20 -7
- package/src/messaging/outbound/media.ts +24 -13
- package/src/messaging/outbound/reply-enqueue-media.ts +181 -0
- package/src/messaging/outbound/reply-enqueue.ts +46 -155
- package/src/messaging/outbound/send-params.ts +3 -0
- package/src/messaging/outbound/send.ts +19 -10
- package/src/messaging/outbound/session-route.ts +18 -3
- package/src/openclaw/channel-runtime-contracts.ts +76 -0
- package/src/openclaw/config-runtime.ts +13 -7
- package/src/openclaw/inbound-session-runtime.ts +7 -3
- package/src/openclaw/ingress-runtime.ts +17 -27
- package/src/openclaw/reply-runtime.ts +54 -59
- package/src/openclaw/routing-runtime.ts +35 -18
- package/src/openclaw/runtime-surface.ts +156 -12
- package/src/openclaw/sdk-helpers.ts +8 -1
- package/src/openclaw/session-route-runtime.ts +12 -12
- package/src/plugin/ack-outbox-runtime-group.ts +264 -0
- package/src/plugin/bridge-ack-facade.ts +137 -0
- package/src/plugin/bridge-connection-facade.ts +111 -0
- package/src/plugin/bridge-diagnostics-facade.ts +23 -0
- package/src/plugin/bridge-drain-facade.ts +98 -0
- package/src/plugin/bridge-extended-diagnostics-facade.ts +149 -0
- package/src/plugin/bridge-file-transfer-push-facade.ts +140 -0
- package/src/plugin/bridge-lifecycle.ts +156 -0
- package/src/plugin/bridge-media-facade.ts +241 -0
- package/src/plugin/bridge-outbox-facade.ts +182 -0
- package/src/plugin/bridge-runtime-helpers.ts +266 -0
- package/src/plugin/bridge-runtime-snapshots.ts +104 -0
- package/src/plugin/bridge-runtime-surface-facade.ts +8 -0
- package/src/plugin/bridge-status-facade.ts +76 -0
- package/src/plugin/bridge-status-worker-facade.ts +72 -0
- package/src/plugin/bridge-support-runtime.ts +137 -0
- package/src/plugin/bridge-surface-handlers-group.ts +242 -0
- package/src/plugin/bridge-surface-helpers.ts +28 -0
- package/src/plugin/capabilities.ts +1 -3
- package/src/plugin/channel-components.ts +289 -0
- package/src/plugin/channel-inbound-helpers.ts +149 -0
- package/src/plugin/channel-plugin-bridge-group.ts +129 -0
- package/src/plugin/channel-plugin-surface-group.ts +202 -0
- package/src/plugin/channel-runtime-builders-delivery.ts +513 -0
- package/src/plugin/channel-runtime-builders-status.ts +331 -0
- package/src/plugin/channel-runtime-builders.ts +25 -0
- package/src/plugin/channel-runtime-constants.ts +40 -0
- package/src/plugin/channel-runtime-types.ts +146 -0
- package/src/plugin/channel-send-runtime-group.ts +37 -0
- package/src/plugin/channel-send.ts +226 -0
- package/src/plugin/channel-utils.ts +102 -0
- package/src/plugin/config.ts +24 -3
- package/src/plugin/connection-handlers-helpers.ts +254 -0
- package/src/plugin/connection-handlers.ts +440 -0
- package/src/plugin/connection-state-helpers.ts +159 -0
- package/src/plugin/connection-state-runtime-group.ts +51 -0
- package/src/plugin/connection-state.ts +527 -0
- package/src/plugin/diagnostics-handlers.ts +211 -0
- package/src/plugin/error-message.ts +15 -0
- package/src/plugin/file-ack-runtime.ts +284 -0
- package/src/plugin/file-inbound-abort.ts +112 -0
- package/src/plugin/file-inbound-chunk.ts +146 -0
- package/src/plugin/file-inbound-complete.ts +153 -0
- package/src/plugin/file-inbound-handlers.ts +19 -0
- package/src/plugin/file-inbound-init.ts +122 -0
- package/src/plugin/file-inbound-runtime.ts +51 -0
- package/src/plugin/file-inbound-state.ts +62 -0
- package/src/plugin/file-transfer-logs.ts +227 -0
- package/src/plugin/file-transfer-orchestrator-chunk.ts +135 -0
- package/src/plugin/file-transfer-orchestrator.ts +304 -0
- package/src/plugin/file-transfer-runtime-group.ts +102 -0
- package/src/plugin/file-transfer-send.ts +89 -0
- package/src/plugin/file-transfer-setup.ts +206 -0
- package/src/plugin/gateway-event-context.ts +41 -0
- package/src/plugin/gateway-runtime.ts +14 -4
- package/src/plugin/inbound-acceptance.ts +107 -0
- package/src/plugin/inbound-handlers.ts +248 -0
- package/src/plugin/inbound-surface-handlers-group.ts +152 -0
- package/src/plugin/media-dedupe-runtime.ts +90 -0
- package/src/plugin/media-orchestrators-runtime-group.ts +316 -0
- package/src/plugin/message-ack-runtime.ts +284 -0
- package/src/plugin/message-send.ts +16 -6
- package/src/plugin/messaging.ts +98 -36
- package/src/plugin/outbound.ts +50 -8
- package/src/plugin/outbox-ack-logs.ts +136 -0
- package/src/plugin/outbox-ack-outcome.ts +128 -0
- package/src/plugin/outbox-drain-ack.ts +145 -0
- package/src/plugin/outbox-drain-failure.ts +84 -0
- package/src/plugin/outbox-drain-loop.ts +554 -0
- package/src/plugin/outbox-drain-post-push.ts +159 -0
- package/src/plugin/outbox-drain-runtime.ts +141 -0
- package/src/plugin/outbox-drain-schedule.ts +116 -0
- package/src/plugin/outbox-file-push-flow.ts +69 -0
- package/src/plugin/outbox-push-route-runtime-group.ts +81 -0
- package/src/plugin/outbox-push.ts +267 -0
- package/src/plugin/outbox-route.ts +181 -0
- package/src/plugin/outbox-text-push-flow.ts +90 -0
- package/src/plugin/runtime-diagnostics-assembler.ts +183 -0
- package/src/plugin/runtime-diagnostics-helpers.ts +302 -0
- package/src/plugin/runtime-diagnostics-payload-builders.ts +171 -0
- package/src/plugin/runtime-diagnostics-snapshot.ts +31 -0
- package/src/plugin/setup.ts +33 -6
- package/src/plugin/state-store.ts +249 -0
- package/src/plugin/state-transient-runtime-group.ts +105 -0
- package/src/plugin/status-runtime.ts +251 -0
- package/src/plugin/status.ts +33 -7
- package/src/plugin/target-runtime.ts +141 -0
- package/src/plugin/target-status-runtime-group.ts +130 -0
- package/src/plugin/transient-state-runtime.ts +82 -0
- package/src/runtime/outbound-ack-timeout.ts +5 -3
- package/src/runtime/outbound-flags.ts +24 -8
- package/src/runtime/status-snapshots.ts +36 -7
- package/src/runtime/status-worker.ts +34 -4
package/README.md
CHANGED
|
@@ -262,7 +262,9 @@ npm root -g
|
|
|
262
262
|
|
|
263
263
|
```bash
|
|
264
264
|
cd plugins/bncr
|
|
265
|
+
npm run fullcheck
|
|
265
266
|
npm test
|
|
267
|
+
npm run typecheck
|
|
266
268
|
npm run selfcheck
|
|
267
269
|
npm run check-pack
|
|
268
270
|
npm pack
|
|
@@ -270,9 +272,12 @@ npm pack
|
|
|
270
272
|
|
|
271
273
|
用途:
|
|
272
274
|
|
|
275
|
+
- `npm run fullcheck`:运行当前全量门禁(`typecheck + check + test + selfcheck + check-pack + format:check`)
|
|
273
276
|
- `npm test`:跑回归测试
|
|
277
|
+
- `npm run typecheck`:执行 `tsconfig.typecheck.json`,确保类型边界与 OpenClaw surface 对齐
|
|
274
278
|
- `npm run selfcheck`:检查插件骨架是否完整,并验证关键 OpenClaw SDK subpath 可解析
|
|
275
279
|
- `npm run check-pack`:执行 `npm pack --dry-run --json`,确认发布包包含关键入口与 OpenClaw adapter 文件
|
|
280
|
+
- `npm run format:check`:执行 Biome `format` 只读检查(不带 `--write`),防止格式漂移混进发布门禁
|
|
276
281
|
- `npm pack`:确认当前版本可正常打包
|
|
277
282
|
- `npm run check-register-drift -- --duration-sec 300 --interval-sec 15`:静置采样 `bncr.diagnostics`,观察 `registerCount / apiGeneration / postWarmupRegisterCount` 是否在 warmup 后继续增长
|
|
278
283
|
|
package/dist/index.js
CHANGED
|
@@ -126,8 +126,27 @@ async function mutateOpenClawRuntimeConfigFile(api, params) {
|
|
|
126
126
|
var pluginFile = fileURLToPath(import.meta.url);
|
|
127
127
|
var pluginDir = path.dirname(pluginFile);
|
|
128
128
|
var pluginRequire = createRequire(import.meta.url);
|
|
129
|
+
var pluginPackageName = "@xmoxmo/bncr";
|
|
129
130
|
var sdkCoreSpecifier = "openclaw/plugin-sdk/core";
|
|
130
131
|
var linkType = process.platform === "win32" ? "junction" : "dir";
|
|
132
|
+
var resolvePluginRoot = (filePath) => {
|
|
133
|
+
let current = fs.existsSync(filePath) && fs.statSync(filePath).isDirectory() ? filePath : path.dirname(filePath);
|
|
134
|
+
while (true) {
|
|
135
|
+
const pkgPath = path.join(current, "package.json");
|
|
136
|
+
if (fs.existsSync(pkgPath)) {
|
|
137
|
+
try {
|
|
138
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
139
|
+
if (pkg.name === pluginPackageName) return current;
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (fs.existsSync(path.join(current, "openclaw.plugin.json"))) return current;
|
|
144
|
+
const parent = path.dirname(current);
|
|
145
|
+
if (parent === current) return path.dirname(filePath);
|
|
146
|
+
current = parent;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var pluginRoot = resolvePluginRoot(pluginFile);
|
|
131
150
|
var BNCR_REGISTER_META = /* @__PURE__ */ Symbol.for("bncr.register.meta");
|
|
132
151
|
var BNCR_GLOBAL_REGISTER_TRACE = /* @__PURE__ */ Symbol.for("bncr.global.register.trace");
|
|
133
152
|
var BNCR_BRIDGE_OWNER = /* @__PURE__ */ Symbol.for("bncr.bridge.owner");
|
|
@@ -155,9 +174,9 @@ var readOpenClawPackageName = (pkgPath) => {
|
|
|
155
174
|
return "";
|
|
156
175
|
}
|
|
157
176
|
};
|
|
158
|
-
var readPluginVersion = () => {
|
|
177
|
+
var readPluginVersion = (rootDir = pluginRoot) => {
|
|
159
178
|
try {
|
|
160
|
-
const raw = fs.readFileSync(path.join(
|
|
179
|
+
const raw = fs.readFileSync(path.join(rootDir, "package.json"), "utf8");
|
|
161
180
|
const parsed = JSON.parse(raw);
|
|
162
181
|
return typeof parsed?.version === "string" ? parsed.version : "unknown";
|
|
163
182
|
} catch {
|
|
@@ -508,7 +527,7 @@ var getBridgeSingleton = (api) => {
|
|
|
508
527
|
} catch {
|
|
509
528
|
}
|
|
510
529
|
g.__bncrBridge = hydrateBridgeRegisterState(
|
|
511
|
-
assignBridgeOwner(loaded.createBncrBridge(api), owner),
|
|
530
|
+
assignBridgeOwner(loaded.createBncrBridge(api, { pluginRoot, pluginFile }), owner),
|
|
512
531
|
registerState
|
|
513
532
|
);
|
|
514
533
|
created = true;
|
|
@@ -520,9 +539,13 @@ var getBridgeSingleton = (api) => {
|
|
|
520
539
|
rebuilt = false;
|
|
521
540
|
}
|
|
522
541
|
} else {
|
|
523
|
-
g.__bncrBridge = assignBridgeOwner(
|
|
542
|
+
g.__bncrBridge = assignBridgeOwner(
|
|
543
|
+
loaded.createBncrBridge(api, { pluginRoot, pluginFile }),
|
|
544
|
+
owner
|
|
545
|
+
);
|
|
524
546
|
created = true;
|
|
525
547
|
}
|
|
548
|
+
g.__bncrBridge.bindRuntimePaths?.({ pluginRoot, pluginFile });
|
|
526
549
|
return { bridge: g.__bncrBridge, runtime: loaded, created, rebuilt, owner, previousOwner };
|
|
527
550
|
};
|
|
528
551
|
var getExistingBridgeSingleton = () => {
|
|
@@ -669,7 +692,7 @@ var plugin = {
|
|
|
669
692
|
globalTrace.lastApiInstanceId = apiInstanceId;
|
|
670
693
|
globalTrace.lastRegistryFingerprint = registryFingerprint;
|
|
671
694
|
bridge?.noteRegister?.({
|
|
672
|
-
source: "
|
|
695
|
+
source: "@xmoxmo/bncr",
|
|
673
696
|
pluginVersion,
|
|
674
697
|
apiRebound: ownerDecision.adoptOwner ? !created && !rebuilt : false,
|
|
675
698
|
apiInstanceId: meta.apiInstanceId,
|