@deepseek-ai/dsh-client-test-runtime 0.2.2-rc.5 → 0.2.3-alpha.2
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/lib/index.js +78 -38
- package/lib/types/assembly/bundle-roster.d.ts.map +1 -1
- package/lib/types/assembly/bundle-roster.js.map +1 -1
- package/lib/types/assembly/remote-default-responses.d.ts.map +1 -1
- package/lib/types/assembly/remote-default-responses.js.map +1 -1
- package/lib/types/assembly/remote-proxies.d.ts +4 -3
- package/lib/types/assembly/remote-proxies.d.ts.map +1 -1
- package/lib/types/assembly/remote-proxies.js.map +1 -1
- package/lib/types/assembly/test-client.d.ts.map +1 -1
- package/lib/types/assembly/test-client.js.map +1 -1
- package/lib/types/index.d.ts +6 -3
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/remote.d.ts +13 -1
- package/lib/types/remote.d.ts.map +1 -1
- package/lib/types/remote.js.map +1 -1
- package/lib/types/sessions.d.ts.map +1 -1
- package/lib/types/sessions.js.map +1 -1
- package/lib/types/synced-config.d.ts +9 -0
- package/lib/types/synced-config.d.ts.map +1 -0
- package/lib/types/synced-config.js.map +1 -0
- package/package.json +59 -57
- package/src/assembly/bundle-roster.ts +4 -5
- package/src/assembly/modules.ts +1 -1
- package/src/assembly/remote-default-responses.ts +8 -0
- package/src/assembly/remote-proxies.ts +12 -4
- package/src/assembly/test-client.ts +3 -7
- package/src/index.ts +22 -4
- package/src/remote.ts +20 -1
- package/src/sessions.ts +20 -34
- package/src/synced-config.ts +12 -0
package/src/sessions.ts
CHANGED
|
@@ -7,10 +7,15 @@ import {
|
|
|
7
7
|
import type {
|
|
8
8
|
AgentContext, ISessions, ProjectionsFace, SessionBinding, SessionFace, SessionListState,
|
|
9
9
|
SessionEventLikeEntry, SessionLiveEventEntry, SessionSearchResultItem,
|
|
10
|
-
SessionReference, SessionReferenceSource, SessionRetainInfo, SessionRetainOptions,
|
|
10
|
+
SessionReference, SessionReferenceSource, SessionRetainFacet, SessionRetainInfo, SessionRetainOptions,
|
|
11
11
|
SessionSnapshot, SessionSummary, SessionTarget, SubmissionHandle,
|
|
12
12
|
} from '@deepseek-ai/dsh-api-session-controller/client'
|
|
13
13
|
import { scopeIdentityOf } from '@deepseek-ai/dsh-api-session-controller/src/client/scope.ts'
|
|
14
|
+
import {
|
|
15
|
+
EMPTY_RETAIN_INFO,
|
|
16
|
+
heldFacets,
|
|
17
|
+
shiftRetention,
|
|
18
|
+
} from '@deepseek-ai/dsh-api-session-controller/src/client/sessions/facets.ts'
|
|
14
19
|
import type { SessionRequestId } from '@deepseek-ai/dsh-api-session-controller/types'
|
|
15
20
|
import type { SubagentAddress } from '@deepseek-ai/dsh-subagent/client'
|
|
16
21
|
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
@@ -214,17 +219,8 @@ interface OpeningControl {
|
|
|
214
219
|
readonly reject: (error: unknown) => void
|
|
215
220
|
}
|
|
216
221
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
): SessionRetainInfo['retainedBy'] {
|
|
220
|
-
Object.setPrototypeOf(counts, null)
|
|
221
|
-
return Object.freeze(counts)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const EMPTY_RETAIN_INFO: SessionRetainInfo = Object.freeze({
|
|
225
|
-
referenceCount: 0,
|
|
226
|
-
retainedBy: freezeRetainedBy({}),
|
|
227
|
-
})
|
|
222
|
+
/** Fixture references default to a rendering use, so Conversation assembly runs as it does under a main view. */
|
|
223
|
+
const DEFAULT_TEST_RETAIN: SessionRetainOptions = { source: 'testFixture', facets: { conversation: true } }
|
|
228
224
|
|
|
229
225
|
// TestSessions implements SessionReference against its fixture-owned
|
|
230
226
|
// SessionGeneration without importing the production service's private record.
|
|
@@ -526,16 +522,17 @@ export class TestSessions implements ISessions {
|
|
|
526
522
|
/* jscpd:ignore-start -- The fixture intentionally mirrors production SessionReference acquisition and release semantics. */
|
|
527
523
|
retain(
|
|
528
524
|
target: SessionTarget,
|
|
529
|
-
options: SessionRetainOptions =
|
|
525
|
+
options: SessionRetainOptions = DEFAULT_TEST_RETAIN,
|
|
530
526
|
): SessionReference {
|
|
531
|
-
const { source, signal } = options
|
|
527
|
+
const { source, signal, facets } = options
|
|
532
528
|
signal?.throwIfAborted()
|
|
533
529
|
if (this.closed) throw new Error('test Session Controller is disposed')
|
|
534
530
|
const id = this.resolveTarget(target)
|
|
535
531
|
const generation = this.generations.get(id) ?? this.materialize(id, this.require(id))
|
|
536
|
-
const
|
|
532
|
+
const connected = options.connection !== false
|
|
533
|
+
const reference = this.retainGeneration(id, generation, source, heldFacets(facets), connected)
|
|
537
534
|
try {
|
|
538
|
-
reference.attachOpening(generation.opening, signal)
|
|
535
|
+
reference.attachOpening(connected ? generation.opening : Promise.resolve(), signal)
|
|
539
536
|
return reference
|
|
540
537
|
} catch (error: unknown) {
|
|
541
538
|
reference.release()
|
|
@@ -577,7 +574,7 @@ export class TestSessions implements ISessions {
|
|
|
577
574
|
retainFor(
|
|
578
575
|
ownerCtx: Context,
|
|
579
576
|
target: SessionTarget,
|
|
580
|
-
options: SessionRetainOptions =
|
|
577
|
+
options: SessionRetainOptions = DEFAULT_TEST_RETAIN,
|
|
581
578
|
): SessionReference {
|
|
582
579
|
const reference = this.retain(target, options)
|
|
583
580
|
try {
|
|
@@ -720,26 +717,15 @@ export class TestSessions implements ISessions {
|
|
|
720
717
|
id: SessionId,
|
|
721
718
|
generation: SessionGeneration,
|
|
722
719
|
source: SessionReferenceSource,
|
|
720
|
+
facets: readonly SessionRetainFacet[],
|
|
721
|
+
connected: boolean,
|
|
723
722
|
): TestSessionReference {
|
|
724
|
-
const
|
|
725
|
-
generation.retention =
|
|
726
|
-
referenceCount: previous.referenceCount + 1,
|
|
727
|
-
retainedBy: freezeRetainedBy({
|
|
728
|
-
...previous.retainedBy,
|
|
729
|
-
[source]: (previous.retainedBy[source] ?? 0) + 1,
|
|
730
|
-
}),
|
|
731
|
-
})
|
|
723
|
+
const use = { source, facets, connected }
|
|
724
|
+
generation.retention = shiftRetention(generation.retention, use, 1)
|
|
732
725
|
const reference = new TestSessionReference(id, generation, () => {
|
|
733
726
|
if (!generation.live) return
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const retainedBy = sourceCount > 1
|
|
737
|
-
? { ...otherSources, [source]: sourceCount - 1 }
|
|
738
|
-
: otherSources
|
|
739
|
-
generation.retention = count === 0
|
|
740
|
-
? EMPTY_RETAIN_INFO
|
|
741
|
-
: Object.freeze({ referenceCount: count, retainedBy: freezeRetainedBy(retainedBy) })
|
|
742
|
-
if (count === 0) this.drop(id, generation)
|
|
727
|
+
generation.retention = shiftRetention(generation.retention, use, -1)
|
|
728
|
+
if (generation.retention.referenceCount === 0) this.drop(id, generation)
|
|
743
729
|
else this.publishRetention(id)
|
|
744
730
|
})
|
|
745
731
|
this.publishRetention(id)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Synced Config objects for specs that mount a Client plugin face directly instead of through the page entry controller. */
|
|
2
|
+
import type { SyncedConfig, SyncedConfigValues } from '@deepseek-ai/dsh-client-config/types'
|
|
3
|
+
import { SyncedConfigEntry } from '@deepseek-ai/dsh-client-modules/src/client/synced-config.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Build the object a plugin activation receives as its `apply` config, holding fixed values.
|
|
7
|
+
* @param values - JSON values of the plugin's top-level volatile fields.
|
|
8
|
+
* @returns the activation's read-only Config object.
|
|
9
|
+
*/
|
|
10
|
+
export function syncedConfig<C>(values: SyncedConfigValues): SyncedConfig<C> {
|
|
11
|
+
return new SyncedConfigEntry(values).activate() as SyncedConfig<C>
|
|
12
|
+
}
|