@rzx/ohs 1.1.18 → 1.1.19

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/index.js CHANGED
@@ -21319,26 +21319,6 @@ class ConversationTransactions {
21319
21319
  if (previous === input.model)
21320
21320
  return false;
21321
21321
  this.storage.atomic(() => {
21322
- if (previous) {
21323
- const message = this.conversations.createMessage({
21324
- sessionId: session.id,
21325
- role: "system",
21326
- metadata: {
21327
- presentation: {
21328
- kind: "model_switch",
21329
- fromModel: previous,
21330
- toModel: input.model
21331
- }
21332
- }
21333
- });
21334
- this.conversations.upsertMessagePart({
21335
- sessionId: session.id,
21336
- messageId: message.id,
21337
- type: "text",
21338
- status: "completed",
21339
- text: `模型已切换 ${previous} → ${input.model}`
21340
- });
21341
- }
21342
21322
  sessions.update(session.id, {
21343
21323
  metadata: { ...session.metadata, appliedRequestModel: input.model }
21344
21324
  });
@@ -404661,26 +404641,6 @@ params: ${params}`);
404661
404641
  if (previous === input.model)
404662
404642
  return false;
404663
404643
  this.storage.atomic(() => {
404664
- if (previous) {
404665
- const message = this.conversations.createMessage({
404666
- sessionId: session.id,
404667
- role: "system",
404668
- metadata: {
404669
- presentation: {
404670
- kind: "model_switch",
404671
- fromModel: previous,
404672
- toModel: input.model
404673
- }
404674
- }
404675
- });
404676
- this.conversations.upsertMessagePart({
404677
- sessionId: session.id,
404678
- messageId: message.id,
404679
- type: "text",
404680
- status: "completed",
404681
- text: `模型已切换 ${previous} → ${input.model}`
404682
- });
404683
- }
404684
404644
  sessions.update(session.id, {
404685
404645
  metadata: { ...session.metadata, appliedRequestModel: input.model }
404686
404646
  });
@@ -449163,14 +449123,32 @@ class SessionCommandService {
449163
449123
  const before = this.options.events.checkpoint();
449164
449124
  const nextModel = metadata ? readSessionRuntimeConfig({ ...existing, metadata }).model : undefined;
449165
449125
  const modelChanged = nextModel !== undefined && nextModel !== existing.model;
449166
- const savedMetadata = modelChanged && metadata && typeof existing.metadata.appliedRequestModel !== "string" ? { ...metadata, appliedRequestModel: existing.model } : metadata;
449126
+ const showModelSwitch = modelChanged && !this.options.runtimeControl.hasRunWork(sessionId) && !this.options.runtimeControl.hasActiveWorkForSession(sessionId) && !this.options.runtimeControl.hasLiveChild(sessionId);
449167
449127
  const session = this.options.transactions.transaction(() => {
449168
449128
  const updated = this.options.sessions.updateSession(sessionId, {
449169
449129
  title: input.title,
449170
449130
  model: nextModel,
449171
449131
  agent: input.agent,
449172
- metadata: savedMetadata
449132
+ metadata
449173
449133
  });
449134
+ if (showModelSwitch && nextModel) {
449135
+ const message = this.options.transactions.createMessage({
449136
+ sessionId,
449137
+ role: "system",
449138
+ metadata: { presentation: {
449139
+ kind: "model_switch",
449140
+ fromModel: existing.model,
449141
+ toModel: nextModel
449142
+ } }
449143
+ });
449144
+ this.options.transactions.upsertMessagePart({
449145
+ sessionId,
449146
+ messageId: message.id,
449147
+ type: "text",
449148
+ status: "completed",
449149
+ text: `模型已切换 ${existing.model} → ${nextModel}`
449150
+ });
449151
+ }
449174
449152
  return updated;
449175
449153
  });
449176
449154
  if (runtimeConfigurationChanged && !liveRequestConfigurationChange) {
@@ -573396,4 +573374,4 @@ program.command("doctor").description("Check environment and dependencies").acti
573396
573374
  });
573397
573375
  program.parse();
573398
573376
 
573399
- //# debugId=B19423AD2EF39B6D64756E2164756E21
573377
+ //# debugId=053CC01502B7120964756E2164756E21