@sparkelf/dsh-plus 0.2.9-alpha.80 → 0.2.9-alpha.82
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/LICENSE +21 -0
- package/lib/apply-DycMqLJO.js +852 -0
- package/lib/apply.js +1 -1
- package/lib/bin.js +1 -1
- package/lib/types/apply.js +37 -2
- package/package.json +495 -516
- package/patches/approval-allow-policy.patch +3 -3
- package/patches/atomic-write-zombie-lock-holder.patch +1 -1
- package/patches/bootstrap-exempt-names.patch +6 -6
- package/patches/browser-auth-mode.patch +3 -3
- package/patches/composer-popover-boundaries.patch +33 -69
- package/patches/diagram-preview.patch +3 -3
- package/patches/image-offload-hoist-replay.patch +6 -6
- package/patches/input-trigger-source-label.patch +4 -4
- package/patches/legacy-code-preset.patch +5 -5
- package/patches/llm-pi-ai-transport-truncation.patch +4 -4
- package/patches/mobile-journal-generation.patch +2 -2
- package/patches/office-preview-stable-load.patch +1 -1
- package/patches/officecli-deliverables.patch +2 -2
- package/patches/ptc-mcp-schema-types.patch +3 -3
- package/patches/resource-ref-chip-mentions.patch +34 -32
- package/patches/responses-reasoning-status.patch +208 -49
- package/patches/session-controller-image-downgrade-and-tool-visibility.patch +16 -14
- package/patches/session-envelope-ignorable.patch +57 -28
- package/patches/session-export-chinese.patch +11 -11
- package/patches/session-format-legacy-restart.patch +1 -1
- package/patches/sidebar-right-tab-menu.patch +10 -8
- package/patches/state-dot-brand-blue.patch +2 -2
- package/patches/ui-schedule-plaza-tab.patch +1 -1
- package/patches/ui-settings-compact-phone.patch +2 -9
- package/patches/ui-sidebar-right-global-panel.patch +3 -3
- package/patches/visibility-filters.patch +10 -10
- package/patches/web-runtime-compat.patch +1 -1
- package/patches/workspace-hide-group-rooms.patch +2 -2
- package/patches/workspace-storage-restore.patch +5 -5
- package/patches/wsl-native-open.patch +8 -8
- package/patches/session-log-trajectory-toolbar.patch +0 -352
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git a/packages/api/session-controller/src/client/contract/session.ts b/packages/api/session-controller/src/client/contract/session.ts
|
|
2
|
-
index
|
|
2
|
+
index ce060ec4..ea3ce4b6 100644
|
|
3
3
|
--- a/packages/api/session-controller/src/client/contract/session.ts
|
|
4
4
|
+++ b/packages/api/session-controller/src/client/contract/session.ts
|
|
5
5
|
@@ -12,7 +12,7 @@ import type { MessageId } from '@deepseek-ai/dsh-llm/brand'
|
|
@@ -20,7 +20,7 @@ index 9233ac84cb..21ce2a2dad 100644
|
|
|
20
20
|
/**
|
|
21
21
|
* Resolve one stored image using this Session's gateway permission scope.
|
|
22
22
|
diff --git a/packages/api/session-controller/src/client/index.ts b/packages/api/session-controller/src/client/index.ts
|
|
23
|
-
index
|
|
23
|
+
index b9600f36..d48cb924 100644
|
|
24
24
|
--- a/packages/api/session-controller/src/client/index.ts
|
|
25
25
|
+++ b/packages/api/session-controller/src/client/index.ts
|
|
26
26
|
@@ -28,6 +28,7 @@ export { createScope, scopeOf } from './scope.ts'
|
|
@@ -32,7 +32,7 @@ index b9600f36a6..d48cb92447 100644
|
|
|
32
32
|
SessionListPhase,
|
|
33
33
|
SessionListSnapshot,
|
|
34
34
|
diff --git a/packages/api/session-controller/src/client/sessions/session.ts b/packages/api/session-controller/src/client/sessions/session.ts
|
|
35
|
-
index
|
|
35
|
+
index 60194de5..67459761 100644
|
|
36
36
|
--- a/packages/api/session-controller/src/client/sessions/session.ts
|
|
37
37
|
+++ b/packages/api/session-controller/src/client/sessions/session.ts
|
|
38
38
|
@@ -17,6 +17,7 @@ import type {
|
|
@@ -43,7 +43,7 @@ index 253da9c463..0d5d4bbf67 100644
|
|
|
43
43
|
} from '../../types.ts'
|
|
44
44
|
import type {
|
|
45
45
|
BeginSubmissionInput, PendingSubmissionRetirement, SessionFace, SubmissionHandle,
|
|
46
|
-
@@ -
|
|
46
|
+
@@ -272,6 +273,7 @@ export class Session implements SessionFace {
|
|
47
47
|
mode: 'queue' | 'steer',
|
|
48
48
|
signal?: AbortSignal,
|
|
49
49
|
requestId?: SessionRequestId,
|
|
@@ -51,7 +51,7 @@ index 253da9c463..0d5d4bbf67 100644
|
|
|
51
51
|
): Promise<RemoteResult<{ accepted: true }>> {
|
|
52
52
|
this.promptError = null
|
|
53
53
|
this.lastAgentError = null
|
|
54
|
-
@@ -
|
|
54
|
+
@@ -287,6 +289,7 @@ export class Session implements SessionFace {
|
|
55
55
|
mode,
|
|
56
56
|
content,
|
|
57
57
|
clientTimeZone,
|
|
@@ -60,10 +60,10 @@ index 253da9c463..0d5d4bbf67 100644
|
|
|
60
60
|
} else if (content.some(part => part.type === 'file')) {
|
|
61
61
|
result = {
|
|
62
62
|
diff --git a/packages/api/session-controller/src/index.ts b/packages/api/session-controller/src/index.ts
|
|
63
|
-
index
|
|
63
|
+
index 6303340c..a6c253ee 100644
|
|
64
64
|
--- a/packages/api/session-controller/src/index.ts
|
|
65
65
|
+++ b/packages/api/session-controller/src/index.ts
|
|
66
|
-
@@ -
|
|
66
|
+
@@ -487,6 +487,9 @@ export class SessionController extends TypertRemoteService {
|
|
67
67
|
rpcId: request.requestId,
|
|
68
68
|
...(clientTimeZone === undefined ? {} : { clientTimeZone }),
|
|
69
69
|
...(principal === undefined ? {} : { principal }),
|
|
@@ -74,10 +74,10 @@ index 94d08c77e3..3d9bf30009 100644
|
|
|
74
74
|
return this.commands.prompt(request, source)
|
|
75
75
|
}
|
|
76
76
|
diff --git a/packages/api/session-controller/src/types.ts b/packages/api/session-controller/src/types.ts
|
|
77
|
-
index
|
|
77
|
+
index 49cd7c0f..12257027 100644
|
|
78
78
|
--- a/packages/api/session-controller/src/types.ts
|
|
79
79
|
+++ b/packages/api/session-controller/src/types.ts
|
|
80
|
-
@@ -
|
|
80
|
+
@@ -320,6 +320,23 @@ export interface SessionForkValue {
|
|
81
81
|
readonly sessionId: SessionId
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -100,17 +100,17 @@ index 9e399d8f3b..46a4507c56 100644
|
|
|
100
100
|
+
|
|
101
101
|
/** Session prompt request. */
|
|
102
102
|
export interface SessionPromptRequest {
|
|
103
|
-
/** Client-minted identity persisted on the
|
|
104
|
-
@@ -
|
|
103
|
+
/** Client-minted identity persisted on the accepted inbox input, including empty continuation. */
|
|
104
|
+
@@ -328,6 +345,8 @@ export interface SessionPromptRequest {
|
|
105
105
|
readonly mode: 'queue' | 'steer'
|
|
106
|
-
/**
|
|
106
|
+
/** Non-whitespace text or attachments; an empty array continues an eligible failed idle Session. */
|
|
107
107
|
readonly content: readonly PromptContentPart[]
|
|
108
108
|
+ /** Structured mentions the composer declared, in document order. Absent when it carried none. */
|
|
109
109
|
+ readonly mentions?: readonly SessionMentionRef[]
|
|
110
110
|
readonly clientTimeZone?: string
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
@@ -
|
|
113
|
+
@@ -397,7 +416,13 @@ declare module '@deepseek-ai/dsh-llm' {
|
|
114
114
|
* caller that submitted the prompt. `principal` is written only for a
|
|
115
115
|
* caller other than the owner, so an absent `principal` means the owner.
|
|
116
116
|
*/
|
|
@@ -122,14 +122,14 @@ index 9e399d8f3b..46a4507c56 100644
|
|
|
122
122
|
+ principal?: Principal
|
|
123
123
|
+ mentions?: readonly SessionMentionRef[]
|
|
124
124
|
+ }
|
|
125
|
+
/** Empty retry user message with browser prompt correlation and caller metadata. */
|
|
126
|
+
'retry-rpc': { kind: 'retry'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal }
|
|
125
127
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
128
|
diff --git a/packages/client/ui-conversation/src/client/contract/draft-editor.ts b/packages/client/ui-conversation/src/client/contract/draft-editor.ts
|
|
129
|
-
index
|
|
129
|
+
index 86592a82..3ee5ea16 100644
|
|
130
130
|
--- a/packages/client/ui-conversation/src/client/contract/draft-editor.ts
|
|
131
131
|
+++ b/packages/client/ui-conversation/src/client/contract/draft-editor.ts
|
|
132
|
-
@@ -
|
|
132
|
+
@@ -16,7 +16,12 @@ export interface ReferenceInsert {
|
|
133
133
|
readonly source: string
|
|
134
134
|
readonly ref: string
|
|
135
135
|
readonly label: string
|
|
@@ -144,10 +144,10 @@ index b305bb3a3c..069ad977dd 100644
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
diff --git a/packages/client/ui-conversation/src/client/input/facade.ts b/packages/client/ui-conversation/src/client/input/facade.ts
|
|
147
|
-
index
|
|
147
|
+
index 1fd208b6..a0155622 100644
|
|
148
148
|
--- a/packages/client/ui-conversation/src/client/input/facade.ts
|
|
149
149
|
+++ b/packages/client/ui-conversation/src/client/input/facade.ts
|
|
150
|
-
@@ -
|
|
150
|
+
@@ -21,8 +21,10 @@ import type {
|
|
151
151
|
SessionInput, SubmitAttempt, SubmitAttachment, SubmitOutcome,
|
|
152
152
|
} from '../contract/input.ts'
|
|
153
153
|
import type {
|
|
@@ -159,7 +159,7 @@ index 6306216b1c..d8e2233001 100644
|
|
|
159
159
|
import type { InputSubmitMode, MessageSubmission, MessageSubmissionState } from '../contract/composer-submission.ts'
|
|
160
160
|
import { serializeDraftPrompt } from './prompt.ts'
|
|
161
161
|
import { SubmitMachine } from './machine.ts'
|
|
162
|
-
@@ -
|
|
162
|
+
@@ -70,6 +72,7 @@ export interface SessionInputDeps {
|
|
163
163
|
mode: InputSubmitMode,
|
|
164
164
|
signal: AbortSignal,
|
|
165
165
|
accept: () => void,
|
|
@@ -167,7 +167,7 @@ index 6306216b1c..d8e2233001 100644
|
|
|
167
167
|
): Promise<SubmitOutcome>
|
|
168
168
|
/** Live Session and composer-block policy for transcript insertion. */
|
|
169
169
|
quoteInsertionAllowed?: () => boolean
|
|
170
|
-
@@ -
|
|
170
|
+
@@ -135,6 +138,29 @@ const EMPTY_LEXICON: ReadonlyMap<'/' | '@', readonly string[]> = new Map()
|
|
171
171
|
* setDraft/submit + the published InputState store, over a shell-owned
|
|
172
172
|
* Lexical editor.
|
|
173
173
|
*/
|
|
@@ -197,10 +197,10 @@ index 6306216b1c..d8e2233001 100644
|
|
|
197
197
|
export class SessionInputShell implements SessionInput {
|
|
198
198
|
/** Published editor projection + submit-plane state + queue overlay (the InputZone currency source). */
|
|
199
199
|
readonly state: SnapshotStore<InputState>
|
|
200
|
-
@@ -
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
@@ -742,7 +768,10 @@ export class SessionInputShell implements SessionInput {
|
|
201
|
+
this.settleSink(attempt, Promise.resolve({ kind: 'success' }))
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
204
|
- this.settleSink(attempt, this.deps.defaultSink(text, attachmentIds, mode, attempt.signal, () => { this.acceptSink(attempt) }))
|
|
205
205
|
+ const mentions = collectMentions(attempt.occurrences)
|
|
206
206
|
+ this.settleSink(attempt, mentions === undefined
|
|
@@ -210,13 +210,13 @@ index 6306216b1c..d8e2233001 100644
|
|
|
210
210
|
if (!(prompt instanceof Promise)) { send(prompt); return }
|
|
211
211
|
void prompt.then(send, (error: unknown) => { this.failSink(attempt, error) })
|
|
212
212
|
diff --git a/packages/client/ui-conversation/src/client/input/hub.ts b/packages/client/ui-conversation/src/client/input/hub.ts
|
|
213
|
-
index
|
|
213
|
+
index f6e9ce41..7f4354b0 100644
|
|
214
214
|
--- a/packages/client/ui-conversation/src/client/input/hub.ts
|
|
215
215
|
+++ b/packages/client/ui-conversation/src/client/input/hub.ts
|
|
216
216
|
@@ -12,6 +12,7 @@ import type {
|
|
217
217
|
ISessions, SessionBinding, SessionFace,
|
|
218
218
|
} from '@deepseek-ai/dsh-api-session-controller/client'
|
|
219
|
-
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
219
|
+
import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types'
|
|
220
220
|
+import type { SessionMentionRef } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
221
221
|
import type { TranslateNS } from '@deepseek-ai/dsh-client-locale/client'
|
|
222
222
|
import type { InboxState } from '@deepseek-ai/dsh-agent/types'
|
|
@@ -238,13 +238,15 @@ index 02897a18c6..5f1a3228a4 100644
|
|
|
238
238
|
quoteRemoveLabel: () => this.t('quote.remove'),
|
|
239
239
|
quoteInsertionAllowed: () => {
|
|
240
240
|
const state = session.getSnapshot()
|
|
241
|
-
@@ -
|
|
241
|
+
@@ -273,11 +275,15 @@ export class InputHub implements SessionInputResolver {
|
|
242
242
|
mode: InputSubmitMode,
|
|
243
243
|
signal: AbortSignal,
|
|
244
244
|
accept: () => void,
|
|
245
245
|
+ mentions?: readonly SessionMentionRef[],
|
|
246
246
|
): Promise<SubmitOutcome> {
|
|
247
|
-
if (text === '' && attachmentIds.length === 0)
|
|
247
|
+
if (text === '' && attachmentIds.length === 0) {
|
|
248
|
+
return session.prompt([], mode, signal).then(result => result.ok ? { kind: 'success' } : { kind: 'error' })
|
|
249
|
+
}
|
|
248
250
|
- return this.conversation().sendSession(session, text, attachmentIds, mode, signal, accept)
|
|
249
251
|
+ // A draft that declared mentions takes one extra argument; the ordinary send keeps its shape.
|
|
250
252
|
+ return mentions === undefined || mentions.length === 0
|
|
@@ -254,7 +256,7 @@ index 02897a18c6..5f1a3228a4 100644
|
|
|
254
256
|
|
|
255
257
|
/**
|
|
256
258
|
diff --git a/packages/client/ui-conversation/src/client/service.ts b/packages/client/ui-conversation/src/client/service.ts
|
|
257
|
-
index
|
|
259
|
+
index af19eb77..4ae2286d 100644
|
|
258
260
|
--- a/packages/client/ui-conversation/src/client/service.ts
|
|
259
261
|
+++ b/packages/client/ui-conversation/src/client/service.ts
|
|
260
262
|
@@ -9,6 +9,7 @@
|
|
@@ -289,7 +291,7 @@ index af19eb7721..4ae2286dcd 100644
|
|
|
289
291
|
// An accepted prompt whose echo already retired unobserved, as when its queue entry was removed.
|
|
290
292
|
diff --git a/packages/client/ui-conversation/tests/mentions.client.spec.ts b/packages/client/ui-conversation/tests/mentions.client.spec.ts
|
|
291
293
|
new file mode 100644
|
|
292
|
-
index
|
|
294
|
+
index 00000000..7439cbff
|
|
293
295
|
--- /dev/null
|
|
294
296
|
+++ b/packages/client/ui-conversation/tests/mentions.client.spec.ts
|
|
295
297
|
@@ -0,0 +1,45 @@
|
|
@@ -340,7 +342,7 @@ index 0000000000..7439cbfff0
|
|
|
340
342
|
+})
|
|
341
343
|
|
|
342
344
|
diff --git a/packages/client/ui-primitives/src/ReferenceIcon.tsx b/packages/client/ui-primitives/src/ReferenceIcon.tsx
|
|
343
|
-
index
|
|
345
|
+
index ca566c40..7fd75f96 100644
|
|
344
346
|
--- a/packages/client/ui-primitives/src/ReferenceIcon.tsx
|
|
345
347
|
+++ b/packages/client/ui-primitives/src/ReferenceIcon.tsx
|
|
346
348
|
@@ -1,12 +1,12 @@
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
diff --git a/packages/client/ui-settings-models/src/client/ModelsSection.module.css b/packages/client/ui-settings-models/src/client/ModelsSection.module.css
|
|
2
|
-
index
|
|
2
|
+
index a232a690..ff7e7bf4 100644
|
|
3
3
|
--- a/packages/client/ui-settings-models/src/client/ModelsSection.module.css
|
|
4
4
|
+++ b/packages/client/ui-settings-models/src/client/ModelsSection.module.css
|
|
5
|
-
@@ -
|
|
5
|
+
@@ -470,6 +470,31 @@
|
|
6
6
|
padding-top: 12px;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
+.settingToggle {
|
|
10
10
|
+ display: flex;
|
|
11
11
|
+ align-items: center;
|
|
@@ -35,20 +35,20 @@ index 51995fc1ae..5c2f3a098b 100644
|
|
|
35
35
|
position: relative;
|
|
36
36
|
display: flex;
|
|
37
37
|
diff --git a/packages/client/ui-settings-models/src/client/ProviderEditor.tsx b/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
|
|
38
|
-
index
|
|
38
|
+
index 6dc2fb3b..e99773b8 100644
|
|
39
39
|
--- a/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
|
|
40
40
|
+++ b/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
|
|
41
|
-
@@ -
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
@@ -50,6 +50,9 @@ type EditorLayout = 'deepseek' | 'pi-ai' | 'unknown'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
45
|
+/** Leaf path of the curated OpenAI Responses compatibility setting. */
|
|
46
46
|
+const OMIT_REASONING_INPUT_STATUS_PATH = ['responsesCompatibility', 'omitReasoningInputStatus'] as const
|
|
47
47
|
+
|
|
48
48
|
/** Props of {@link ProviderEditor}. */
|
|
49
49
|
export interface ProviderEditorProps {
|
|
50
50
|
/** Provider route id. */
|
|
51
|
-
@@ -
|
|
51
|
+
@@ -219,6 +222,10 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
|
|
52
52
|
const root = useMemo(() => schema.rehydrate(namespace.schema), [namespace.schema, schema])
|
|
53
53
|
const node = useMemo(() => schema.nodeAtPath(root, settingsPath), [root, schema, settingsPath])
|
|
54
54
|
const fallback = schema.getPath(namespace.value, settingsPath)
|
|
@@ -59,7 +59,7 @@ index 262f8c9d55..c1789d7813 100644
|
|
|
59
59
|
const disabled = props.readOnly || busy
|
|
60
60
|
const layout = layoutOf(namespace.ns)
|
|
61
61
|
const keyRef = refFor(schema, namespace, settingsPath, props.provider)
|
|
62
|
-
@@ -
|
|
62
|
+
@@ -235,6 +242,11 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
|
|
63
63
|
const value = schema.getPath(source, [key])
|
|
64
64
|
return typeof value === 'string' && value.trim().length > 0 ? value : undefined
|
|
65
65
|
}
|
|
@@ -71,17 +71,18 @@ index 262f8c9d55..c1789d7813 100644
|
|
|
71
71
|
const setField = (key: string, next: string | undefined): void => {
|
|
72
72
|
// A value of nothing but whitespace is cleared, not stored: `stringAt`
|
|
73
73
|
// already reports it as absent, so the field would otherwise render empty
|
|
74
|
-
@@ -
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
74
|
+
@@ -294,7 +306,9 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
|
|
75
|
+
? 'keyRequired' as const
|
|
76
|
+
: undefined
|
|
77
|
+
const shownKeyFailure = credentialRequiredFailure ?? keyFailure
|
|
78
|
+
- // An edited-but-unsaved endpoint, and a key typed but not yet stored.
|
|
78
79
|
+ const omitReasoningInputStatus = schema.hasPath(draft, OMIT_REASONING_INPUT_STATUS_PATH)
|
|
79
80
|
+ ? schema.getPath(draft, OMIT_REASONING_INPUT_STATUS_PATH) === true
|
|
80
81
|
+ : schema.getPath(fallback, OMIT_REASONING_INPUT_STATUS_PATH) === true
|
|
81
82
|
const probeBaseURL = stringAt(draft, 'baseURL') ?? stringAt(fallback, 'baseURL')
|
|
82
83
|
const probe = {
|
|
83
84
|
settingsNs: namespace.ns,
|
|
84
|
-
@@ -
|
|
85
|
+
@@ -579,7 +593,15 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
|
|
85
86
|
value={probeApi ?? ''}
|
|
86
87
|
aria-label={t('customApi')}
|
|
87
88
|
disabled={disabled}
|
|
@@ -98,10 +99,10 @@ index 262f8c9d55..c1789d7813 100644
|
|
|
98
99
|
>
|
|
99
100
|
{/* A profile naming no protocol — hand-written into
|
|
100
101
|
cordis.patch.yml with no model to need one — selects
|
|
101
|
-
@@ -
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
@@ -611,6 +633,24 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
105
106
|
+ {family === 'pi-ai' && probeApi === 'openai-responses'
|
|
106
107
|
+ ? (
|
|
107
108
|
+ <label className={styles['settingToggle']}>
|
|
@@ -124,83 +125,92 @@ index 262f8c9d55..c1789d7813 100644
|
|
|
124
125
|
the extras differ — DeepSeek's inherited capacities, pi-ai's
|
|
125
126
|
endpoint interrogation. */}
|
|
126
127
|
diff --git a/packages/client/ui-settings-models/src/client/locales.ts b/packages/client/ui-settings-models/src/client/locales.ts
|
|
127
|
-
index
|
|
128
|
+
index 5dec1bda..f596cd47 100644
|
|
128
129
|
--- a/packages/client/ui-settings-models/src/client/locales.ts
|
|
129
130
|
+++ b/packages/client/ui-settings-models/src/client/locales.ts
|
|
130
|
-
@@ -
|
|
131
|
-
protocolOpenAiCompletions: 'OpenAI Chat Completions',
|
|
131
|
+
@@ -156,6 +156,7 @@ export const en = {
|
|
132
132
|
protocolOpenAiResponses: 'OpenAI Responses',
|
|
133
133
|
protocolAnthropicMessages: 'Anthropic Messages',
|
|
134
|
+
protocolGemini: 'Gemini API',
|
|
134
135
|
+ omitReasoningInputStatus: 'Gateway compatibility mode',
|
|
135
136
|
customNeedsBaseUrl: 'A custom provider needs a base URL.',
|
|
136
137
|
customBaseUrlInvalid: 'Enter a valid HTTP or HTTPS URL.',
|
|
137
138
|
customNeedsModels: 'A custom provider needs at least one model.',
|
|
138
|
-
@@ -
|
|
139
|
-
protocolOpenAiCompletions: 'OpenAI Chat Completions',
|
|
139
|
+
@@ -336,7 +337,8 @@ export const zh: { [Key in keyof typeof en]: string } = {
|
|
140
140
|
protocolOpenAiResponses: 'OpenAI Responses',
|
|
141
141
|
protocolAnthropicMessages: 'Anthropic Messages',
|
|
142
|
+
protocolGemini: 'Gemini API',
|
|
142
143
|
- customNeedsBaseUrl: '自定义模型 API 需要填写 API 地址。',
|
|
143
144
|
+ omitReasoningInputStatus: '中转站兼容模式',
|
|
144
145
|
+ customNeedsBaseUrl: '自定义提供方需要填写 API 地址。',
|
|
145
146
|
customBaseUrlInvalid: '请输入有效的 HTTP 或 HTTPS 地址。',
|
|
146
147
|
customNeedsModels: '自定义模型 API 至少需要一个模型。',
|
|
147
148
|
customBaseUrlPlaceholder: 'https://gateway.example/v1',
|
|
148
|
-
@@ -
|
|
149
|
-
'protocolOpenAiCompletions': 'OpenAI Chat Completions',
|
|
149
|
+
@@ -513,6 +515,7 @@ export const ja = {
|
|
150
150
|
'protocolOpenAiResponses': 'OpenAI Responses',
|
|
151
151
|
'protocolAnthropicMessages': 'Anthropic Messages',
|
|
152
|
+
'protocolGemini': 'Gemini API',
|
|
152
153
|
+ 'omitReasoningInputStatus': 'ゲートウェイ互換モード',
|
|
153
154
|
'customNeedsBaseUrl': 'カスタムプロバイダーにはベースURLが必要です。',
|
|
154
155
|
'customBaseUrlInvalid': '有効なHTTPまたはHTTPSのURLを入力してください。',
|
|
155
156
|
'customNeedsModels': 'カスタムプロバイダーには少なくとも1つのモデルが必要です。',
|
|
156
|
-
@@ -
|
|
157
|
-
protocolOpenAiCompletions: 'Finalizaciones del chat OpenAI',
|
|
157
|
+
@@ -690,6 +693,7 @@ export const es = {
|
|
158
158
|
protocolOpenAiResponses: 'Respuestas de OpenAI',
|
|
159
159
|
protocolAnthropicMessages: 'Mensajes antrópicos',
|
|
160
|
+
protocolGemini: 'Gemini API',
|
|
160
161
|
+ omitReasoningInputStatus: 'Modo de compatibilidad de la puerta de enlace',
|
|
161
162
|
customNeedsBaseUrl: 'Un proveedor personalizado necesita una URL base.',
|
|
162
163
|
customBaseUrlInvalid: 'Ingrese una URL HTTP o HTTPS válida.',
|
|
163
164
|
customNeedsModels: 'Un proveedor personalizado necesita al menos un modelo.',
|
|
164
|
-
@@ -
|
|
165
|
-
protocolOpenAiCompletions: 'Achèvements du chat OpenAI',
|
|
165
|
+
@@ -867,6 +871,7 @@ export const fr = {
|
|
166
166
|
protocolOpenAiResponses: 'Réponses OpenAI',
|
|
167
167
|
protocolAnthropicMessages: 'Messages anthropiques',
|
|
168
|
+
protocolGemini: 'Gemini API',
|
|
168
169
|
+ omitReasoningInputStatus: 'Mode de compatibilité de la passerelle',
|
|
169
170
|
customNeedsBaseUrl: "Un fournisseur personnalisé a besoin d'une URL de base.",
|
|
170
171
|
customBaseUrlInvalid: 'Saisissez une URL HTTP ou HTTPS valide.',
|
|
171
172
|
customNeedsModels: "Un fournisseur personnalisé a besoin d'au moins un modèle.",
|
|
172
|
-
@@ -
|
|
173
|
-
protocolOpenAiCompletions: 'OpenAI-Chat-Abschlüsse',
|
|
173
|
+
@@ -1044,6 +1049,7 @@ export const de = {
|
|
174
174
|
protocolOpenAiResponses: 'OpenAI-Antworten',
|
|
175
175
|
protocolAnthropicMessages: 'Anthropische Botschaften',
|
|
176
|
+
protocolGemini: 'Gemini API',
|
|
176
177
|
+ omitReasoningInputStatus: 'Gateway-Kompatibilitätsmodus',
|
|
177
178
|
customNeedsBaseUrl: 'Ein benutzerdefinierter Anbieter benötigt eine Basis-URL.',
|
|
178
179
|
customBaseUrlInvalid: 'Geben Sie eine gültige HTTP- oder HTTPS-URL ein.',
|
|
179
180
|
customNeedsModels: 'Ein benutzerdefinierter Anbieter benötigt mindestens ein Modell.',
|
|
180
|
-
@@ -
|
|
181
|
-
protocolOpenAiCompletions: 'Завершения чата OpenAI',
|
|
181
|
+
@@ -1221,6 +1227,7 @@ export const ru = {
|
|
182
182
|
protocolOpenAiResponses: 'Ответы OpenAI',
|
|
183
183
|
protocolAnthropicMessages: 'Антропные сообщения',
|
|
184
|
+
protocolGemini: 'Gemini API',
|
|
184
185
|
+ omitReasoningInputStatus: 'Режим совместимости со шлюзом',
|
|
185
186
|
customNeedsBaseUrl: 'Пользовательскому поставщику нужен базовый URL-адрес.',
|
|
186
187
|
customBaseUrlInvalid: 'Введите действительный URL-адрес HTTP или HTTPS.',
|
|
187
188
|
customNeedsModels: 'Пользовательскому поставщику нужна хотя бы одна модель.',
|
|
188
|
-
@@ -
|
|
189
|
-
protocolOpenAiCompletions: 'Conclusões do bate-papo OpenAI',
|
|
189
|
+
@@ -1398,6 +1405,7 @@ export const pt = {
|
|
190
190
|
protocolOpenAiResponses: 'Respostas OpenAI',
|
|
191
191
|
protocolAnthropicMessages: 'Mensagens Antrópicas',
|
|
192
|
+
protocolGemini: 'Gemini API',
|
|
192
193
|
+ omitReasoningInputStatus: 'Modo de compatibilidade do gateway',
|
|
193
194
|
customNeedsBaseUrl: 'Um provedor personalizado precisa de um URL base.',
|
|
194
195
|
customBaseUrlInvalid: 'Insira um URL HTTP ou HTTPS válido.',
|
|
195
196
|
customNeedsModels: 'Um provedor personalizado precisa de pelo menos um modelo.',
|
|
196
197
|
diff --git a/packages/llm/llm-pi-ai/src/adapter.ts b/packages/llm/llm-pi-ai/src/adapter.ts
|
|
197
|
-
index
|
|
198
|
+
index f3f9ac00..f5ef95a1 100644
|
|
198
199
|
--- a/packages/llm/llm-pi-ai/src/adapter.ts
|
|
199
200
|
+++ b/packages/llm/llm-pi-ai/src/adapter.ts
|
|
200
|
-
@@ -
|
|
201
|
+
@@ -58,7 +58,7 @@ import type {
|
|
202
|
+
} from '@deepseek-ai/dsh-llm'
|
|
203
|
+
import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'
|
|
204
|
+
import { idleWatchdog, timeoutOf } from '@deepseek-ai/dsh-timeout'
|
|
205
|
+
-import type { ResolvedPiAiProviderProfile } from './config.ts'
|
|
206
|
+
+import type { PiAiReasoningSummary, ResolvedPiAiProviderProfile } from './config.ts'
|
|
207
|
+
import { requestImageTarget, toPiContext } from './context.ts'
|
|
208
|
+
import { conversationUpdates, createModels, getSupportedThinkingLevels } from './models.ts'
|
|
209
|
+
import { toStreamChunks } from './stream.ts'
|
|
210
|
+
@@ -145,9 +145,85 @@ export interface PiAiAuthInjection {
|
|
201
211
|
authContext: AuthContext
|
|
202
212
|
}
|
|
203
|
-
|
|
213
|
+
|
|
204
214
|
+/** Whether one Responses input item is replayed reasoning with response status metadata. */
|
|
205
215
|
+function hasReasoningInputStatus(item: unknown): boolean {
|
|
206
216
|
+ const inputItem = item as Record<string, unknown>
|
|
@@ -218,26 +228,167 @@ index 9c8b4d3f60..b179b11883 100644
|
|
|
218
228
|
+ })
|
|
219
229
|
+ return { ...request, input }
|
|
220
230
|
+}
|
|
231
|
+
+
|
|
232
|
+
+/**
|
|
233
|
+
+ * Force one model's `reasoning.summary` to a chosen spelling, or drop it.
|
|
234
|
+
+ *
|
|
235
|
+
+ * pi-ai writes `summary: options?.reasoningSummary || 'auto'` whenever a
|
|
236
|
+
+ * Responses model reasons, so the field leaves even when nothing asked for it.
|
|
237
|
+
+ * A gateway that refuses the field therefore fails every reply from that model
|
|
238
|
+
+ * rather than merely omitting a summary, and only a payload hook can keep the
|
|
239
|
+
+ * field off the wire.
|
|
240
|
+
+ * @param payload - the request body pi-ai built.
|
|
241
|
+
+ * @param summary - the configured spelling, or `omit` to drop the field.
|
|
242
|
+
+ * @returns the adjusted body, or undefined to leave the request untouched.
|
|
243
|
+
+ */
|
|
244
|
+
+function applyReasoningSummary(payload: unknown, summary: PiAiReasoningSummary): unknown {
|
|
245
|
+
+ const request = payload as Record<string, unknown> & { reasoning?: Record<string, unknown> }
|
|
246
|
+
+ if (request.reasoning === undefined) return undefined
|
|
247
|
+
+ if (summary === 'omit') {
|
|
248
|
+
+ const { summary: _summary, ...reasoning } = request.reasoning
|
|
249
|
+
+ return { ...request, reasoning }
|
|
250
|
+
+ }
|
|
251
|
+
+ return { ...request, reasoning: { ...request.reasoning, summary } }
|
|
252
|
+
+}
|
|
253
|
+
+
|
|
254
|
+
+/**
|
|
255
|
+
+ * The payload hook a model needs, if any.
|
|
256
|
+
+ *
|
|
257
|
+
+ * One hook field is a function, so a model needing both adjustments gets a
|
|
258
|
+
+ * composition rather than one silently replacing the other.
|
|
259
|
+
+ * @param profile - the resolved route profile.
|
|
260
|
+
+ * @param model - the model being called, which may pin its own summary.
|
|
261
|
+
+ * @returns the `onPayload` option for this call, or an empty object.
|
|
262
|
+
+ */
|
|
263
|
+
+function payloadOptions(
|
|
264
|
+
+ profile: ResolvedPiAiProviderProfile,
|
|
265
|
+
+ model: Model<Api>,
|
|
266
|
+
+): { onPayload?: (payload: unknown, model: Model<Api>) => unknown } {
|
|
267
|
+
+ const hooks: ((payload: unknown) => unknown)[] = []
|
|
268
|
+
+ if (profile.responsesCompatibility?.omitReasoningInputStatus === true) hooks.push(omitReasoningInputStatus)
|
|
269
|
+
+ const summary = (model as { reasoningSummary?: PiAiReasoningSummary }).reasoningSummary
|
|
270
|
+
+ if (summary !== undefined) hooks.push(payload => applyReasoningSummary(payload, summary))
|
|
271
|
+
+ const [first, ...rest] = hooks
|
|
272
|
+
+ if (first === undefined) return {}
|
|
273
|
+
+ if (rest.length === 0) return { onPayload: first }
|
|
274
|
+
+ return {
|
|
275
|
+
+ onPayload: (payload: unknown): unknown => {
|
|
276
|
+
+ let current = payload
|
|
277
|
+
+ let changed = false
|
|
278
|
+
+ for (const hook of hooks) {
|
|
279
|
+
+ const next = hook(current)
|
|
280
|
+
+ if (next === undefined) continue
|
|
281
|
+
+ current = next
|
|
282
|
+
+ changed = true
|
|
283
|
+
+ }
|
|
284
|
+
+ return changed ? current : undefined
|
|
285
|
+
+ },
|
|
286
|
+
+ }
|
|
287
|
+
+}
|
|
221
288
|
+
|
|
222
289
|
/** Copy profile stream knobs into pi-ai's common option vocabulary. */
|
|
223
290
|
function profileOptions(
|
|
224
291
|
profile: ResolvedPiAiProviderProfile,
|
|
225
|
-
|
|
292
|
+
+ model: Model<Api>,
|
|
293
|
+
reasoning: ModelThinkingLevel | undefined,
|
|
294
|
+
apiKey: string | undefined,
|
|
295
|
+
): SimpleStreamOptions {
|
|
296
|
+
@@ -160,6 +236,7 @@ function profileOptions(
|
|
226
297
|
...profile.transport === undefined ? {} : { transport: profile.transport },
|
|
227
298
|
...profile.timeoutMs === undefined ? {} : { timeoutMs: profile.timeoutMs },
|
|
228
299
|
...profile.websocketConnectTimeoutMs === undefined ? {} : { websocketConnectTimeoutMs: profile.websocketConnectTimeoutMs },
|
|
229
|
-
+ ...profile
|
|
300
|
+
+ ...payloadOptions(profile, model),
|
|
230
301
|
// The agent recovery layer owns visible attempts; one adapter call is one SDK attempt.
|
|
231
302
|
maxRetries: 0,
|
|
232
303
|
}
|
|
304
|
+
@@ -473,7 +550,7 @@ export class PiAiAdapter extends LlmAdapter {
|
|
305
|
+
this.config.onThinkingOmitted?.({ provider: options.provider, model: options.model, count })
|
|
306
|
+
})
|
|
307
|
+
const events = snapshot.models.streamSimple(model, context, {
|
|
308
|
+
- ...profileOptions(profile, reasoning, apiKey),
|
|
309
|
+
+ ...profileOptions(profile, model, reasoning, apiKey),
|
|
310
|
+
...options.temperature === undefined ? {} : { temperature: options.temperature },
|
|
311
|
+
...options.maxTokens === undefined ? {} : { maxTokens: options.maxTokens },
|
|
312
|
+
...options.sessionId === undefined ? {} : { sessionId: String(options.sessionId) },
|
|
313
|
+
diff --git a/packages/llm/llm-pi-ai/src/catalog.ts b/packages/llm/llm-pi-ai/src/catalog.ts
|
|
314
|
+
index b2103095..cd903ab0 100644
|
|
315
|
+
--- a/packages/llm/llm-pi-ai/src/catalog.ts
|
|
316
|
+
+++ b/packages/llm/llm-pi-ai/src/catalog.ts
|
|
317
|
+
@@ -600,6 +600,29 @@ function assertOfferedCompatFields(
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
+/**
|
|
322
|
+
+ * How one model's `reasoning.summary` leaves for an OpenAI Responses upstream.
|
|
323
|
+
+ *
|
|
324
|
+
+ * `auto`, `concise`, and `detailed` are the values the OpenAI Responses schema
|
|
325
|
+
+ * accepts, so naming one pins the field. `omit` drops it instead.
|
|
326
|
+
+ */
|
|
327
|
+
+export type PiAiReasoningSummary = 'auto' | 'concise' | 'detailed' | 'omit'
|
|
328
|
+
+
|
|
329
|
+
+/**
|
|
330
|
+
+ * The `reasoning.summary` spellings a profile may declare. A drift gate like
|
|
331
|
+
+ * the modality and thinking-level ones, so a new upstream spelling fails
|
|
332
|
+
+ * compilation here until it is classified.
|
|
333
|
+
+ */
|
|
334
|
+
+const REASONING_SUMMARY_GATE: Record<PiAiReasoningSummary, true> = {
|
|
335
|
+
+ auto: true,
|
|
336
|
+
+ concise: true,
|
|
337
|
+
+ detailed: true,
|
|
338
|
+
+ omit: true,
|
|
339
|
+
+}
|
|
340
|
+
+
|
|
341
|
+
+/** Every `reasoning.summary` spelling a profile may declare. */
|
|
342
|
+
+export const REASONING_SUMMARIES = Object.keys(REASONING_SUMMARY_GATE) as readonly PiAiReasoningSummary[]
|
|
343
|
+
+
|
|
344
|
+
/** One configured model entry: an id plus the catalog fields it overrides. */
|
|
345
|
+
export interface PiAiModelProfile {
|
|
346
|
+
/** Model id sent to the provider and accepted by {@link GenerateOptions.model}. */
|
|
347
|
+
@@ -637,6 +660,16 @@ export interface PiAiModelProfile {
|
|
348
|
+
reasoningEfforts?: false | PiAiReasoningEfforts
|
|
349
|
+
/** pi-ai wire-compatibility switches for this model, winning over the route's per field; one its protocol does not declare is refused. */
|
|
350
|
+
compat?: PiAiCompatProfile
|
|
351
|
+
+ /**
|
|
352
|
+
+ * How this model's `reasoning.summary` leaves for an OpenAI Responses
|
|
353
|
+
+ * upstream. Absent keeps pi-ai's own default (`auto`).
|
|
354
|
+
+ *
|
|
355
|
+
+ * `omit` is for a gateway that refuses the field outright: pi-ai writes
|
|
356
|
+
+ * `summary: options?.reasoningSummary || 'auto'` whenever a Responses model
|
|
357
|
+
+ * reasons, so without this knob such a gateway fails every reply from that
|
|
358
|
+
+ * model rather than merely losing a summary.
|
|
359
|
+
+ */
|
|
360
|
+
+ reasoningSummary?: PiAiReasoningSummary
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
@@ -957,6 +990,7 @@ export function resolveRouteModels(
|
|
365
|
+
maxTokens,
|
|
366
|
+
...resolveModelReasoning(provider, entry, base),
|
|
367
|
+
...resolveModelCompat(provider, entry, request.compat, base, api),
|
|
368
|
+
+ ...entry.reasoningSummary === undefined ? {} : { reasoningSummary: entry.reasoningSummary },
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const models: Model<Api>[] = []
|
|
233
372
|
diff --git a/packages/llm/llm-pi-ai/src/config.ts b/packages/llm/llm-pi-ai/src/config.ts
|
|
234
|
-
index
|
|
373
|
+
index 9de6c441..3f918b9b 100644
|
|
235
374
|
--- a/packages/llm/llm-pi-ai/src/config.ts
|
|
236
375
|
+++ b/packages/llm/llm-pi-ai/src/config.ts
|
|
237
|
-
@@ -
|
|
376
|
+
@@ -29,6 +29,7 @@ import {
|
|
377
|
+
MODALITIES,
|
|
378
|
+
PiAiCatalogError,
|
|
379
|
+
resolveRouteModels,
|
|
380
|
+
+ REASONING_SUMMARIES,
|
|
381
|
+
SUPPORTED_THINKING_FORMATS,
|
|
382
|
+
THINKING_LEVELS,
|
|
383
|
+
THINKING_TOKEN_BUDGET_FIELDS,
|
|
384
|
+
@@ -98,9 +99,16 @@ export type {
|
|
385
|
+
PiAiModelOverride,
|
|
386
|
+
PiAiModelProfile,
|
|
387
|
+
PiAiReasoningEfforts,
|
|
388
|
+
+ PiAiReasoningSummary,
|
|
238
389
|
PiAiThinkingFormat,
|
|
239
390
|
} from './catalog.ts'
|
|
240
|
-
|
|
391
|
+
|
|
241
392
|
+/** OpenAI Responses input-item adjustments for compatible gateways. */
|
|
242
393
|
+export interface PiAiResponsesCompatibility {
|
|
243
394
|
+ /** Omit response-only status metadata from replayed reasoning input items. */
|
|
@@ -247,7 +398,7 @@ index 3731e1bcc0..c0422f4d6f 100644
|
|
|
247
398
|
/** Configuration for one pi-ai provider route; the `providers` dict key IS the route. */
|
|
248
399
|
export interface PiAiProviderProfile {
|
|
249
400
|
/** Credential reference (environment-variable name) resolved per request through `ctx.credentials`. */
|
|
250
|
-
@@ -
|
|
401
|
+
@@ -138,6 +146,8 @@ export interface PiAiProviderProfile {
|
|
251
402
|
* refused rather than left looking applied.
|
|
252
403
|
*/
|
|
253
404
|
compat?: PiAiCompatProfile
|
|
@@ -256,10 +407,18 @@ index 3731e1bcc0..c0422f4d6f 100644
|
|
|
256
407
|
/**
|
|
257
408
|
* Context capacity for a model this route lists that neither the entry nor
|
|
258
409
|
* the installed catalog sizes (default 1,000,000). A guess by construction, so
|
|
259
|
-
@@ -
|
|
410
|
+
@@ -342,6 +352,7 @@ const modelFields = {
|
|
411
|
+
// installed catalog's capability", while `false` disables reasoning.
|
|
412
|
+
reasoningEfforts: z.union([z.const(false), reasoningEfforts]),
|
|
413
|
+
compat: compatProfile,
|
|
414
|
+
+ reasoningSummary: z.union(REASONING_SUMMARIES),
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const modelProfile: z<PiAiModelProfile> = z.object({
|
|
418
|
+
@@ -352,6 +363,10 @@ const modelProfile: z<PiAiModelProfile> = z.object({
|
|
260
419
|
/** A {@link modelProfile} whose id lives in the `modelOverrides` dict key. */
|
|
261
420
|
const modelOverride: z<PiAiModelOverride> = z.object(modelFields)
|
|
262
|
-
|
|
421
|
+
|
|
263
422
|
+const responsesCompatibility: z<PiAiResponsesCompatibility> = z.object({
|
|
264
423
|
+ omitReasoningInputStatus: z.boolean(),
|
|
265
424
|
+})
|
|
@@ -267,7 +426,7 @@ index 3731e1bcc0..c0422f4d6f 100644
|
|
|
267
426
|
const profile = z.object({
|
|
268
427
|
apiKeyEnv: z.string().role('credential-ref'),
|
|
269
428
|
displayName: z.string(),
|
|
270
|
-
@@ -
|
|
429
|
+
@@ -360,6 +375,7 @@ const profile = z.object({
|
|
271
430
|
models: z.array(modelProfile),
|
|
272
431
|
modelOverrides: z.dict(modelOverride),
|
|
273
432
|
compat: compatProfile,
|
|
@@ -275,7 +434,7 @@ index 3731e1bcc0..c0422f4d6f 100644
|
|
|
275
434
|
defaultContextWindow: z.number().step(1).min(1).default(DEFAULT_CONTEXT_WINDOW),
|
|
276
435
|
defaultMaxTokens: z.number().step(1).min(1).default(DEFAULT_MAX_TOKENS),
|
|
277
436
|
defaultInput: z.array(z.union(MODALITIES)).default([...DEFAULT_INPUT]),
|
|
278
|
-
@@ -
|
|
437
|
+
@@ -457,6 +473,11 @@ export function resolveProfiles(
|
|
279
438
|
throw new Error(`llm-pi-ai: provider "${provider}" has an empty displayName`)
|
|
280
439
|
}
|
|
281
440
|
assertValidHeaders(provider, source.headers)
|