@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/execution/dispatcher.js
CHANGED
|
@@ -10,8 +10,12 @@ import { assertContextEnvelope, mergeContext } from "@mininglamp-oss/octo-runtim
|
|
|
10
10
|
import { validateImConfig } from "../lifecycle/configuration.js";
|
|
11
11
|
import { compactHistoryGap, historyGapContext } from "../application/context-gap.js";
|
|
12
12
|
import { MENTION_GUIDANCE } from "../transport/mentions.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import { artifactPolicy } from "../delivery/artifact-policy.js";
|
|
14
|
+
import { stableChannelContexts } from "../application/stable-context.js";
|
|
15
|
+
import { modelRulesContext } from "../application/rules-context.js";
|
|
16
|
+
import { modelHistoryContexts } from "../application/history-context.js";
|
|
17
|
+
export function createImInvocation(config, message, context, sessionKey, session, _signal, occurrenceId = message.messageId, refreshStableContext = !session.providerSession?.sessionId ||
|
|
18
|
+
session.providerSession.resumable === false) {
|
|
15
19
|
validateImConfig(config);
|
|
16
20
|
assertContextEnvelope(context);
|
|
17
21
|
if (!session.id)
|
|
@@ -82,11 +86,11 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
82
86
|
]
|
|
83
87
|
};
|
|
84
88
|
// Channel 只组装公开 InvokeInput;执行解析和指令渲染统一交给 Host,避免再次拒绝业务 Context。
|
|
85
|
-
// 宿主已先解析静态/动态 Context
|
|
89
|
+
// 宿主已先解析静态/动态 Context;渠道默认指令仅在刷新轮与有效 entries 保序组合。
|
|
86
90
|
// 不改变公共 mergeContext 或动态人设替换合同,也不把上一轮的组合结果累积回来。
|
|
87
91
|
let submitted = context;
|
|
88
92
|
// 同代次卡片重试已从 occurrence 取得组合后的冻结快照,不能再次追加或按文本去重。
|
|
89
|
-
if (!message.historyRetry) {
|
|
93
|
+
if (!message.historyRetry && refreshStableContext) {
|
|
90
94
|
const instructions = context.items.find((item) => item.namespace === "octo.control" && item.name === "instructions");
|
|
91
95
|
const channelInstructions = {
|
|
92
96
|
namespace: "octo.control",
|
|
@@ -106,25 +110,26 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
106
110
|
: [...context.items, channelInstructions]
|
|
107
111
|
};
|
|
108
112
|
}
|
|
113
|
+
submitted = { ...submitted, items: submitted.items.map(modelRulesContext) };
|
|
109
114
|
let snapshot;
|
|
115
|
+
let artifacts;
|
|
116
|
+
let stable = [];
|
|
110
117
|
// 执行默认项也占协议预算;只降级本渠道自动追加的辅助材料,不丢弃显式业务项。
|
|
111
|
-
for (const optional of [
|
|
112
|
-
"history",
|
|
113
|
-
"history-gap-compact",
|
|
114
|
-
"mention-instructions",
|
|
115
|
-
"history-gap",
|
|
116
|
-
undefined
|
|
117
|
-
]) {
|
|
118
|
+
for (const optional of ["history", "history-gap-compact", "history-gap", undefined]) {
|
|
118
119
|
try {
|
|
119
|
-
snapshot = mergeContext(defaults,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
snapshot = mergeContext(defaults, {
|
|
121
|
+
...submitted,
|
|
122
|
+
items: modelHistoryContexts(submitted.items)
|
|
123
|
+
});
|
|
124
|
+
artifacts = structuredClone(message.frozenArtifacts ?? artifactPolicy(config, snapshot));
|
|
125
|
+
stable = stableChannelContexts(artifacts);
|
|
126
|
+
// 稳定说明只由渠道按周期生成;已有同名项不能抑制刷新或绕过普通轮省略。
|
|
127
|
+
// 冻结重试复用渠道已生成的完整快照,不重建或再次追加说明。
|
|
128
|
+
if (!message.historyRetry) {
|
|
129
|
+
snapshot.items = snapshot.items.filter((item) => !stable.some((owned) => owned.namespace === item.namespace && owned.name === item.name));
|
|
130
|
+
if (refreshStableContext)
|
|
131
|
+
snapshot.items.push(...stable);
|
|
132
|
+
}
|
|
128
133
|
assertContextEnvelope(snapshot);
|
|
129
134
|
break;
|
|
130
135
|
}
|
|
@@ -182,8 +187,13 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
|
-
if (!snapshot)
|
|
190
|
+
if (!snapshot || !artifacts)
|
|
186
191
|
throw new Error("IM_EXECUTION_CONFIG_INVALID");
|
|
192
|
+
// 仅最终仍提交的自动历史构成交接证据;内部字段不进入模型快照或冻结重试。
|
|
193
|
+
const historyContext = submitted.items.find((item) => item.namespace === "extra.im" &&
|
|
194
|
+
item.name === "history" &&
|
|
195
|
+
item.payload.automatic === true &&
|
|
196
|
+
snapshot.items.some((candidate) => candidate.namespace === item.namespace && candidate.name === item.name));
|
|
187
197
|
const eventId = `evt_${randomUUID()}`, runId = `run_${randomUUID()}`;
|
|
188
198
|
const prompt = message.buildInputs ? "[Image]" : message.text.trim();
|
|
189
199
|
const request = {
|
|
@@ -191,6 +201,7 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
191
201
|
invocationId: `invoke_${randomUUID()}`,
|
|
192
202
|
runId,
|
|
193
203
|
sessionId: session.id,
|
|
204
|
+
...(session.sessionName ? { sessionName: session.sessionName } : {}),
|
|
194
205
|
sessionGeneration: session.generation,
|
|
195
206
|
providerEpoch: session.generation,
|
|
196
207
|
agentSource,
|
|
@@ -219,6 +230,9 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
219
230
|
return {
|
|
220
231
|
request,
|
|
221
232
|
adapterType: selectedAdapter,
|
|
222
|
-
artifacts
|
|
233
|
+
artifacts,
|
|
234
|
+
historyContext,
|
|
235
|
+
recoveryContexts: stable.filter((item) => !snapshot.items.some((existing) => existing.namespace === item.namespace && existing.name === item.name)),
|
|
236
|
+
stableContextIncluded: stable.every((item) => snapshot.items.some((existing) => existing.namespace === item.namespace && existing.name === item.name))
|
|
223
237
|
};
|
|
224
238
|
}
|
|
@@ -33,7 +33,20 @@ async function initialize(context, config, dependencies) {
|
|
|
33
33
|
log: context.log,
|
|
34
34
|
createSessionStore: dependencies.createSessionStore,
|
|
35
35
|
// 只保存调用入口,不预取提示词;宿主更新业务存储后,下一个接纳的逻辑轮重新读取。
|
|
36
|
-
prepareContexts: (bot, signal) =>
|
|
36
|
+
prepareContexts: async (bot, signal) => {
|
|
37
|
+
let ignored = 0;
|
|
38
|
+
const business = await contexts.load(bot, signal, (items) => {
|
|
39
|
+
const selected = items.filter((item) => item.namespace !== "extra.im");
|
|
40
|
+
ignored += items.length - selected.length;
|
|
41
|
+
return selected;
|
|
42
|
+
});
|
|
43
|
+
// 保留命名空间误配只记数量,不输出内容或阻断当前任务。
|
|
44
|
+
if (ignored)
|
|
45
|
+
context.log("warn", "channel.context.reserved_ignored", {
|
|
46
|
+
ignored_items: ignored
|
|
47
|
+
});
|
|
48
|
+
return business;
|
|
49
|
+
},
|
|
37
50
|
credentials: (bot) => Promise.resolve(configuredCredential(bot)),
|
|
38
51
|
...(allowed
|
|
39
52
|
? {
|
|
@@ -64,6 +64,10 @@ export function validateImConfig(config) {
|
|
|
64
64
|
}
|
|
65
65
|
if (config.context !== undefined)
|
|
66
66
|
assertContextEnvelope(config.context);
|
|
67
|
+
const refreshInterval = config.stable_context_refresh_interval_turns;
|
|
68
|
+
if (refreshInterval !== undefined &&
|
|
69
|
+
(!Number.isSafeInteger(refreshInterval) || refreshInterval < 1))
|
|
70
|
+
throw new Error("IM_STABLE_CONTEXT_REFRESH_INTERVAL_INVALID");
|
|
67
71
|
const delivery = config.artifact_delivery;
|
|
68
72
|
if (delivery !== undefined) {
|
|
69
73
|
if (!delivery || typeof delivery !== "object" || Array.isArray(delivery))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 公开事件投影:将 CanonicalEvent 累积为平台无关的展示快照。
|
|
3
|
-
*
|
|
3
|
+
* 只保留近期五条展示明细和必要在途元数据;最终正文独立保存,不展示私有 reasoning。
|
|
4
4
|
*/
|
|
5
5
|
import type { CanonicalEvent, FailureEnvelope } from "@mininglamp-oss/octo-runtime-protocol";
|
|
6
6
|
import type { ImTaskAttempt } from "../contracts.js";
|
|
@@ -18,6 +18,7 @@ export interface ProgressItem {
|
|
|
18
18
|
finishReason?: string;
|
|
19
19
|
startedAtMs?: number;
|
|
20
20
|
durationMs?: number;
|
|
21
|
+
ordinal?: number;
|
|
21
22
|
}
|
|
22
23
|
export interface RunPresentation {
|
|
23
24
|
runId: string;
|
|
@@ -27,6 +28,7 @@ export interface RunPresentation {
|
|
|
27
28
|
terminal?: "completed" | "failed" | "cancelled";
|
|
28
29
|
elapsedMs?: number;
|
|
29
30
|
items: ProgressItem[];
|
|
31
|
+
modelSteps?: ProgressItem[];
|
|
30
32
|
reasoningCount: number;
|
|
31
33
|
toolCallCount: number;
|
|
32
34
|
modelStepCount: number;
|
|
@@ -52,6 +54,8 @@ export declare class ImRunProjector {
|
|
|
52
54
|
constructor(runId: string, allowToolPreview?: boolean);
|
|
53
55
|
accept(event: CanonicalEvent, now?: number): void;
|
|
54
56
|
get finalText(): string;
|
|
57
|
+
/** 最终文本已取出、卡片/投递收尾后调用;即使迟到回调仍引用对象,也不再持有正文。 */
|
|
58
|
+
dispose(): void;
|
|
55
59
|
get finalReply(): {
|
|
56
60
|
text: string;
|
|
57
61
|
allowMention: boolean;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { sanitizePublicValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
2
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
3
3
|
const publicExposures = new Set(["public_reasoning", "public_summary", "public_plan"]);
|
|
4
|
+
const PROGRESS_WINDOW = 5;
|
|
5
|
+
const PREVIEW_RUNES = 180;
|
|
6
|
+
// 近期退役缓存只作辅助;未结束步骤的精确去重不能依赖其容量或滚动淘汰。
|
|
7
|
+
const RETIRED_WINDOW = 256;
|
|
4
8
|
export class ImRunProjector {
|
|
5
9
|
runId;
|
|
6
10
|
allowToolPreview;
|
|
7
11
|
#items = new Map();
|
|
8
12
|
#messages = new Map();
|
|
9
13
|
#toolInputs = new Map();
|
|
14
|
+
#steps = new Map();
|
|
15
|
+
#activeTools = new Map();
|
|
16
|
+
// 未结束步骤的身份与分类用于准确去重;不保存旧正文,步骤结束即释放。
|
|
17
|
+
#stepMessages = new Map();
|
|
18
|
+
#stepTools = new Map();
|
|
19
|
+
#unfinishedSteps = new Set();
|
|
20
|
+
#hasClosedStep = false;
|
|
21
|
+
#finalMessages = new Map();
|
|
22
|
+
#retired = new Set();
|
|
23
|
+
#reasoningCount = 0;
|
|
24
|
+
#toolCallCount = 0;
|
|
25
|
+
#modelStepCount = 0;
|
|
26
|
+
#disposed = false;
|
|
10
27
|
#currentStep;
|
|
11
28
|
#seq = 0;
|
|
12
29
|
#phase = "accepted";
|
|
@@ -27,7 +44,7 @@ export class ImRunProjector {
|
|
|
27
44
|
}
|
|
28
45
|
accept(event, now = Date.now()) {
|
|
29
46
|
// 终态后不再接纳迟到帧,防止完成卡片被旧进度改回执行中。
|
|
30
|
-
if (this.#terminal)
|
|
47
|
+
if (this.#terminal || this.#disposed)
|
|
31
48
|
return;
|
|
32
49
|
this.#seq++;
|
|
33
50
|
const p = event.payload;
|
|
@@ -43,26 +60,96 @@ export class ImRunProjector {
|
|
|
43
60
|
this.#phase = "accepted";
|
|
44
61
|
if (event.type === "model_step.started") {
|
|
45
62
|
const p = event.payload;
|
|
63
|
+
if (this.#retired.has(`step:${p.stepId}`))
|
|
64
|
+
return;
|
|
46
65
|
this.#currentStep = p.stepId;
|
|
47
|
-
this.#
|
|
66
|
+
this.#unfinishedSteps.add(p.stepId);
|
|
67
|
+
let step = this.#steps.get(p.stepId);
|
|
68
|
+
if (!step) {
|
|
69
|
+
step = {
|
|
70
|
+
id: `step:${p.stepId}`,
|
|
71
|
+
kind: "model_step",
|
|
72
|
+
stepId: p.stepId,
|
|
73
|
+
status: "running",
|
|
74
|
+
content: "",
|
|
75
|
+
ordinal: ++this.#modelStepCount
|
|
76
|
+
};
|
|
77
|
+
this.#steps.set(p.stepId, step);
|
|
78
|
+
}
|
|
79
|
+
step.startedAtMs = p.startedAtMs;
|
|
80
|
+
this.#pruneSteps();
|
|
48
81
|
this.#phase = "model";
|
|
49
82
|
this.#label = undefined;
|
|
50
83
|
}
|
|
51
84
|
if (event.type === "model_step.finished") {
|
|
52
85
|
const p = event.payload;
|
|
53
|
-
const item = this.#
|
|
54
|
-
item
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
item.
|
|
86
|
+
const item = this.#steps.get(p.stepId);
|
|
87
|
+
if (item) {
|
|
88
|
+
item.status = p.status;
|
|
89
|
+
item.finishReason = p.finishReason;
|
|
90
|
+
if (item.startedAtMs !== undefined && p.endedAtMs !== undefined)
|
|
91
|
+
item.durationMs = Math.max(0, p.endedAtMs - item.startedAtMs);
|
|
92
|
+
}
|
|
93
|
+
// 有的 Provider 只结束步骤、不逐条结束 reasoning;所属消息此时不再是在途资源。
|
|
94
|
+
this.#hasClosedStep = true;
|
|
95
|
+
this.#unfinishedSteps.delete(p.stepId);
|
|
96
|
+
for (const [id, message] of this.#stepMessages)
|
|
97
|
+
if (message.stepId === p.stepId) {
|
|
98
|
+
this.#stepMessages.delete(id);
|
|
99
|
+
this.#retire(`message:${id}`);
|
|
100
|
+
const detail = this.#items.get(`message:${id}`);
|
|
101
|
+
if (detail?.status === "running")
|
|
102
|
+
detail.status = p.status;
|
|
103
|
+
}
|
|
104
|
+
for (const [id, stepId] of this.#stepTools)
|
|
105
|
+
if (stepId === p.stepId && !this.#activeTools.has(id)) {
|
|
106
|
+
this.#stepTools.delete(id);
|
|
107
|
+
this.#retire(`tool:${id}`);
|
|
108
|
+
}
|
|
58
109
|
}
|
|
59
110
|
if (event.type.startsWith("message.")) {
|
|
60
111
|
const id = p.messageId ??
|
|
61
112
|
`unidentified:${p.stepId ?? this.#currentStep ?? "run"}:${p.channel ?? "final"}`;
|
|
62
|
-
const
|
|
63
|
-
|
|
113
|
+
const hasStableId = typeof p.messageId === "string" && p.messageId.length > 0;
|
|
114
|
+
// 合成的匿名 key 不是源消息身份,不能借其碰巧命中的记录推断通道。
|
|
115
|
+
if (p.channel === undefined && !hasStableId)
|
|
116
|
+
return;
|
|
117
|
+
const storedIdentity = this.#stepMessages.get(id);
|
|
118
|
+
const identity = storedIdentity?.stableId === hasStableId ? storedIdentity : undefined;
|
|
119
|
+
const knownFinal = hasStableId && this.#finalMessages.get(id)?.stableId === true;
|
|
120
|
+
// 已淘汰进度的迟到 delta 可能省略 channel,不能按缺省 final 拼进最终回复。
|
|
121
|
+
if (this.#retired.has(`message:${id}`) && !identity && p.channel !== "final" && !knownFinal)
|
|
122
|
+
return;
|
|
123
|
+
const storedPrevious = this.#messages.get(id);
|
|
124
|
+
const previous = storedPrevious?.stableId === hasStableId ? storedPrevious : undefined;
|
|
125
|
+
const channel = p.channel ?? (knownFinal ? "final" : (previous?.channel ?? identity?.channel));
|
|
126
|
+
// 无法证明通道时不发布正文;匿名帧也不能借用另一个匿名 final 的身份。
|
|
127
|
+
if (channel === undefined)
|
|
128
|
+
return;
|
|
129
|
+
const scopedStepId = p.stepId ?? previous?.stepId ?? identity?.stepId;
|
|
130
|
+
// 步骤结束后,未知旧身份不能仅靠 currentStep 被补造成当前步骤的新记录。
|
|
131
|
+
if (this.#hasClosedStep &&
|
|
132
|
+
scopedStepId === undefined &&
|
|
133
|
+
!identity &&
|
|
134
|
+
!previous &&
|
|
135
|
+
channel !== "final" &&
|
|
136
|
+
event.type !== "message.create")
|
|
137
|
+
return;
|
|
138
|
+
const stepId = scopedStepId ?? this.#currentStep;
|
|
139
|
+
// 已结束步骤的非 final/未分类迟到帧不能因身份缓存滚动而重新进入当前步骤。
|
|
140
|
+
if (p.channel !== "final" && !knownFinal && this.#stepClosed(stepId))
|
|
141
|
+
return;
|
|
142
|
+
// update 也可能是流式替换快照(例如 OpenClaw),不能仅按事件名提前清除分类。
|
|
143
|
+
const running = event.type !== "message.update" || p.status === "streaming" || p.status === "running";
|
|
64
144
|
// analysis 必须显式声明可公开;历史片段也清除,避免后续快照泄漏。
|
|
65
145
|
if (channel === "analysis" && !publicExposures.has(p.exposure ?? "")) {
|
|
146
|
+
this.#stepMessages.set(id, {
|
|
147
|
+
channel,
|
|
148
|
+
stepId,
|
|
149
|
+
hidden: identity?.hidden ?? false,
|
|
150
|
+
counted: identity?.counted ?? false,
|
|
151
|
+
stableId: hasStableId
|
|
152
|
+
});
|
|
66
153
|
this.#messages.delete(id);
|
|
67
154
|
this.#items.delete(`message:${id}`);
|
|
68
155
|
return;
|
|
@@ -70,23 +157,66 @@ export class ImRunProjector {
|
|
|
70
157
|
if (!["analysis", "commentary", "final"].includes(channel) ||
|
|
71
158
|
(p.role && p.role !== "assistant"))
|
|
72
159
|
return;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
? (
|
|
77
|
-
:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
160
|
+
if (channel === "final") {
|
|
161
|
+
this.#stepMessages.delete(id);
|
|
162
|
+
const text = typeof p.text !== "string"
|
|
163
|
+
? (this.#finalMessages.get(id)?.text ?? "")
|
|
164
|
+
: event.type === "message.delta"
|
|
165
|
+
? (this.#finalMessages.get(id)?.text ?? "") + p.text
|
|
166
|
+
: p.text;
|
|
167
|
+
this.#finalMessages.set(id, { text, stableId: hasStableId });
|
|
168
|
+
const step = stepId && this.#steps.get(stepId);
|
|
169
|
+
if (step)
|
|
170
|
+
step.content = previewText(text);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
if (this.#retired.has(`message:${id}`) && !identity)
|
|
174
|
+
return;
|
|
175
|
+
// 同一步骤内的迟到更新仍使用原分类和计数;已淘汰正文不回窗。
|
|
176
|
+
if (identity?.hidden) {
|
|
177
|
+
if (channel === "analysis" && !identity.counted) {
|
|
178
|
+
this.#reasoningCount++;
|
|
179
|
+
identity.counted = true;
|
|
180
|
+
}
|
|
181
|
+
identity.channel = channel;
|
|
182
|
+
if (!running)
|
|
183
|
+
this.#retire(`message:${id}`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// 有步骤身份的迟到快照不能重新创建已离开窗口的旧阶段。
|
|
187
|
+
if (stepId && stepId !== this.#currentStep && !this.#steps.has(stepId)) {
|
|
188
|
+
// 首次公开但已不在近期阶段的摘要仍计数,不为了统计恢复旧正文。
|
|
189
|
+
if (channel === "analysis" && !identity?.counted)
|
|
190
|
+
this.#reasoningCount++;
|
|
191
|
+
this.#stepMessages.set(id, {
|
|
192
|
+
channel,
|
|
193
|
+
stepId,
|
|
194
|
+
hidden: true,
|
|
195
|
+
counted: channel === "analysis" || !!identity?.counted,
|
|
196
|
+
stableId: hasStableId
|
|
197
|
+
});
|
|
198
|
+
this.#retire(`message:${id}`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const text = typeof p.text !== "string"
|
|
202
|
+
? (previous?.text ?? "")
|
|
203
|
+
: event.type === "message.delta"
|
|
204
|
+
? appendPreview(previous?.text ?? "", p.text)
|
|
205
|
+
: previewText(p.text);
|
|
206
|
+
const existing = this.#items.get(`message:${id}`);
|
|
207
|
+
if (!existing && channel === "analysis" && !identity?.counted)
|
|
208
|
+
this.#reasoningCount++;
|
|
209
|
+
this.#stepMessages.set(id, {
|
|
210
|
+
channel,
|
|
211
|
+
stepId,
|
|
212
|
+
hidden: false,
|
|
213
|
+
counted: channel === "analysis" || !!identity?.counted,
|
|
214
|
+
stableId: hasStableId
|
|
215
|
+
});
|
|
81
216
|
const item = this.#item(`message:${id}`, channel === "analysis" ? "reasoning" : "commentary", stepId);
|
|
82
217
|
item.content = text;
|
|
83
218
|
item.status = event.type === "message.update" ? "completed" : "running";
|
|
84
|
-
|
|
85
|
-
if (channel === "final" && stepId && this.#items.has(`step:${stepId}`)) {
|
|
86
|
-
this.#items.get(`step:${stepId}`).content = [...this.#messages.values()]
|
|
87
|
-
.filter((message) => message.channel === "final" && message.stepId === stepId)
|
|
88
|
-
.map((message) => message.text)
|
|
89
|
-
.join("\n\n");
|
|
219
|
+
this.#messages.set(id, { channel, text, stepId, stableId: hasStableId });
|
|
90
220
|
}
|
|
91
221
|
this.#phase =
|
|
92
222
|
channel === "final" ? "answering" : channel === "analysis" ? "thinking" : "commentary";
|
|
@@ -94,7 +224,17 @@ export class ImRunProjector {
|
|
|
94
224
|
}
|
|
95
225
|
if (event.type === "tool_call.create") {
|
|
96
226
|
const p = event.payload;
|
|
97
|
-
|
|
227
|
+
if (this.#retired.has(`tool:${p.id}`) ||
|
|
228
|
+
this.#stepTools.has(p.id) ||
|
|
229
|
+
this.#activeTools.has(p.id) ||
|
|
230
|
+
this.#items.has(`tool:${p.id}`))
|
|
231
|
+
return;
|
|
232
|
+
const stepId = p.stepId ?? this.#currentStep;
|
|
233
|
+
if (this.#stepClosed(stepId))
|
|
234
|
+
return;
|
|
235
|
+
const item = this.#item(`tool:${p.id}`, "tool", stepId);
|
|
236
|
+
this.#toolCallCount++;
|
|
237
|
+
this.#stepTools.set(p.id, stepId);
|
|
98
238
|
item.toolName = p.name;
|
|
99
239
|
item.startedAtMs = now;
|
|
100
240
|
if (this.allowToolPreview)
|
|
@@ -102,21 +242,50 @@ export class ImRunProjector {
|
|
|
102
242
|
const command = stringArg(p.args.command ?? p.args.cmd);
|
|
103
243
|
if (command.length <= 8192)
|
|
104
244
|
this.#toolInputs.set(p.id, { command });
|
|
245
|
+
this.#activeTools.set(p.id, item);
|
|
105
246
|
this.#phase = "tool";
|
|
106
247
|
this.#label = undefined;
|
|
107
248
|
}
|
|
108
249
|
if (event.type === "tool_call.update") {
|
|
109
250
|
const p = event.payload;
|
|
110
|
-
|
|
251
|
+
let item = this.#activeTools.get(p.id) ?? this.#items.get(`tool:${p.id}`);
|
|
252
|
+
const args = p.args && typeof p.args === "object" && !Array.isArray(p.args)
|
|
253
|
+
? p.args
|
|
254
|
+
: {};
|
|
255
|
+
if (!item) {
|
|
256
|
+
// 已有步骤完成时,缺少自身步骤的未知终态可能是旧工具迟到;不能补造归属。
|
|
257
|
+
if (this.#hasClosedStep && p.stepId === undefined)
|
|
258
|
+
return;
|
|
259
|
+
const stepId = p.stepId ?? this.#currentStep;
|
|
260
|
+
if (this.#stepTools.has(p.id) ||
|
|
261
|
+
this.#retired.has(`tool:${p.id}`) ||
|
|
262
|
+
this.#stepClosed(stepId))
|
|
263
|
+
return;
|
|
264
|
+
// ACP/OpenCode 支持仅终态工具;补建展示和计数,不虚构开始时间。
|
|
265
|
+
item = this.#item(`tool:${p.id}`, "tool", stepId);
|
|
266
|
+
this.#toolCallCount++;
|
|
267
|
+
this.#stepTools.set(p.id, stepId);
|
|
268
|
+
}
|
|
269
|
+
if (typeof p.name === "string") {
|
|
270
|
+
item.toolName = p.name;
|
|
271
|
+
if (this.allowToolPreview && item.summary === undefined)
|
|
272
|
+
item.summary = toolPreview(p.name, args);
|
|
273
|
+
}
|
|
111
274
|
item.status = p.status;
|
|
112
275
|
item.exitCode = p.exitCode;
|
|
113
276
|
item.durationMs =
|
|
114
277
|
p.durationMs ??
|
|
115
278
|
(item.startedAtMs === undefined ? undefined : Math.max(0, now - item.startedAtMs));
|
|
116
|
-
const
|
|
279
|
+
const command = stringArg(args.command ?? args.cmd);
|
|
280
|
+
const input = this.#toolInputs.get(p.id) ?? (command.length <= 8192 ? { command } : undefined);
|
|
117
281
|
if (p.status === "failed" && p.exitCode === 2 && input && detectorFindings(input, p.output))
|
|
118
282
|
item.outcome = "check_findings";
|
|
119
283
|
this.#toolInputs.delete(p.id);
|
|
284
|
+
this.#activeTools.delete(p.id);
|
|
285
|
+
if (this.#stepClosed(item.stepId))
|
|
286
|
+
this.#stepTools.delete(p.id);
|
|
287
|
+
if (!this.#items.has(item.id))
|
|
288
|
+
this.#retire(item.id);
|
|
120
289
|
this.#phase = "tool";
|
|
121
290
|
this.#label = "工具调用完成";
|
|
122
291
|
}
|
|
@@ -192,31 +361,80 @@ export class ImRunProjector {
|
|
|
192
361
|
: this.#failureMessage || detail;
|
|
193
362
|
}
|
|
194
363
|
this.#selectFinalReply();
|
|
195
|
-
for (const item of this.#items.values())
|
|
364
|
+
for (const item of [...this.#items.values(), ...this.#steps.values()])
|
|
196
365
|
if (item.status === "running")
|
|
197
366
|
item.status = this.#terminal === "completed" ? "completed" : "cancelled";
|
|
367
|
+
this.#activeTools.clear();
|
|
368
|
+
this.#stepMessages.clear();
|
|
369
|
+
this.#stepTools.clear();
|
|
370
|
+
this.#unfinishedSteps.clear();
|
|
371
|
+
this.#toolInputs.clear();
|
|
198
372
|
}
|
|
199
|
-
if (this.#items.size > 512 ||
|
|
200
|
-
this.#messages.size > 512 ||
|
|
201
|
-
[...this.#messages.values()].reduce((size, message) => size + Buffer.byteLength(message.text), 0) >
|
|
202
|
-
256 * 1024)
|
|
203
|
-
throw new Error("IM_RESULT_TOO_LARGE");
|
|
204
373
|
}
|
|
205
374
|
#item(id, kind, stepId) {
|
|
206
375
|
let item = this.#items.get(id);
|
|
207
376
|
if (!item) {
|
|
208
377
|
item = { id, kind, stepId, status: "running", content: "" };
|
|
209
378
|
this.#items.set(id, item);
|
|
379
|
+
if (this.#items.size > PROGRESS_WINDOW) {
|
|
380
|
+
const oldest = this.#items.keys().next().value;
|
|
381
|
+
this.#items.delete(oldest);
|
|
382
|
+
if (oldest.startsWith("message:")) {
|
|
383
|
+
const messageId = oldest.slice(8);
|
|
384
|
+
this.#messages.delete(messageId);
|
|
385
|
+
const identity = this.#stepMessages.get(messageId);
|
|
386
|
+
if (identity)
|
|
387
|
+
identity.hidden = true;
|
|
388
|
+
}
|
|
389
|
+
this.#retire(oldest);
|
|
390
|
+
}
|
|
391
|
+
this.#pruneSteps();
|
|
210
392
|
}
|
|
211
393
|
return item;
|
|
212
394
|
}
|
|
213
395
|
get finalText() {
|
|
214
|
-
return [...this.#
|
|
215
|
-
.
|
|
216
|
-
.map((m) => m.text)
|
|
396
|
+
return [...this.#finalMessages.values()]
|
|
397
|
+
.map((message) => message.text)
|
|
217
398
|
.filter(Boolean)
|
|
218
399
|
.join("\n\n");
|
|
219
400
|
}
|
|
401
|
+
#retire(id) {
|
|
402
|
+
this.#retired.add(id);
|
|
403
|
+
if (this.#retired.size > RETIRED_WINDOW)
|
|
404
|
+
this.#retired.delete(this.#retired.values().next().value);
|
|
405
|
+
}
|
|
406
|
+
#pruneSteps() {
|
|
407
|
+
const retained = new Set([...this.#items.values()].map((item) => item.stepId));
|
|
408
|
+
retained.add(this.#currentStep);
|
|
409
|
+
for (const [id] of this.#steps)
|
|
410
|
+
if (!retained.has(id)) {
|
|
411
|
+
this.#steps.delete(id);
|
|
412
|
+
this.#retire(`step:${id}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
#stepClosed(stepId) {
|
|
416
|
+
// 无步骤事件沿用隐式单步,兼容旧归一化器;有步骤流以 started/finished 管理身份。
|
|
417
|
+
return (stepId !== undefined && this.#currentStep !== undefined && !this.#unfinishedSteps.has(stepId));
|
|
418
|
+
}
|
|
419
|
+
/** 最终文本已取出、卡片/投递收尾后调用;即使迟到回调仍引用对象,也不再持有正文。 */
|
|
420
|
+
dispose() {
|
|
421
|
+
this.#disposed = true;
|
|
422
|
+
this.#items.clear();
|
|
423
|
+
this.#messages.clear();
|
|
424
|
+
this.#steps.clear();
|
|
425
|
+
this.#activeTools.clear();
|
|
426
|
+
this.#stepMessages.clear();
|
|
427
|
+
this.#stepTools.clear();
|
|
428
|
+
this.#unfinishedSteps.clear();
|
|
429
|
+
this.#toolInputs.clear();
|
|
430
|
+
this.#finalMessages.clear();
|
|
431
|
+
this.#retired.clear();
|
|
432
|
+
this.#currentStep = undefined;
|
|
433
|
+
this.#finalReply = undefined;
|
|
434
|
+
this.#failure = undefined;
|
|
435
|
+
this.#failureDetail = this.#failureMessage = undefined;
|
|
436
|
+
this.#providerDiagnostic = undefined;
|
|
437
|
+
}
|
|
220
438
|
// 只在终态选择一次;有故障证据的轮次才解析可见 Markdown 内容。
|
|
221
439
|
#selectFinalReply() {
|
|
222
440
|
let text;
|
|
@@ -261,9 +479,10 @@ export class ImRunProjector {
|
|
|
261
479
|
? undefined
|
|
262
480
|
: Math.max(0, (this.#endedAt ?? now) - this.#startedAt),
|
|
263
481
|
items,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
482
|
+
modelSteps: structuredClone([...this.#steps.values()]),
|
|
483
|
+
reasoningCount: this.#reasoningCount,
|
|
484
|
+
toolCallCount: this.#toolCallCount,
|
|
485
|
+
modelStepCount: this.#modelStepCount,
|
|
267
486
|
failure: this.#failure,
|
|
268
487
|
failureMessage: this.#failureMessage,
|
|
269
488
|
failureDetail: this.#failureDetail,
|
|
@@ -273,6 +492,14 @@ export class ImRunProjector {
|
|
|
273
492
|
};
|
|
274
493
|
}
|
|
275
494
|
}
|
|
495
|
+
// 预览仅取有限首尾片段,避免为展示截短而 Array.from 整段长正文。
|
|
496
|
+
function previewText(text) {
|
|
497
|
+
const edge = PREVIEW_RUNES * 2;
|
|
498
|
+
return compactRunes(text.length > edge * 2 ? text.slice(0, edge) + text.slice(-edge) : text, PREVIEW_RUNES);
|
|
499
|
+
}
|
|
500
|
+
function appendPreview(previous, delta) {
|
|
501
|
+
return previewText(previous + previewText(delta));
|
|
502
|
+
}
|
|
276
503
|
function failureIdentity(failure) {
|
|
277
504
|
return failure ? `\n错误码:${failure.code}\n诊断编号:${failure.diagnosticId}` : "";
|
|
278
505
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ChannelType } from "./types.js";
|
|
6
6
|
import { type SendMessageResult } from "./types.js";
|
|
7
|
+
import { type HttpRequestDispatch } from "./client.js";
|
|
7
8
|
export interface CardTemplateRef {
|
|
8
9
|
id: string;
|
|
9
10
|
version: string;
|
|
@@ -50,6 +51,7 @@ export declare function sendTemplateCardMessage(params: {
|
|
|
50
51
|
data: object;
|
|
51
52
|
clientMsgNo?: string;
|
|
52
53
|
signal?: AbortSignal;
|
|
54
|
+
dispatchRequest?: HttpRequestDispatch;
|
|
53
55
|
/**
|
|
54
56
|
* Forwarded to postJson. A transient progress frame passes false: it is discardable,
|
|
55
57
|
* and holding the flush while we back off would block the frames behind it. A finalize
|
|
@@ -70,6 +72,7 @@ export declare function editTemplateCardMessage(params: {
|
|
|
70
72
|
cardSeq: number;
|
|
71
73
|
transient?: boolean;
|
|
72
74
|
signal?: AbortSignal;
|
|
75
|
+
dispatchRequest?: HttpRequestDispatch;
|
|
73
76
|
/**
|
|
74
77
|
* Forwarded to postJson. A transient progress frame passes false: it is discardable,
|
|
75
78
|
* and holding the flush while we back off would block the frames behind it. A finalize
|
|
@@ -125,4 +128,5 @@ export declare function getCardProfile(params: {
|
|
|
125
128
|
apiUrl: string;
|
|
126
129
|
botToken: string;
|
|
127
130
|
signal?: AbortSignal;
|
|
131
|
+
dispatchRequest?: HttpRequestDispatch;
|
|
128
132
|
}): Promise<CardProfileManifest>;
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageType } from "./types.js";
|
|
2
|
-
import { postJson, generateClientMsgNo, DEFAULT_TIMEOUT_MS } from "./client.js";
|
|
2
|
+
import { postJson, generateClientMsgNo, DEFAULT_TIMEOUT_MS, fetchWithDispatch } from "./client.js";
|
|
3
3
|
import { OctoApiError } from "./errors.js";
|
|
4
4
|
import { trimTrailingSlashes } from "./url.js";
|
|
5
5
|
function validateTemplateFrame(params) {
|
|
@@ -54,7 +54,7 @@ export async function sendTemplateCardMessage(params) {
|
|
|
54
54
|
data: params.data
|
|
55
55
|
},
|
|
56
56
|
client_msg_no: params.clientMsgNo ?? generateClientMsgNo()
|
|
57
|
-
}, params.signal, { retryOn429: params.retryOn429 ?? true });
|
|
57
|
+
}, params.signal, { retryOn429: params.retryOn429 ?? true, dispatchRequest: params.dispatchRequest });
|
|
58
58
|
}
|
|
59
59
|
/** Replace one Registry-authored card frame; raw content_edit is intentionally unavailable. */
|
|
60
60
|
export async function editTemplateCardMessage(params) {
|
|
@@ -75,7 +75,7 @@ export async function editTemplateCardMessage(params) {
|
|
|
75
75
|
data: params.data,
|
|
76
76
|
card_seq: params.cardSeq,
|
|
77
77
|
...(params.transient ? { transient: true } : {})
|
|
78
|
-
}, params.signal, { retryOn429: params.retryOn429 ?? true });
|
|
78
|
+
}, params.signal, { retryOn429: params.retryOn429 ?? true, dispatchRequest: params.dispatchRequest });
|
|
79
79
|
}
|
|
80
80
|
function stringArray(value) {
|
|
81
81
|
return Array.isArray(value)
|
|
@@ -178,11 +178,11 @@ function parseBotCardConfig(value) {
|
|
|
178
178
|
*/
|
|
179
179
|
export async function getCardProfile(params) {
|
|
180
180
|
const url = `${trimTrailingSlashes(params.apiUrl)}/v1/bot/card/profile`;
|
|
181
|
-
const resp = await
|
|
181
|
+
const resp = await fetchWithDispatch(url, {
|
|
182
182
|
method: "GET",
|
|
183
183
|
headers: { Authorization: `Bearer ${params.botToken}` },
|
|
184
184
|
signal: params.signal ?? AbortSignal.timeout(DEFAULT_TIMEOUT_MS)
|
|
185
|
-
});
|
|
185
|
+
}, params.dispatchRequest);
|
|
186
186
|
// 端点尚未部署时 fail closed;不使用本地开关猜测服务端 Bot 策略。
|
|
187
187
|
if (resp.status === 404)
|
|
188
188
|
return { available: false, enabled: false };
|