dsh-input-traffic 0.3.0 → 0.3.1

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.
@@ -1,17 +1,17 @@
1
- import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
- import type { SteerQueueDockInjected } from './steer-queue-dock.tsx';
3
- /**
4
- * Full props of the composer-right entry.
5
- *
6
- * DUAL-VERSION: 0.1.1 delivers the `InputZone` owner share here, 0.1.2 renders
7
- * the slot with `{}` (`InputBar.tsx:466`). Only the session standard kit is
8
- * shared, so the type declares exactly that — reading `session`/`input` off
9
- * this slot is a compile error, not a 0.1.2 crash.
10
- */
11
- export type FreezeButtonProps = Pick<PropsRuntime<'conversation.input.right'>, 'useSession' | 'sessionId'> & SteerQueueDockInjected & PropsLocale<'steer'>;
12
- /**
13
- * Freeze/resume toggle for the peak-hour scenario.
14
- * @param props - slot props; the session snapshot drives the detach list.
15
- */
16
- export declare function FreezeButton({ useSession, updateQueue, cancel, send, sendSteer, sessionId, setComposerBlock, notify, t }: FreezeButtonProps): import("react").JSX.Element;
1
+ import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { SteerQueueDockInjected } from './steer-queue-dock.tsx';
3
+ /**
4
+ * Full props of the composer-right entry.
5
+ *
6
+ * DUAL-VERSION: 0.1.1 delivers the `InputZone` owner share here, 0.1.2 renders
7
+ * the slot with `{}` (`InputBar.tsx:466`). Only the session standard kit is
8
+ * shared, so the type declares exactly that — reading `session`/`input` off
9
+ * this slot is a compile error, not a 0.1.2 crash.
10
+ */
11
+ export type FreezeButtonProps = Pick<PropsRuntime<'conversation.input.right'>, 'useSession' | 'sessionId'> & SteerQueueDockInjected & PropsLocale<'steer'>;
12
+ /**
13
+ * Freeze/resume toggle for the peak-hour scenario.
14
+ * @param props - slot props; the session snapshot drives the detach list.
15
+ */
16
+ export declare function FreezeButton({ useSession, updateQueue, cancel, send, sendSteer, sessionId, setComposerBlock, notify, t }: FreezeButtonProps): import("react").JSX.Element;
17
17
  //# sourceMappingURL=freeze-button.d.ts.map
