@nexus-aethra/dshell-std 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/index.js CHANGED
@@ -17,6 +17,7 @@
17
17
  export * from './contracts.js';
18
18
  export * from './data-root.js';
19
19
  export * from './host-copy.js';
20
+ export * from './session-view.js';
20
21
  export * from './shell-line.js';
21
22
  export * from './storage.js';
22
23
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Which Session the main view is holding.
3
+ *
4
+ * The host's rule, taken once. `0.1.5-rc.2` published the Session on screen as
5
+ * `sessions.list.current`; `0.1.6-alpha.2` removed that field, because a Client
6
+ * may now hold several generations at once and no service owns "the one on
7
+ * screen" — navigation belongs to view owners. What replaced the field is
8
+ * RETENTION: the surface displaying a Session claims it with
9
+ * `retain(target, { source: 'mainView' })`, and the Session on screen is the row
10
+ * whose `mainView` count is positive.
11
+ *
12
+ * The derivation is what the host itself repeats wherever it needs the answer —
13
+ * `ui-workspace/tree.ts`, `ui-layout/DocumentTitle.tsx`, `ui-session`,
14
+ * `ui-settings-general` all write it out — so reading it here is not a dshell
15
+ * invention, it is the same reading taken once instead of once per package.
16
+ *
17
+ * `undefined` means no view holds a Session: on a page that has not navigated
18
+ * yet, and in the window between a release and the next retain.
19
+ */
20
+ /**
21
+ * The Session the main view is holding, by the host's own rule.
22
+ * @param rows - the session-list rows, in any order.
23
+ * @returns the held Session's id, or undefined when no view holds one.
24
+ */
25
+ export function mainSessionId(rows) {
26
+ for (const row of rows) {
27
+ // The cast is the point of the structural parameter: the host publishes a
28
+ // frozen partial record whose source names are its own, and the one this
29
+ // rule reads is `mainView`.
30
+ const counts = row.retainedBy;
31
+ if ((counts?.mainView ?? 0) > 0)
32
+ return row.id;
33
+ }
34
+ return undefined;
35
+ }
36
+ //# sourceMappingURL=session-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-view.js","sourceRoot":"","sources":["../src/session-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAoBH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAK,IAAsC;IACtE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,0EAA0E;QAC1E,yEAAyE;QACzE,4BAA4B;QAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,UAAsE,CAAA;QACzF,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC,EAAE,CAAA;IAChD,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -17,6 +17,7 @@
17
17
  export * from './contracts.js';
18
18
  export * from './data-root.js';
19
19
  export * from './host-copy.js';
20
+ export * from './session-view.js';
20
21
  export * from './shell-line.js';
21
22
  export * from './storage.js';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Which Session the main view is holding.
3
+ *
4
+ * The host's rule, taken once. `0.1.5-rc.2` published the Session on screen as
5
+ * `sessions.list.current`; `0.1.6-alpha.2` removed that field, because a Client
6
+ * may now hold several generations at once and no service owns "the one on
7
+ * screen" — navigation belongs to view owners. What replaced the field is
8
+ * RETENTION: the surface displaying a Session claims it with
9
+ * `retain(target, { source: 'mainView' })`, and the Session on screen is the row
10
+ * whose `mainView` count is positive.
11
+ *
12
+ * The derivation is what the host itself repeats wherever it needs the answer —
13
+ * `ui-workspace/tree.ts`, `ui-layout/DocumentTitle.tsx`, `ui-session`,
14
+ * `ui-settings-general` all write it out — so reading it here is not a dshell
15
+ * invention, it is the same reading taken once instead of once per package.
16
+ *
17
+ * `undefined` means no view holds a Session: on a page that has not navigated
18
+ * yet, and in the window between a release and the next retain.
19
+ */
20
+ /**
21
+ * The fields the rule reads.
22
+ *
23
+ * Structural rather than imported: `dshell-std` is the layer allowed to care
24
+ * about how dsh spells things, and the cheapest way to keep that true is to
25
+ * state the fields instead of depending on the package that owns them.
26
+ */
27
+ export interface RetainedSessionRow<Id> {
28
+ readonly id: Id;
29
+ /**
30
+ * The host's retention counts. Left as `object` rather than spelled out: the
31
+ * host types them as a partial record of its own source names, and restating
32
+ * that here would tie this module to the package that owns it — which is the
33
+ * dependency this layer exists to avoid.
34
+ */
35
+ readonly retainedBy?: object | undefined;
36
+ }
37
+ /**
38
+ * The Session the main view is holding, by the host's own rule.
39
+ * @param rows - the session-list rows, in any order.
40
+ * @returns the held Session's id, or undefined when no view holds one.
41
+ */
42
+ export declare function mainSessionId<Id>(rows: Iterable<RetainedSessionRow<Id>>): Id | undefined;
43
+ //# sourceMappingURL=session-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-view.d.ts","sourceRoot":"","sources":["../../src/session-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB,CAAC,EAAE;IACpC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;IACf;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACzC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,CASxF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-aethra/dshell-std",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "dshell standard layer: the wire contracts every plugin shares (paths + shapes), with no dependency on dsh and no feature code — the single place a dsh interface change is absorbed.",
5
5
  "license": "MIT",
6
6
  "repository": {