@mininglamp-oss/octo-runtime 1.1.6 → 1.1.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/apps/cli/dist/build-info.json +2 -2
- package/dist/public/dsh.d.ts +1 -1
- package/dist/public/dsh.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/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +20 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +32 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +16 -2
- 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.js +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +32 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-IW62UM3C.js → chunk-CFKMMCO6.js} +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-FWAPYRV2.js → chunk-LO34KB7D.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-3GXX5VD5.js → chunk-V5W6ZTYC.js} +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +17 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +8 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +1 -0
- 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 +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +10 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +12 -40
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +22 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +422 -135
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +6 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +18 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +7 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +20 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.js +102 -52
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +8 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +9 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +17 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +22 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.js +27 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +444 -226
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.js +42 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.js +28 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +16 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +4 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +12 -9
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +7 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +36 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +36 -22
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +14 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +265 -38
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +19 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.d.ts +0 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.js +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +8 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +27 -15
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +17 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +217 -50
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +2 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +41 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +2 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +53 -82
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.d.ts +12 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.js +133 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.js +76 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.js +74 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.js +19 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.js +90 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.js +60 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +20 -8
- 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 +10 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +14 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.js +2 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- 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.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +11 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +8 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +138 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
- package/node_modules/iconv-lite/encodings/index.js +23 -0
- package/node_modules/iconv-lite/encodings/internal.js +218 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +180 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +187 -0
- package/node_modules/iconv-lite/encodings/utf32.js +314 -0
- package/node_modules/iconv-lite/encodings/utf7.js +283 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +48 -0
- package/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
- package/node_modules/iconv-lite/lib/index.d.ts +129 -0
- package/node_modules/iconv-lite/lib/index.js +182 -0
- package/node_modules/iconv-lite/lib/streams.js +105 -0
- package/node_modules/iconv-lite/package.json +70 -0
- package/node_modules/iconv-lite/types/encodings.d.ts +425 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/package.json +33 -27
- package/packages/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +43 -1
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Adapted from Mininglamp-OSS/openclaw-channel-octo/src/api-fetch.ts.
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { open } from "node:fs/promises";
|
|
8
|
-
import { readResponseText } from "./client.js";
|
|
8
|
+
import { readResponseText, fetchWithDispatch } from "./client.js";
|
|
9
9
|
import { trimTrailingSlashes } from "./url.js";
|
|
10
10
|
/** 校验服务端返回的长期下载地址;不把 PUT 地址、签名有效期或 Bot 鉴权路由冒充附件。 */
|
|
11
11
|
export function attachmentUrl(raw, apiUrl) {
|
|
@@ -32,16 +32,16 @@ export function attachmentUrl(raw, apiUrl) {
|
|
|
32
32
|
return url.href;
|
|
33
33
|
}
|
|
34
34
|
/** 当前 Bot 获取聊天上传凭据后直传;只交付独立 downloadUrl,绝不转发 Bot Token。 */
|
|
35
|
-
export async function uploadChatAttachment(apiUrl, token, bytes, filename, mime, signal) {
|
|
35
|
+
export async function uploadChatAttachment(apiUrl, token, bytes, filename, mime, signal, dispatchRequest) {
|
|
36
36
|
signal = AbortSignal.any([signal, AbortSignal.timeout(30_000)]);
|
|
37
37
|
signal.throwIfAborted();
|
|
38
38
|
const query = new URLSearchParams({ filename, fileSize: String(bytes.byteLength) });
|
|
39
|
-
const response = await
|
|
39
|
+
const response = await fetchWithDispatch(`${trimTrailingSlashes(apiUrl)}/v1/bot/upload/presigned?${query.toString()}`, {
|
|
40
40
|
method: "GET",
|
|
41
41
|
headers: { Authorization: `Bearer ${token}` },
|
|
42
42
|
signal,
|
|
43
43
|
redirect: "error"
|
|
44
|
-
});
|
|
44
|
+
}, dispatchRequest);
|
|
45
45
|
const body = await readResponseText(response, 64 << 10);
|
|
46
46
|
if (!response.ok)
|
|
47
47
|
throw new Error("upload-rejected");
|
|
@@ -91,14 +91,16 @@ export async function uploadChatAttachment(apiUrl, token, bytes, filename, mime,
|
|
|
91
91
|
}
|
|
92
92
|
signal.throwIfAborted();
|
|
93
93
|
// PUT 必须原样回显签名的类型/文件名;临时上传地址仅在此使用,网络未知不自动重放。
|
|
94
|
-
|
|
94
|
+
// presign 等待期间目标身份或任务可能取消;直传前检查,但不等待 WS 握手。
|
|
95
|
+
const stored = await fetchWithDispatch(upload.href, {
|
|
95
96
|
method: "PUT",
|
|
96
97
|
headers,
|
|
97
98
|
body: new Uint8Array(bytes),
|
|
98
99
|
redirect: "error",
|
|
99
100
|
signal
|
|
100
|
-
});
|
|
101
|
+
}, dispatchRequest);
|
|
101
102
|
await stored.body?.cancel();
|
|
103
|
+
signal.throwIfAborted();
|
|
102
104
|
if (!stored.ok)
|
|
103
105
|
throw new Error("upload-rejected");
|
|
104
106
|
return download;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ChannelType } from "./types.js";
|
|
6
6
|
import { MessageType, type MentionEntity, type RichTextBlock, type SendMessageResult } from "./types.js";
|
|
7
|
+
import { type HttpRequestDispatch } from "./client.js";
|
|
7
8
|
/**
|
|
8
9
|
* Send a media message (image or file) to a channel.
|
|
9
10
|
*/
|
|
@@ -37,6 +38,7 @@ export declare function sendMessage(params: {
|
|
|
37
38
|
onBehalfOf?: string;
|
|
38
39
|
clientMsgNo?: string;
|
|
39
40
|
signal?: AbortSignal;
|
|
41
|
+
dispatchRequest?: HttpRequestDispatch;
|
|
40
42
|
}): Promise<SendMessageResult | undefined>;
|
|
41
43
|
/**
|
|
42
44
|
* 发送一条 RichText(=14) 图文混排消息。
|
|
@@ -73,6 +75,7 @@ export declare function sendTyping(params: {
|
|
|
73
75
|
channelType: ChannelType;
|
|
74
76
|
onBehalfOf?: string;
|
|
75
77
|
signal?: AbortSignal;
|
|
78
|
+
dispatchRequest?: HttpRequestDispatch;
|
|
76
79
|
}): Promise<void>;
|
|
77
80
|
export declare function sendReadReceipt(params: {
|
|
78
81
|
apiUrl: string;
|
|
@@ -89,7 +89,7 @@ export async function sendMessage(params) {
|
|
|
89
89
|
payload,
|
|
90
90
|
client_msg_no: params.clientMsgNo ?? generateClientMsgNo(),
|
|
91
91
|
...(params.onBehalfOf ? { on_behalf_of: params.onBehalfOf } : {})
|
|
92
|
-
}, params.signal);
|
|
92
|
+
}, params.signal, { dispatchRequest: params.dispatchRequest });
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* 发送一条 RichText(=14) 图文混排消息。
|
|
@@ -151,7 +151,7 @@ export async function sendTyping(params) {
|
|
|
151
151
|
...(params.onBehalfOf ? { on_behalf_of: params.onBehalfOf } : {})
|
|
152
152
|
// A discardable hint, re-sent every few seconds while the model works. Retrying it
|
|
153
153
|
// only adds pressure to a bucket that is already empty.
|
|
154
|
-
}, params.signal, { retryOn429: false });
|
|
154
|
+
}, params.signal, { retryOn429: false, dispatchRequest: params.dispatchRequest });
|
|
155
155
|
}
|
|
156
156
|
export async function sendReadReceipt(params) {
|
|
157
157
|
await postJson(params.apiUrl, params.botToken, "/v1/bot/readReceipt", {
|
|
@@ -11,11 +11,11 @@ export declare class CardSession {
|
|
|
11
11
|
readonly connector: OctoConnector;
|
|
12
12
|
readonly delivery: ImDeliveryDispatcher;
|
|
13
13
|
readonly address: ImAddress;
|
|
14
|
-
readonly stopTyping: () => void;
|
|
15
|
-
readonly onDiagnostic: (code: string) => void;
|
|
16
14
|
readonly effectKey: string;
|
|
17
15
|
constructor(connector: OctoConnector, delivery: ImDeliveryDispatcher, address: ImAddress, runId: string, stopTyping: () => void, onDiagnostic: (code: string) => void);
|
|
18
16
|
update(snapshot: RunPresentation): void;
|
|
19
17
|
finish(): Promise<void>;
|
|
18
|
+
/** 所有者完成 finish 后释放调度/回调;保留 messageId 供已有卡片按钮关联使用。 */
|
|
19
|
+
release(): void;
|
|
20
20
|
get messageId(): string | undefined;
|
|
21
21
|
}
|
|
@@ -6,19 +6,19 @@ export class CardSession {
|
|
|
6
6
|
connector;
|
|
7
7
|
delivery;
|
|
8
8
|
address;
|
|
9
|
-
stopTyping;
|
|
10
|
-
onDiagnostic;
|
|
11
9
|
#messageId;
|
|
12
10
|
#seq = 0;
|
|
13
11
|
#terminalFailed = false;
|
|
14
12
|
#scheduler;
|
|
13
|
+
#stopTyping;
|
|
14
|
+
#onDiagnostic;
|
|
15
15
|
effectKey;
|
|
16
16
|
constructor(connector, delivery, address, runId, stopTyping, onDiagnostic) {
|
|
17
17
|
this.connector = connector;
|
|
18
18
|
this.delivery = delivery;
|
|
19
19
|
this.address = address;
|
|
20
|
-
this
|
|
21
|
-
this
|
|
20
|
+
this.#stopTyping = stopTyping;
|
|
21
|
+
this.#onDiagnostic = onDiagnostic;
|
|
22
22
|
this.effectKey = stableEffectKey(imBotIdentity(connector.config), address, runId, "progress");
|
|
23
23
|
this.#scheduler = new ProgressScheduler(async (snapshot) => {
|
|
24
24
|
try {
|
|
@@ -29,51 +29,63 @@ export class CardSession {
|
|
|
29
29
|
this.#terminalFailed = true;
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
|
-
}, () => onDiagnostic("IM_CARD_FAILED"));
|
|
32
|
+
}, () => this.#onDiagnostic?.("IM_CARD_FAILED"));
|
|
33
33
|
}
|
|
34
34
|
update(snapshot) {
|
|
35
35
|
if (snapshot.terminal || snapshot.phase === "waiting")
|
|
36
|
-
this
|
|
37
|
-
this.#scheduler
|
|
36
|
+
this.#stopTyping?.();
|
|
37
|
+
this.#scheduler?.enqueue(snapshot, !!snapshot.terminal || !!snapshot.resultUnknown);
|
|
38
38
|
}
|
|
39
39
|
async #send(snapshot) {
|
|
40
|
+
if (!this.#scheduler)
|
|
41
|
+
return;
|
|
40
42
|
const settled = !!snapshot.terminal || !!snapshot.resultUnknown;
|
|
41
43
|
const template = await this.connector.reasoningTemplate();
|
|
42
44
|
if (!template) {
|
|
43
45
|
if (settled && this.#messageId)
|
|
44
46
|
this.#terminalFailed = true;
|
|
45
|
-
this
|
|
47
|
+
this.#onDiagnostic?.("IM_CARD_UNAVAILABLE");
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
const frame = buildReasoningFrame(snapshot, template);
|
|
49
51
|
if (!frame) {
|
|
50
52
|
if (settled)
|
|
51
53
|
this.#terminalFailed = true;
|
|
52
|
-
this
|
|
54
|
+
this.#onDiagnostic?.("IM_CARD_BUDGET_EXCEEDED");
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
57
|
// 模板查询期间可能已收到终态;旧快照必须在出站前再次检查。
|
|
56
|
-
if (this.#scheduler.terminal && !settled)
|
|
58
|
+
if (!this.#scheduler || (this.#scheduler.terminal && !settled))
|
|
57
59
|
return;
|
|
58
60
|
const seq = ++this.#seq;
|
|
59
|
-
const receipt = await this.delivery.deliver(`${this.effectKey}:${seq}`, () => this.connector.card(this.address, template, frame, this.effectKey, this.#messageId, seq, !settled), {
|
|
61
|
+
const receipt = await this.delivery.deliver(`${this.effectKey}:${seq}`, () => this.connector.card(this.address, template, frame, this.effectKey, this.#messageId, seq, !settled), {
|
|
62
|
+
transient: !settled,
|
|
63
|
+
obsolete: () => !this.#scheduler || (this.#scheduler.terminal && !settled)
|
|
64
|
+
});
|
|
60
65
|
if (receipt.state === "delivered") {
|
|
61
66
|
// 后续更新绑定第一次成功发送的消息,不另起卡片;可见卡片接替 typing 提示。
|
|
62
67
|
this.#messageId = receipt.messageId;
|
|
63
|
-
this
|
|
68
|
+
this.#stopTyping?.();
|
|
64
69
|
}
|
|
65
70
|
else {
|
|
66
71
|
if (settled)
|
|
67
72
|
this.#terminalFailed = true;
|
|
68
|
-
this
|
|
73
|
+
this.#onDiagnostic?.(receipt.code ?? "IM_CARD_FAILED");
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
async finish() {
|
|
72
|
-
this
|
|
73
|
-
await this.#scheduler
|
|
77
|
+
this.#stopTyping?.();
|
|
78
|
+
await this.#scheduler?.flush();
|
|
74
79
|
if (this.#terminalFailed)
|
|
75
80
|
throw new Error("IM_CARD_FINALIZATION_FAILED");
|
|
76
81
|
}
|
|
82
|
+
/** 所有者完成 finish 后释放调度/回调;保留 messageId 供已有卡片按钮关联使用。 */
|
|
83
|
+
release() {
|
|
84
|
+
this.#scheduler?.dispose();
|
|
85
|
+
this.#scheduler = undefined;
|
|
86
|
+
this.#stopTyping = undefined;
|
|
87
|
+
this.#onDiagnostic = undefined;
|
|
88
|
+
}
|
|
77
89
|
get messageId() {
|
|
78
90
|
return this.#messageId;
|
|
79
91
|
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import type { ChannelCallbacks, OctoBotConfig } from "../contracts.js";
|
|
2
2
|
import type { ImCredentialSource } from "../ports.js";
|
|
3
|
+
import { ImDeliveryDispatcher } from "../delivery/dispatcher.js";
|
|
4
|
+
import { type ImDeliveryIdentity } from "../delivery/identity.js";
|
|
3
5
|
/** Octo IM 平台连接器:WuKong 与 Octo REST 适配;不是 MCP 连接器。 */
|
|
4
6
|
export declare class GatewayTransport {
|
|
5
7
|
#private;
|
|
6
8
|
readonly config: OctoBotConfig;
|
|
7
9
|
readonly credentials: ImCredentialSource;
|
|
8
10
|
readonly callbacks: ChannelCallbacks;
|
|
11
|
+
readonly deliveryOwner?: {
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
dispatcher: ImDeliveryDispatcher;
|
|
14
|
+
identity: ImDeliveryIdentity;
|
|
15
|
+
token?: () => string | undefined;
|
|
16
|
+
current: () => GatewayTransport | undefined;
|
|
17
|
+
} | undefined;
|
|
9
18
|
identity: string;
|
|
10
19
|
readonly botId: string;
|
|
11
20
|
get scopedConfig(): {
|
|
12
21
|
spaceId: string;
|
|
13
22
|
api_url: string;
|
|
14
23
|
bf_token?: string;
|
|
24
|
+
stable_context_refresh_interval_turns?: number;
|
|
15
25
|
groups_enabled?: boolean;
|
|
16
26
|
group_ids?: string[] | null;
|
|
17
27
|
cards?: boolean;
|
|
@@ -42,7 +52,13 @@ export declare class GatewayTransport {
|
|
|
42
52
|
};
|
|
43
53
|
allowed_sender_ids?: string[];
|
|
44
54
|
};
|
|
45
|
-
constructor(config: OctoBotConfig, credentials: ImCredentialSource, callbacks: ChannelCallbacks
|
|
55
|
+
constructor(config: OctoBotConfig, credentials: ImCredentialSource, callbacks: ChannelCallbacks, deliveryOwner?: {
|
|
56
|
+
signal: AbortSignal;
|
|
57
|
+
dispatcher: ImDeliveryDispatcher;
|
|
58
|
+
identity: ImDeliveryIdentity;
|
|
59
|
+
token?: () => string | undefined;
|
|
60
|
+
current: () => GatewayTransport | undefined;
|
|
61
|
+
} | undefined);
|
|
46
62
|
get status(): {
|
|
47
63
|
connected: boolean;
|
|
48
64
|
cardDeliveries: number;
|