@mininglamp-oss/octo-runtime 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/cli/dist/build-info.json +2 -2
- package/dist/public/dsh.d.ts +1 -1
- package/dist/public/dsh.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +20 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +32 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +16 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +32 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-IW62UM3C.js → chunk-CFKMMCO6.js} +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-FWAPYRV2.js → chunk-LO34KB7D.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-3GXX5VD5.js → chunk-V5W6ZTYC.js} +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +17 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +8 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +10 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +12 -40
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +22 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +422 -135
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +6 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +9 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +18 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +7 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +20 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.js +102 -52
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +8 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +9 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +17 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +22 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.js +27 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +444 -226
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.js +42 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.js +28 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +16 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +4 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +12 -9
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +7 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +36 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +36 -22
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +14 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +265 -38
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +19 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.d.ts +0 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.js +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +8 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +27 -15
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +17 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +217 -50
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +2 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +41 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +2 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +53 -82
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.d.ts +12 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.js +133 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.js +76 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.js +74 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.js +19 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.js +90 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.js +60 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +20 -8
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +10 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +14 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.js +2 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +11 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +8 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +138 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
- package/node_modules/iconv-lite/encodings/index.js +23 -0
- package/node_modules/iconv-lite/encodings/internal.js +218 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +180 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +187 -0
- package/node_modules/iconv-lite/encodings/utf32.js +314 -0
- package/node_modules/iconv-lite/encodings/utf7.js +283 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +48 -0
- package/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
- package/node_modules/iconv-lite/lib/index.d.ts +129 -0
- package/node_modules/iconv-lite/lib/index.js +182 -0
- package/node_modules/iconv-lite/lib/streams.js +105 -0
- package/node_modules/iconv-lite/package.json +70 -0
- package/node_modules/iconv-lite/types/encodings.d.ts +425 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/package.json +33 -27
- package/packages/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +43 -1
|
@@ -14,12 +14,15 @@ export interface ImRulesContext {
|
|
|
14
14
|
providerSessionId: string;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
export declare function rulesGuidance(item: ContextItem): string;
|
|
18
|
+
/** 版本游标在应用层保留;执行快照只携带实际规则正文。显式宿主项不改写。 */
|
|
19
|
+
export declare function modelRulesContext(item: ContextItem): ContextItem;
|
|
17
20
|
/** 仅选择 Gateway 自动读取的规则;宿主显式提交的 Context 不参与省略。 */
|
|
18
|
-
export declare function selectRulesContext(context: ContextEnvelope, cursor: ImRulesContext | undefined, provider: ProviderSession | undefined): {
|
|
21
|
+
export declare function selectRulesContext(context: ContextEnvelope, cursor: ImRulesContext | undefined, provider: ProviderSession | undefined, refresh?: boolean): {
|
|
19
22
|
context: ContextEnvelope;
|
|
20
23
|
versions?: ImRulesVersions;
|
|
21
24
|
omitted: ContextItem[];
|
|
22
25
|
};
|
|
23
|
-
/**
|
|
26
|
+
/** 新 Provider 恢复本轮省略的渠道材料(规则、稳定说明和已覆盖历史),保留原 inputs/图片。 */
|
|
24
27
|
export declare function addRulesRecovery(input: ImInvocationInput, rules: ContextItem[]): void;
|
|
25
28
|
export {};
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
export function rulesGuidance(item) {
|
|
2
|
+
const document = item.name === "group-rules" ? "Octo IM Group's GROUP.md" : "Octo IM Group Topic Rules";
|
|
3
|
+
if (item.payload.status === "not_found")
|
|
4
|
+
return `${document} is currently unavailable (not found); previously supplied rules no longer apply.`;
|
|
5
|
+
if (item.payload.status === "empty")
|
|
6
|
+
return `${document} is currently empty; previously supplied rules no longer apply.`;
|
|
7
|
+
return `${document}. These rules replace the previously supplied version.`;
|
|
8
|
+
}
|
|
9
|
+
/** 版本游标在应用层保留;执行快照只携带实际规则正文。显式宿主项不改写。 */
|
|
10
|
+
export function modelRulesContext(item) {
|
|
11
|
+
if (item.namespace !== "extra.im" ||
|
|
12
|
+
!["group-rules", "topic-rules"].includes(item.name) ||
|
|
13
|
+
item.payload.automatic !== true)
|
|
14
|
+
return item;
|
|
15
|
+
return {
|
|
16
|
+
namespace: item.namespace,
|
|
17
|
+
name: item.name,
|
|
18
|
+
guidance: rulesGuidance(item),
|
|
19
|
+
data_format: "text",
|
|
20
|
+
payload: {
|
|
21
|
+
text: typeof item.payload.text === "string" && item.payload.text.trim()
|
|
22
|
+
? item.payload.text
|
|
23
|
+
: "NO RULES"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
1
27
|
/** 仅选择 Gateway 自动读取的规则;宿主显式提交的 Context 不参与省略。 */
|
|
2
|
-
export function selectRulesContext(context, cursor, provider) {
|
|
28
|
+
export function selectRulesContext(context, cursor, provider, refresh = false) {
|
|
3
29
|
const rules = context.items.filter((item) => item.namespace === "extra.im" &&
|
|
4
30
|
["group-rules", "topic-rules"].includes(item.name) &&
|
|
5
31
|
item.payload.automatic === true);
|
|
@@ -14,7 +40,8 @@ export function selectRulesContext(context, cursor, provider) {
|
|
|
14
40
|
const versions = { group: stamp(group), ...(topic ? { topic: stamp(topic) } : {}) };
|
|
15
41
|
const supplied = cursor?.supplied;
|
|
16
42
|
const same = (left, right) => left?.version === right?.version && left?.status === right?.status;
|
|
17
|
-
if (
|
|
43
|
+
if (refresh ||
|
|
44
|
+
!provider?.sessionId ||
|
|
18
45
|
provider.resumable === false ||
|
|
19
46
|
!supplied ||
|
|
20
47
|
supplied.providerSessionId !== provider.sessionId ||
|
|
@@ -27,11 +54,22 @@ export function selectRulesContext(context, cursor, provider) {
|
|
|
27
54
|
omitted: rules
|
|
28
55
|
};
|
|
29
56
|
}
|
|
30
|
-
/**
|
|
57
|
+
/** 新 Provider 恢复本轮省略的渠道材料(规则、稳定说明和已覆盖历史),保留原 inputs/图片。 */
|
|
31
58
|
export function addRulesRecovery(input, rules) {
|
|
32
59
|
if (!rules.length)
|
|
33
60
|
return;
|
|
34
|
-
const text =
|
|
61
|
+
const text = [
|
|
62
|
+
"Current channel context for session recovery:",
|
|
63
|
+
...rules
|
|
64
|
+
.map(modelRulesContext)
|
|
65
|
+
.map((item) => [
|
|
66
|
+
`${item.namespace}/${item.name}`,
|
|
67
|
+
...(item.guidance ? [item.guidance] : []),
|
|
68
|
+
item.data_format === "text"
|
|
69
|
+
? String(item.payload.text)
|
|
70
|
+
: JSON.stringify(item.payload, null, 2)
|
|
71
|
+
].join("\n"))
|
|
72
|
+
].join("\n\n");
|
|
35
73
|
input.freshFallbackModelInputParts = [{ type: "text", text }, ...structuredClone(input.inputs)];
|
|
36
74
|
input.freshFallbackModelInput = input.freshFallbackModelInputParts
|
|
37
75
|
.map((part) => (part.type === "text" ? part.text : "[Image]"))
|
|
@@ -3,22 +3,27 @@ import type { FailureEnvelope, ProviderSession } from "@mininglamp-oss/octo-runt
|
|
|
3
3
|
import type { ImTaskAttempt } from "../contracts.js";
|
|
4
4
|
import type { ImGapMetadata, ImGapTurnToken } from "./context-gap.js";
|
|
5
5
|
import type { ImRulesContext } from "./rules-context.js";
|
|
6
|
+
import type { ImStableContextState } from "./stable-context.js";
|
|
7
|
+
import type { ImArtifactPolicy } from "../delivery/artifact-policy.js";
|
|
6
8
|
export interface ImSessionOccurrence {
|
|
7
9
|
text: string;
|
|
8
10
|
sessionId: string;
|
|
9
11
|
runId: string;
|
|
10
12
|
snapshot?: ImInvocationInput;
|
|
13
|
+
artifacts?: ImArtifactPolicy;
|
|
11
14
|
attempts?: ImTaskAttempt[];
|
|
12
15
|
/** 仅整轮没有已执行或未知尝试时保存;旧记录缺省不推测执行事实。 */
|
|
13
16
|
notSubmittedFailure?: FailureEnvelope;
|
|
14
17
|
}
|
|
15
18
|
export interface ImSessionBinding {
|
|
16
19
|
id?: string;
|
|
20
|
+
sessionName?: string;
|
|
17
21
|
generation: number;
|
|
18
22
|
providerSession?: ProviderSession;
|
|
19
23
|
lastEventId?: string;
|
|
20
24
|
lastRunId?: string;
|
|
21
25
|
initialContextPrepared?: boolean;
|
|
26
|
+
stableContext?: ImStableContextState;
|
|
22
27
|
gap?: ImGapMetadata;
|
|
23
28
|
rulesContext?: ImRulesContext;
|
|
24
29
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContextItem } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
import { type ImArtifactPolicy } from "../delivery/artifact-policy.js";
|
|
3
|
+
export declare const DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS = 30;
|
|
4
|
+
/** 同代次排队共享,binding 只保存快照;待刷新仅在实际携带规则的执行成功后清除。 */
|
|
5
|
+
export interface ImStableContextState {
|
|
6
|
+
turnCount: number;
|
|
7
|
+
refreshPending: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** 只计算下一轮计划;准备失败或同轮重试不能提前推进用户任务轮数。 */
|
|
10
|
+
export declare function planStableContext(state: ImStableContextState, interval?: number): {
|
|
11
|
+
turn: number;
|
|
12
|
+
refresh: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Gateway 自有稳定说明;普通轮省略的内容仅供本次显式新会话恢复,不缓存宿主材料。 */
|
|
15
|
+
export declare function stableChannelContexts(policy: ImArtifactPolicy): ContextItem[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { artifactContext } from "../delivery/artifact-policy.js";
|
|
2
|
+
import { MENTION_GUIDANCE } from "../transport/mentions.js";
|
|
3
|
+
export const DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS = 30;
|
|
4
|
+
/** 只计算下一轮计划;准备失败或同轮重试不能提前推进用户任务轮数。 */
|
|
5
|
+
export function planStableContext(state, interval = DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS) {
|
|
6
|
+
const turn = state.turnCount + 1;
|
|
7
|
+
if (!Number.isSafeInteger(turn) || turn < 1)
|
|
8
|
+
throw new Error("IM_CONTEXT_TURN_LIMIT");
|
|
9
|
+
return { turn, refresh: state.refreshPending || turn === 1 || turn % interval === 0 };
|
|
10
|
+
}
|
|
11
|
+
/** Gateway 自有稳定说明;普通轮省略的内容仅供本次显式新会话恢复,不缓存宿主材料。 */
|
|
12
|
+
export function stableChannelContexts(policy) {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
namespace: "extra.im",
|
|
16
|
+
name: "mention-instructions",
|
|
17
|
+
guidance: MENTION_GUIDANCE,
|
|
18
|
+
payload: { automatic: true }
|
|
19
|
+
},
|
|
20
|
+
artifactContext(policy),
|
|
21
|
+
{
|
|
22
|
+
namespace: "extra.im",
|
|
23
|
+
name: "history-instructions",
|
|
24
|
+
guidance: "Understand the current intent using relevant conversation history, honor the latest relevant corrections, and do not restart past tasks merely because they appear in history.",
|
|
25
|
+
payload: { automatic: true }
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
}
|
|
@@ -5,12 +5,14 @@ import type { ApprovalMode, ContextEnvelope, ContextItem, CanonicalEvent, Intera
|
|
|
5
5
|
import type { RunPresentation } from "./presentation/run-projector.js";
|
|
6
6
|
import type { ImGapPlan, ImGapTurnToken } from "./application/context-gap.js";
|
|
7
7
|
import type { ImArtifactPolicy } from "./delivery/artifact-policy.js";
|
|
8
|
+
import type { ImStableContextState } from "./application/stable-context.js";
|
|
8
9
|
export interface ImPositionObservation {
|
|
9
10
|
conversationId: string;
|
|
10
11
|
conversationKind: "group" | "thread";
|
|
11
12
|
messageSeq: number;
|
|
12
13
|
own?: boolean;
|
|
13
14
|
turn?: ImGapTurnToken;
|
|
15
|
+
outputFingerprint?: string;
|
|
14
16
|
}
|
|
15
17
|
export interface ImAdapterConfig {
|
|
16
18
|
adapter_type?: string;
|
|
@@ -42,6 +44,8 @@ export interface ImCommonConfig {
|
|
|
42
44
|
export interface OctoBotConfig extends ImCommonConfig {
|
|
43
45
|
api_url: string;
|
|
44
46
|
bf_token?: string;
|
|
47
|
+
/** 自动稳定说明的用户任务刷新周期,默认 30;首轮必带,reset/new 后重新计轮。 */
|
|
48
|
+
stable_context_refresh_interval_turns?: number;
|
|
45
49
|
/** .octospec/tasks/channel-group-admission/plan.md:群/话题入口开关,省略为 true,不影响私聊。 */
|
|
46
50
|
groups_enabled?: boolean;
|
|
47
51
|
/** 仅约束群范围;省略、null、[] 均不增加限制,关闭入口使用 groups_enabled=false。 */
|
|
@@ -51,6 +55,7 @@ export interface OctoBotConfig extends ImCommonConfig {
|
|
|
51
55
|
/** 渠道固定产物交付;由宿主配置,模型 Context 不能扩大文件访问范围。 */
|
|
52
56
|
artifact_delivery?: {
|
|
53
57
|
mode?: "channel" | "tools";
|
|
58
|
+
/** 可选的 Gateway 本机产物目录限制;省略不额外限制,空列表拒绝全部,不改变 Agent 工作区。 */
|
|
54
59
|
allowed_roots?: string[];
|
|
55
60
|
allowed_mime_types?: string[];
|
|
56
61
|
max_file_bytes?: number;
|
|
@@ -59,7 +64,7 @@ export interface OctoBotConfig extends ImCommonConfig {
|
|
|
59
64
|
timeout_ms?: number;
|
|
60
65
|
};
|
|
61
66
|
}
|
|
62
|
-
/**
|
|
67
|
+
/** 终态回复的冻结投递合同;成功 final 才准备产物,所有终态都遵守当前交付的取消期限。 */
|
|
63
68
|
export interface ImFinalReplyOptions {
|
|
64
69
|
artifacts: ImArtifactPolicy;
|
|
65
70
|
signal: AbortSignal;
|
|
@@ -77,6 +82,8 @@ export interface ImInboundMessage {
|
|
|
77
82
|
};
|
|
78
83
|
/** 同代次卡片重试:buildContext 返回 Gateway 已组合的冻结快照,不再采集或追加默认项。 */
|
|
79
84
|
historyRetry?: boolean;
|
|
85
|
+
/** 同代次卡片重试复用原投递合同,不从更新后的配置重建文件访问策略。 */
|
|
86
|
+
frozenArtifacts?: ImArtifactPolicy;
|
|
80
87
|
bindHistoryTurn?(token: ImGapTurnToken): void;
|
|
81
88
|
markRead?(signal: AbortSignal): Promise<void>;
|
|
82
89
|
messageId: string;
|
|
@@ -85,14 +92,15 @@ export interface ImInboundMessage {
|
|
|
85
92
|
conversationKind: "direct" | "group" | "thread";
|
|
86
93
|
text: string;
|
|
87
94
|
buildInputs?(signal: AbortSignal): Promise<ModelInputPart[]>;
|
|
88
|
-
|
|
95
|
+
/** 终态提示也携带该轮投递期限;普通控制回复可省略,不进行产物准备。 */
|
|
96
|
+
reply(text: string, effectKey?: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
|
|
89
97
|
replyFinal?(text: string, effectKey: string, options?: ImFinalReplyOptions): Promise<void>;
|
|
90
|
-
replyFailure?(event: CanonicalEvent, effectKey: string): Promise<void>;
|
|
91
|
-
|
|
98
|
+
replyFailure?(event: CanonicalEvent, effectKey: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
|
|
99
|
+
/** 原轮未知通知继承最终投递取消及过期判断,在实际 REST 发送前再次检查。 */
|
|
100
|
+
replyDeliveryUnknown?(event: CanonicalEvent, effectKey: string, replyEffectKey: string, signal: AbortSignal, obsolete?: () => boolean): Promise<void>;
|
|
92
101
|
isReplyDelivered?(effectKey: string): boolean;
|
|
93
102
|
buildContext(signal: AbortSignal, options?: {
|
|
94
103
|
initialSession: boolean;
|
|
95
|
-
mentionGuidance?: boolean;
|
|
96
104
|
configuredItems?: readonly ContextItem[];
|
|
97
105
|
historyGap?: ImGapPlan;
|
|
98
106
|
onHistoryGapPrepared?(plan: ImGapPlan): void;
|
|
@@ -139,6 +147,7 @@ export interface ImAddress {
|
|
|
139
147
|
export type ImConnectionState = "stopped" | "connecting" | "online" | "retrying" | "failed";
|
|
140
148
|
export interface ImSession {
|
|
141
149
|
id?: string;
|
|
150
|
+
sessionName?: string;
|
|
142
151
|
generation: number;
|
|
143
152
|
providerSession?: ProviderSession;
|
|
144
153
|
lastEventId?: string;
|
|
@@ -150,6 +159,8 @@ export interface ImSession {
|
|
|
150
159
|
initialization?: {
|
|
151
160
|
attempted: boolean;
|
|
152
161
|
};
|
|
162
|
+
/** 与初始化资格相同的同代次共享对象,reset 替换而非修改旧轮状态。 */
|
|
163
|
+
stableContext?: ImStableContextState;
|
|
153
164
|
}
|
|
154
165
|
export type DeliveryState = "pending" | "delivered" | "failed" | "unknown";
|
|
155
166
|
export interface ImDeliveryReceipt {
|
|
@@ -3,8 +3,7 @@ import type { OctoBotConfig } from "../contracts.js";
|
|
|
3
3
|
export interface ImArtifactPolicy {
|
|
4
4
|
mode: "channel" | "tools";
|
|
5
5
|
workspace?: string;
|
|
6
|
-
|
|
7
|
-
roots: string[];
|
|
6
|
+
roots?: string[];
|
|
8
7
|
mimeTypes?: string[];
|
|
9
8
|
maxFileBytes: number;
|
|
10
9
|
maxTotalBytes: number;
|
|
@@ -17,7 +16,7 @@ export declare const ARTIFACT_LIMITS: {
|
|
|
17
16
|
readonly max_files: 16;
|
|
18
17
|
readonly timeout_ms: 30000;
|
|
19
18
|
};
|
|
20
|
-
/**
|
|
21
|
-
export declare function artifactPolicy(config: OctoBotConfig, context: ContextEnvelope
|
|
22
|
-
/**
|
|
19
|
+
/** 本地引用均按 Gateway 文件系统尝试读取;仅可信宿主配置可额外限制根目录。 */
|
|
20
|
+
export declare function artifactPolicy(config: OctoBotConfig, context: ContextEnvelope): ImArtifactPolicy;
|
|
21
|
+
/** 默认交付只约定本地引用格式;真实上传策略由代码执行,不以提示词授予访问权限。 */
|
|
23
22
|
export declare function artifactContext(policy: ImArtifactPolicy): ContextItem;
|
|
@@ -4,15 +4,14 @@ export const ARTIFACT_LIMITS = {
|
|
|
4
4
|
max_files: 16,
|
|
5
5
|
timeout_ms: 30_000
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
export function artifactPolicy(config, context
|
|
7
|
+
/** 本地引用均按 Gateway 文件系统尝试读取;仅可信宿主配置可额外限制根目录。 */
|
|
8
|
+
export function artifactPolicy(config, context) {
|
|
9
9
|
const options = config.artifact_delivery;
|
|
10
10
|
const workspace = context.items.find((item) => item.namespace === "octo.execution" && item.name === "workspace")?.payload.path;
|
|
11
11
|
return {
|
|
12
12
|
mode: options?.mode ?? "channel",
|
|
13
13
|
...(typeof workspace === "string" ? { workspace } : {}),
|
|
14
|
-
|
|
15
|
-
roots: [...(options?.allowed_roots ?? (typeof workspace === "string" ? [workspace] : []))],
|
|
14
|
+
...(options?.allowed_roots !== undefined ? { roots: [...options.allowed_roots] } : {}),
|
|
16
15
|
...(options?.allowed_mime_types ? { mimeTypes: [...options.allowed_mime_types] } : {}),
|
|
17
16
|
maxFileBytes: options?.max_file_bytes ?? ARTIFACT_LIMITS.max_file_bytes,
|
|
18
17
|
maxTotalBytes: options?.max_total_bytes ?? ARTIFACT_LIMITS.max_total_bytes,
|
|
@@ -20,19 +19,23 @@ export function artifactPolicy(config, context, local) {
|
|
|
20
19
|
timeoutMs: options?.timeout_ms ?? ARTIFACT_LIMITS.timeout_ms
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
22
|
+
/** 默认交付只约定本地引用格式;真实上传策略由代码执行,不以提示词授予访问权限。 */
|
|
24
23
|
export function artifactContext(policy) {
|
|
25
24
|
return {
|
|
26
25
|
namespace: "extra.im",
|
|
27
26
|
name: "artifact-delivery",
|
|
28
27
|
guidance: policy.mode === "channel"
|
|
29
|
-
? "
|
|
30
|
-
:
|
|
28
|
+
? "If your final deliverable is a local file, reference it using Markdown with an absolute path: [label](/absolute/path); for images, use ."
|
|
29
|
+
: [
|
|
30
|
+
"This channel does not automatically upload output files.",
|
|
31
|
+
"Use normal tool calls when the task requires file delivery and return recipient-accessible URLs.",
|
|
32
|
+
"Do not present runtime-local paths as downloadable attachments.",
|
|
33
|
+
"Do not send a duplicate final reply with a messaging tool."
|
|
34
|
+
].join("\n"),
|
|
31
35
|
payload: {
|
|
32
36
|
mode: policy.mode,
|
|
33
|
-
localWorkspaceAccessible: policy.local,
|
|
34
37
|
...(policy.workspace ? { workspace: policy.workspace } : {}),
|
|
35
|
-
allowedRoots: policy.roots,
|
|
38
|
+
...(policy.roots !== undefined ? { allowedRoots: policy.roots } : {}),
|
|
36
39
|
...(policy.mimeTypes ? { allowedMimeTypes: policy.mimeTypes } : {}),
|
|
37
40
|
maxFileBytes: policy.maxFileBytes,
|
|
38
41
|
maxTotalBytes: policy.maxTotalBytes,
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface ArtifactFile {
|
|
|
10
10
|
export interface PreparedArtifacts {
|
|
11
11
|
text: string;
|
|
12
12
|
files: ArtifactFile[];
|
|
13
|
+
incomplete?: true;
|
|
13
14
|
}
|
|
14
15
|
/** 只交付成功 final 的显式引用;失败不改变生成终态,缓存由 transport 的 final effect 闭包持有。 */
|
|
15
16
|
export declare function prepareArtifacts(text: string, policy: ImArtifactPolicy, ownerSignal: AbortSignal, upload: ArtifactUpload): Promise<PreparedArtifacts>;
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js
CHANGED
|
@@ -186,14 +186,12 @@ export async function prepareArtifacts(text, policy, ownerSignal, upload) {
|
|
|
186
186
|
if (file === undefined)
|
|
187
187
|
continue;
|
|
188
188
|
signal.throwIfAborted();
|
|
189
|
-
if (
|
|
190
|
-
throw new Error("remote-file-unavailable");
|
|
191
|
-
if (!roots)
|
|
189
|
+
if (policy.roots !== undefined && !roots)
|
|
192
190
|
roots = await Promise.all(policy.roots.map((root) => realpath(root)));
|
|
193
191
|
const resolved = await realpath(file).catch(() => {
|
|
194
192
|
throw new Error("file-unavailable");
|
|
195
193
|
});
|
|
196
|
-
if (!roots.some((root) => contained(root, resolved)))
|
|
194
|
+
if (roots && !roots.some((root) => contained(root, resolved)))
|
|
197
195
|
throw new Error("directory-policy");
|
|
198
196
|
let result = files.get(resolved);
|
|
199
197
|
if (!result) {
|
|
@@ -279,5 +277,9 @@ export async function prepareArtifacts(text, policy, ownerSignal, upload) {
|
|
|
279
277
|
output = output.slice(0, edit.start) + edit.url + output.slice(edit.end);
|
|
280
278
|
if (failures.length)
|
|
281
279
|
output += `\n\nAttachment delivery failed: ${failures.join("; ")}. These local references are unavailable to channel recipients; generation was not rerun.`;
|
|
282
|
-
return {
|
|
280
|
+
return {
|
|
281
|
+
text: output,
|
|
282
|
+
files: [...cards.values()],
|
|
283
|
+
...(failures.length ? { incomplete: true } : {})
|
|
284
|
+
};
|
|
283
285
|
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 一次已核验目标身份的投递权限及有界 ACK 账本;更新 token 或重建 WS 不取消。 */
|
|
2
|
+
export declare class ImDeliveryScope {
|
|
3
|
+
#private;
|
|
4
|
+
readonly signal: AbortSignal;
|
|
5
|
+
revoke(): void;
|
|
6
|
+
confirm(key: string): void;
|
|
7
|
+
isConfirmed(key: string): boolean;
|
|
8
|
+
}
|
|
9
|
+
/** 归 Bot 所有;只接受核验成功的身份,不随 current transport 的替换遗忘旧代次失效。 */
|
|
10
|
+
export declare class ImDeliveryIdentity {
|
|
11
|
+
#private;
|
|
12
|
+
/** 明确拒绝目标身份/空间后关闭旧代次;后续恢复到相同身份也不能复活旧投递。 */
|
|
13
|
+
revoke(): void;
|
|
14
|
+
accept(identity: string): ImDeliveryScope;
|
|
15
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ImSendError } from "./text-send.js";
|
|
2
|
+
/** 一次已核验目标身份的投递权限及有界 ACK 账本;更新 token 或重建 WS 不取消。 */
|
|
3
|
+
export class ImDeliveryScope {
|
|
4
|
+
#abort = new AbortController();
|
|
5
|
+
#confirmed = new Set();
|
|
6
|
+
signal = this.#abort.signal;
|
|
7
|
+
revoke() {
|
|
8
|
+
this.#abort.abort(new ImSendError("IM_CONNECTION_IDENTITY_CHANGED", "failed"));
|
|
9
|
+
}
|
|
10
|
+
confirm(key) {
|
|
11
|
+
if (this.signal.aborted)
|
|
12
|
+
return;
|
|
13
|
+
this.#confirmed.add(key);
|
|
14
|
+
if (this.#confirmed.size > 512)
|
|
15
|
+
this.#confirmed.delete(this.#confirmed.values().next().value);
|
|
16
|
+
}
|
|
17
|
+
isConfirmed(key) {
|
|
18
|
+
return this.#confirmed.has(key);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** 归 Bot 所有;只接受核验成功的身份,不随 current transport 的替换遗忘旧代次失效。 */
|
|
22
|
+
export class ImDeliveryIdentity {
|
|
23
|
+
#current;
|
|
24
|
+
/** 明确拒绝目标身份/空间后关闭旧代次;后续恢复到相同身份也不能复活旧投递。 */
|
|
25
|
+
revoke() {
|
|
26
|
+
this.#current?.scope.revoke();
|
|
27
|
+
this.#current = undefined;
|
|
28
|
+
}
|
|
29
|
+
accept(identity) {
|
|
30
|
+
if (this.#current?.identity !== identity) {
|
|
31
|
+
this.#current?.scope.revoke();
|
|
32
|
+
this.#current = { identity, scope: new ImDeliveryScope() };
|
|
33
|
+
}
|
|
34
|
+
return this.#current.scope;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export declare class ProgressScheduler<T> {
|
|
|
10
10
|
constructor(send: (value: T) => Promise<void>, onError: () => void, intervalMs?: number);
|
|
11
11
|
enqueue(value: T, terminal?: boolean): void;
|
|
12
12
|
flush(): Promise<void>;
|
|
13
|
+
/** 所有者收尾时丢弃未发送进度并解除 timer;在途发送仍沿原 finally 完成,不伪报排空。 */
|
|
14
|
+
dispose(): void;
|
|
13
15
|
get terminal(): boolean;
|
|
14
16
|
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js
CHANGED
|
@@ -82,6 +82,16 @@ export class ProgressScheduler {
|
|
|
82
82
|
this.#schedule();
|
|
83
83
|
await done;
|
|
84
84
|
}
|
|
85
|
+
/** 所有者收尾时丢弃未发送进度并解除 timer;在途发送仍沿原 finally 完成,不伪报排空。 */
|
|
86
|
+
dispose() {
|
|
87
|
+
this.#terminal = true;
|
|
88
|
+
this.#pending = undefined;
|
|
89
|
+
clearTimeout(this.#timer);
|
|
90
|
+
this.#timer = undefined;
|
|
91
|
+
if (!this.#running)
|
|
92
|
+
for (const resolve of this.#waiters.splice(0))
|
|
93
|
+
resolve();
|
|
94
|
+
}
|
|
85
95
|
get terminal() {
|
|
86
96
|
return this.#terminal;
|
|
87
97
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ContextEnvelope, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
1
|
+
import { type ContextEnvelope, type ContextItem, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
2
|
import type { ImBotConfig, ImInboundMessage, ImSession } from "../contracts.js";
|
|
3
3
|
import type { ImArtifactPolicy } from "../delivery/artifact-policy.js";
|
|
4
4
|
export type ImInvocationInput = InvokeInput & {
|
|
@@ -7,8 +7,11 @@ export type ImInvocationInput = InvokeInput & {
|
|
|
7
7
|
sessionId: string;
|
|
8
8
|
protocol_mode: "canonical";
|
|
9
9
|
};
|
|
10
|
-
export declare function createImInvocation(config: ImBotConfig, message: ImInboundMessage, context: ContextEnvelope, sessionKey: string, session: ImSession, _signal: AbortSignal, occurrenceId?: string): {
|
|
10
|
+
export declare function createImInvocation(config: ImBotConfig, message: ImInboundMessage, context: ContextEnvelope, sessionKey: string, session: ImSession, _signal: AbortSignal, occurrenceId?: string, refreshStableContext?: boolean): {
|
|
11
11
|
request: ImInvocationInput;
|
|
12
12
|
adapterType: string;
|
|
13
13
|
artifacts: ImArtifactPolicy;
|
|
14
|
+
recoveryContexts: ContextItem[];
|
|
15
|
+
stableContextIncluded: boolean;
|
|
16
|
+
historyContext?: ContextItem;
|
|
14
17
|
};
|
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;
|