remote-default-responses.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Default responses for every Remote endpoint the web assembly calls while
  3. * booting and rendering with no sessions, no workspaces, and default settings.
  4. * The comment above each row names the plugin that calls it; endpoints boot
  5. * never touches stay absent so a new call fails loud. `$events` is built into
  6. * `RemoteMock`.
  7. * @module @deepseek-ai/dsh-client-test-runtime/src/assembly/remote-default-responses
  8. */
  9. import { ok, openStream, type RemoteTable } from '@deepseek-ai/dsh-remote-mock'
  10. /** Default responses of the boot-time Remote endpoints; a spec loads it first and layers its own table on top. */
  11. export const remoteDefaultResponses: RemoteTable = {
  12. unary: {
  13. // api-session-controller `sessions.handleConnected()` on `connection/reset`.
  14. 'session/list': ok({ items: [] }),
  15. // ui-settings `mirror.ensure()` at apply and again on `connection/reset`.
  16. 'settings/describe': ok({ writable: true, hasDocument: false, namespaces: [] }),
  17. // ui-model-selection `ModelDirectoryResolver` constructor.
  18. 'session/modelCatalog': ok({
  19. default: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
  20. routableProviders: [],
  21. groups: [],
  22. failures: [],
  23. }),
  24. // ui-agent-preset hero chip and header label on first mount.
  25. 'agentPresets/list': ok({ presets: [], authorable: false }),
  26. // cordis-client-runner `ClientCordisInspectRegistry.sync` at apply and on `connection/reset`.
  27. 'dynamicCordisRunner/syncInspectManifest': ok(null),
  28. // ui-cordis inventory at apply and on `connection/reset`.
  29. 'dynamicCordisRunner/inventory': ok([]),
  30. // ui-settings-plugins web-search card `readCredential()` when the settings mirror first publishes.
  31. 'credentials/describe': ok({}),
  32. },
  33. // Stream endpoints the roster opens later than boot; declared so a spec that forgets the script gets a stream miss.
  34. streams: [
  35. // api-session-controller `SessionEventStream.follow` when a Session opens.
  36. 'session/follow',
  37. ],
  38. stream: {
  39. // api-session-controller client `apply`: the control stream's opening baseline, then open.
  40. 'session/control': openStream([{ type: 'baseline', value: { queues: {}, jobs: {}, projections: {} } }]),
  41. // api-workspace-controller client `apply`: the follow stream's opening baseline, then open.
  42. 'workspace/follow': openStream([{ type: 'baseline', value: { items: [], archivedSessionIds: [] } }]),
  43. },
  44. }