@jsonstudio/llms 0.6.2979 → 0.6.3214
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/dist/conversion/args-mapping.js +8 -0
- package/dist/conversion/{shared/bridge-actions.js → bridge-actions.js} +2 -1
- package/dist/conversion/{shared/bridge-id-utils.js → bridge-id-utils.js} +1 -1
- package/dist/conversion/{shared/bridge-instructions.js → bridge-instructions.js} +1 -1
- package/dist/conversion/{shared/bridge-message-utils.d.ts → bridge-message-utils.d.ts} +1 -1
- package/dist/conversion/{shared/bridge-message-utils.js → bridge-message-utils.js} +5 -149
- package/dist/conversion/{shared/bridge-metadata.js → bridge-metadata.js} +1 -1
- package/dist/conversion/{shared/bridge-policies.js → bridge-policies.js} +1 -1
- package/dist/conversion/codecs/gemini-openai-codec.js +27 -8
- package/dist/conversion/codecs/responses-openai-codec.js +1 -1
- package/dist/conversion/{shared/compaction-detect.d.ts → compaction-detect.d.ts} +1 -1
- package/dist/conversion/compaction-detect.js +4 -0
- package/dist/conversion/compat/actions/apply-patch-fixer.js +2 -2
- package/dist/conversion/compat/actions/deepseek-web-response.d.ts +0 -1
- package/dist/conversion/compat/actions/deepseek-web-response.js +15 -405
- package/dist/conversion/compat/actions/harvest-tool-calls-from-text.js +1 -1
- package/dist/conversion/compat/actions/lmstudio-responses-fc-ids.js +1 -1
- package/dist/conversion/compat/actions/qwen-transform.js +74 -2
- package/dist/conversion/compat/actions/snapshot.js +1 -1
- package/dist/conversion/compat/antigravity-session-signature.js +36 -0
- package/dist/conversion/compat/profiles/chat-deepseek-web.json +0 -22
- package/dist/conversion/compat/profiles/chat-glm.json +251 -72
- package/dist/conversion/compat/profiles/chat-iflow.json +174 -39
- package/dist/conversion/compat/profiles/chat-lmstudio.json +43 -14
- package/dist/conversion/hub/operation-table/operation-table-runner.js +2 -2
- package/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +1 -1
- package/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.js +7 -4
- package/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.js +2 -2
- package/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +2 -8
- package/dist/conversion/hub/pipeline/hub-pipeline.d.ts +1 -0
- package/dist/conversion/hub/pipeline/hub-pipeline.js +50 -3
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.d.ts +1 -1
- package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +62 -0
- package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.js +3 -1
- package/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.js +1 -1
- package/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.d.ts +1 -1
- package/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +42 -29
- package/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.js +12 -0
- package/dist/conversion/hub/policy/protocol-spec.js +1 -1
- package/dist/conversion/hub/process/chat-process-clock-reminders.js +1 -1
- package/dist/conversion/hub/process/chat-process-clock-tools.js +1 -1
- package/dist/conversion/hub/process/chat-process-continue-execution.js +1 -1
- package/dist/conversion/hub/process/chat-process-servertool-orchestration.js +1 -1
- package/dist/conversion/hub/process/chat-process-web-search.js +1 -1
- package/dist/conversion/hub/response/provider-response.js +14 -5
- package/dist/conversion/hub/response/response-mappers.js +23 -1
- package/dist/conversion/hub/response/response-runtime.js +28 -5
- package/dist/conversion/hub/snapshot-recorder.js +1 -1
- package/dist/conversion/hub/tool-governance/engine.d.ts +8 -0
- package/dist/conversion/hub/tool-governance/engine.js +25 -68
- package/dist/conversion/hub/tool-governance/rules.js +73 -69
- package/dist/conversion/hub/tool-surface/tool-surface-engine.js +1 -1
- package/dist/conversion/index.d.ts +1 -2
- package/dist/conversion/index.js +1 -2
- package/dist/conversion/{shared/jsonish.js → jsonish.js} +1 -1
- package/dist/conversion/{shared/mcp-injection.js → mcp-injection.js} +1 -1
- package/dist/conversion/media.js +4 -0
- package/dist/conversion/{shared/metadata-passthrough.d.ts → metadata-passthrough.d.ts} +1 -1
- package/dist/conversion/{shared/metadata-passthrough.js → metadata-passthrough.js} +2 -2
- package/dist/conversion/payload-budget.js +47 -0
- package/dist/conversion/protocol-field-allowlists.d.ts +7 -0
- package/dist/conversion/protocol-field-allowlists.js +9 -0
- package/dist/conversion/{shared/protocol-state.d.ts → protocol-state.d.ts} +2 -2
- package/dist/conversion/{shared/protocol-state.js → protocol-state.js} +2 -2
- package/dist/conversion/{shared/errors.d.ts → provider-protocol-error.d.ts} +0 -3
- package/dist/conversion/provider-protocol-error.js +25 -0
- package/dist/conversion/responses/responses-openai-bridge/response-payload.js +8 -5
- package/dist/conversion/responses/responses-openai-bridge/types.d.ts +1 -1
- package/dist/conversion/responses/responses-openai-bridge.d.ts +1 -1
- package/dist/conversion/responses/responses-openai-bridge.js +43 -10
- package/dist/conversion/{shared/runtime-metadata.d.ts → runtime-metadata.d.ts} +1 -1
- package/dist/conversion/{shared/runtime-metadata.js → runtime-metadata.js} +2 -2
- package/dist/conversion/shared/anthropic-message-utils.js +19 -8
- package/dist/conversion/shared/chat-request-filters.d.ts +3 -4
- package/dist/conversion/shared/chat-request-filters.js +22 -78
- package/dist/conversion/shared/gemini-tool-utils.d.ts +1 -1
- package/dist/conversion/shared/openai-finalizer.js +1 -0
- package/dist/conversion/shared/openai-message-normalize.js +2 -2
- package/dist/conversion/shared/reasoning-normalizer.js +6 -0
- package/dist/conversion/shared/reasoning-utils.js +5 -2
- package/dist/conversion/shared/responses-conversation-store.js +1 -1
- package/dist/conversion/shared/responses-output-builder.js +55 -11
- package/dist/conversion/shared/responses-reasoning-registry.d.ts +14 -2
- package/dist/conversion/shared/responses-reasoning-registry.js +34 -6
- package/dist/conversion/shared/responses-response-utils.js +99 -9
- package/dist/conversion/shared/responses-tool-utils.js +1 -1
- package/dist/conversion/shared/text-markup-normalizer/normalize.d.ts +1 -1
- package/dist/conversion/shared/text-markup-normalizer.d.ts +2 -2
- package/dist/conversion/shared/text-markup-normalizer.js +1 -1
- package/dist/conversion/shared/tool-filter-pipeline.js +1 -1
- package/dist/conversion/shared/tool-governor.js +3 -3
- package/dist/conversion/shared/tool-mapping.d.ts +1 -1
- package/dist/conversion/{shared/snapshot-utils.d.ts → snapshot-utils.d.ts} +11 -0
- package/dist/conversion/{shared/snapshot-utils.js → snapshot-utils.js} +14 -23
- package/dist/conversion/types/text-markup-normalizer.d.ts +13 -0
- package/dist/conversion/types/text-markup-normalizer.js +1 -0
- package/dist/filters/special/request-tools-normalize.js +1 -1
- package/dist/filters/special/response-tool-text-canonicalize.js +2 -2
- package/dist/native/router_hotpath_napi.node +0 -0
- package/dist/quota/quota-manager.js +31 -59
- package/dist/quota/quota-state.js +14 -7
- package/dist/router/virtual-router/bootstrap/profile-builder.d.ts +1 -0
- package/dist/router/virtual-router/bootstrap/profile-builder.js +13 -0
- package/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +2 -0
- package/dist/router/virtual-router/bootstrap/provider-normalization.js +4 -1
- package/dist/router/virtual-router/bootstrap/streaming-helpers.d.ts +7 -0
- package/dist/router/virtual-router/bootstrap/streaming-helpers.js +44 -0
- package/dist/router/virtual-router/bootstrap.js +2 -0
- package/dist/router/virtual-router/engine/routing-state/store.d.ts +1 -2
- package/dist/router/virtual-router/engine/routing-state/store.js +2 -2
- package/dist/router/virtual-router/engine-legacy/config.d.ts +11 -0
- package/dist/router/virtual-router/engine-legacy/config.js +108 -0
- package/dist/router/virtual-router/engine-legacy/direct-model.d.ts +10 -0
- package/dist/router/virtual-router/engine-legacy/direct-model.js +38 -0
- package/dist/router/virtual-router/engine-legacy/health.d.ts +13 -0
- package/dist/router/virtual-router/engine-legacy/health.js +104 -0
- package/dist/router/virtual-router/engine-legacy/helpers.d.ts +16 -0
- package/dist/router/virtual-router/engine-legacy/helpers.js +226 -0
- package/dist/router/virtual-router/engine-legacy/route-finalize.d.ts +9 -0
- package/dist/router/virtual-router/engine-legacy/route-finalize.js +84 -0
- package/dist/router/virtual-router/engine-legacy/route-selection.d.ts +17 -0
- package/dist/router/virtual-router/engine-legacy/route-selection.js +205 -0
- package/dist/router/virtual-router/engine-legacy/route-state-allowlist.d.ts +3 -0
- package/dist/router/virtual-router/engine-legacy/route-state-allowlist.js +36 -0
- package/dist/router/virtual-router/engine-legacy/route-state.d.ts +12 -0
- package/dist/router/virtual-router/engine-legacy/route-state.js +386 -0
- package/dist/router/virtual-router/engine-legacy/route-utils.d.ts +19 -0
- package/dist/router/virtual-router/engine-legacy/route-utils.js +212 -0
- package/dist/router/virtual-router/engine-legacy/routing.d.ts +8 -0
- package/dist/router/virtual-router/engine-legacy/routing.js +8 -0
- package/dist/router/virtual-router/engine-legacy/selection-core.d.ts +28 -0
- package/dist/router/virtual-router/engine-legacy/selection-core.js +112 -0
- package/dist/router/virtual-router/engine-legacy/selection-state.d.ts +16 -0
- package/dist/router/virtual-router/engine-legacy/selection-state.js +187 -0
- package/dist/router/virtual-router/engine-legacy/state-accessors.d.ts +21 -0
- package/dist/router/virtual-router/engine-legacy/state-accessors.js +118 -0
- package/dist/router/virtual-router/engine-legacy.d.ts +123 -0
- package/dist/router/virtual-router/engine-legacy.js +194 -0
- package/dist/router/virtual-router/engine-logging.d.ts +2 -0
- package/dist/router/virtual-router/engine-logging.js +7 -2
- package/dist/router/virtual-router/engine-selection/key-parsing.js +0 -3
- package/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.d.ts +1 -0
- package/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.js +54 -0
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.d.ts +10 -0
- package/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.js +67 -0
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.d.ts +22 -0
- package/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.js +154 -0
- package/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +38 -2
- package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +75 -0
- package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +205 -0
- package/dist/router/virtual-router/engine-selection/native-snapshot-hooks.d.ts +2 -0
- package/dist/router/virtual-router/engine-selection/native-snapshot-hooks.js +69 -0
- package/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.d.ts +16 -0
- package/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.js +14 -0
- package/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.d.ts +2 -0
- package/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.js +86 -0
- package/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.js +100 -0
- package/dist/router/virtual-router/engine-selection/tier-selection-select.js +99 -0
- package/dist/router/virtual-router/engine.d.ts +22 -105
- package/dist/router/virtual-router/engine.js +274 -1641
- package/dist/router/virtual-router/load-balancer.d.ts +8 -0
- package/dist/router/virtual-router/load-balancer.js +65 -2
- package/dist/router/virtual-router/provider-registry.js +2 -0
- package/dist/router/virtual-router/routing-instructions/clean.d.ts +3 -0
- package/dist/router/virtual-router/routing-instructions/clean.js +34 -0
- package/dist/router/virtual-router/routing-instructions/parse.d.ts +18 -0
- package/dist/router/virtual-router/routing-instructions/parse.js +377 -0
- package/dist/router/virtual-router/routing-instructions/state.d.ts +4 -0
- package/dist/router/virtual-router/routing-instructions/state.js +245 -0
- package/dist/router/virtual-router/routing-instructions/types.d.ts +70 -0
- package/dist/router/virtual-router/routing-instructions/types.js +2 -0
- package/dist/router/virtual-router/routing-instructions.d.ts +5 -89
- package/dist/router/virtual-router/routing-instructions.js +4 -655
- package/dist/router/virtual-router/sticky-session-store.d.ts +4 -0
- package/dist/router/virtual-router/sticky-session-store.js +19 -81
- package/dist/router/virtual-router/tool-signals.js +21 -3
- package/dist/router/virtual-router/types.d.ts +4 -0
- package/dist/servertool/clock/session-scope.js +32 -1
- package/dist/servertool/engine.js +79 -8
- package/dist/servertool/handlers/antigravity-thought-signature-bootstrap.js +1 -1
- package/dist/servertool/handlers/clock-auto.js +1 -1
- package/dist/servertool/handlers/clock.js +1 -1
- package/dist/servertool/handlers/compaction-detect.d.ts +1 -1
- package/dist/servertool/handlers/compaction-detect.js +1 -1
- package/dist/servertool/handlers/gemini-empty-reply-continue.js +1 -1
- package/dist/servertool/handlers/iflow-model-error-retry.js +1 -1
- package/dist/servertool/handlers/recursive-detection-guard.js +1 -1
- package/dist/servertool/handlers/review.js +1 -1
- package/dist/servertool/handlers/stop-message-auto/iflow-followup.js +1 -1
- package/dist/servertool/handlers/stop-message-auto/runtime-utils.js +1 -1
- package/dist/servertool/handlers/stop-message-auto.js +1 -1
- package/dist/servertool/handlers/vision.js +1 -1
- package/dist/servertool/handlers/web-search.js +1 -1
- package/dist/servertool/reenter-backend.js +1 -1
- package/dist/servertool/server-side-tools.js +2 -2
- package/dist/servertool/stop-gateway-context.js +1 -1
- package/dist/servertool/stop-message-compare-context.js +1 -1
- package/dist/sse/json-to-sse/event-generators/responses.d.ts +4 -0
- package/dist/sse/json-to-sse/event-generators/responses.js +95 -1
- package/dist/sse/json-to-sse/sequencers/responses-sequencer.js +6 -4
- package/dist/sse/sse-to-json/builders/response-builder.d.ts +8 -0
- package/dist/sse/sse-to-json/builders/response-builder.js +162 -4
- package/dist/sse/sse-to-json/responses-sse-to-json-converter.js +2 -0
- package/dist/sse/types/responses-types.d.ts +6 -2
- package/dist/tools/apply-patch/structured/coercion.js +5 -0
- package/dist/tools/args-json.js +29 -0
- package/package.json +8 -5
- package/dist/conversion/shared/args-mapping.js +0 -77
- package/dist/conversion/shared/compaction-detect.js +0 -4
- package/dist/conversion/shared/errors.js +0 -31
- package/dist/conversion/shared/media.js +0 -4
- package/dist/conversion/shared/payload-budget.js +0 -165
- package/dist/conversion/shared/protocol-field-allowlists.d.ts +0 -7
- package/dist/conversion/shared/protocol-field-allowlists.js +0 -149
- package/dist/conversion/shared/snapshot-hooks.d.ts +0 -11
- package/dist/conversion/shared/snapshot-hooks.js +0 -503
- package/dist/conversion/shared/text-markup-normalizer/extractors-apply-patch.d.ts +0 -2
- package/dist/conversion/shared/text-markup-normalizer/extractors-apply-patch.js +0 -129
- package/dist/conversion/shared/text-markup-normalizer/extractors-json.d.ts +0 -4
- package/dist/conversion/shared/text-markup-normalizer/extractors-json.js +0 -637
- package/dist/conversion/shared/text-markup-normalizer/extractors-shared.d.ts +0 -21
- package/dist/conversion/shared/text-markup-normalizer/extractors-shared.js +0 -177
- package/dist/conversion/shared/text-markup-normalizer/extractors-transcript.d.ts +0 -5
- package/dist/conversion/shared/text-markup-normalizer/extractors-transcript.js +0 -385
- package/dist/conversion/shared/text-markup-normalizer/extractors-xml.d.ts +0 -10
- package/dist/conversion/shared/text-markup-normalizer/extractors-xml.js +0 -602
- package/dist/conversion/shared/text-markup-normalizer/extractors.d.ts +0 -5
- package/dist/conversion/shared/text-markup-normalizer/extractors.js +0 -4
- package/dist/conversion/shared/tool-canonicalizer.d.ts +0 -2
- package/dist/conversion/shared/tool-canonicalizer.js +0 -38
- /package/dist/conversion/{shared/args-mapping.d.ts → args-mapping.d.ts} +0 -0
- /package/dist/conversion/{shared/bridge-actions.d.ts → bridge-actions.d.ts} +0 -0
- /package/dist/conversion/{shared/bridge-id-utils.d.ts → bridge-id-utils.d.ts} +0 -0
- /package/dist/conversion/{shared/bridge-instructions.d.ts → bridge-instructions.d.ts} +0 -0
- /package/dist/conversion/{shared/bridge-metadata.d.ts → bridge-metadata.d.ts} +0 -0
- /package/dist/conversion/{shared/bridge-policies.d.ts → bridge-policies.d.ts} +0 -0
- /package/dist/conversion/{shared/jsonish.d.ts → jsonish.d.ts} +0 -0
- /package/dist/conversion/{shared/mcp-injection.d.ts → mcp-injection.d.ts} +0 -0
- /package/dist/conversion/{shared/media.d.ts → media.d.ts} +0 -0
- /package/dist/conversion/{shared/payload-budget.d.ts → payload-budget.d.ts} +0 -0
- /package/dist/conversion/{shared → types}/bridge-message-types.d.ts +0 -0
- /package/dist/conversion/{shared → types}/bridge-message-types.js +0 -0
|
@@ -3,6 +3,14 @@ import * as path from 'node:path';
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import { serializeRoutingInstructionState, deserializeRoutingInstructionState } from './routing-instructions.js';
|
|
5
5
|
const pendingWrites = new Map();
|
|
6
|
+
export class StickySessionKeyMissingError extends Error {
|
|
7
|
+
key;
|
|
8
|
+
constructor(key, message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.key = key;
|
|
11
|
+
this.name = 'StickySessionKeyMissingError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
6
14
|
function isPersistentKey(key) {
|
|
7
15
|
if (!key)
|
|
8
16
|
return false;
|
|
@@ -93,91 +101,13 @@ function resolveSessionFilepaths(key) {
|
|
|
93
101
|
if (!dir || !filename) {
|
|
94
102
|
return [];
|
|
95
103
|
}
|
|
96
|
-
|
|
97
|
-
const fallbackDir = resolveSessionFallbackDir(dir);
|
|
98
|
-
if (fallbackDir) {
|
|
99
|
-
const fallbackPath = path.join(fallbackDir, filename);
|
|
100
|
-
if (!filepaths.includes(fallbackPath)) {
|
|
101
|
-
filepaths.push(fallbackPath);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return filepaths;
|
|
104
|
+
return [path.join(dir, filename)];
|
|
105
105
|
}
|
|
106
106
|
function resolveSessionLoadFilepaths(key) {
|
|
107
107
|
if (!isPersistentKey(key)) {
|
|
108
108
|
return [];
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
if (filepaths.length === 0) {
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
const dir = resolveSessionDir();
|
|
115
|
-
const filename = keyToFilename(key);
|
|
116
|
-
if (!dir || !filename) {
|
|
117
|
-
return filepaths;
|
|
118
|
-
}
|
|
119
|
-
const legacyFallbacks = resolveLegacyServerScopedFilepaths(dir, filename);
|
|
120
|
-
for (const candidate of legacyFallbacks) {
|
|
121
|
-
if (!filepaths.includes(candidate)) {
|
|
122
|
-
filepaths.push(candidate);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return filepaths;
|
|
126
|
-
}
|
|
127
|
-
function resolveLegacyServerScopedFilepaths(primaryDir, filename) {
|
|
128
|
-
try {
|
|
129
|
-
const normalizedPrimary = path.resolve(primaryDir);
|
|
130
|
-
const searchRoot = resolveSessionSearchRoot(normalizedPrimary);
|
|
131
|
-
if (!searchRoot) {
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
const currentDirName = path.dirname(normalizedPrimary) === searchRoot ? path.basename(normalizedPrimary) : '';
|
|
135
|
-
const entries = fs.readdirSync(searchRoot, { withFileTypes: true });
|
|
136
|
-
const candidates = [];
|
|
137
|
-
for (const entry of entries) {
|
|
138
|
-
if (!entry.isDirectory()) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (currentDirName && entry.name === currentDirName) {
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
const candidatePath = path.join(searchRoot, entry.name, filename);
|
|
145
|
-
try {
|
|
146
|
-
const stat = fs.statSync(candidatePath);
|
|
147
|
-
if (!stat.isFile()) {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
candidates.push({
|
|
151
|
-
filepath: candidatePath,
|
|
152
|
-
mtimeMs: Number.isFinite(stat.mtimeMs) ? stat.mtimeMs : 0
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
// ignore missing legacy files
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
candidates.sort((left, right) => right.mtimeMs - left.mtimeMs);
|
|
160
|
-
return candidates.map((entry) => entry.filepath);
|
|
161
|
-
}
|
|
162
|
-
catch {
|
|
163
|
-
return [];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function resolveSessionSearchRoot(sessionDir) {
|
|
167
|
-
try {
|
|
168
|
-
const normalized = path.resolve(sessionDir);
|
|
169
|
-
if (path.basename(normalized) === 'sessions') {
|
|
170
|
-
return normalized;
|
|
171
|
-
}
|
|
172
|
-
const parent = path.dirname(normalized);
|
|
173
|
-
if (path.basename(parent) === 'sessions') {
|
|
174
|
-
return parent;
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
catch {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
110
|
+
return resolveSessionFilepaths(key);
|
|
181
111
|
}
|
|
182
112
|
function readPersistedStateFromFile(filepath) {
|
|
183
113
|
try {
|
|
@@ -221,9 +151,14 @@ function readPersistedStateFromFile(filepath) {
|
|
|
221
151
|
}
|
|
222
152
|
}
|
|
223
153
|
export function loadRoutingInstructionStateSync(key) {
|
|
154
|
+
if (!isPersistentKey(key)) {
|
|
155
|
+
const error = new StickySessionKeyMissingError(key, 'Sticky session key missing or invalid; failing fast per no-fallback policy');
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
224
158
|
const filepaths = resolveSessionLoadFilepaths(key);
|
|
225
159
|
if (filepaths.length === 0) {
|
|
226
|
-
|
|
160
|
+
const error = new StickySessionKeyMissingError(key, 'Unable to resolve session file path for sticky key; failing fast per no-fallback policy');
|
|
161
|
+
throw error;
|
|
227
162
|
}
|
|
228
163
|
const writeTargets = resolveSessionFilepaths(key);
|
|
229
164
|
for (const filepath of filepaths) {
|
|
@@ -280,6 +215,9 @@ export function saveRoutingInstructionStateAsync(key, state) {
|
|
|
280
215
|
}
|
|
281
216
|
}
|
|
282
217
|
export function saveRoutingInstructionStateSync(key, state) {
|
|
218
|
+
if (!isPersistentKey(key)) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
283
221
|
const filepaths = resolveSessionFilepaths(key);
|
|
284
222
|
if (filepaths.length === 0) {
|
|
285
223
|
return;
|
|
@@ -33,7 +33,10 @@ const SEARCH_TOOL_EXACT = new Set([
|
|
|
33
33
|
'glob_search',
|
|
34
34
|
'grep_files',
|
|
35
35
|
'code_search',
|
|
36
|
-
'lookup_symbol'
|
|
36
|
+
'lookup_symbol',
|
|
37
|
+
'list_files',
|
|
38
|
+
'list_directory',
|
|
39
|
+
'list_dir'
|
|
37
40
|
]);
|
|
38
41
|
const READ_TOOL_KEYWORDS = ['read', 'view', 'download', 'open', 'show', 'fetch', 'inspect'];
|
|
39
42
|
const WRITE_TOOL_KEYWORDS = ['write', 'patch', 'modify', 'edit', 'create', 'update', 'append', 'replace', 'save'];
|
|
@@ -54,7 +57,12 @@ const SHELL_SEARCH_COMMANDS = new Set([
|
|
|
54
57
|
'find',
|
|
55
58
|
'fd',
|
|
56
59
|
'locate',
|
|
57
|
-
'codesearch'
|
|
60
|
+
'codesearch',
|
|
61
|
+
'ls',
|
|
62
|
+
'dir',
|
|
63
|
+
'tree',
|
|
64
|
+
'eza',
|
|
65
|
+
'exa'
|
|
58
66
|
]);
|
|
59
67
|
const SHELL_REDIRECT_WRITE_BINARIES = new Set(['cat', 'printf', 'python', 'node', 'perl', 'ruby', 'php', 'bash', 'sh', 'zsh', 'echo']);
|
|
60
68
|
const SHELL_WRAPPER_COMMANDS = new Set(['sudo', 'env', 'time', 'nice', 'nohup', 'command', 'stdbuf']);
|
|
@@ -356,7 +364,8 @@ function buildCommandSnippet(commandText) {
|
|
|
356
364
|
function categorizeToolName(name) {
|
|
357
365
|
const normalized = name.toLowerCase();
|
|
358
366
|
if (SEARCH_TOOL_EXACT.has(normalized) ||
|
|
359
|
-
SEARCH_TOOL_KEYWORDS.some((keyword) => normalized.includes(keyword.toLowerCase()))
|
|
367
|
+
SEARCH_TOOL_KEYWORDS.some((keyword) => normalized.includes(keyword.toLowerCase())) ||
|
|
368
|
+
isListToolName(normalized)) {
|
|
360
369
|
return 'search';
|
|
361
370
|
}
|
|
362
371
|
if (READ_TOOL_EXACT.has(normalized)) {
|
|
@@ -367,6 +376,15 @@ function categorizeToolName(name) {
|
|
|
367
376
|
}
|
|
368
377
|
return 'other';
|
|
369
378
|
}
|
|
379
|
+
function isListToolName(normalized) {
|
|
380
|
+
if (!normalized) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
if (normalized === 'list') {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
return normalized.startsWith('list_') || normalized.startsWith('list-');
|
|
387
|
+
}
|
|
370
388
|
function classifyShellCommand(command) {
|
|
371
389
|
if (!command) {
|
|
372
390
|
return 'other';
|
|
@@ -60,6 +60,7 @@ export interface ProviderProfile {
|
|
|
60
60
|
processMode?: 'chat' | 'passthrough';
|
|
61
61
|
responsesConfig?: ResponsesProviderConfig;
|
|
62
62
|
streaming?: StreamingPreference;
|
|
63
|
+
maxOutputTokens?: number;
|
|
63
64
|
maxContextTokens?: number;
|
|
64
65
|
deepseek?: DeepSeekCompatRuntimeOptions;
|
|
65
66
|
/**
|
|
@@ -85,6 +86,8 @@ export interface ProviderRuntimeProfile {
|
|
|
85
86
|
responsesConfig?: ResponsesProviderConfig;
|
|
86
87
|
streaming?: StreamingPreference;
|
|
87
88
|
modelStreaming?: Record<string, StreamingPreference>;
|
|
89
|
+
modelOutputTokens?: Record<string, number>;
|
|
90
|
+
defaultOutputTokens?: number;
|
|
88
91
|
modelContextTokens?: Record<string, number>;
|
|
89
92
|
defaultContextTokens?: number;
|
|
90
93
|
maxContextTokens?: number;
|
|
@@ -432,6 +435,7 @@ export interface TargetMetadata {
|
|
|
432
435
|
processMode?: 'chat' | 'passthrough';
|
|
433
436
|
responsesConfig?: ResponsesProviderConfig;
|
|
434
437
|
streaming?: StreamingPreference;
|
|
438
|
+
maxOutputTokens?: number;
|
|
435
439
|
maxContextTokens?: number;
|
|
436
440
|
deepseek?: DeepSeekCompatRuntimeOptions;
|
|
437
441
|
/**
|
|
@@ -5,6 +5,37 @@ export function buildClockSessionScopeFromDaemonId(_daemonId) {
|
|
|
5
5
|
export function extractClockDaemonIdFromSessionScope(_sessionScope) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
+
function readToken(value) {
|
|
9
|
+
if (typeof value !== 'string') {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const trimmed = value.trim();
|
|
13
|
+
return trimmed ? trimmed : null;
|
|
14
|
+
}
|
|
15
|
+
function readTmuxSessionId(record) {
|
|
16
|
+
if (!record || typeof record !== 'object') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (readToken(record.tmuxSessionId) ||
|
|
20
|
+
readToken(record.tmux_session_id) ||
|
|
21
|
+
readToken(record.clientTmuxSessionId) ||
|
|
22
|
+
readToken(record.client_tmux_session_id));
|
|
23
|
+
}
|
|
24
|
+
function readSessionId(record) {
|
|
25
|
+
if (!record || typeof record !== 'object') {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return readToken(record.sessionId) || readToken(record.session_id) || readToken(record.conversationId) || readToken(record.conversation_id);
|
|
29
|
+
}
|
|
8
30
|
export function resolveClockSessionScope(primary, fallback) {
|
|
9
|
-
|
|
31
|
+
const native = resolveClockSessionScopeWithNative(primary, fallback);
|
|
32
|
+
if (native && native.trim()) {
|
|
33
|
+
return native;
|
|
34
|
+
}
|
|
35
|
+
const tmuxSessionId = readTmuxSessionId(primary) || readTmuxSessionId(fallback);
|
|
36
|
+
if (tmuxSessionId) {
|
|
37
|
+
return `tmux:${tmuxSessionId}`;
|
|
38
|
+
}
|
|
39
|
+
const sessionId = readSessionId(primary) || readSessionId(fallback);
|
|
40
|
+
return sessionId || null;
|
|
10
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { runServerSideToolEngine } from './server-side-tools.js';
|
|
2
|
-
import { ProviderProtocolError } from '../conversion/
|
|
3
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/
|
|
2
|
+
import { ProviderProtocolError } from '../conversion/provider-protocol-error.js';
|
|
3
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { loadRoutingInstructionStateSync, saveRoutingInstructionStateSync } from '../router/virtual-router/sticky-session-store.js';
|
|
6
6
|
import { deserializeRoutingInstructionState, serializeRoutingInstructionState } from '../router/virtual-router/routing-instructions.js';
|
|
@@ -686,8 +686,12 @@ export async function runServerToolOrchestration(options) {
|
|
|
686
686
|
flowId: engineResult.execution.flowId
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
|
-
const
|
|
690
|
-
|
|
689
|
+
const loopPayload = followupPayloadRaw ||
|
|
690
|
+
(engineResult.execution.flowId === 'stop_message_flow'
|
|
691
|
+
? buildStopMessageLoopPayload(options.adapterContext)
|
|
692
|
+
: null);
|
|
693
|
+
const loopState = loopPayload
|
|
694
|
+
? buildServerToolLoopState(options.adapterContext, engineResult.execution.flowId, loopPayload, engineResult.finalChatResponse)
|
|
691
695
|
: null;
|
|
692
696
|
const stopMessageReservation = null;
|
|
693
697
|
if (applyAutoLimit && loopState && typeof loopState.repeatCount === 'number' && loopState.repeatCount >= 3) {
|
|
@@ -797,9 +801,15 @@ export async function runServerToolOrchestration(options) {
|
|
|
797
801
|
flowId: engineResult.execution.flowId
|
|
798
802
|
});
|
|
799
803
|
try {
|
|
800
|
-
const injectFollowupBody =
|
|
801
|
-
?
|
|
802
|
-
:
|
|
804
|
+
const injectFollowupBody = isStopMessageFlow
|
|
805
|
+
? {}
|
|
806
|
+
: (followupPayloadRaw && typeof followupPayloadRaw === 'object' && !Array.isArray(followupPayloadRaw)
|
|
807
|
+
? coerceFollowupPayloadStream(followupPayloadRaw, metadata.stream === true)
|
|
808
|
+
: {});
|
|
809
|
+
if (isStopMessageFlow && shouldInjectStopLoopWarning && loopState) {
|
|
810
|
+
injectFollowupBody.messages = [];
|
|
811
|
+
appendStopMessageLoopWarning(injectFollowupBody, loopState.stopPairRepeatCount ?? STOP_MESSAGE_LOOP_WARN_THRESHOLD);
|
|
812
|
+
}
|
|
803
813
|
const dispatchResult = await withTimeout(Promise.race([
|
|
804
814
|
options.clientInjectDispatch({
|
|
805
815
|
entryEndpoint: followupEntryEndpoint,
|
|
@@ -1146,7 +1156,8 @@ function resolveStickyKeyFromAdapterContext(adapterContext) {
|
|
|
1146
1156
|
readTextFromAny(runtime?.stopMessageClientInjectScope) ||
|
|
1147
1157
|
readTextFromAny(record.stopMessageClientInjectSessionScope) ||
|
|
1148
1158
|
readTextFromAny(record.stopMessageClientInjectScope);
|
|
1149
|
-
if (explicitScope &&
|
|
1159
|
+
if (explicitScope &&
|
|
1160
|
+
(explicitScope.startsWith('tmux:') || explicitScope.startsWith('session:') || explicitScope.startsWith('conversation:'))) {
|
|
1150
1161
|
return explicitScope;
|
|
1151
1162
|
}
|
|
1152
1163
|
const metadata = asRecord(record.metadata);
|
|
@@ -1163,6 +1174,24 @@ function resolveStickyKeyFromAdapterContext(adapterContext) {
|
|
|
1163
1174
|
readTextFromAny(metadata?.tmuxSessionId) ||
|
|
1164
1175
|
readTextFromAny(metadata?.tmux_session_id);
|
|
1165
1176
|
if (!tmuxSessionId) {
|
|
1177
|
+
const sessionId = readTextFromAny(record.sessionId) ||
|
|
1178
|
+
readTextFromAny(record.session_id) ||
|
|
1179
|
+
readTextFromAny(runtime?.sessionId) ||
|
|
1180
|
+
readTextFromAny(runtime?.session_id) ||
|
|
1181
|
+
readTextFromAny(metadata?.sessionId) ||
|
|
1182
|
+
readTextFromAny(metadata?.session_id);
|
|
1183
|
+
if (sessionId) {
|
|
1184
|
+
return `session:${sessionId}`;
|
|
1185
|
+
}
|
|
1186
|
+
const conversationId = readTextFromAny(record.conversationId) ||
|
|
1187
|
+
readTextFromAny(record.conversation_id) ||
|
|
1188
|
+
readTextFromAny(runtime?.conversationId) ||
|
|
1189
|
+
readTextFromAny(runtime?.conversation_id) ||
|
|
1190
|
+
readTextFromAny(metadata?.conversationId) ||
|
|
1191
|
+
readTextFromAny(metadata?.conversation_id);
|
|
1192
|
+
if (conversationId) {
|
|
1193
|
+
return `conversation:${conversationId}`;
|
|
1194
|
+
}
|
|
1166
1195
|
return undefined;
|
|
1167
1196
|
}
|
|
1168
1197
|
return `tmux:${tmuxSessionId}`;
|
|
@@ -1336,6 +1365,48 @@ function buildServerToolLoopState(adapterContext, flowId, payload, response) {
|
|
|
1336
1365
|
}
|
|
1337
1366
|
return base;
|
|
1338
1367
|
}
|
|
1368
|
+
function resolveCapturedChatRequest(adapterContext) {
|
|
1369
|
+
if (!adapterContext || typeof adapterContext !== 'object') {
|
|
1370
|
+
return null;
|
|
1371
|
+
}
|
|
1372
|
+
const record = adapterContext;
|
|
1373
|
+
const direct = record.capturedChatRequest;
|
|
1374
|
+
if (direct && typeof direct === 'object' && !Array.isArray(direct)) {
|
|
1375
|
+
return direct;
|
|
1376
|
+
}
|
|
1377
|
+
const rt = readRuntimeMetadata(record);
|
|
1378
|
+
const runtimeCaptured = rt && typeof rt === 'object' && !Array.isArray(rt)
|
|
1379
|
+
? rt.capturedChatRequest
|
|
1380
|
+
: undefined;
|
|
1381
|
+
if (runtimeCaptured && typeof runtimeCaptured === 'object' && !Array.isArray(runtimeCaptured)) {
|
|
1382
|
+
return runtimeCaptured;
|
|
1383
|
+
}
|
|
1384
|
+
const originalRequest = record.originalRequest;
|
|
1385
|
+
if (originalRequest && typeof originalRequest === 'object' && !Array.isArray(originalRequest)) {
|
|
1386
|
+
return originalRequest;
|
|
1387
|
+
}
|
|
1388
|
+
return null;
|
|
1389
|
+
}
|
|
1390
|
+
function buildStopMessageLoopPayload(adapterContext) {
|
|
1391
|
+
const captured = resolveCapturedChatRequest(adapterContext);
|
|
1392
|
+
const seed = extractCapturedChatSeed(captured);
|
|
1393
|
+
if (!seed || !Array.isArray(seed.messages) || seed.messages.length === 0) {
|
|
1394
|
+
return null;
|
|
1395
|
+
}
|
|
1396
|
+
const payload = {
|
|
1397
|
+
messages: seed.messages
|
|
1398
|
+
};
|
|
1399
|
+
if (seed.model) {
|
|
1400
|
+
payload.model = seed.model;
|
|
1401
|
+
}
|
|
1402
|
+
if (Array.isArray(seed.tools) && seed.tools.length > 0) {
|
|
1403
|
+
payload.tools = seed.tools;
|
|
1404
|
+
}
|
|
1405
|
+
if (seed.parameters && typeof seed.parameters === 'object' && !Array.isArray(seed.parameters)) {
|
|
1406
|
+
payload.parameters = seed.parameters;
|
|
1407
|
+
}
|
|
1408
|
+
return payload;
|
|
1409
|
+
}
|
|
1339
1410
|
function readServerToolLoopState(adapterContext) {
|
|
1340
1411
|
if (!adapterContext || typeof adapterContext !== 'object') {
|
|
1341
1412
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
3
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/
|
|
3
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
4
4
|
import { cloneJson } from '../server-side-tools.js';
|
|
5
5
|
const FLOW_ID = 'antigravity_thought_signature_bootstrap';
|
|
6
6
|
function readProviderKey(adapterContext) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
3
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
3
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
4
4
|
import { findNextUndeliveredDueAtMs, listClockTasks, reserveDueTasksForRequest, resolveClockConfig, startClockDaemonIfNeeded } from '../clock/task-store.js';
|
|
5
5
|
import { nowMs } from '../clock/state.js';
|
|
6
6
|
import { logClock } from '../clock/log.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { cloneJson } from '../server-side-tools.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/
|
|
4
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
5
5
|
import { cancelClockTask, clearClockTasks, listClockTasks, resolveClockConfig, parseDueAtMs, scheduleClockTasks, startClockDaemonIfNeeded, updateClockTask } from '../clock/task-store.js';
|
|
6
6
|
import { getClockTimeSnapshot } from '../clock/ntp.js';
|
|
7
7
|
import { nowMs } from '../clock/state.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { isCompactionRequest } from '../../conversion/
|
|
1
|
+
export { isCompactionRequest } from '../../conversion/compaction-detect.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { isCompactionRequest } from '../../conversion/
|
|
1
|
+
export { isCompactionRequest } from '../../conversion/compaction-detect.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { isCompactionRequest } from './compaction-detect.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/
|
|
4
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
5
5
|
const FLOW_ID = 'empty_reply_continue';
|
|
6
6
|
const MAX_TOOL_HINTS = 24;
|
|
7
7
|
const handler = async (ctx) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { isCompactionRequest } from './compaction-detect.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
4
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
5
5
|
const FLOW_ID = 'iflow_model_error_retry';
|
|
6
6
|
const handler = async (ctx) => {
|
|
7
7
|
if (!ctx.capabilities.reenterPipeline) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { registerServerToolHandler } from '../registry.js';
|
|
3
3
|
import { cloneJson } from '../server-side-tools.js';
|
|
4
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
4
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
5
5
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
6
6
|
const FLOW_ID = 'recursive_detection_guard';
|
|
7
7
|
const CONSECUTIVE_TRIGGER_COUNT = 10;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
1
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
2
2
|
import { registerServerToolHandler } from '../registry.js';
|
|
3
3
|
import { cloneJson } from '../server-side-tools.js';
|
|
4
4
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
@@ -2,7 +2,7 @@ import * as childProcess from 'node:child_process';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as os from 'node:os';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
|
-
import { readRuntimeMetadata } from '../../../conversion/
|
|
5
|
+
import { readRuntimeMetadata } from '../../../conversion/runtime-metadata.js';
|
|
6
6
|
import { extractTextFromMessageContent } from './blocked-report.js';
|
|
7
7
|
import { appendServerToolProgressFileEvent } from '../../log/progress-file.js';
|
|
8
8
|
const DEFAULT_STOP_MESSAGE_AI_DONE_MARKER = '[STOPMESSAGE_DONE]';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readRuntimeMetadata } from '../../../conversion/
|
|
1
|
+
import { readRuntimeMetadata } from '../../../conversion/runtime-metadata.js';
|
|
2
2
|
import { saveRoutingInstructionStateSync } from '../../../router/virtual-router/sticky-session-store.js';
|
|
3
3
|
import { isStopEligibleForServerTool } from '../../stop-gateway-context.js';
|
|
4
4
|
import { extractResponsesOutputText, hasToolLikeOutput } from './iflow-followup.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerServerToolHandler } from '../registry.js';
|
|
2
2
|
import { isCompactionRequest } from './compaction-detect.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
4
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
5
5
|
import { isStopEligibleForServerTool } from '../stop-gateway-context.js';
|
|
6
6
|
import { attachStopMessageCompareContext } from '../stop-message-compare-context.js';
|
|
7
7
|
import { extractStopMessageAutoResponseSnapshot, renderStopMessageAutoFollowupViaAi, resolveStopMessageAiApprovedMarker, resolveStopMessageAiDoneMarker } from './stop-message-auto/iflow-followup.js';
|
|
@@ -2,7 +2,7 @@ import { registerServerToolHandler } from '../registry.js';
|
|
|
2
2
|
import { cloneJson, extractTextFromChatLike } from '../server-side-tools.js';
|
|
3
3
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
4
4
|
import { reenterServerToolBackend } from '../reenter-backend.js';
|
|
5
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
5
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
6
6
|
const FLOW_ID = 'vision_flow';
|
|
7
7
|
const handler = async (ctx) => {
|
|
8
8
|
if (!ctx.capabilities.reenterPipeline) {
|
|
@@ -3,7 +3,7 @@ import { registerServerToolHandler } from '../registry.js';
|
|
|
3
3
|
import { cloneJson, extractTextFromChatLike } from '../server-side-tools.js';
|
|
4
4
|
import { extractCapturedChatSeed } from './followup-request-builder.js';
|
|
5
5
|
import { reenterServerToolBackend } from '../reenter-backend.js';
|
|
6
|
-
import { readRuntimeMetadata } from '../../conversion/
|
|
6
|
+
import { readRuntimeMetadata } from '../../conversion/runtime-metadata.js';
|
|
7
7
|
const FLOW_ID = 'web_search_flow';
|
|
8
8
|
const handler = async (ctx) => {
|
|
9
9
|
const toolCall = ctx.toolCall;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureRuntimeMetadata } from '../conversion/
|
|
1
|
+
import { ensureRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
2
2
|
export async function reenterServerToolBackend(args) {
|
|
3
3
|
const routeHint = typeof args.routeHint === 'string' && args.routeHint.trim().length ? args.routeHint.trim() : undefined;
|
|
4
4
|
const merged = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getServerToolHandler, listAutoServerToolHooks } from './registry.js';
|
|
2
|
-
import { ProviderProtocolError } from '../conversion/
|
|
2
|
+
import { ProviderProtocolError } from '../conversion/provider-protocol-error.js';
|
|
3
3
|
import { executeWebSearchBackendPlan } from './handlers/web-search.js';
|
|
4
4
|
import { executeVisionBackendPlan } from './handlers/vision.js';
|
|
5
5
|
import './handlers/iflow-model-error-retry.js';
|
|
@@ -13,7 +13,7 @@ import './handlers/apply-patch-guard.js';
|
|
|
13
13
|
import './handlers/continue-execution.js';
|
|
14
14
|
import './handlers/review.js';
|
|
15
15
|
import { runPreCommandHooks } from './pre-command-hooks.js';
|
|
16
|
-
import { readRuntimeMetadata } from '../conversion/
|
|
16
|
+
import { readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
17
17
|
function traceAutoHook(options, event) {
|
|
18
18
|
try {
|
|
19
19
|
options.onAutoHookTrace?.(event);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/
|
|
1
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
2
2
|
export function inspectStopGatewaySignal(base) {
|
|
3
3
|
if (!base || typeof base !== 'object' || Array.isArray(base)) {
|
|
4
4
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/
|
|
1
|
+
import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
2
2
|
const STOP_MESSAGE_COMPARE_KEY = 'stopMessageCompareContext';
|
|
3
3
|
export function attachStopMessageCompareContext(adapterContext, context) {
|
|
4
4
|
if (!adapterContext || typeof adapterContext !== 'object' || Array.isArray(adapterContext)) {
|
|
@@ -72,6 +72,10 @@ export declare function buildReasoningStartEvent(reasoning: ResponsesReasoningIt
|
|
|
72
72
|
* 映射:reasoning.delta → response.reasoning_text.delta
|
|
73
73
|
*/
|
|
74
74
|
export declare function buildReasoningDeltas(reasoning: ResponsesReasoningItem, context: ResponsesEventGeneratorContext, config?: ResponsesEventGeneratorConfig): Generator<ResponsesSseEvent>;
|
|
75
|
+
/**
|
|
76
|
+
* 构建response.reasoning_summary_*事件流
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildReasoningSummaryEvents(reasoning: ResponsesReasoningItem, context: ResponsesEventGeneratorContext, config?: ResponsesEventGeneratorConfig): Generator<ResponsesSseEvent>;
|
|
75
79
|
/**
|
|
76
80
|
* 构建reasoning.done事件
|
|
77
81
|
*/
|