@@ -1,48 +1,48 @@
1
- /**
2
- * dsh-input-traffic —browser half.
3
- *
4
- * The whole takeover lives here:
5
- * 1. registers the `steer` dictionaries;
6
- * 2. pins `ui-conversation.busyEnter` to `queue` (plain Enter = green later)
7
- * so the hidden official row cannot leak a stale queue/steer preference;
8
- * 3. shadows the official queue dock (`conversation.input.dock` cell id
9
- * `queue`, priority -1) with the three-tier planning strip;
10
- * 4. shadows the official busy-Enter settings row (`settings.general.item`
11
- * cell id `composer-enter`, priority -1) with a null render.
12
- *
13
- * ORDERING (why the dock registers at QUEUE_DOCK_ORDER instead of the
14
- * official dock's 20): a list slot's DISPLAY position is decided by `order`
15
- * alone — `ui-renderer/src/client/scoped-slots.tsx` maps the shadowing
16
- * winners to rows and then sorts them by `order` (both 0.1.1 and 0.1.2) —
17
- * while `priority` only decides which entry wins a shared cell id. Keeping
18
- * the official 20 therefore left the strip above any later contributor
19
- * (dsh-perm-gate's notice registers order 30), which pushed that notice
20
- * between the queue strip and the composer card. A deliberately high order
21
- * keeps the strip adjacent to the card; priority stays -1 so the cell
22
- * takeover still holds.
23
- *
24
- * All @deepseek-ai/* imports are type-only: collaboration happens through
25
- * cordis services and slot registration only (client bundle purity).
26
- */
27
- import type { Context as ClientContext } from '@deepseek-ai/cordis';
28
- /**
29
- * Display order of the queue strip inside `conversation.input.dock`.
30
- *
31
- * List rows render sorted by `order` ascending, so a value above every other
32
- * contributor keeps the strip as the bottom-most entry of the band — directly
33
- * on top of the composer card. Known contributors in both 0.1.1-rc.2 and
34
- * 0.1.2-rc.1: `todo` 0, `goal` 10, official `queue` 20, `dsh-perm-gate.notice`
35
- * 30. DSH has no "last" slot semantics, so this is a convention, not a
36
- * structural guarantee: a third party registering a larger value could still
37
- * land below us.
38
- */
39
- export declare const QUEUE_DOCK_ORDER = 1000;
40
- /** Services required by the browser half. */
41
- export declare const inject: string[];
42
- /**
43
- * Client plugin body: dictionaries, busy-Enter pinning, and the two slot
44
- * shadowings.
45
- * @param ctx - client root context.
46
- */
47
- export declare function apply(ctx: ClientContext): void;
1
+ /**
2
+ * dsh-input-traffic —browser half.
3
+ *
4
+ * The whole takeover lives here:
5
+ * 1. registers the `steer` dictionaries;
6
+ * 2. pins `ui-conversation.busyEnter` to `queue` (plain Enter = green later)
7
+ * so the hidden official row cannot leak a stale queue/steer preference;
8
+ * 3. shadows the official queue dock (`conversation.input.dock` cell id
9
+ * `queue`, priority -1) with the three-tier planning strip;
10
+ * 4. shadows the official busy-Enter settings row (`settings.general.item`
11
+ * cell id `composer-enter`, priority -1) with a null render.
12
+ *
13
+ * ORDERING (why the dock registers at QUEUE_DOCK_ORDER instead of the
14
+ * official dock's 20): a list slot's DISPLAY position is decided by `order`
15
+ * alone — `ui-renderer/src/client/scoped-slots.tsx` maps the shadowing
16
+ * winners to rows and then sorts them by `order` (both 0.1.1 and 0.1.2) —
17
+ * while `priority` only decides which entry wins a shared cell id. Keeping
18
+ * the official 20 therefore left the strip above any later contributor
19
+ * (dsh-perm-gate's notice registers order 30), which pushed that notice
20
+ * between the queue strip and the composer card. A deliberately high order
21
+ * keeps the strip adjacent to the card; priority stays -1 so the cell
22
+ * takeover still holds.
23
+ *
24
+ * All @deepseek-ai/* imports are type-only: collaboration happens through
25
+ * cordis services and slot registration only (client bundle purity).
26
+ */
27
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
28
+ /**
29
+ * Display order of the queue strip inside `conversation.input.dock`.
30
+ *
31
+ * List rows render sorted by `order` ascending, so a value above every other
32
+ * contributor keeps the strip as the bottom-most entry of the band — directly
33
+ * on top of the composer card. Known contributors in both 0.1.1-rc.2 and
34
+ * 0.1.2-rc.1: `todo` 0, `goal` 10, official `queue` 20, `dsh-perm-gate.notice`
35
+ * 30. DSH has no "last" slot semantics, so this is a convention, not a
36
+ * structural guarantee: a third party registering a larger value could still
37
+ * land below us.
38
+ */
39
+ export declare const QUEUE_DOCK_ORDER = 1000;
40
+ /** Services required by the browser half. */
41
+ export declare const inject: string[];
42
+ /**
43
+ * Client plugin body: dictionaries, busy-Enter pinning, and the two slot
44
+ * shadowings.
45
+ * @param ctx - client root context.
46
+ */
47
+ export declare function apply(ctx: ClientContext): void;
48
48
  //# sourceMappingURL=index.d.ts.map
