@mininglamp-oss/octo-runtime 1.1.8 → 1.1.10
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 +1 -1
- package/apps/cli/README.md +3 -1
- package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.d.ts → apps/cli/dist/adapter-configuration.d.ts} +1 -0
- package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.js → apps/cli/dist/adapter-configuration.js} +1 -0
- package/apps/cli/dist/adapter-configurations.d.ts +1 -1
- package/apps/cli/dist/adapter-configurations.js +1 -1
- package/apps/cli/dist/adapters.d.ts +7 -0
- package/apps/cli/dist/adapters.js +51 -0
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/command-tree.js +3 -1
- package/apps/cli/dist/help.js +1 -1
- package/apps/cli/dist/index.js +4 -0
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +10 -12
- package/apps/cli/dist/manifest.json +0 -5
- package/apps/cli/dist/output.js +7 -9
- package/apps/cli/dist/playboard-interrupt.d.ts +6 -0
- package/apps/cli/dist/playboard-interrupt.js +86 -0
- package/apps/cli/dist/playboard.d.ts +2 -0
- package/apps/cli/dist/playboard.js +20 -12
- package/dist/public/executor-kernel.d.ts +2 -3
- package/dist/public/executor-kernel.js +1 -2
- package/dist/public/protocol.d.ts +1 -1
- package/dist/public/protocol.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +200 -106
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.d.ts +27 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.js +205 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +223 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-V5W6ZTYC.js → chunk-FGFEM7JP.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-CFKMMCO6.js → chunk-R3PDZLX5.js} +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-LO34KB7D.js → chunk-TSRZVLIG.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.js +57 -13
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/reasoning.js +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +12 -30
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.js +125 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +51 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/index.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +10 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +7 -9
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.js +86 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +20 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -24
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.js +12 -11
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/experience.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +8 -7
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +33 -11
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +9 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +6 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +199 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.d.ts +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.js +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts +9 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +3 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +14 -13
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +84 -187
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -8
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +77 -53
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +15 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +6 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.js +71 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-B127MhT-.js → index-BLMf2Etg.js} +2 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +63 -12
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +110 -20
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +28 -6
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.js +84 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +11 -5
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +26 -28
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +157 -41
- package/apps/cli/dist/worker.d.ts +0 -1
- package/apps/cli/dist/worker.js +0 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.d.ts +0 -63
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.js +0 -846
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +0 -54
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +0 -154
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.js +0 -18
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.d.ts +0 -16
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.js +0 -59
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.d.ts +0 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.js +0 -88
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +0 -42
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +0 -292
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.d.ts +0 -62
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +0 -661
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.js +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.d.ts +0 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +0 -96
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +0 -279
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { attachKernel } from "./client.js";
|
|
2
2
|
import { startKernelServer } from "./server.js";
|
|
3
3
|
import { beforeDeadline, ServiceInitializationError } from "./lifecycle.js";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* 宿主传入本地 RPC 地址和已装配的 Adapter;initialize 注册成功后才开放 client。
|
|
6
|
+
* socket、Core 和本服务创建的日志由 close 回收;宿主依赖仍由宿主拥有。
|
|
7
|
+
* 即使与调用方同进程,client 也始终通过 RPC,不能绕过 Run 接纳和观察管理。
|
|
8
|
+
*/
|
|
5
9
|
export function createKernelService(options) {
|
|
10
|
+
if (!options ||
|
|
11
|
+
typeof options.endpoint !== "string" ||
|
|
12
|
+
!options.endpoint ||
|
|
13
|
+
!Array.isArray(options.adapters))
|
|
14
|
+
throw new TypeError("Kernel requires endpoint and adapters");
|
|
15
|
+
// 旧 JS 接入不能静默退回文件加载或忽略 worker 环境;模块装配完全归宿主。
|
|
16
|
+
for (const field of ["workerEntrypoint", "manifest", "adapterModules", "env"])
|
|
17
|
+
if (field in options)
|
|
18
|
+
throw new TypeError(`Kernel does not accept ${field}; compose adapters in the host`);
|
|
6
19
|
const configuration = {
|
|
7
20
|
...options,
|
|
8
|
-
|
|
21
|
+
adapters: [...options.adapters],
|
|
9
22
|
adapterConfigurations: options.adapterConfigurations && structuredClone(options.adapterConfigurations),
|
|
10
|
-
env: options.env && { ...options.env },
|
|
11
23
|
logging: options.logging && { ...options.logging }
|
|
12
24
|
};
|
|
13
25
|
const owner = new AbortController();
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-kernel",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"./manifest-adapters": {
|
|
12
|
-
"types": "./dist/manifest-adapters.d.ts",
|
|
13
|
-
"import": "./dist/manifest-adapters.js"
|
|
14
|
-
},
|
|
15
|
-
"./runner": {
|
|
16
|
-
"types": "./dist/runner.d.ts",
|
|
17
|
-
"import": "./dist/runner.js"
|
|
18
10
|
}
|
|
19
11
|
},
|
|
20
12
|
"dependencies": {
|
|
21
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
22
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
23
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
13
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.10",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.10",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.10"
|
|
24
16
|
},
|
|
25
17
|
"types": "./dist/index.d.ts",
|
|
26
18
|
"files": [
|
|
@@ -491,6 +491,8 @@ export class ImRuntime {
|
|
|
491
491
|
}
|
|
492
492
|
this.#seen.set(dedupe, now + 120_000);
|
|
493
493
|
const command = message.text.trim();
|
|
494
|
+
// null 表示 Gateway 已拒绝控制授权;不能用 ?? 回退原文,避免广播裸命令绕过。
|
|
495
|
+
const sessionControl = message.sessionControl === undefined ? command : message.sessionControl;
|
|
494
496
|
if (/^\/(approve|decline|respond)\s/.test(command)) {
|
|
495
497
|
void this.#respond(message, key).catch(() => this.#diagnostic("IM_INTERACTION_RESPONSE_FAILED"));
|
|
496
498
|
return;
|
|
@@ -509,7 +511,7 @@ export class ImRuntime {
|
|
|
509
511
|
return;
|
|
510
512
|
}
|
|
511
513
|
try {
|
|
512
|
-
if (
|
|
514
|
+
if (sessionControl === "/reset" || sessionControl === "/new") {
|
|
513
515
|
try {
|
|
514
516
|
const binding = this.#sessionStore.reset(key, message.messageId);
|
|
515
517
|
this.#finalDeliveries.get(key)?.abort();
|
|
@@ -532,7 +534,7 @@ export class ImRuntime {
|
|
|
532
534
|
}
|
|
533
535
|
return;
|
|
534
536
|
}
|
|
535
|
-
if (
|
|
537
|
+
if (sessionControl === "/stop" || command === "/cancel") {
|
|
536
538
|
// 控制命令绕过普通消息队列,否则 stop 会排在待取消的长任务之后。
|
|
537
539
|
const preparation = this.#preparing.get(key);
|
|
538
540
|
preparation?.abort();
|
|
@@ -822,6 +824,7 @@ export class ImRuntime {
|
|
|
822
824
|
if (!entry ||
|
|
823
825
|
entry.key !== key ||
|
|
824
826
|
entry.senderId !== message.senderId ||
|
|
827
|
+
entry.request.expiresAt === undefined ||
|
|
825
828
|
!Number.isFinite(Date.parse(entry.request.expiresAt)) ||
|
|
826
829
|
Date.parse(entry.request.expiresAt) <= Date.now()) {
|
|
827
830
|
await this.#reply(message, "该交互已失效或不属于当前会话。", `interaction:${message.messageId}`);
|
|
@@ -856,6 +859,7 @@ export class ImRuntime {
|
|
|
856
859
|
entry.key !== key ||
|
|
857
860
|
entry.senderId !== senderId ||
|
|
858
861
|
this.#sessionStore.read(key)?.id !== entry.sessionId ||
|
|
862
|
+
entry.request.expiresAt === undefined ||
|
|
859
863
|
!Number.isFinite(Date.parse(entry.request.expiresAt)) ||
|
|
860
864
|
Date.parse(entry.request.expiresAt) <= Date.now())
|
|
861
865
|
throw Error("IM_INTERACTION_STALE");
|
|
@@ -91,6 +91,8 @@ export interface ImInboundMessage {
|
|
|
91
91
|
conversationId: string;
|
|
92
92
|
conversationKind: "direct" | "group" | "thread";
|
|
93
93
|
text: string;
|
|
94
|
+
/** Gateway 群/话题已核验的完整控制命令;null 禁止正文回退,省略沿用 DM/内部调用行为。 */
|
|
95
|
+
sessionControl?: "/reset" | "/new" | "/stop" | null;
|
|
94
96
|
buildInputs?(signal: AbortSignal): Promise<ModelInputPart[]>;
|
|
95
97
|
/** 终态提示也携带该轮投递期限;普通控制回复可省略,不进行产物准备。 */
|
|
96
98
|
reply(text: string, effectKey?: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js
CHANGED
|
@@ -244,6 +244,7 @@ export class ImTask {
|
|
|
244
244
|
this.attempts.push(attempt);
|
|
245
245
|
let terminal;
|
|
246
246
|
let completion = "unresolved";
|
|
247
|
+
const ignoredAsyncQuestions = new Set();
|
|
247
248
|
try {
|
|
248
249
|
for await (const event of this.kernel.invoke(request, {
|
|
249
250
|
...this.environment,
|
|
@@ -251,6 +252,19 @@ export class ImTask {
|
|
|
251
252
|
})) {
|
|
252
253
|
if (terminal)
|
|
253
254
|
throw new Error("IM_FRAME_AFTER_TERMINAL");
|
|
255
|
+
// Gateway 尚不接入异步表单;成对忽略交互事件,避免暂停等待钟或改变卡片状态。
|
|
256
|
+
// 消息正文仍正常投影,原流继续消费;已出现交互的尝试仍禁止自动重放。
|
|
257
|
+
if (event.type === "interaction.requested" && event.payload.delivery === "async") {
|
|
258
|
+
this.#replaySafe = false;
|
|
259
|
+
if (ignoredAsyncQuestions.size >= 64 &&
|
|
260
|
+
!ignoredAsyncQuestions.has(event.payload.interactionId))
|
|
261
|
+
throw new Error("IM_INTERACTION_CAPACITY_EXHAUSTED");
|
|
262
|
+
ignoredAsyncQuestions.add(event.payload.interactionId);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (event.type === "interaction.resolved" &&
|
|
266
|
+
ignoredAsyncQuestions.delete(event.payload.interactionId))
|
|
267
|
+
continue;
|
|
254
268
|
this.#observe(event);
|
|
255
269
|
if (event.type === "session.update")
|
|
256
270
|
request = {
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js
CHANGED
|
@@ -8,6 +8,7 @@ import { imBotIdentity } from "../lifecycle/configuration.js";
|
|
|
8
8
|
import { verifyBotIdentity } from "./auth.js";
|
|
9
9
|
import { registerBot, WukongConnection } from "./wukong.js";
|
|
10
10
|
import { acceptsImMessage, groupScope, isRulesNotification, rulesChange } from "./normalize.js";
|
|
11
|
+
import { sessionCommand } from "./session-command.js";
|
|
11
12
|
import { build_im_contexts } from "./contexts.js";
|
|
12
13
|
import { OctoConnector, stableEffectKey } from "./connector.js";
|
|
13
14
|
import { CardSession } from "./card-session.js";
|
|
@@ -186,6 +187,9 @@ export class GatewayTransport {
|
|
|
186
187
|
};
|
|
187
188
|
this.callbacks.onMessage({
|
|
188
189
|
messageId: message.messageId,
|
|
190
|
+
...(message.channelType === 2 || message.channelType === 5
|
|
191
|
+
? { sessionControl: sessionCommand(message, this.botId) }
|
|
192
|
+
: {}),
|
|
189
193
|
...(message.channelType === 2 || message.channelType === 5
|
|
190
194
|
? {
|
|
191
195
|
position: { messageSeq: message.messageSeq },
|
|
@@ -76,7 +76,8 @@ export function interactionCard(request, settled) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
export function interactionAnswer(request, action) {
|
|
79
|
-
if (
|
|
79
|
+
if (request.expiresAt === undefined ||
|
|
80
|
+
!Number.isFinite(Date.parse(request.expiresAt)) ||
|
|
80
81
|
Date.parse(request.expiresAt) <= Date.now())
|
|
81
82
|
throw Error("IM_INTERACTION_EXPIRED");
|
|
82
83
|
const outcome = action.actionId.slice("interaction_".length);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImInboundMessage } from "../contracts.js";
|
|
2
|
+
import type { ImMessage } from "./wukong.js";
|
|
3
|
+
type SessionCommand = NonNullable<ImInboundMessage["sessionControl"]>;
|
|
4
|
+
/**
|
|
5
|
+
* 在 Gateway 已完成消息准入后解析当前纯文本;不改变原文,不从名称补造授权。
|
|
6
|
+
* 只有剥离原生提及前缀后的完整输入才是控制命令,含 /stop 的语义文本仍交给 AgentRun。
|
|
7
|
+
*/
|
|
8
|
+
export declare function sessionCommand(message: ImMessage, botId: string): SessionCommand | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function exactCommand(text) {
|
|
2
|
+
const command = text.trim();
|
|
3
|
+
return command === "/reset" || command === "/new" || command === "/stop" ? command : null;
|
|
4
|
+
}
|
|
5
|
+
function splitsSurrogate(text, offset) {
|
|
6
|
+
const before = text.charCodeAt(offset - 1), after = text.charCodeAt(offset);
|
|
7
|
+
return before >= 0xd800 && before <= 0xdbff && after >= 0xdc00 && after <= 0xdfff;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 在 Gateway 已完成消息准入后解析当前纯文本;不改变原文,不从名称补造授权。
|
|
11
|
+
* 只有剥离原生提及前缀后的完整输入才是控制命令,含 /stop 的语义文本仍交给 AgentRun。
|
|
12
|
+
*/
|
|
13
|
+
export function sessionCommand(message, botId) {
|
|
14
|
+
if (![2, 5].includes(message.channelType) || message.payload.type !== 1)
|
|
15
|
+
return null;
|
|
16
|
+
const text = message.payload.content, raw = message.payload.mention;
|
|
17
|
+
if (typeof text !== "string" || !raw || typeof raw !== "object" || Array.isArray(raw))
|
|
18
|
+
return null;
|
|
19
|
+
const mention = raw;
|
|
20
|
+
const flag = (value) => value === 1 || value === true;
|
|
21
|
+
// ais 会把 Bot UID 展开到 uids;广播与直接点名混合也不能操作会话。
|
|
22
|
+
if ([mention.all, mention.ais, mention.humans].some(flag) || !Array.isArray(mention.uids))
|
|
23
|
+
return null;
|
|
24
|
+
const uids = new Set(mention.uids);
|
|
25
|
+
if (!uids.has(botId))
|
|
26
|
+
return null;
|
|
27
|
+
if (mention.entities === undefined)
|
|
28
|
+
return exactCommand(text);
|
|
29
|
+
if (!Array.isArray(mention.entities))
|
|
30
|
+
return null;
|
|
31
|
+
if (!mention.entities.length)
|
|
32
|
+
return exactCommand(text);
|
|
33
|
+
const entities = [];
|
|
34
|
+
for (const rawEntity of mention.entities) {
|
|
35
|
+
if (!rawEntity || typeof rawEntity !== "object" || Array.isArray(rawEntity))
|
|
36
|
+
return null;
|
|
37
|
+
const entity = rawEntity;
|
|
38
|
+
const { uid, offset, length } = entity;
|
|
39
|
+
if (typeof uid !== "string" ||
|
|
40
|
+
!uid ||
|
|
41
|
+
!uids.has(uid) ||
|
|
42
|
+
typeof offset !== "number" ||
|
|
43
|
+
!Number.isSafeInteger(offset) ||
|
|
44
|
+
offset < 0 ||
|
|
45
|
+
typeof length !== "number" ||
|
|
46
|
+
!Number.isSafeInteger(length) ||
|
|
47
|
+
length <= 1 ||
|
|
48
|
+
offset + length > text.length ||
|
|
49
|
+
splitsSurrogate(text, offset) ||
|
|
50
|
+
splitsSurrogate(text, offset + length) ||
|
|
51
|
+
text[offset] !== "@" ||
|
|
52
|
+
!text.slice(offset + 1, offset + length).trim())
|
|
53
|
+
return null;
|
|
54
|
+
entities.push({ uid, offset, length });
|
|
55
|
+
}
|
|
56
|
+
entities.sort((left, right) => left.offset - right.offset);
|
|
57
|
+
let end = 0;
|
|
58
|
+
for (const entity of entities) {
|
|
59
|
+
if (entity.offset < end)
|
|
60
|
+
return null;
|
|
61
|
+
end = entity.offset + entity.length;
|
|
62
|
+
}
|
|
63
|
+
let cursor = 0, directlyMentioned = false;
|
|
64
|
+
for (const entity of entities) {
|
|
65
|
+
if (text.slice(cursor, entity.offset).trim())
|
|
66
|
+
break;
|
|
67
|
+
cursor = entity.offset + entity.length;
|
|
68
|
+
directlyMentioned ||= entity.uid === botId;
|
|
69
|
+
}
|
|
70
|
+
return directlyMentioned ? exactCommand(text.slice(cursor)) : null;
|
|
71
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-channel-gateway",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"docs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
26
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
27
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
28
|
-
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.
|
|
29
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
25
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.10",
|
|
26
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.10",
|
|
27
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.10",
|
|
28
|
+
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.10",
|
|
29
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.10",
|
|
30
30
|
"mdast-util-from-markdown": "2.1.0",
|
|
31
31
|
"ws": "8.22.0"
|
|
32
32
|
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js
CHANGED
|
@@ -433,6 +433,7 @@ export class ImRuntime {
|
|
|
433
433
|
if (!entry ||
|
|
434
434
|
entry.key !== key ||
|
|
435
435
|
entry.senderId !== message.senderId ||
|
|
436
|
+
entry.request.expiresAt === undefined ||
|
|
436
437
|
!Number.isFinite(Date.parse(entry.request.expiresAt)) ||
|
|
437
438
|
Date.parse(entry.request.expiresAt) <= Date.now()) {
|
|
438
439
|
await this.#reply(message, "该交互已失效或不属于当前会话。", `interaction:${message.messageId}`);
|
|
@@ -531,6 +532,7 @@ export class ImRuntime {
|
|
|
531
532
|
let presentationFailed = false;
|
|
532
533
|
let executionStarted = false;
|
|
533
534
|
let localFailure;
|
|
535
|
+
const ignoredAsyncQuestions = new Set();
|
|
534
536
|
try {
|
|
535
537
|
presentation = message.beginPresentation?.(request.runId, (code) => this.#diagnostic(code, request.runId), controls);
|
|
536
538
|
presentation?.update(projector.snapshot());
|
|
@@ -541,6 +543,18 @@ export class ImRuntime {
|
|
|
541
543
|
})) {
|
|
542
544
|
if (this.#closed || this.#signal.aborted)
|
|
543
545
|
break;
|
|
546
|
+
// 企微尚未接入异步表单;在登记、提示和状态投影前成对过滤,正文继续正常交付。
|
|
547
|
+
// resolved 不带 delivery,须用本轮 requested 的身份识别,避免覆盖同步交互的等待状态。
|
|
548
|
+
if (event.type === "interaction.requested" && event.payload.delivery === "async") {
|
|
549
|
+
if (ignoredAsyncQuestions.size >= 64 &&
|
|
550
|
+
!ignoredAsyncQuestions.has(event.payload.interactionId))
|
|
551
|
+
throw new Error("IM_INTERACTION_CAPACITY_EXHAUSTED");
|
|
552
|
+
ignoredAsyncQuestions.add(event.payload.interactionId);
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
if (event.type === "interaction.resolved" &&
|
|
556
|
+
ignoredAsyncQuestions.delete(event.payload.interactionId))
|
|
557
|
+
continue;
|
|
544
558
|
if (event.type === "session.update" && session.id === request.sessionId) {
|
|
545
559
|
session.providerSession = event.payload.providerSession;
|
|
546
560
|
this.#saveBinding(key, session);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-channel-wecom",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"docs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.
|
|
26
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
27
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
25
|
+
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.10",
|
|
26
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.10",
|
|
27
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.10",
|
|
28
28
|
"ws": "8.22.0",
|
|
29
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
29
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.10"
|
|
30
30
|
}
|
|
31
31
|
}
|