@lincyaw/dsh 0.2.0-rc.10 → 0.2.0-rc.101

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.
@@ -0,0 +1,15 @@
1
+ const zh = {
2
+ opening: '正在打开工作区…',
3
+ failed: '无法打开工作区。可以重试,或查看详细信息。',
4
+ slow: '打开工作区所需时间较长,你可以继续等待或重试。',
5
+ retry: '重试', details: '详细信息',
6
+ }
7
+ export const STARTUP_MESSAGES = {
8
+ 'zh-CN': zh,
9
+ en: {
10
+ opening: 'Opening your workspace…',
11
+ failed: 'The workspace could not open. Retry or view details.',
12
+ slow: 'Opening the workspace is taking longer than usual. You can keep waiting or retry.',
13
+ retry: 'Retry', details: 'Details',
14
+ } satisfies typeof zh,
15
+ }
@@ -2,7 +2,7 @@ import { z } from 'zod'
2
2
 
3
3
  /** One authenticated Studio socket carries these existing workspace subscriptions. */
4
4
  export const WORKSPACE_EVENTS_PATH = '/api/presmium/events'
5
- export const WORKSPACE_EVENT_TOPICS = ['document', 'diagnostics', 'review', 'ir', 'jobs'] as const
5
+ export const WORKSPACE_EVENT_TOPICS = ['document', 'diagnostics', 'review', 'ir', 'jobs', 'agent-activity'] as const
6
6
  const subscriptionId = z.string().min(1).max(80)
7
7
 
8
8
  const viewerSite = z.strictObject({ type: z.literal('subscribe'), id: subscriptionId, topic: z.literal('viewer-site'), document: z.string().max(1024), app: z.string().max(200), lang: z.string().max(80), form: z.enum(['web', 'slides']) })
@@ -12,6 +12,7 @@ const approvals = z.strictObject({ type: z.literal('subscribe'), id: subscriptio
12
12
 
13
13
  export const workspaceEventCommand = z.union([
14
14
  z.strictObject({ type: z.literal('subscribe'), id: subscriptionId, topic: z.literal('authoring-client'), document: z.string().max(1024), clientId: subscriptionId, epoch: subscriptionId, snapshot: z.unknown() }),
15
+ z.strictObject({ type: z.literal('subscribe'), id: subscriptionId, topic: z.literal('authoring-window'), clientId: subscriptionId, epoch: subscriptionId, snapshot: z.unknown() }),
15
16
  z.strictObject({ type: z.literal('authoring-client-publish'), id: subscriptionId, connectionId: subscriptionId, sequence: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), kind: z.enum(['state', 'ack']), value: z.unknown() }),
16
17
  viewerSite, viewerControl, approvals,
17
18
  z.strictObject({ type: z.literal('subscribe'), id: subscriptionId, topic: z.enum(WORKSPACE_EVENT_TOPICS), document: z.string().max(1024) }),
@@ -26,6 +27,6 @@ export const workspaceEventMessage = z.discriminatedUnion('type', [
26
27
  z.strictObject({ type: z.literal('event'), id: subscriptionId, event: z.string().max(40).optional(), data: z.string() }),
27
28
  ])
28
29
 
29
- export type WorkspaceEventTopic = typeof WORKSPACE_EVENT_TOPICS[number] | 'viewer-site' | 'viewer-control' | 'approvals' | 'authoring-client'
30
+ export type WorkspaceEventTopic = typeof WORKSPACE_EVENT_TOPICS[number] | 'viewer-site' | 'viewer-control' | 'approvals' | 'authoring-client' | 'authoring-window'
30
31
  export type WorkspaceEventCommand = z.infer<typeof workspaceEventCommand>
31
32
  export type WorkspaceEventMessage = z.infer<typeof workspaceEventMessage>
@@ -1,37 +0,0 @@
1
- import { PmMascot, PmSegmented, setMascotEnabled, useAssistantMascot, useMascotEnabled, WorkbenchProvider } from '@lincyaw/workbench'
2
- import type { Workbench } from '@lincyaw/workbench'
3
- import { MASCOT_SETTING, MASCOT_SLOT } from './contract.ts'
4
- import { useClientMessages } from './messages.ts'
5
-
6
- /** The session header's standard prop: a selector over the bound session's snapshot. */
7
- type UseSession = <T>(select: (snapshot: { running?: boolean }) => T) => T
8
-
9
- function Kitten({ running }: { running: boolean }) {
10
- return <span className="pmw-conversation-mascot"><PmMascot size="small" action={useAssistantMascot(running)} /></span>
11
- }
12
-
13
- function MascotSetting({ workbench }: { workbench: Workbench }) {
14
- const t = useClientMessages(workbench)
15
- const on = useMascotEnabled()
16
- return (
17
- <div className="pmw-mascot-setting pm-ui" data-pmw-setting="mascot">
18
- <div className="pmw-mascot-setting__copy">
19
- <p className="pmw-mascot-setting__title">{t.mascot}</p>
20
- <p className="pmw-mascot-setting__hint">{t.mascotHint}</p>
21
- </div>
22
- <PmSegmented label={t.mascot} value={on ? 'show' : 'hide'} options={[{ value: 'show', label: t.mascotShow }, { value: 'hide', label: t.mascotHide }]} onChange={value => setMascotEnabled(value === 'show')} />
23
- </div>
24
- )
25
- }
26
-
27
- /** Puts the kitten in the conversation's header, where it acts out what the assistant is doing, and its switch in
28
- * Settings → General. */
29
- export function registerMascot(ctx: DshClientContext, workbench: Workbench): void {
30
- ctx.effect(() => ctx.slots.inject(MASCOT_SLOT.name, () => ctx.slots.register({ name: MASCOT_SLOT.name, id: MASCOT_SLOT.id, order: -100 }, ({ useSession }: { useSession: UseSession }) => {
31
- const running = useSession(snapshot => Boolean(snapshot.running))
32
- return <WorkbenchProvider workbench={workbench}><Kitten running={running} /></WorkbenchProvider>
33
- })), 'presmium: the kitten beside the conversation')
34
- ctx.effect(() => ctx.slots.inject(MASCOT_SETTING.name, () => ctx.slots.register({ name: MASCOT_SETTING.name, id: MASCOT_SETTING.id, order: 1000 }, () => (
35
- <WorkbenchProvider workbench={workbench}><MascotSetting workbench={workbench} /></WorkbenchProvider>
36
- ))), 'presmium: the kitten\'s switch in Settings')
37
- }