@mininglamp-oss/octo-runtime 1.1.6 → 1.1.8
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 +19 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +8 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +22 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +14 -1
- 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 +447 -241
- 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 +17 -7
- 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/dispatcher.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.js +29 -6
- 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/delivery/send-error.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.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 +5 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +76 -20
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +197 -66
- 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 +5 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +52 -36
- 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 +44 -9
- 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 +0 -10
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +19 -127
- 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/dist/web/assets/{index-CXTvRGim.js → index-B127MhT-.js} +10 -9
- 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.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/delivery/text-send.d.ts +0 -19
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/text-send.js +0 -86
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.d.ts +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.js +0 -35
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Octo 出站适配:统一文本、typing 和模板卡片发送,以及服务端能力发现。
|
|
3
|
-
*
|
|
3
|
+
* 持有调用方提供的凭据与取消期限;任务 REST 可使用 Bot 期限,不依赖单次 WS 存活。
|
|
4
4
|
*/
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { getCardProfile, sendTemplateCardMessage, editTemplateCardMessage } from "./api/cards.js";
|
|
7
|
-
import {
|
|
7
|
+
import { sendTyping } from "./api/messages.js";
|
|
8
8
|
import { selectReasoningTemplate } from "./cards.js";
|
|
9
9
|
import { postJson } from "./api/client.js";
|
|
10
|
+
import { ImSendError } from "../delivery/send-error.js";
|
|
11
|
+
import { OctoApiError } from "./api/errors.js";
|
|
10
12
|
export class OctoConnector {
|
|
11
13
|
config;
|
|
12
14
|
token;
|
|
13
15
|
signal;
|
|
14
|
-
|
|
16
|
+
dispatchRequest;
|
|
15
17
|
#profile;
|
|
16
|
-
constructor(config, token, signal,
|
|
18
|
+
constructor(config, token, signal,
|
|
19
|
+
// 跨 WS 的 REST 使用 Bot 持有凭据及任务期限,不把 WS 状态当作 HTTP 准入。
|
|
20
|
+
dispatchRequest) {
|
|
17
21
|
this.config = config;
|
|
18
22
|
this.token = token;
|
|
19
23
|
this.signal = signal;
|
|
20
|
-
this.
|
|
24
|
+
this.dispatchRequest = dispatchRequest;
|
|
21
25
|
}
|
|
22
26
|
async reasoningTemplate() {
|
|
23
27
|
if (this.config.cards === false)
|
|
@@ -27,58 +31,66 @@ export class OctoConnector {
|
|
|
27
31
|
const profile = await getCardProfile({
|
|
28
32
|
apiUrl: this.config.api_url,
|
|
29
33
|
botToken: this.token,
|
|
30
|
-
signal: this.
|
|
34
|
+
signal: this.signal,
|
|
35
|
+
dispatchRequest: this.#dispatch
|
|
31
36
|
});
|
|
32
37
|
const template = selectReasoningTemplate(profile);
|
|
33
38
|
this.#profile = { expires: Date.now() + 300_000, template };
|
|
34
39
|
return template;
|
|
35
40
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
// 3 秒 HTTP 预算从获准发出请求起算;准入回调直接执行 fetch,不返回异步许可。
|
|
42
|
+
#dispatch = (signal, send) => {
|
|
43
|
+
const owner = AbortSignal.any([this.signal, signal]);
|
|
44
|
+
owner.throwIfAborted();
|
|
45
|
+
const dispatch = (authorized, botToken) => send(AbortSignal.any([authorized, AbortSignal.timeout(3_000)]), botToken);
|
|
46
|
+
return this.dispatchRequest ? this.dispatchRequest(owner, dispatch) : dispatch(owner);
|
|
47
|
+
};
|
|
39
48
|
async typing(address, signal) {
|
|
40
49
|
await sendTyping({
|
|
41
50
|
apiUrl: this.config.api_url,
|
|
42
51
|
botToken: this.token,
|
|
43
52
|
...address,
|
|
44
|
-
signal
|
|
53
|
+
signal,
|
|
54
|
+
dispatchRequest: this.#dispatch
|
|
45
55
|
});
|
|
46
56
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
/** 任务文本/文件经 REST 投递;返回真实消息 ID,位置可选,不以 WS ACK 确认。 */
|
|
58
|
+
async message(address, payload, effectKey, onPosition) {
|
|
59
|
+
const receipt = await postJson(this.config.api_url, this.token, "/v1/bot/sendMessage", {
|
|
60
|
+
channel_id: address.channelId,
|
|
61
|
+
channel_type: address.channelType,
|
|
62
|
+
payload,
|
|
63
|
+
client_msg_no: effectKey
|
|
64
|
+
}, this.signal, { dispatchRequest: this.#dispatch, retryOn429: false }).catch((error) => {
|
|
65
|
+
// 无有效回应不标记送达;仅外层当前收尾可用同一消息身份进行有限 REST 重试。
|
|
66
|
+
if (error instanceof ImSendError)
|
|
67
|
+
throw error;
|
|
68
|
+
if (error instanceof OctoApiError && error.status < 500)
|
|
69
|
+
throw error;
|
|
70
|
+
throw new ImSendError("IM_DELIVERY_UNKNOWN", "unknown");
|
|
58
71
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
const id = receipt?.message_id;
|
|
73
|
+
if (!((typeof id === "string" && id.trim()) || (Number.isSafeInteger(id) && Number(id) > 0)))
|
|
74
|
+
throw new ImSendError("IM_DELIVERY_RECEIPT_UNKNOWN", "unknown");
|
|
75
|
+
const sequence = receipt?.message_seq;
|
|
76
|
+
if (Number.isSafeInteger(sequence) && sequence > 0)
|
|
77
|
+
onPosition?.(sequence);
|
|
78
|
+
return String(id);
|
|
62
79
|
}
|
|
63
80
|
async interactionCard(address, card, effectKey, messageId) {
|
|
64
|
-
return this.#rawCard(address, card, effectKey, messageId, true);
|
|
65
|
-
}
|
|
66
|
-
async displayCard(address, card, effectKey, obsolete) {
|
|
67
|
-
return this.#rawCard(address, card, effectKey, undefined, false, obsolete);
|
|
68
|
-
}
|
|
69
|
-
async #rawCard(address, card, effectKey, messageId, interactive, obsolete) {
|
|
70
81
|
if (this.config.cards === false)
|
|
71
82
|
return;
|
|
72
83
|
const profile = await getCardProfile({
|
|
73
84
|
apiUrl: this.config.api_url,
|
|
74
85
|
botToken: this.token,
|
|
75
|
-
signal: this.
|
|
86
|
+
signal: this.signal,
|
|
87
|
+
dispatchRequest: this.#dispatch
|
|
76
88
|
});
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
// 身份代次撤销不是能力不支持;保留取消原因供调用方区分已阻止的旧身份写入。
|
|
90
|
+
this.signal.throwIfAborted();
|
|
79
91
|
if (!profile.available ||
|
|
80
92
|
!profile.enabled ||
|
|
81
|
-
!
|
|
93
|
+
!profile.config?.interaction_enabled ||
|
|
82
94
|
!profile.profiles?.includes("octo/v2"))
|
|
83
95
|
return;
|
|
84
96
|
const payload = {
|
|
@@ -97,7 +109,10 @@ export class OctoConnector {
|
|
|
97
109
|
...(messageId
|
|
98
110
|
? { message_id: messageId, content_edit: JSON.stringify(payload) }
|
|
99
111
|
: { payload, client_msg_no: effectKey })
|
|
100
|
-
}, this.
|
|
112
|
+
}, this.signal, {
|
|
113
|
+
retryOn429: false,
|
|
114
|
+
dispatchRequest: this.#dispatch
|
|
115
|
+
});
|
|
101
116
|
if (!messageId && !result?.message_id)
|
|
102
117
|
throw Error("IM_DELIVERY_RECEIPT_UNKNOWN");
|
|
103
118
|
return messageId ?? String(result.message_id);
|
|
@@ -110,7 +125,8 @@ export class OctoConnector {
|
|
|
110
125
|
templateRef: template.ref,
|
|
111
126
|
state: frame.state,
|
|
112
127
|
data: frame,
|
|
113
|
-
signal: this.
|
|
128
|
+
signal: this.signal,
|
|
129
|
+
dispatchRequest: this.#dispatch,
|
|
114
130
|
retryOn429: false
|
|
115
131
|
};
|
|
116
132
|
if (messageId) {
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts
CHANGED
|
@@ -5,15 +5,11 @@ import { type ContextItem } from "@mininglamp-oss/octo-runtime-protocol";
|
|
|
5
5
|
import type { ScopedOctoBotConfig } from "../contracts.js";
|
|
6
6
|
import type { ImMessage } from "./wukong.js";
|
|
7
7
|
import { type ImGapPlan } from "../application/context-gap.js";
|
|
8
|
+
import { type MessageIdentityCache } from "./message-identities.js";
|
|
8
9
|
export declare function build_im_contexts(config: ScopedOctoBotConfig, message: ImMessage, botToken: string, signal: AbortSignal, options?: {
|
|
9
10
|
initialSession: boolean;
|
|
10
|
-
mentionGuidance?: boolean;
|
|
11
11
|
configuredItems?: readonly ContextItem[];
|
|
12
12
|
historyGap?: ImGapPlan;
|
|
13
|
+
identityCache?: MessageIdentityCache;
|
|
13
14
|
onHistoryGapPrepared?(plan: ImGapPlan): void;
|
|
14
15
|
}): Promise<ContextItem[]>;
|
|
15
|
-
export declare function historyText(entries: Array<{
|
|
16
|
-
from_uid: string;
|
|
17
|
-
content: string;
|
|
18
|
-
type?: number;
|
|
19
|
-
}>): string;
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js
CHANGED
|
@@ -6,14 +6,18 @@ import { resourceContext, RESOURCE_GUIDANCE } from "./resources.js";
|
|
|
6
6
|
import { groupScope } from "./normalize.js";
|
|
7
7
|
import { getGroupMd, getThreadMd } from "./api/rules.js";
|
|
8
8
|
import { getChannelMessagePage } from "./api/conversations.js";
|
|
9
|
-
import { compactHistoryGap, historyGapContext, IM_HISTORY_MESSAGE_LIMIT, planHistoryGap, validMessageSeq } from "../application/context-gap.js";
|
|
9
|
+
import { compactHistoryGap, historyGapContext, IM_HISTORY_MESSAGE_LIMIT, planHistoryGap, validMessageSeq, assistantOutputFingerprint } from "../application/context-gap.js";
|
|
10
10
|
import { OctoApiError } from "./api/errors.js";
|
|
11
|
-
import { MENTION_REMINDER } from "./mentions.js";
|
|
12
11
|
import { messageContent } from "./message-content.js";
|
|
12
|
+
import { rulesGuidance } from "../application/rules-context.js";
|
|
13
|
+
import { buildMessageTrigger } from "./message-trigger.js";
|
|
14
|
+
import { resolveMessageIdentities } from "./message-identities.js";
|
|
15
|
+
import { historyMessages } from "./history-messages.js";
|
|
16
|
+
import { historySenderUids, supportedHistoryType } from "./history-content.js";
|
|
17
|
+
import { modelHistoryContexts } from "../application/history-context.js";
|
|
13
18
|
export async function build_im_contexts(config, message, botToken, signal, options = { initialSession: false }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]);
|
|
19
|
+
// extra.im 归渠道所有;宿主静态/动态项即使本轮没有对应自动材料也不能透传。
|
|
20
|
+
const items = structuredClone((options.configuredItems ?? config.context?.items ?? []).filter((item) => item.namespace !== "extra.im"));
|
|
17
21
|
const source = {
|
|
18
22
|
service: config.api_url,
|
|
19
23
|
spaceId: config.spaceId,
|
|
@@ -27,6 +31,13 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
27
31
|
throw new Error("IM_CONTEXT_KEY_CONFLICT");
|
|
28
32
|
items.push({ namespace: "extra.im", name, payload: { source, ...payload } });
|
|
29
33
|
};
|
|
34
|
+
// 只描述真实入站事实;稳定通知规则仍由应用层按会话周期单独装配。
|
|
35
|
+
if (typeof message.channelId === "string" &&
|
|
36
|
+
typeof message.messageId === "string" &&
|
|
37
|
+
items.some((item) => item.namespace === "extra.im" && item.name === "message-trigger"))
|
|
38
|
+
throw new Error("IM_CONTEXT_KEY_CONFLICT");
|
|
39
|
+
const currentMessage = await buildMessageTrigger(config, message, botToken, signal, options.identityCache);
|
|
40
|
+
const trigger = currentMessage ? [currentMessage] : [];
|
|
30
41
|
// Octospec F01: .octospec/tasks/gateway-august-feature-assessment/assessment.md
|
|
31
42
|
// 引用是本轮业务材料;不参与命令/mention 准入,不解引用或补抓历史。
|
|
32
43
|
const reply = message.payload?.reply;
|
|
@@ -77,7 +88,7 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
77
88
|
text: doc.content,
|
|
78
89
|
version: doc.version,
|
|
79
90
|
...(doc.updated_at !== undefined ? { updatedAt: doc.updated_at } : {}),
|
|
80
|
-
status: doc.content ? "present" : "empty",
|
|
91
|
+
status: doc.content.trim() ? "present" : "empty",
|
|
81
92
|
automatic: true
|
|
82
93
|
});
|
|
83
94
|
}
|
|
@@ -90,7 +101,7 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
90
101
|
}
|
|
91
102
|
};
|
|
92
103
|
await rule("group-rules", () => getGroupMd({ apiUrl: config.api_url, botToken, groupNo: scope.groupNo, signal }));
|
|
93
|
-
if (scope.shortId)
|
|
104
|
+
if (message.channelType === 5 && scope.shortId)
|
|
94
105
|
await rule("topic-rules", () => getThreadMd({
|
|
95
106
|
apiUrl: config.api_url,
|
|
96
107
|
botToken,
|
|
@@ -100,38 +111,7 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
100
111
|
}));
|
|
101
112
|
for (const item of items)
|
|
102
113
|
if (item.namespace === "extra.im" && ["group-rules", "topic-rules"].includes(item.name))
|
|
103
|
-
item.guidance =
|
|
104
|
-
}
|
|
105
|
-
if ((options.mentionGuidance ?? options.initialSession) &&
|
|
106
|
-
!items.some((item) => item.namespace === "extra.im" && item.name === "mention-instructions")) {
|
|
107
|
-
const scope = [2, 5].includes(message.channelType) ? groupScope(message.channelId) : undefined;
|
|
108
|
-
const instructions = {
|
|
109
|
-
namespace: "extra.im",
|
|
110
|
-
name: "mention-instructions",
|
|
111
|
-
guidance: MENTION_REMINDER,
|
|
112
|
-
payload: {
|
|
113
|
-
source,
|
|
114
|
-
actorId: message.fromUid,
|
|
115
|
-
outputMarker: "@[uid:displayName]",
|
|
116
|
-
automatic: true,
|
|
117
|
-
...(scope
|
|
118
|
-
? {
|
|
119
|
-
memberLookup: {
|
|
120
|
-
groupNo: scope.groupNo,
|
|
121
|
-
argv: ["octo-cli", "group", "members", scope.groupNo],
|
|
122
|
-
fields: ["uid", "name", "robot"]
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
: {})
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
try {
|
|
129
|
-
assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: [...items, instructions] });
|
|
130
|
-
items.push(instructions);
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
/* 可选使用指引超预算时不影响当前输入。 */
|
|
134
|
-
}
|
|
114
|
+
item.guidance = rulesGuidance(item);
|
|
135
115
|
}
|
|
136
116
|
const historyPlan = options.initialSession
|
|
137
117
|
? planHistoryGap(message.messageSeq, undefined, "cold-window")
|
|
@@ -177,27 +157,36 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
177
157
|
return true;
|
|
178
158
|
})
|
|
179
159
|
.slice(0, IM_HISTORY_MESSAGE_LIMIT);
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
|
|
160
|
+
const identities = await resolveMessageIdentities(config, [
|
|
161
|
+
...entries
|
|
162
|
+
.filter((entry) => supportedHistoryType(entry.type))
|
|
163
|
+
.map((entry) => entry.from_uid),
|
|
164
|
+
...historySenderUids(entries.map((entry) => entry.payload))
|
|
165
|
+
], botToken, signal, options.identityCache);
|
|
166
|
+
const excludedSeqs = options.initialSession || historyPlan.mode !== "delta"
|
|
167
|
+
? []
|
|
168
|
+
: entries
|
|
169
|
+
.filter((entry) => entry.from_uid === config.bot_id &&
|
|
170
|
+
historyPlan.excludedOutputs?.some((output) => output.seq === entry.message_seq &&
|
|
171
|
+
output.fingerprint === assistantOutputFingerprint({ ...entry.payload })))
|
|
172
|
+
.map((entry) => entry.message_seq);
|
|
173
|
+
const { messages, truncated, recoveryMessages } = historyMessages(entries, identities, excludedSeqs);
|
|
186
174
|
if (gap)
|
|
187
175
|
gap = {
|
|
188
176
|
...historyPlan,
|
|
189
|
-
retrieval:
|
|
177
|
+
retrieval: messages.length || recoveryMessages?.length ? "omitted" : "empty",
|
|
190
178
|
earlierOmitted: (historyPlan.earlierOmitted === true && historyPlan.mode === "delta") ||
|
|
191
179
|
page.more !== false ||
|
|
192
180
|
entries.length !== page.messages.length ||
|
|
193
|
-
entries.some((entry) => entry.type
|
|
181
|
+
entries.some((entry) => !supportedHistoryType(entry.type)) ||
|
|
194
182
|
truncated
|
|
195
183
|
};
|
|
196
|
-
if (
|
|
184
|
+
if ((messages.length || recoveryMessages?.length) &&
|
|
185
|
+
!items.some((item) => item.namespace === "extra.im" && item.name === "history")) {
|
|
197
186
|
const history = {
|
|
198
187
|
namespace: "extra.im",
|
|
199
188
|
name: "history",
|
|
200
|
-
guidance: "
|
|
189
|
+
guidance: "This data contains bounded earlier messages from the current channel.",
|
|
201
190
|
payload: {
|
|
202
191
|
source,
|
|
203
192
|
upperMessageSeq: message.messageSeq,
|
|
@@ -205,14 +194,21 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
205
194
|
beforeSeq: historyPlan.beforeSeq,
|
|
206
195
|
...(historyPlan.afterSeq !== undefined ? { afterSeq: historyPlan.afterSeq } : {})
|
|
207
196
|
},
|
|
208
|
-
|
|
197
|
+
messages,
|
|
209
198
|
truncated,
|
|
210
199
|
automatic: true
|
|
211
200
|
}
|
|
212
201
|
};
|
|
213
202
|
try {
|
|
214
|
-
assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: [...items, history] });
|
|
203
|
+
assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: [...items, history, ...trigger] });
|
|
215
204
|
items.push(history);
|
|
205
|
+
if (gap && recoveryMessages?.length)
|
|
206
|
+
gap.recoveryHistory = modelHistoryContexts([
|
|
207
|
+
{
|
|
208
|
+
...history,
|
|
209
|
+
payload: { ...history.payload, messages: recoveryMessages }
|
|
210
|
+
}
|
|
211
|
+
])[0];
|
|
216
212
|
if (gap)
|
|
217
213
|
gap.retrieval = gap.earlierOmitted ? "partial" : "provided";
|
|
218
214
|
}
|
|
@@ -235,13 +231,16 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
235
231
|
throw new Error("IM_CONTEXT_KEY_CONFLICT");
|
|
236
232
|
if (candidate) {
|
|
237
233
|
try {
|
|
238
|
-
assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: [...items, candidate] });
|
|
234
|
+
assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: [...items, candidate, ...trigger] });
|
|
239
235
|
}
|
|
240
236
|
catch {
|
|
241
237
|
candidate = compactHistoryGap(candidate);
|
|
242
238
|
try {
|
|
243
239
|
if (candidate)
|
|
244
|
-
assertContextEnvelope({
|
|
240
|
+
assertContextEnvelope({
|
|
241
|
+
schema: CONTEXT_SCHEMA,
|
|
242
|
+
items: [...items, candidate, ...trigger]
|
|
243
|
+
});
|
|
245
244
|
}
|
|
246
245
|
catch {
|
|
247
246
|
candidate = undefined;
|
|
@@ -251,36 +250,8 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
251
250
|
items.push(candidate);
|
|
252
251
|
}
|
|
253
252
|
}
|
|
253
|
+
items.push(...trigger);
|
|
254
254
|
const envelope = { schema: CONTEXT_SCHEMA, items };
|
|
255
255
|
assertContextEnvelope(envelope);
|
|
256
256
|
return items;
|
|
257
257
|
}
|
|
258
|
-
export function historyText(entries) {
|
|
259
|
-
const marker = "<历史已截断>";
|
|
260
|
-
const selected = [];
|
|
261
|
-
let remaining = 1500;
|
|
262
|
-
for (const entry of entries) {
|
|
263
|
-
if (entry.type !== 1 || typeof entry.content !== "string" || !entry.content.trim())
|
|
264
|
-
continue;
|
|
265
|
-
const line = Array.from(`${entry.from_uid}:${entry.content}`);
|
|
266
|
-
const separator = selected.length ? 1 : 0;
|
|
267
|
-
if (line.length + separator <= remaining) {
|
|
268
|
-
selected.unshift(line.join(""));
|
|
269
|
-
remaining -= line.length + separator;
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
const available = remaining - separator - Array.from(marker).length;
|
|
273
|
-
if (available > 0)
|
|
274
|
-
selected.unshift(marker + line.slice(-available).join(""));
|
|
275
|
-
else if (selected.length) {
|
|
276
|
-
const text = selected.join("\n");
|
|
277
|
-
return (marker +
|
|
278
|
-
Array.from(text)
|
|
279
|
-
.slice(-(1500 - Array.from(marker).length))
|
|
280
|
-
.join(""));
|
|
281
|
-
}
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return selected.join("\n");
|
|
286
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MessageIdentity } from "./message-identities.js";
|
|
2
|
+
type Data = Record<string, unknown>;
|
|
3
|
+
export declare const historyObject: (value: unknown) => Data;
|
|
4
|
+
export declare const supportedHistoryType: (type: unknown) => boolean;
|
|
5
|
+
/** 只收集有限层级的真实来源 UID;转发自报姓名不参与可信身份映射。 */
|
|
6
|
+
export declare function historySenderUids(payloads: unknown[]): string[];
|
|
7
|
+
/** 历史只携带已返回的内容结构和资源地址,不下载、解引用或把嵌套材料当新任务。 */
|
|
8
|
+
export declare function historyContent(raw: unknown, identities: ReadonlyMap<string, MessageIdentity>): {
|
|
9
|
+
content: Data;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { messageSentAt } from "./message-time.js";
|
|
2
|
+
export const historyObject = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
3
|
+
const field = (value, limit = 256) => typeof value === "string" && value.length <= limit ? value : null;
|
|
4
|
+
export const supportedHistoryType = (type) => typeof type === "number" && [1, 2, 8, 11, 14, 18].includes(type);
|
|
5
|
+
/** 只收集有限层级的真实来源 UID;转发自报姓名不参与可信身份映射。 */
|
|
6
|
+
export function historySenderUids(payloads) {
|
|
7
|
+
const result = new Set();
|
|
8
|
+
let nodes = 0;
|
|
9
|
+
const visit = (raw, depth) => {
|
|
10
|
+
if (depth >= 4 || ++nodes > 128)
|
|
11
|
+
return;
|
|
12
|
+
const value = historyObject(raw);
|
|
13
|
+
const quote = historyObject(value.reply);
|
|
14
|
+
if (typeof quote.from_uid === "string")
|
|
15
|
+
result.add(quote.from_uid);
|
|
16
|
+
if (quote.payload)
|
|
17
|
+
visit(quote.payload, depth + 1);
|
|
18
|
+
if (value.type === 11 && Array.isArray(value.msgs))
|
|
19
|
+
for (const rawMessage of value.msgs.slice(0, 128)) {
|
|
20
|
+
if (nodes >= 128)
|
|
21
|
+
break;
|
|
22
|
+
const message = historyObject(rawMessage);
|
|
23
|
+
if (typeof message.from_uid === "string")
|
|
24
|
+
result.add(message.from_uid);
|
|
25
|
+
visit(message.payload, depth + 1);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
for (const value of payloads)
|
|
29
|
+
visit(value, 0);
|
|
30
|
+
return [...result];
|
|
31
|
+
}
|
|
32
|
+
/** 历史只携带已返回的内容结构和资源地址,不下载、解引用或把嵌套材料当新任务。 */
|
|
33
|
+
export function historyContent(raw, identities) {
|
|
34
|
+
let nodes = 0, remaining = 12000, truncated = false;
|
|
35
|
+
const text = (value) => {
|
|
36
|
+
if (typeof value !== "string")
|
|
37
|
+
return "";
|
|
38
|
+
const points = Array.from(value);
|
|
39
|
+
if (points.length > remaining)
|
|
40
|
+
truncated = true;
|
|
41
|
+
const result = points.slice(0, remaining).join("");
|
|
42
|
+
remaining -= Math.min(points.length, remaining);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
const speaker = (value) => {
|
|
46
|
+
const uid = field(value.from_uid, 64);
|
|
47
|
+
return {
|
|
48
|
+
uid,
|
|
49
|
+
username: uid ? (identities.get(uid)?.name ?? null) : null,
|
|
50
|
+
sentAt: messageSentAt(value.timestamp, "seconds")
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const visit = (value, depth) => {
|
|
54
|
+
if (depth >= 4 || ++nodes > 128) {
|
|
55
|
+
truncated = true;
|
|
56
|
+
return { type: "omitted", reason: "nesting-limit" };
|
|
57
|
+
}
|
|
58
|
+
const payload = historyObject(value);
|
|
59
|
+
let body;
|
|
60
|
+
if (payload.type === 1)
|
|
61
|
+
body = { type: "text", text: text(payload.content) };
|
|
62
|
+
else if (payload.type === 2)
|
|
63
|
+
body = { type: "image", url: field(payload.url, 8192), read: false };
|
|
64
|
+
else if (payload.type === 8)
|
|
65
|
+
body = {
|
|
66
|
+
type: "file",
|
|
67
|
+
name: field(payload.name),
|
|
68
|
+
url: field(payload.url, 8192),
|
|
69
|
+
read: false
|
|
70
|
+
};
|
|
71
|
+
else if (payload.type === 18)
|
|
72
|
+
body = {
|
|
73
|
+
type: "document",
|
|
74
|
+
id: field(payload.doc_id),
|
|
75
|
+
name: field(payload.title),
|
|
76
|
+
url: field(payload.url, 8192),
|
|
77
|
+
read: false
|
|
78
|
+
};
|
|
79
|
+
else if (payload.type === 11) {
|
|
80
|
+
const messages = [];
|
|
81
|
+
if (Array.isArray(payload.msgs))
|
|
82
|
+
for (const entry of payload.msgs.slice(0, 128)) {
|
|
83
|
+
if (nodes >= 128) {
|
|
84
|
+
truncated = true;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
const message = historyObject(entry);
|
|
88
|
+
messages.push({ ...speaker(message), content: visit(message.payload, depth + 1) });
|
|
89
|
+
}
|
|
90
|
+
if (Array.isArray(payload.msgs) && payload.msgs.length > 128)
|
|
91
|
+
truncated = true;
|
|
92
|
+
body = { type: "forward", messages };
|
|
93
|
+
}
|
|
94
|
+
else if (payload.type === 14) {
|
|
95
|
+
if (Array.isArray(payload.content)) {
|
|
96
|
+
const blocks = [];
|
|
97
|
+
for (const block of payload.content.slice(0, 128)) {
|
|
98
|
+
if (++nodes > 128) {
|
|
99
|
+
truncated = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
const data = historyObject(block);
|
|
103
|
+
if (data.type === "text")
|
|
104
|
+
blocks.push({ type: "text", text: text(data.text) });
|
|
105
|
+
else if (data.type === "image")
|
|
106
|
+
blocks.push({ type: "image", url: field(data.url, 8192), read: false });
|
|
107
|
+
else
|
|
108
|
+
blocks.push({ type: "unsupported" });
|
|
109
|
+
}
|
|
110
|
+
if (payload.content.length > 128)
|
|
111
|
+
truncated = true;
|
|
112
|
+
body = { type: "rich-text", blocks };
|
|
113
|
+
}
|
|
114
|
+
else
|
|
115
|
+
body = {
|
|
116
|
+
type: "text",
|
|
117
|
+
text: text(typeof payload.plain === "string" ? payload.plain : payload.content)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
body = { type: "unsupported" };
|
|
122
|
+
const quote = historyObject(payload.reply);
|
|
123
|
+
if (Object.keys(quote).length)
|
|
124
|
+
body = {
|
|
125
|
+
type: "reply",
|
|
126
|
+
quote: { ...speaker(quote), content: visit(quote.payload, depth + 1) },
|
|
127
|
+
content: body
|
|
128
|
+
};
|
|
129
|
+
return body;
|
|
130
|
+
};
|
|
131
|
+
const content = visit(raw, 0);
|
|
132
|
+
return { content, truncated };
|
|
133
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MessageIdentity } from "./message-identities.js";
|
|
2
|
+
export interface HistoryMessage {
|
|
3
|
+
uid: string;
|
|
4
|
+
username: string | null;
|
|
5
|
+
sentAt: string | null;
|
|
6
|
+
content: Record<string, unknown>;
|
|
7
|
+
truncated?: true;
|
|
8
|
+
}
|
|
9
|
+
/** 输入按新到旧;输出按旧到新,8000 码点预算包含 JSON,截断只影响正文。 */
|
|
10
|
+
export declare function historyMessages(entries: Array<{
|
|
11
|
+
from_uid: string;
|
|
12
|
+
content: string;
|
|
13
|
+
timestamp?: number | null;
|
|
14
|
+
type?: number;
|
|
15
|
+
payload?: unknown;
|
|
16
|
+
message_seq?: number;
|
|
17
|
+
}>, identities?: ReadonlyMap<string, MessageIdentity>, excludedSeqs?: readonly number[]): {
|
|
18
|
+
messages: HistoryMessage[];
|
|
19
|
+
truncated: boolean;
|
|
20
|
+
recoveryMessages?: HistoryMessage[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { historyContent, historyObject, supportedHistoryType } from "./history-content.js";
|
|
2
|
+
import { messageSentAt } from "./message-time.js";
|
|
3
|
+
import { IM_HISTORY_MESSAGE_LIMIT } from "../application/context-gap.js";
|
|
4
|
+
/** 输入按新到旧;输出按旧到新,8000 码点预算包含 JSON,截断只影响正文。 */
|
|
5
|
+
export function historyMessages(entries, identities = new Map(), excludedSeqs = []) {
|
|
6
|
+
const messages = [];
|
|
7
|
+
const excluded = new Set();
|
|
8
|
+
const size = (value) => Array.from(JSON.stringify(value)).length;
|
|
9
|
+
let truncated = false;
|
|
10
|
+
for (const entry of entries.slice(0, IM_HISTORY_MESSAGE_LIMIT)) {
|
|
11
|
+
// 先对完整窗口执行原预算;恢复与主历史只是同一材料的互不重叠分区。
|
|
12
|
+
const prepend = (record) => {
|
|
13
|
+
messages.unshift(record);
|
|
14
|
+
if (entry.message_seq !== undefined && excludedSeqs.includes(entry.message_seq))
|
|
15
|
+
excluded.add(record);
|
|
16
|
+
};
|
|
17
|
+
if (!supportedHistoryType(entry.type))
|
|
18
|
+
continue;
|
|
19
|
+
const payload = historyObject(entry.payload ?? { type: entry.type, content: entry.content });
|
|
20
|
+
const plain = entry.type === 1 && !Object.keys(historyObject(payload.reply)).length;
|
|
21
|
+
if (plain && (typeof entry.content !== "string" || !entry.content.trim()))
|
|
22
|
+
continue;
|
|
23
|
+
const body = plain ? undefined : historyContent(payload, identities);
|
|
24
|
+
const record = {
|
|
25
|
+
uid: entry.from_uid,
|
|
26
|
+
username: identities.get(entry.from_uid)?.name ?? null,
|
|
27
|
+
sentAt: messageSentAt(entry.timestamp, "milliseconds"),
|
|
28
|
+
content: plain ? { type: "text", text: entry.content } : body.content,
|
|
29
|
+
...(body?.truncated ? { truncated: true } : {})
|
|
30
|
+
};
|
|
31
|
+
if (size([record, ...messages]) <= 8000) {
|
|
32
|
+
prepend(record);
|
|
33
|
+
truncated ||= body?.truncated === true;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// 尾部保留最新正文;JSON 转义也占预算,二分选择可容纳的 Unicode 尾段。
|
|
37
|
+
if (!plain) {
|
|
38
|
+
const omitted = {
|
|
39
|
+
uid: record.uid,
|
|
40
|
+
username: record.username,
|
|
41
|
+
sentAt: record.sentAt,
|
|
42
|
+
content: { type: "omitted", reason: "history-budget" },
|
|
43
|
+
truncated: true
|
|
44
|
+
};
|
|
45
|
+
if (size([omitted, ...messages]) <= 8000)
|
|
46
|
+
prepend(omitted);
|
|
47
|
+
truncated = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
const tail = Array.from(entry.content).slice(-8000);
|
|
51
|
+
let low = 0, high = tail.length;
|
|
52
|
+
const shortened = (length) => ({
|
|
53
|
+
...record,
|
|
54
|
+
content: { type: "text", text: length ? tail.slice(-length).join("") : "" },
|
|
55
|
+
truncated: true
|
|
56
|
+
});
|
|
57
|
+
while (low < high) {
|
|
58
|
+
const middle = Math.ceil((low + high) / 2);
|
|
59
|
+
if (size([shortened(middle), ...messages]) <= 8000)
|
|
60
|
+
low = middle;
|
|
61
|
+
else
|
|
62
|
+
high = middle - 1;
|
|
63
|
+
}
|
|
64
|
+
if (low > 0)
|
|
65
|
+
prepend(shortened(low));
|
|
66
|
+
truncated = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
messages: messages.filter((record) => !excluded.has(record)),
|
|
71
|
+
truncated,
|
|
72
|
+
...(excluded.size
|
|
73
|
+
? { recoveryMessages: messages.filter((record) => excluded.has(record)) }
|
|
74
|
+
: {})
|
|
75
|
+
};
|
|
76
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type { MentionEntity } from "./api/types.js";
|
|
|
2
2
|
import type { GroupMember } from "./api/conversations.js";
|
|
3
3
|
/** Gateway 的稳定控制指令;压缩时的保留由模型遵守文本要求,不新增 Provider 保留机制。 */
|
|
4
4
|
export declare const MENTION_GUIDANCE: string;
|
|
5
|
-
/** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
|
|
6
|
-
export declare const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
|
|
7
5
|
export interface ImTextMention {
|
|
8
6
|
uids: string[];
|
|
9
7
|
entities: MentionEntity[];
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js
CHANGED
|
@@ -12,8 +12,6 @@ export const MENTION_GUIDANCE = [
|
|
|
12
12
|
"If the target cannot be confirmed, use a plain @name or ordinary text without guessing a UID. Continue delivering the final answer without a separate mention-failure notice or a forced clarification.",
|
|
13
13
|
"[/OCTO_CHANNEL_MENTION_RULES_V1]"
|
|
14
14
|
].join("\n");
|
|
15
|
-
/** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
|
|
16
|
-
export const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
|
|
17
15
|
function candidates(text) {
|
|
18
16
|
const found = [];
|
|
19
17
|
const visit = (node) => {
|