@@ -1,118 +1,118 @@
1
- import { NS, en, zh } from "./locales.js";
2
- import { SteerQueueDock } from "./steer-queue-dock.js";
3
- import { FreezeButton } from "./freeze-button.js";
4
- import { HideEnterRow } from "./hide-enter-row.js";
5
- /** Durable conversation settings namespace owned by ui-conversation. */
6
- const CONVERSATION_SETTINGS_NAMESPACE = 'ui-conversation';
7
- /** Busy-Enter field inside that namespace; the plugin pins it to queue. */
8
- const BUSY_ENTER_FIELD = 'busyEnter';
9
- /**
10
- * Display order of the queue strip inside `conversation.input.dock`.
11
- *
12
- * List rows render sorted by `order` ascending, so a value above every other
13
- * contributor keeps the strip as the bottom-most entry of the band — directly
14
- * on top of the composer card. Known contributors in both 0.1.1-rc.2 and
15
- * 0.1.2-rc.1: `todo` 0, `goal` 10, official `queue` 20, `dsh-perm-gate.notice`
16
- * 30. DSH has no "last" slot semantics, so this is a convention, not a
17
- * structural guarantee: a third party registering a larger value could still
18
- * land below us.
19
- */
20
- export const QUEUE_DOCK_ORDER = 1000;
21
- /**
22
- * Deliver one plain-text message into the session's next step. The exposed
23
- * conversation `send` verb only queues into the next turn, so resume steers
24
- * through the session face's steer-mode prompt instead (no harness change).
25
- * @param ctx - root context (resolves the session face behind the scope).
26
- * @param actx - agent-scoped context of the owning session.
27
- * @param text - message text to deliver.
28
- */
29
- function steerPrompt(actx, text) {
30
- // steer-mode prompt 面在本版(main@0.2.8)契约中未声明;resume 落到 conversation.send
31
- // (排队到下一轮)交付 safe_point 文本,与 feature 分支语义对齐但取当前可用 API。
32
- const conversation = actx.get('conversation');
33
- if (conversation === undefined)
34
- return Promise.reject(new Error('steer resume: conversation service unavailable'));
35
- return conversation.send(text);
36
- }
37
- /** Services required by the browser half. */
38
- export const inject = ['slots', 'locale', 'sessions', 'conversation', 'settingsScope'];
39
- /**
40
- * Client plugin body: dictionaries, busy-Enter pinning, and the two slot
41
- * shadowings.
42
- * @param ctx - client root context.
43
- */
44
- export function apply(ctx) {
45
- ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-input-traffic: dictionaries');
46
- // Take over the busy-Enter behavior: plain Enter stays queue-later while
47
- // the official row is hidden. Pinning here also repairs a persisted `steer`
48
- // preference that would otherwise keep working invisibly behind the hidden
49
- // row. Best-effort: a memory-mode host simply accepts it locally.
50
- const conversationSettings = ctx.settingsScope.bind({
51
- namespace: CONVERSATION_SETTINGS_NAMESPACE,
52
- });
53
- void conversationSettings.set(BUSY_ENTER_FIELD, 'queue');
54
- // Shadow the official queue dock with the three-tier planning strip. The
55
- // high `order` keeps it the bottom-most entry of the band (see the file
56
- // header); `priority: -1` is what wins the official `queue` cell.
57
- ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
58
- name: 'conversation.input.dock',
59
- id: 'queue',
60
- order: QUEUE_DOCK_ORDER,
61
- priority: -1,
62
- locale: NS,
63
- inject: (sessionId) => {
64
- const actx = ctx.sessions.scope(sessionId);
65
- if (actx === undefined)
66
- throw new Error(`steer dock: session "${sessionId}" resolved no scope`);
67
- const conversation = actx.get('conversation');
68
- if (conversation === undefined)
69
- throw new Error('steer dock: conversation service unavailable');
70
- return {
71
- updateQueue: (itemId, action) => conversation.updateQueue(itemId, action),
72
- cancel: () => conversation.cancel(),
73
- send: (text) => conversation.send(text),
74
- setDraft: (text) => { conversation.input.for(actx).actions.setDraft(text); },
75
- notify: (level, text) => { conversation.input.for(actx).notify(level, text); },
76
- };
77
- },
78
- }, SteerQueueDock));
79
- // Composer-right freeze/resume control (reachable before anything queues).
80
- ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
81
- name: 'conversation.input.right',
82
- id: 'steer-freeze',
83
- order: 30,
84
- locale: NS,
85
- inject: (sessionId) => {
86
- const actx = ctx.sessions.scope(sessionId);
87
- if (actx === undefined)
88
- throw new Error(`steer freeze: session "${sessionId}" resolved no scope`);
89
- const conversation = actx.get('conversation');
90
- if (conversation === undefined)
91
- throw new Error('steer freeze: conversation service unavailable');
92
- return {
93
- updateQueue: (itemId, action) => conversation.updateQueue(itemId, action),
94
- cancel: () => conversation.cancel(),
95
- send: (text) => conversation.send(text),
96
- // safe_point 恢复经 conversation.send 排队到下一轮(本版契约无 steer prompt 面)。
97
- sendSteer: (text) => steerPrompt(actx, text),
98
- sessionId: String(sessionId),
99
- setDraft: (text) => { conversation.input.for(actx).actions.setDraft(text); },
100
- notify: (level, text) => { conversation.input.for(actx).notify(level, text); },
101
- // 冻结期间 raise composer block:composer 变 inert(回车/发送按钮全部失效),
102
- // 输入不会漏进对话;恢复时清除。block 不锁 input.right(恢复按钮仍可点)。
103
- setComposerBlock: (reason) => {
104
- conversation.blocks.set(sessionId, reason === undefined ? undefined : { reason });
105
- },
106
- };
107
- },
108
- }, FreezeButton));
109
- // Hide the official busy-Enter settings row (null render wins the cell).
110
- ctx.slots.inject('settings.general.item', () => ctx.slots.register({
111
- name: 'settings.general.item',
112
- id: 'composer-enter',
113
- order: 20,
114
- priority: -1,
115
- locale: NS,
116
- }, HideEnterRow));
117
- }
1
+ import { NS, en, zh } from "./locales.js";
2
+ import { SteerQueueDock } from "./steer-queue-dock.js";
3
+ import { FreezeButton } from "./freeze-button.js";
4
+ import { HideEnterRow } from "./hide-enter-row.js";
5
+ /** Durable conversation settings namespace owned by ui-conversation. */
6
+ const CONVERSATION_SETTINGS_NAMESPACE = 'ui-conversation';
7
+ /** Busy-Enter field inside that namespace; the plugin pins it to queue. */
8
+ const BUSY_ENTER_FIELD = 'busyEnter';
9
+ /**
10
+ * Display order of the queue strip inside `conversation.input.dock`.
11
+ *
12
+ * List rows render sorted by `order` ascending, so a value above every other
13
+ * contributor keeps the strip as the bottom-most entry of the band — directly
14
+ * on top of the composer card. Known contributors in both 0.1.1-rc.2 and
15
+ * 0.1.2-rc.1: `todo` 0, `goal` 10, official `queue` 20, `dsh-perm-gate.notice`
16
+ * 30. DSH has no "last" slot semantics, so this is a convention, not a
17
+ * structural guarantee: a third party registering a larger value could still
18
+ * land below us.
19
+ */
20
+ export const QUEUE_DOCK_ORDER = 1000;
21
+ /**
22
+ * Deliver one plain-text message into the session's next step. The exposed
23
+ * conversation `send` verb only queues into the next turn, so resume steers
24
+ * through the session face's steer-mode prompt instead (no harness change).
25
+ * @param ctx - root context (resolves the session face behind the scope).
26
+ * @param actx - agent-scoped context of the owning session.
27
+ * @param text - message text to deliver.
28
+ */
29
+ function steerPrompt(actx, text) {
30
+ // steer-mode prompt 面在本版(main@0.2.8)契约中未声明;resume 落到 conversation.send
31
+ // (排队到下一轮)交付 safe_point 文本,与 feature 分支语义对齐但取当前可用 API。
32
+ const conversation = actx.get('conversation');
33
+ if (conversation === undefined)
34
+ return Promise.reject(new Error('steer resume: conversation service unavailable'));
35
+ return conversation.send(text);
36
+ }
37
+ /** Services required by the browser half. */
38
+ export const inject = ['slots', 'locale', 'sessions', 'conversation', 'settingsScope'];
39
+ /**
40
+ * Client plugin body: dictionaries, busy-Enter pinning, and the two slot
41
+ * shadowings.
42
+ * @param ctx - client root context.
43
+ */
44
+ export function apply(ctx) {
45
+ ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-input-traffic: dictionaries');
46
+ // Take over the busy-Enter behavior: plain Enter stays queue-later while
47
+ // the official row is hidden. Pinning here also repairs a persisted `steer`
48
+ // preference that would otherwise keep working invisibly behind the hidden
49
+ // row. Best-effort: a memory-mode host simply accepts it locally.
50
+ const conversationSettings = ctx.settingsScope.bind({
51
+ namespace: CONVERSATION_SETTINGS_NAMESPACE,
52
+ });
53
+ void conversationSettings.set(BUSY_ENTER_FIELD, 'queue');
54
+ // Shadow the official queue dock with the three-tier planning strip. The
55
+ // high `order` keeps it the bottom-most entry of the band (see the file
56
+ // header); `priority: -1` is what wins the official `queue` cell.
57
+ ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
58
+ name: 'conversation.input.dock',
59
+ id: 'queue',
60
+ order: QUEUE_DOCK_ORDER,
61
+ priority: -1,
62
+ locale: NS,
63
+ inject: (sessionId) => {
64
+ const actx = ctx.sessions.scope(sessionId);
65
+ if (actx === undefined)
66
+ throw new Error(`steer dock: session "${sessionId}" resolved no scope`);
67
+ const conversation = actx.get('conversation');
68
+ if (conversation === undefined)
69
+ throw new Error('steer dock: conversation service unavailable');
70
+ return {
71
+ updateQueue: (itemId, action) => conversation.updateQueue(itemId, action),
72
+ cancel: () => conversation.cancel(),
73
+ send: (text) => conversation.send(text),
74
+ setDraft: (text) => { conversation.input.for(actx).actions.setDraft(text); },
75
+ notify: (level, text) => { conversation.input.for(actx).notify(level, text); },
76
+ };
77
+ },
78
+ }, SteerQueueDock));
79
+ // Composer-right freeze/resume control (reachable before anything queues).
80
+ ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
81
+ name: 'conversation.input.right',
82
+ id: 'steer-freeze',
83
+ order: 30,
84
+ locale: NS,
85
+ inject: (sessionId) => {
86
+ const actx = ctx.sessions.scope(sessionId);
87
+ if (actx === undefined)
88
+ throw new Error(`steer freeze: session "${sessionId}" resolved no scope`);
89
+ const conversation = actx.get('conversation');
90
+ if (conversation === undefined)
91
+ throw new Error('steer freeze: conversation service unavailable');
92
+ return {
93
+ updateQueue: (itemId, action) => conversation.updateQueue(itemId, action),
94
+ cancel: () => conversation.cancel(),
95
+ send: (text) => conversation.send(text),
96
+ // safe_point 恢复经 conversation.send 排队到下一轮(本版契约无 steer prompt 面)。
97
+ sendSteer: (text) => steerPrompt(actx, text),
98
+ sessionId: String(sessionId),
99
+ setDraft: (text) => { conversation.input.for(actx).actions.setDraft(text); },
100
+ notify: (level, text) => { conversation.input.for(actx).notify(level, text); },
101
+ // 冻结期间 raise composer block:composer 变 inert(回车/发送按钮全部失效),
102
+ // 输入不会漏进对话;恢复时清除。block 不锁 input.right(恢复按钮仍可点)。
103
+ setComposerBlock: (reason) => {
104
+ conversation.blocks.set(sessionId, reason === undefined ? undefined : { reason });
105
+ },
106
+ };
107
+ },
108
+ }, FreezeButton));
109
+ // Hide the official busy-Enter settings row (null render wins the cell).
110
+ ctx.slots.inject('settings.general.item', () => ctx.slots.register({
111
+ name: 'settings.general.item',
112
+ id: 'composer-enter',
113
+ order: 20,
114
+ priority: -1,
115
+ locale: NS,
116
+ }, HideEnterRow));
117
+ }
118
118
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-input-traffic",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",