@nexus-aethra/dshell-conversation 0.1.3 → 0.1.5
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/client/index.js +4 -1
- package/lib/client/index.js.map +1 -1
- package/lib/client.js +30 -1
- package/lib/client.js.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/package.json +10 -8
package/lib/client/index.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* shows the chat tab in the view ledger for advanced use) takes
|
|
19
19
|
* precedence via the stock selectView path — we only steer the default.
|
|
20
20
|
*/
|
|
21
|
+
import { mainSessionId } from '@nexus-aethra/dshell-std';
|
|
21
22
|
export const name = '@nexus-aethra/dshell-conversation/client';
|
|
22
23
|
export const inject = ['uiConversation', 'sessions', 'slots'];
|
|
23
24
|
class TerminalViewBuilder {
|
|
@@ -61,7 +62,9 @@ export function apply(ctx) {
|
|
|
61
62
|
// re-adds `terminal` to a monotonic active set.
|
|
62
63
|
ctx.effect(() => {
|
|
63
64
|
const reconcile = () => {
|
|
64
|
-
|
|
65
|
+
// The held Session, by the host's retention rule: `list.current` went
|
|
66
|
+
// away in 0.1.6-alpha.2 (see `mainSessionId`).
|
|
67
|
+
const current = mainSessionId(Object.values(sessions.list.getSnapshot().byId));
|
|
65
68
|
if (current === undefined)
|
|
66
69
|
return;
|
|
67
70
|
try {
|
package/lib/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,MAAM,CAAC,MAAM,IAAI,GAAG,0CAA0C,CAAA;AAE9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,OAAO,KAAK,SAAS;gBAAE,OAAM;YACjC,IAAI,CAAC;gBACH,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;YAC1D,CAAC;YAAC,MAAM,CAAC;gBACP,gEAAgE;YAClE,CAAC;QACH,CAAC,CAAA;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAA;QACxE,SAAS,EAAE,CAAA;QACX,OAAO,GAAG,EAAE;YACV,WAAW,EAAE,CAAA;YACb,YAAY,EAAE,CAAA;QAChB,CAAC,CAAA;IACH,CAAC,EAAE,8CAA8C,CAAC,CAAA;AACpD,CAAC"}
|
package/lib/client.js
CHANGED
|
@@ -4,6 +4,35 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
//#region ../std/lib/session-view.js
|
|
8
|
+
/**
|
|
9
|
+
* Which Session the main view is holding.
|
|
10
|
+
*
|
|
11
|
+
* The host's rule, taken once. `0.1.5-rc.2` published the Session on screen as
|
|
12
|
+
* `sessions.list.current`; `0.1.6-alpha.2` removed that field, because a Client
|
|
13
|
+
* may now hold several generations at once and no service owns "the one on
|
|
14
|
+
* screen" — navigation belongs to view owners. What replaced the field is
|
|
15
|
+
* RETENTION: the surface displaying a Session claims it with
|
|
16
|
+
* `retain(target, { source: 'mainView' })`, and the Session on screen is the row
|
|
17
|
+
* whose `mainView` count is positive.
|
|
18
|
+
*
|
|
19
|
+
* The derivation is what the host itself repeats wherever it needs the answer —
|
|
20
|
+
* `ui-workspace/tree.ts`, `ui-layout/DocumentTitle.tsx`, `ui-session`,
|
|
21
|
+
* `ui-settings-general` all write it out — so reading it here is not a dshell
|
|
22
|
+
* invention, it is the same reading taken once instead of once per package.
|
|
23
|
+
*
|
|
24
|
+
* `undefined` means no view holds a Session: on a page that has not navigated
|
|
25
|
+
* yet, and in the window between a release and the next retain.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The Session the main view is holding, by the host's own rule.
|
|
29
|
+
* @param rows - the session-list rows, in any order.
|
|
30
|
+
* @returns the held Session's id, or undefined when no view holds one.
|
|
31
|
+
*/
|
|
32
|
+
function mainSessionId(rows) {
|
|
33
|
+
for (const row of rows) if ((row.retainedBy?.mainView ?? 0) > 0) return row.id;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
7
36
|
//#region lib/client/index.js
|
|
8
37
|
/**
|
|
9
38
|
* dshell-conversation browser face — Phase 4 (activity marker).
|
|
@@ -51,7 +80,7 @@ window.__ModuleLoader__.load({
|
|
|
51
80
|
ctx.effect(() => ctx.uiConversation.views.register(viewDefinition));
|
|
52
81
|
ctx.effect(() => {
|
|
53
82
|
const reconcile = () => {
|
|
54
|
-
const current = sessions.list.getSnapshot().
|
|
83
|
+
const current = mainSessionId(Object.values(sessions.list.getSnapshot().byId));
|
|
55
84
|
if (current === void 0) return;
|
|
56
85
|
try {
|
|
57
86
|
ctx.uiConversation.binding(current).activate("terminal");
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["client/index.js"],"sourcesContent":["/**\n * dshell-conversation browser face — Phase 4 (activity marker).\n *\n * The single registration here is an always-active ConversationView\n * Definition on the `terminal` target with no renderer. Its only job is\n * to count the Session as active conversation activity so the framework\n * skips the centered hero layout and engages the docked composer (the\n * terminal-style dock lives in `dshell-mode` and shadows\n * `conversation.composer.bar`). The dock itself is the visible content\n * surface — no separate view tab — keeping PTY output and the input\n * line fused in one column.\n *\n * The plugin also auto-activates `terminal` whenever a new Session\n * becomes current. The stock view-restore path falls back to `chat` when\n * no preference exists, which would put the conversation back in `hero`\n * phase; activating `terminal` first forces `active` phase immediately.\n * A subsequent `selectView('chat')` from the user (the header still\n * shows the chat tab in the view ledger for advanced use) takes\n * precedence via the stock selectView path — we only steer the default.\n */\nexport const name = '@nexus-aethra/dshell-conversation/client';\nexport const inject = ['uiConversation', 'sessions', 'slots'];\nclass TerminalViewBuilder {\n empty = { rows: [] };\n replace() {\n return this.empty;\n }\n apply() {\n return this.empty;\n }\n}\nconst viewDefinition = {\n target: 'terminal',\n create: () => new TerminalViewBuilder(),\n // The terminal surface IS dshell's content (design 4.1): it counts as\n // visible activity even in a blank session, so the conversation renders\n // its docked composer instead of the centered hero.\n isActive: () => true,\n};\n/** Register the always-active `terminal` target and auto-activate it per current session. */\nexport function apply(ctx) {\n // Cast through unknown: the 'sessions' key collides across faces in one\n // tsc program (host SessionStore vs client ISessions); see terminal-bridge.\n const sessions = ctx.get('sessions');\n ctx.effect(() => ctx.uiConversation.views.register(viewDefinition));\n // The terminal target must be the active view or the shell renders the\n // (empty) chat transcript instead: ui-conversation resolves the shell\n // phase from active targets, and its own restore path falls back to the\n // `chat` view whenever the preference is unset. Re-assert on every\n // session-list and view-slot change — our subscriptions are registered\n // after ui-conversation's, so our activation runs last and wins the\n // tick. `activate` is idempotent (the assembler ignores a target already\n // active).\n //\n // This asserts the terminal *target* (which snapshots the conversation\n // assembles), not the user's tab choice — the strip's selection is a\n // separate per-session preference the store owns, and `activate` never\n // touches it. So the strip can offer `会话` / `轨迹` and a click on\n // `轨迹` stays put: it writes the preference through the stock\n // selectView path, and the reconcile that follows a session switch only\n // re-adds `terminal` to a monotonic active set.\n ctx.effect(() => {\n const reconcile = () => {\n const current = sessions.list.getSnapshot().
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../std/lib/session-view.js","client/index.js"],"sourcesContent":["/**\n * Which Session the main view is holding.\n *\n * The host's rule, taken once. `0.1.5-rc.2` published the Session on screen as\n * `sessions.list.current`; `0.1.6-alpha.2` removed that field, because a Client\n * may now hold several generations at once and no service owns \"the one on\n * screen\" — navigation belongs to view owners. What replaced the field is\n * RETENTION: the surface displaying a Session claims it with\n * `retain(target, { source: 'mainView' })`, and the Session on screen is the row\n * whose `mainView` count is positive.\n *\n * The derivation is what the host itself repeats wherever it needs the answer —\n * `ui-workspace/tree.ts`, `ui-layout/DocumentTitle.tsx`, `ui-session`,\n * `ui-settings-general` all write it out — so reading it here is not a dshell\n * invention, it is the same reading taken once instead of once per package.\n *\n * `undefined` means no view holds a Session: on a page that has not navigated\n * yet, and in the window between a release and the next retain.\n */\n/**\n * The Session the main view is holding, by the host's own rule.\n * @param rows - the session-list rows, in any order.\n * @returns the held Session's id, or undefined when no view holds one.\n */\nexport function mainSessionId(rows) {\n for (const row of rows) {\n // The cast is the point of the structural parameter: the host publishes a\n // frozen partial record whose source names are its own, and the one this\n // rule reads is `mainView`.\n const counts = row.retainedBy;\n if ((counts?.mainView ?? 0) > 0)\n return row.id;\n }\n return undefined;\n}\n//# sourceMappingURL=session-view.js.map","/**\n * dshell-conversation browser face — Phase 4 (activity marker).\n *\n * The single registration here is an always-active ConversationView\n * Definition on the `terminal` target with no renderer. Its only job is\n * to count the Session as active conversation activity so the framework\n * skips the centered hero layout and engages the docked composer (the\n * terminal-style dock lives in `dshell-mode` and shadows\n * `conversation.composer.bar`). The dock itself is the visible content\n * surface — no separate view tab — keeping PTY output and the input\n * line fused in one column.\n *\n * The plugin also auto-activates `terminal` whenever a new Session\n * becomes current. The stock view-restore path falls back to `chat` when\n * no preference exists, which would put the conversation back in `hero`\n * phase; activating `terminal` first forces `active` phase immediately.\n * A subsequent `selectView('chat')` from the user (the header still\n * shows the chat tab in the view ledger for advanced use) takes\n * precedence via the stock selectView path — we only steer the default.\n */\nimport { mainSessionId } from '@nexus-aethra/dshell-std';\nexport const name = '@nexus-aethra/dshell-conversation/client';\nexport const inject = ['uiConversation', 'sessions', 'slots'];\nclass TerminalViewBuilder {\n empty = { rows: [] };\n replace() {\n return this.empty;\n }\n apply() {\n return this.empty;\n }\n}\nconst viewDefinition = {\n target: 'terminal',\n create: () => new TerminalViewBuilder(),\n // The terminal surface IS dshell's content (design 4.1): it counts as\n // visible activity even in a blank session, so the conversation renders\n // its docked composer instead of the centered hero.\n isActive: () => true,\n};\n/** Register the always-active `terminal` target and auto-activate it per current session. */\nexport function apply(ctx) {\n // Cast through unknown: the 'sessions' key collides across faces in one\n // tsc program (host SessionStore vs client ISessions); see terminal-bridge.\n const sessions = ctx.get('sessions');\n ctx.effect(() => ctx.uiConversation.views.register(viewDefinition));\n // The terminal target must be the active view or the shell renders the\n // (empty) chat transcript instead: ui-conversation resolves the shell\n // phase from active targets, and its own restore path falls back to the\n // `chat` view whenever the preference is unset. Re-assert on every\n // session-list and view-slot change — our subscriptions are registered\n // after ui-conversation's, so our activation runs last and wins the\n // tick. `activate` is idempotent (the assembler ignores a target already\n // active).\n //\n // This asserts the terminal *target* (which snapshots the conversation\n // assembles), not the user's tab choice — the strip's selection is a\n // separate per-session preference the store owns, and `activate` never\n // touches it. So the strip can offer `会话` / `轨迹` and a click on\n // `轨迹` stays put: it writes the preference through the stock\n // selectView path, and the reconcile that follows a session switch only\n // re-adds `terminal` to a monotonic active set.\n ctx.effect(() => {\n const reconcile = () => {\n // The held Session, by the host's retention rule: `list.current` went\n // away in 0.1.6-alpha.2 (see `mainSessionId`).\n const current = mainSessionId(Object.values(sessions.list.getSnapshot().byId));\n if (current === undefined)\n return;\n try {\n ctx.uiConversation.binding(current).activate('terminal');\n }\n catch {\n // Session scope not materialized yet; retry on the next change.\n }\n };\n const disposeList = sessions.list.subscribe(reconcile);\n const disposeViews = ctx.slots.subscribe('conversation.view', reconcile);\n reconcile();\n return () => {\n disposeList();\n disposeViews();\n };\n }, 'dshell-conversation: open into terminal view');\n}\n//# sourceMappingURL=index.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,SAAgB,cAAc,MAAM;GAChC,KAAK,MAAM,OAAO,MAKd,KADe,IAAI,YACN,YAAY,KAAK,GAC1B,OAAO,IAAI;EAGvB;;;;;;;;;;;;;;;;;;;;;;;ECbA,MAAa,OAAO;EACpB,MAAa,SAAS;GAAC;GAAkB;GAAY;EAAO;EAC5D,IAAM,sBAAN,MAA0B;GACtB,QAAQ,EAAE,MAAM,CAAC,EAAE;GACnB,UAAU;IACN,OAAO,KAAK;GAChB;GACA,QAAQ;IACJ,OAAO,KAAK;GAChB;EACJ;EACA,MAAM,iBAAiB;GACnB,QAAQ;GACR,cAAc,IAAI,oBAAoB;GAItC,gBAAgB;EACpB;;EAEA,SAAgB,MAAM,KAAK;GAGvB,MAAM,WAAW,IAAI,IAAI,UAAU;GACnC,IAAI,aAAa,IAAI,eAAe,MAAM,SAAS,cAAc,CAAC;GAiBlE,IAAI,aAAa;IACb,MAAM,kBAAkB;KAGpB,MAAM,UAAU,cAAc,OAAO,OAAO,SAAS,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC;KAC7E,IAAI,YAAY,KAAA,GACZ;KACJ,IAAI;MACA,IAAI,eAAe,QAAQ,OAAO,CAAC,CAAC,SAAS,UAAU;KAC3D,QACM,CAEN;IACJ;IACA,MAAM,cAAc,SAAS,KAAK,UAAU,SAAS;IACrD,MAAM,eAAe,IAAI,MAAM,UAAU,qBAAqB,SAAS;IACvE,UAAU;IACV,aAAa;KACT,YAAY;KACZ,aAAa;IACjB;GACJ,GAAG,8CAA8C;EACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAYlD,eAAO,MAAM,IAAI,6CAA6C,CAAA;AAE9D,eAAO,MAAM,MAAM,kDAAmD,CAAA;AA2BtE,6FAA6F;AAC7F,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA2CxC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-aethra/dshell-conversation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "dshell Conversation activity marker: registers an always-active `terminal` view target so the conversation stays in active phase and the docked terminal surface renders instead of the centered hero.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,18 +32,20 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nexus-aethra/dshell-std": "^0.1.5"
|
|
37
|
+
},
|
|
36
38
|
"peerDependencies": {
|
|
37
39
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
38
|
-
"@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
39
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
40
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
40
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2 || 0.1.6-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2 || 0.1.6-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2 || 0.1.6-alpha.2"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
44
|
-
"@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2 || 0.1.6-alpha.
|
|
46
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2 || 0.1.6-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2 || 0.1.6-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2 || 0.1.6-alpha.2",
|
|
47
49
|
"@types/react": "~18.3.1",
|
|
48
50
|
"@types/react-dom": "~18.3.0",
|
|
49
51
|
"react": "^18.2.0",
|