Skip to content

添加 dsh 0.2.x 版本的支持 - #19

Merged
Max-Samson merged 3 commits into
Max-Samson:mainfrom
ChthoIly:main
Oct 22, 2026
Merged

Max-Samson merged 3 commits into
Max-Samson:mainfrom
ChthoIly:main

Conversation

@ChthoIly

@ChthoIly ChthoIly commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

DSH更新到 0.2.x 后有破坏性更新改动,目前v1.1.7没法安装了。这次添加新版的支持

这次的 Flash 很好用 😄

  • Widen client peer ranges to >=0.1.0-rc.6 <0.3.0-0 and remove the retired @deepseek-ai/dsh-client-runtime peer/inject entry, so DSH 0.2.x's plugin admission gate accepts the plugin while DSH 0.1.x remains supported.
  • Make client context types self-contained: emitted client .d.ts no longer imports the retired runtime package, and build externals cover both the 0.1.x and 0.2.x browser shared-module tables.
  • Read assistant providerMetadata (0.2.x) for model attribution, keeping provenance (0.1.x) first and requestConfig as the last fallback.
  • Fold DSH 0.2.x session logs: derive TTFT/TPS from assistant/message.stream and normalize object user/message.source; keep the assistant/chunk path for 0.1.x logs.
  • Add manifest/fold regression tests (49 passing), bump to 1.1.8, sync the lockfile, and update bilingual changelogs, README, and CONTRIBUTING.

Summary

Describe the user-visible change and why it belongs in this plugin.

Verification

  • npm run verify
  • npm pack --dry-run
  • Clean-profile DSH installation tested when bundle, inject, slot, or route behavior changed
  • No API keys, account data, private sessions, logs, or generated lib/ files included
  • CHANGELOG.md updated for user-visible changes

- Widen client peer ranges to >=0.1.0-rc.6 <0.3.0-0 and remove the retired
  @deepseek-ai/dsh-client-runtime peer/inject entry, so DSH 0.2.x's plugin
  admission gate accepts the plugin while DSH 0.1.x remains supported.
- Make client context types self-contained: emitted client .d.ts no longer
  imports the retired runtime package, and build externals cover both the
  0.1.x and 0.2.x browser shared-module tables.
- Read assistant providerMetadata (0.2.x) for model attribution, keeping
  provenance (0.1.x) first and requestConfig as the last fallback.
- Fold DSH 0.2.x session logs: derive TTFT/TPS from assistant/message.stream
  and normalize object user/message.source; keep the assistant/chunk path
  for 0.1.x logs.
- Add manifest/fold regression tests (49 passing), bump to 1.1.8, sync the
  lockfile, and update bilingual changelogs, README, and CONTRIBUTING.

Co-authored-by: DeepSeek V4.1 Flash 1017 <deepseek-flash@deepseek.com>
@ChthoIly

Copy link
Copy Markdown
Contributor Author

@Max-Samson  速速review然后发新版,我们不能落后于人 💪

@Max-Samson
Max-Samson self-requested a review October 21, 2026 17:03

@Max-Samson Max-Samson left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔁 This review has been superseded. See the latest review.

Comment thread src/usage/rounds.ts Outdated
Address PR #19 review: skip structural block-start/usage/finish records and empty leading fragments in packed runs, place fragment i at time0 + sum(dt[0..i-1]), and end the TPS window at the last token. Add a regression for the reviewer sequence and a client test for the provenance -> providerMetadata -> requestConfig model fallback.
Comment thread src/usage/rounds.ts Outdated
@ChthoIly

Copy link
Copy Markdown
Contributor Author

这版在 DSH Desktop 0.2.1-rc.2 测试过

@Max-Samson Max-Samson left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔁 This review has been superseded. See the latest review.

Comment thread src/usage/rounds.ts
Comment thread src/usage/rounds.ts
Address PR #19 review round 2 and a self-review pass:
- Count assistant/attempt usage from its stream and bill each settled
  attempt separately across retry boundaries (P1).
- Treat name-bearing tool-call fragments and raw *-delta chunks as tokens
  for TTFT (P2), and fall back to the stream usage record when an
  assistant/message has no data.usage.
- Measure 0.2.x output TPS over the summed streaming time of each
  message/attempt instead of the turn wall clock, so tool execution and
  step gaps no longer depress it.
- Normalize object user/message.source kinds (user/user-* -> human,
  other runtime injections -> agent.<kind>).
- Scan every published client .d.ts for the retired runtime import.
- Add regressions for each case and correct the changelog wording.
Comment thread src/usage/rounds.ts
Comment thread src/usage/rounds.ts
@ChthoIly

Copy link
Copy Markdown
Contributor Author

这AI能不能问题一次说完?怎么改完又说之前一版的其他问题呢

@Max-Samson
Max-Samson self-requested a review October 22, 2026 02:29

@Max-Samson Max-Samson left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: ✅ APPROVE

Adds DSH 0.2.x support while retaining the 0.1.x paths. Reviewed the changed implementations, callers, tests, and relevant DSH contracts.

Typecheck, build, all 55 tests, and package dry-run passed. Live clean-profile installation was not independently rerun.

Verdict: APPROVE — The compatibility changes fit the existing architecture, and no actionable defects were found.

No issues found. Code looks good!


Automated review by RomeOS Code Review · commit 924092b

@Max-Samson
Max-Samson merged commit 91fe353 into Max-Samson:main Oct 22, 2026
2 checks passed
@Max-Samson

Copy link
Copy Markdown
Owner

@ChthoIly 感谢pr贡献,已经合并更新了,npm v1.1.8已经发布

@ChthoIly

Copy link
Copy Markdown
Contributor Author

@al-alsace /review

@al-alsace

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Source misclassification

The doc comment says subagent-settled should become agent.subagent-settled. In practice it is returned unchanged as subagent-settled. The cause is that /agent|goal|continuation/i matches any kind that merely contains "agent", and "subagent" contains it. A consumer that detects agent injections by the agent prefix (e.g. agent.* / agent-message) would then not classify subagent-triggered turns as agent input. The regex should match only kinds that start with these words (e.g. /^(agent|goal)|continuation/), or the comment should be updated if passthrough is intended. Untested: the source-normalization test does not cover subagent-settled.

function sourceKindOf(kind: string): string {
  // user、user-question-reply、user-approval 等都是人的输入
  if (kind === 'user' || kind.startsWith('user-')) return 'human'
  if (/agent|goal|continuation/i.test(kind)) return kind
  return `agent.${kind}`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants