@crossworks/content-core 0.400.28 → 0.400.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/content-core",
3
- "version": "0.400.28",
3
+ "version": "0.400.31",
4
4
  "description": "Browser-safe content logic — markdown, blocks, pages, tables, formulas — shared by the server and any client. Zero server deps by design: nothing here may reach @mantle/db, node-only APIs, or the network (the jackdaw-repo-split P0 boundary).",
5
5
  "type": "module",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "./tree": "./src/tree.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@mantle/client-types": "npm:@crossworks/client-types@0.400.28",
40
+ "@mantle/client-types": "npm:@crossworks/client-types@0.400.31",
41
41
  "marked": "^18.1.1",
42
42
  "mathjs": "15.2.0"
43
43
  },
@@ -65,9 +65,9 @@ export function kindLane(key: string | null): JournalLane {
65
65
  }
66
66
 
67
67
  /** Legacy life areas that describe WHO the user is (background), not what
68
- * happened lately. Spike 10 (dev-brain page 60a2f51e): mapping these to
69
- * `context` let the newest-first cap drop a personal brain's family, faith
70
- * and health baseline entries from every prompt. */
68
+ * happened lately. Mapped to `context`, the newest-first cap dropped a
69
+ * personal brain's family, faith and health baseline entries from every
70
+ * prompt. */
71
71
  const LEGACY_BACKGROUND = new Set(['family', 'relationships', 'faith', 'health']);
72
72
 
73
73
  /** Map a legacy pre-v2 `category` value to a kind, for rows written before
@@ -110,7 +110,7 @@ export function inlineMediaImageIds(source: string | undefined | null): Set<stri
110
110
  }
111
111
 
112
112
  /** The node type each scheme requires (`mention:node:` takes any node, so it
113
- * has none): the one place the scheme names a kind (A10 #12). */
113
+ * has none): the one place the scheme names a kind. */
114
114
  const SCHEME_NODE_TYPE = {
115
115
  media: 'file',
116
116
  page: 'page',
@@ -1,5 +1,10 @@
1
1
  import { describe, expect, it } from 'vitest';
2
- import { projectAppOpens, projectAppPins, projectNavFavorites } from './profile-projections';
2
+ import {
3
+ projectAppOpens,
4
+ projectAppPins,
5
+ projectNavFavorites,
6
+ projectSounds,
7
+ } from './profile-projections';
3
8
 
4
9
  const id = (n: number) => `00000000-0000-4000-8000-${String(n).padStart(12, '0')}`;
5
10
 
@@ -32,3 +37,21 @@ describe('projectAppOpens', () => {
32
37
  expect(Object.keys(out)).toEqual([id(2), id(1)]);
33
38
  });
34
39
  });
40
+
41
+ describe('projectSounds', () => {
42
+ it('is unset for anything but an object', () => {
43
+ expect(projectSounds(undefined)).toBeUndefined();
44
+ expect(projectSounds('on')).toBeUndefined();
45
+ expect(projectSounds([true, 1])).toBeUndefined();
46
+ });
47
+
48
+ it('keeps a stored choice, clamps the volume, defaults what is missing', () => {
49
+ expect(projectSounds({ enabled: false, volume: 0.3 })).toEqual({ enabled: false, volume: 0.3 });
50
+ expect(projectSounds({ enabled: true, volume: 4 })).toEqual({ enabled: true, volume: 1 });
51
+ expect(projectSounds({ volume: -1 })).toEqual({ enabled: true, volume: 0 });
52
+ expect(projectSounds({ enabled: 'no', volume: Number.NaN })).toEqual({
53
+ enabled: true,
54
+ volume: 0.7,
55
+ });
56
+ });
57
+ });
@@ -23,6 +23,7 @@ import type {
23
23
  OnboardingModelChoices,
24
24
  ProfilePreferences,
25
25
  ReminderChannel,
26
+ SoundPreference,
26
27
  ThoughtTrailMode,
27
28
  } from '@mantle/client-types';
28
29
  import { kindsWhere } from '@mantle/client-types/kinds';
@@ -77,8 +78,8 @@ export function isPersistThoughtsEnabled(
77
78
  /** Builtin read tools that reach the owner's PRIVATE corpus (email + journal).
78
79
  * The Team Chat responder holds these via the `team-read` group, but they only
79
80
  * actually reach the model when the owner has opted in (`teamPrivateReads`).
80
- * The brain reads each tool's policy (`privateCorpus`, @mantle/tools; A5 step
81
- * 6a) to strip them from a workspace user's turn; this list stays exported
81
+ * The brain reads each tool's policy (`privateCorpus`, @mantle/tools) to
82
+ * strip them from a workspace user's turn; this list stays exported
82
83
  * for the published contract (the client) for one jackdaw pair release, and
83
84
  * packages/runtime/src/tool-policy-snapshot.test.ts pins it to the policies. */
84
85
  export const TEAM_PRIVATE_READ_SLUGS: readonly string[] = [
@@ -509,6 +510,20 @@ export function projectNavFavorites(raw: unknown): string[] | undefined {
509
510
  return out.length > 0 ? out : undefined;
510
511
  }
511
512
 
513
+ /** Project stored `sounds`: an object with a boolean `enabled` (else on) and
514
+ * a finite `volume` clamped to 0..1 (else 0.7, the client's default).
515
+ * Anything that is not an object is unset: the client's default applies. */
516
+ export function projectSounds(raw: unknown): SoundPreference | undefined {
517
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;
518
+ const v = raw as { enabled?: unknown; volume?: unknown };
519
+ const enabled = typeof v.enabled === 'boolean' ? v.enabled : true;
520
+ const volume =
521
+ typeof v.volume === 'number' && Number.isFinite(v.volume)
522
+ ? Math.min(1, Math.max(0, v.volume))
523
+ : 0.7;
524
+ return { enabled, volume };
525
+ }
526
+
512
527
  /** The Desk's bounds. Generous (a full desk is a few KB); they bound
513
528
  * the stored jsonb, not the layout. */
514
529
  export const HOME_DESK_ITEMS_MAX = 400;
@@ -855,8 +855,8 @@ export type TableRow = {
855
855
  columnCount: number;
856
856
  rowCount: number;
857
857
 
858
- /** A read-only snapshot copy of an accepted item (data.snapshot_of,
859
- * workspaces W6b fix round 1): nobody edits it, moves it out of its
858
+ /** A read-only snapshot copy of an accepted item (data.snapshot_of):
859
+ * nobody edits it, moves it out of its
860
860
  * private workspace or shares it; its author may delete it. Absent on
861
861
  * every other item. */
862
862
  readOnly?: true;