@gamaze/hicortex 0.27.4 → 0.28.0

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.
Files changed (92) hide show
  1. package/assets/dashboard.html +361 -100
  2. package/dist/backfill-privacy.d.ts +68 -45
  3. package/dist/backfill-privacy.js +236 -145
  4. package/dist/calibration.d.ts +67 -68
  5. package/dist/calibration.js +75 -78
  6. package/dist/capture-health.d.ts +2 -2
  7. package/dist/capture-health.js +2 -2
  8. package/dist/classification.d.ts +141 -12
  9. package/dist/classification.js +214 -27
  10. package/dist/classify-domains.d.ts +1 -1
  11. package/dist/classify-domains.js +2 -2
  12. package/dist/cli-args.d.ts +5 -3
  13. package/dist/cli-args.js +7 -3
  14. package/dist/cli.d.ts +2 -0
  15. package/dist/cli.js +64 -16
  16. package/dist/cluster.d.ts +12 -9
  17. package/dist/cluster.js +9 -6
  18. package/dist/consolidate.d.ts +93 -43
  19. package/dist/consolidate.js +255 -119
  20. package/dist/dashboard.d.ts +48 -5
  21. package/dist/dashboard.js +55 -3
  22. package/dist/db.js +27 -6
  23. package/dist/dedup.d.ts +2 -3
  24. package/dist/dedup.js +2 -3
  25. package/dist/distill-queue.d.ts +36 -4
  26. package/dist/distill-queue.js +80 -18
  27. package/dist/distiller.d.ts +1 -1
  28. package/dist/distiller.js +13 -12
  29. package/dist/domain-classify.d.ts +8 -9
  30. package/dist/domain-classify.js +6 -7
  31. package/dist/graph.d.ts +15 -5
  32. package/dist/graph.js +46 -13
  33. package/dist/hermes-transcript-reader.d.ts +1 -1
  34. package/dist/hermes-transcript-reader.js +1 -1
  35. package/dist/init.d.ts +2 -2
  36. package/dist/init.js +3 -3
  37. package/dist/llm.d.ts +1 -1
  38. package/dist/llm.js +5 -5
  39. package/dist/mcp-server.js +323 -59
  40. package/dist/memory-instructions.d.ts +2 -2
  41. package/dist/memory-instructions.js +2 -2
  42. package/dist/nightly.d.ts +1 -1
  43. package/dist/nightly.js +64 -5
  44. package/dist/nofit.d.ts +2 -2
  45. package/dist/nofit.js +2 -2
  46. package/dist/observed-agents.d.ts +54 -0
  47. package/dist/observed-agents.js +78 -0
  48. package/dist/project-canonicalize.d.ts +6 -5
  49. package/dist/project-canonicalize.js +6 -5
  50. package/dist/prompts.d.ts +29 -8
  51. package/dist/prompts.js +39 -16
  52. package/dist/quality-scoreboard.d.ts +1 -1
  53. package/dist/recall-hook-cli.d.ts +1 -1
  54. package/dist/recall-hook-cli.js +2 -2
  55. package/dist/recall-index.d.ts +28 -14
  56. package/dist/recall-index.js +22 -10
  57. package/dist/recall-precision.d.ts +3 -3
  58. package/dist/recall-precision.js +5 -4
  59. package/dist/reconcile-projects.d.ts +2 -2
  60. package/dist/reconcile-projects.js +2 -2
  61. package/dist/reconsolidation.d.ts +9 -2
  62. package/dist/reconsolidation.js +48 -31
  63. package/dist/relink.d.ts +2 -2
  64. package/dist/relink.js +4 -4
  65. package/dist/rescore-importance.d.ts +2 -2
  66. package/dist/rescore-importance.js +22 -3
  67. package/dist/retrieval.d.ts +14 -0
  68. package/dist/retrieval.js +11 -11
  69. package/dist/schema-prototypes.d.ts +1 -1
  70. package/dist/schema-prototypes.js +1 -1
  71. package/dist/seed-lesson.js +4 -2
  72. package/dist/spaces-api.d.ts +104 -0
  73. package/dist/spaces-api.js +193 -0
  74. package/dist/spaces-cli.d.ts +90 -0
  75. package/dist/spaces-cli.js +245 -0
  76. package/dist/spaces.d.ts +187 -0
  77. package/dist/spaces.js +360 -0
  78. package/dist/storage.d.ts +47 -10
  79. package/dist/storage.js +74 -17
  80. package/dist/sweep-volatile.d.ts +2 -2
  81. package/dist/sweep-volatile.js +2 -2
  82. package/dist/telemetry-cli.d.ts +1 -1
  83. package/dist/telemetry-cli.js +1 -1
  84. package/dist/type-classify.d.ts +1 -1
  85. package/dist/type-classify.js +1 -1
  86. package/dist/type-labels.d.ts +1 -1
  87. package/dist/type-labels.js +1 -1
  88. package/dist/types.d.ts +43 -20
  89. package/dist/wrapper-prompt.d.ts +2 -2
  90. package/dist/wrapper-prompt.js +2 -2
  91. package/package.json +1 -1
  92. package/server.json +2 -2
@@ -6,7 +6,7 @@
6
6
  visual on real endpoints, zero new write paths (Update/Remove ride the
7
7
  existing /update + /delete; identity Save rides PUT /identity).
8
8
 
9
- NAMING (owner ruling 2026-09-14): this surface is "the Hicortex server
9
+ NAMING RULE: this surface is "the Hicortex server
10
10
  dashboard" — the word "console" never appears in USER-VISIBLE strings
11
11
  (titles, tooltips, aria-labels, placeholders, toasts, empty states).
12
12
  Historical "console" wording in these comments is internal shorthand and
@@ -27,7 +27,7 @@
27
27
  - Capture health: real /distill accounting rows (posts · sessions · MB ·
28
28
  held per machine × harness) via /dashboard/data capture_health; the
29
29
  phase-1 counts-only rows remain as the degrade.
30
- Fix round 7 (#409, owner ruling 2026-09-14 — "the normal 30 day as the
30
+ Fix round 7 (#409 — "the normal 30 day as the
31
31
  other cards"): the card's face is the ROLLING window (window_rows,
32
32
  window_days), the newest night rides as a per-row secondary suffix;
33
33
  retention == window (CAPTURE_HEALTH_WINDOW_DAYS).
@@ -38,9 +38,9 @@
38
38
  /dashboard/model (api key write-only, applies on restart).
39
39
  - Overview: the counter/bar/headroom key off LIVE memories (absorbed
40
40
  rows show as an "absorbed (kept as evidence)" note); the counter is
41
- STATIC (no replay tracking — owner ruling 2026-09-13).
41
+ STATIC (no replay tracking — design ruling).
42
42
  - Recall card: the RAW uses-per-showing ratio, NO
43
- grade verdict (#426 owner semantics ruling: recall depends on the
43
+ grade verdict (#426 semantics ruling: recall depends on the
44
44
  conversation, higher is not a target).
45
45
  - Rail header: "Fleet".
46
46
 
@@ -61,7 +61,7 @@
61
61
  (override / global / off) over PUT /identity/mode — applies
62
62
  immediately, survives restart. Degrades to read-only on old servers.
63
63
 
64
- PRE-RELEASE POLISH (owner findings on the live console, 2026-09-13):
64
+ PRE-RELEASE POLISH (live-console findings):
65
65
  - SEARCH: /search accepts an OPTIONAL ?minSimilarity= floor (absent =
66
66
  ungated — agents unaffected; the gate is the recall-index's own
67
67
  passesRelevanceGate: FTS/both pass, vector-only must clear it). The
@@ -80,11 +80,9 @@
80
80
  field takes the viewport remainder (clamp with a measured offset —
81
81
  see the #brainwrap CSS note). Scroll stays available as overflow.
82
82
 
83
- FIX ROUND 2 (owner findings on the live console, 2026-09-14):
84
- - ACCOUNT MENU RESTORED TO THE CORNER (owner: "It needs to be an account
85
- menu where you can of course upgrade, but you should also be able to
86
- get the token — that was the critical problem — and see who you're
87
- logged in as and whatnot"). The chip + #365 menu render for EVERY
83
+ FIX ROUND 2 (live-console findings):
84
+ - ACCOUNT MENU RESTORED TO THE CORNER (an account menu where you can
85
+ upgrade, get the token, and see who you're logged in as). The chip + #365 menu render for EVERY
88
86
  account shape /account answers — including the all-null self-hosted
89
87
  default, which used to degrade the corner to a standalone Upgrade
90
88
  button. The upgrade CTA is a MENU ITEM (same plan-unset eligibility
@@ -95,7 +93,7 @@
95
93
  height.
96
94
  - DOT SIZING: strength→radius through a COMPRESSED mapping (sqrt span +
97
95
  dz^0.35 divisor, was s^1.2 + dz^1.25) — the rendered spread stays
98
- within ~2–2.5× (owner: no huge green balls, nothing barely visible);
96
+ within ~2–2.5× (no huge green balls, nothing barely visible);
99
97
  stage colors untouched.
100
98
 
101
99
  FIX ROUND 6 (the approved mockup, variant 3 + copy A): ENTRY LOADING
@@ -120,15 +118,15 @@
120
118
  data may still land). #still removes it synchronously (screenshot
121
119
  contract); reduced motion rests on the bar's static base transform.
122
120
 
123
- FIX ROUND 3 (owner findings on the live console, 2026-09-14):
124
- - FIELD LINKS (owner: "the white lines … get very thick — they kind of
121
+ FIX ROUND 3 (live-console findings):
122
+ - FIELD LINKS (the white lines get very thick — they kind of
125
123
  overtake most of the image"): settled strokes are hairline-floored and
126
124
  roughly half as opaque in both themes, the dark-theme thread color is
127
125
  dimmed (160,190,210 → 108,128,144) so the additive mesh reads as
128
126
  structure, not foreground; width still tapers by link strength (use
129
127
  count); the formation overlay slimmed in proportion. NO new-vs-old
130
- link highlighting (owner rejected it as incorrect). LOD untouched.
131
- - RECALL CARD final shape (owner, verbatim intent): the zone WORD is the
128
+ link highlighting (rejected as incorrect). LOD untouched.
129
+ - RECALL CARD final shape (the settled intent): the zone WORD is the
132
130
  card's big element — the same .big .n slot as the sibling numbers,
133
131
  colored by SAMPLING the band gradient at the marker fraction (one JS
134
132
  stop table drives band + word; setTheme re-renders). The band moved
@@ -137,17 +135,17 @@
137
135
  stays marked; the visible word failed to communicate). Vocabulary
138
136
  amendment: Low / HEALTHY / Overfetching. Marker + zone word stay.
139
137
 
140
- REPLAY + RANGE (#452, owner directives 2026-09-16):
138
+ REPLAY + RANGE (#452):
141
139
  - 30-DAY DEFAULT FOR ALL VIEWS: the replay ledger, the band and the
142
140
  snapshot series all default to 30 days (server EVENTS_DEFAULT_DAYS
143
141
  90 → 30; the client's every fetch is selector-driven). Longer
144
142
  ranges are OPT-IN via a compact 7 / 30 / 90 / 180 segmented control
145
143
  in the replay foot — explicit click only, never auto-loaded
146
- (SUPERSEDES the 2026-09-12 no-dropdowns ruling). No persistence:
144
+ (SUPERSEDES the no-dropdowns ruling). No persistence:
147
145
  every load starts at 30 (loads fast).
148
146
  - PLAY ONCE, THEN REST: the replay auto-starts as before (~3.6 s after
149
147
  boot), walks the ledger ONCE to today, and STOPS there — no loop
150
- (SUPERSEDES the 2026-09-13 auto-loop/no-buttons ruling). Controls in
148
+ (SUPERSEDES the auto-loop/no-buttons ruling). Controls in
151
149
  the replay foot, styled like "return to now": pause/resume (holds
152
150
  position mid-cruise; hides once the playback completed — nothing is
153
151
  playing) and "replay again" (appears once completed; restarts from
@@ -165,7 +163,7 @@
165
163
  - Recall card: no raw shown/used counts (the per-memory adoption sums
166
164
  are not in any payload yet).
167
165
  - Stage colors map forming→blue, belief→amber, truth→green, fading→red;
168
- thresholds CALIBRATED 2026-09-13 (the field payload echoes them).
166
+ thresholds CALIBRATED per release (the field payload echoes them).
169
167
  - D.fleet absent (pre-phase-3 server) → no dots, no pause toggles — the
170
168
  exact phase-2 rendering.
171
169
 
@@ -231,7 +229,7 @@
231
229
  body{ min-height:100%; }
232
230
  body{
233
231
  background:var(--bg); color:var(--text); font:14px/1.5 var(--font);
234
- /* #424 review (owner mechanics): the document scrolls END-TO-END — no
232
+ /* #424 review (settled mechanics): the document scrolls END-TO-END — no
235
233
  fixed app-shell. The flight field keeps its own viewport-height area
236
234
  within the flow (see #brainwrap); canvas interaction is untouched. */
237
235
  display:flex; flex-direction:column;
@@ -362,9 +360,9 @@
362
360
  }
363
361
  .acct-link:hover{ background:var(--panel); }
364
362
  .acct-link.acct-danger:hover{ color:var(--red); }
365
- /* the Subscription entry's upgrade pill (#371 round 3, owner: the menu's
366
- two billing entries merge into ONE "Subscription" item — "it can have
367
- an upgrade pill/label after it before any subscription is active").
363
+ /* the Subscription entry's upgrade pill (#371 round 3: the menu's
364
+ two billing entries merge into ONE "Subscription" item, which can have
365
+ an upgrade pill/label after it before any subscription is active).
368
366
  The ENTRY always renders; the PILL is what the plan-unset eligibility
369
367
  gates. Accent badge in the trigger's chip idiom. */
370
368
  .acct-link .acct-pill{
@@ -429,11 +427,11 @@
429
427
  .csub b{ color:var(--green-mid); font-weight:600; }
430
428
  .csub .blue{ color:var(--blue); }
431
429
  .csub.mono{ font-family:var(--mono); font-size:10px; }
432
- /* recall card — the designed U-band (#426 final ruling 2026-09-13): a
430
+ /* recall card — the designed U-band (#426 final ruling): a
433
431
  continuous red→green→red gradient over the PROVISIONAL zone edges. NO
434
- tick marks or edge numerics — the owner's calibration state is "we have
435
- no clue on how to calibrate yet", so nothing implies measured
436
- boundaries. #409 fix round 3 (owner, verbatim intent): the ZONE WORD is
432
+ tick marks or edge numerics — there are no measured calibration
433
+ boundaries yet, so nothing implies measured
434
+ boundaries. #409 fix round 3 (the settled intent): the ZONE WORD is
437
435
  the card's big element — the same .big .n slot as the sibling numbers,
438
436
  its color SAMPLED from the band gradient at the marker fraction (one JS
439
437
  stop table drives band fill + word color, so they cannot disagree). The
@@ -441,7 +439,7 @@
441
439
  shared .bseg gap rhythm — limitbar alignment; card height matches the
442
440
  row). The visible "provisional" word is GONE — the marking is hover-only
443
441
  now, a tooltip on the band (the visible word failed to communicate).
444
- Vocabulary (owner 2026-09-14): Low / Healthy / Overfetching. The raw
442
+ Vocabulary: Low / Healthy / Overfetching. The raw
445
443
  number stays tooltip-only on the marker (mock
446
444
  family). Colors: the band + word carry concrete per-theme colors from
447
445
  the JS stop table (setTheme re-renders), the dot rides theme tokens. */
@@ -594,7 +592,7 @@
594
592
  }
595
593
 
596
594
  /* ---- the brain-field ---- */
597
- /* ONE-SCREEN AT-REST LAYOUT (#409 polish, owner ruling 2026-09-13): header
595
+ /* ONE-SCREEN AT-REST LAYOUT (#409 polish, design ruling): header
598
596
  + stats band + field fit the first viewport at ~1440×900 (that is the
599
597
  reference; 1280×800 verified too). The field takes the viewport REMAINDER
600
598
  — the subtracted constant is the MEASURED header+band+paddings total on
@@ -789,7 +787,7 @@
789
787
  .btn.confirm{ border-color:color-mix(in srgb, var(--red) 80%, transparent); color:var(--red); }
790
788
  .btn.save{ border-color:color-mix(in srgb, var(--blue) 60%, transparent); color:var(--blue); }
791
789
  .btn.sm{ padding:4px 11px; font-size:10.5px; flex:none; }
792
- /* ---- bounded list mechanics (#424 review, owner numbers): card lists cap
790
+ /* ---- bounded list mechanics (#424 review): card lists cap
793
791
  at 10 visible rows and scroll INSIDE the card — the card's height is
794
792
  bounded, the band layout never blows up ---- */
795
793
  #cap-rows{ max-height:200px; overflow-y:auto; scrollbar-width:thin; } /* ~8 rows — tightened for the one-screen at-rest layout */
@@ -827,7 +825,7 @@
827
825
  /* rolling 30 nights card — five segments per bar in phase 2 (#422): added
828
826
  (blue), merged (grey) + the three graduation deltas (stage palette).
829
827
  The chart is not a list — it FLEXES to fill the card's vertical space
830
- (owner live-review: 24px left dead space under it); the bounded-list
828
+ (live review found 24px left dead space under it); the bounded-list
831
829
  scroll mechanics elsewhere are untouched. */
832
830
  .roll-top{ display:flex; gap:16px; align-items:baseline; flex-wrap:wrap; margin-bottom:4px; }
833
831
  .roll-top .rn{ font-size:15px; font-weight:620; font-variant-numeric:tabular-nums; }
@@ -872,7 +870,7 @@
872
870
  .cap-bar{ flex:1; height:5px; border-radius:2.5px; background:var(--tbar-bg); overflow:hidden; min-width:30px; }
873
871
  /* the share fill sources its accent the same way the activity bars do —
874
872
  a plain CSS var, no color-mix (the mix-based fill
875
- rendered grey in the owner's live review; both themes flip the var) */
873
+ rendered grey in live review; both themes flip the var) */
876
874
  .cap-bar .fill{ height:100%; border-radius:2.5px; background:var(--green-mid); }
877
875
  .cap-row2 .st{ font-size:10px; color:var(--faint); font-family:var(--mono); white-space:nowrap; }
878
876
  .cap-row2 .st b{ color:var(--dim); font-weight:500; }
@@ -907,6 +905,59 @@
907
905
  nothing. */
908
906
  #ag-circle{ margin-left:auto; }
909
907
  #ag-circle[hidden]{ display:none; }
908
+ /* #642: the space chips — one small chip per space membership (the amber
909
+ circle pill generalized to N pools; the confidential chip KEEPS the amber
910
+ family via .conf, every other space reads neutral-dim). Shared by the
911
+ per-agent badges (ctx rows, detail headers) and the bundle chips. */
912
+ .space-chip{
913
+ flex:none; display:inline-flex; align-items:center; line-height:1.25;
914
+ font-size:9px; font-family:var(--mono); letter-spacing:.03em;
915
+ padding:2px 7px; border-radius:999px; white-space:nowrap;
916
+ color:var(--dim); background:color-mix(in srgb, var(--dim) 11%, transparent);
917
+ border:1px solid var(--line2);
918
+ }
919
+ .space-chip.conf{
920
+ color:var(--amber); background:color-mix(in srgb, var(--amber) 13%, transparent);
921
+ border-color:color-mix(in srgb, var(--amber) 45%, transparent);
922
+ }
923
+ /* #642: the space management card (under the fleet rail's agent list) —
924
+ one lane per space + the Unassigned lane; agent chips assign/unassign
925
+ through PUT /spaces/assign|unassign. [hidden] wins (the .cap-qrow idiom)
926
+ so a pre-#642 server — or a zero-space, zero-unassigned payload — shows
927
+ nothing at all. */
928
+ #ag-spaces{
929
+ flex:none; border-top:1px solid var(--line); padding:9px 12px 11px;
930
+ max-height:44%; overflow-y:auto; scrollbar-width:thin;
931
+ }
932
+ #ag-spaces[hidden]{ display:none; }
933
+ .sp-head{ display:flex; align-items:baseline; gap:7px; margin-bottom:7px; }
934
+ .sp-head .t{ font-size:10px; color:var(--faint); text-transform:uppercase; letter-spacing:.15em; }
935
+ .sp-head small{ font-size:9px; color:var(--faint); font-family:var(--mono); }
936
+ .sp-lane{ margin-bottom:7px; }
937
+ .sp-lane:last-child{ margin-bottom:0; }
938
+ .sp-lane-head{ display:flex; align-items:baseline; gap:6px; margin-bottom:4px; min-width:0; }
939
+ .sp-lane-head b{ font-weight:600; font-size:11px; white-space:nowrap; }
940
+ .sp-lane-head small{ font-size:9px; color:var(--faint); font-family:var(--mono); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
941
+ .sp-chips{ display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
942
+ .sp-agent{
943
+ font-size:9.5px; font-family:var(--mono); color:var(--text);
944
+ border:1px solid var(--line2); border-radius:999px; padding:2px 8px;
945
+ background:var(--elev); cursor:pointer; white-space:nowrap;
946
+ transition:border-color .15s, color .15s;
947
+ }
948
+ .sp-agent:hover{ border-color:color-mix(in srgb, var(--green) 40%, transparent); }
949
+ .sp-agent.confirm{ color:var(--red); border-color:color-mix(in srgb, var(--red) 70%, transparent); }
950
+ .sp-agent.unassigned{ color:var(--faint); border-style:dashed; }
951
+ .sp-note{ font-size:9px; color:var(--faint); font-family:var(--mono); padding:2px 0; }
952
+ /* the per-chip assign picker — inline (never a positioned popover: the rail
953
+ clips), rendered in place of the clicked unassigned chip */
954
+ .sp-pick{ display:inline-flex; flex-wrap:wrap; gap:4px; align-items:center; }
955
+ .sp-pick button{
956
+ font-size:9.5px; font-family:var(--mono); color:var(--green-mid);
957
+ border:1px solid color-mix(in srgb, var(--green) 40%, transparent);
958
+ border-radius:999px; padding:2px 8px; background:transparent; cursor:pointer;
959
+ }
960
+ .sp-pick button.cancel{ color:var(--faint); border-color:var(--line2); }
910
961
 
911
962
  /* ================= the memory dropdown — opens UNDER the left search ================= */
912
963
  #panel{
@@ -1047,7 +1098,7 @@
1047
1098
  #model-modal .mm-note{ padding:4px 14px 8px; font-size:10px; color:var(--faint); font-style:italic; }
1048
1099
  #model-modal .mm-foot{ display:flex; justify-content:flex-end; gap:7px; padding:10px 14px; border-top:1px solid var(--line); }
1049
1100
 
1050
- /* plan & billing overlay (#371, owner amendment 2 2026-09-23: the under-
1101
+ /* plan & billing overlay (#371, amendment 2: the under-
1051
1102
  graph section was rejected — the upgrade surface must COVER the dash).
1052
1103
  The #model-modal idiom, widened for two side-by-side option cards; the
1053
1104
  cover is OPAQUE (var(--bg), not a scrim) — the dash is fully hidden
@@ -1082,8 +1133,8 @@
1082
1133
  cards, shown only while the selected currency is USD (setPlanCur). No
1083
1134
  display rule of its own, so the UA [hidden] hides it. */
1084
1135
  #plan-overlay .po-tax{ font-size:11px; color:var(--dim); }
1085
- /* what's included (round 3, owner: "NO info on what is included in the
1086
- plan") — the marketing site's Cloud feature lines, verbatim, per card. */
1136
+ /* what's included (round 3: the plan must say what is included) —
1137
+ the marketing site's Cloud feature lines, verbatim, per card. */
1087
1138
  .po-opt .po-feat{ list-style:none; margin-top:7px; display:flex; flex-direction:column; gap:3px; }
1088
1139
  .po-opt .po-feat li{ font-size:11px; color:var(--dim); display:flex; gap:7px; align-items:baseline; }
1089
1140
  .po-opt .po-feat li::before{ content:"✓"; color:var(--green-mid); font-size:10px; }
@@ -1097,7 +1148,7 @@
1097
1148
  @media (max-width:720px){ .po-opts{ grid-template-columns:1fr; } }
1098
1149
 
1099
1150
  /* connect overlay (#506) — ONE full-cover surface for every "Connect an
1100
- agent" entry (the #plan-overlay idiom, owner 2026-09-24: the fleet
1151
+ agent" entry (the #plan-overlay idiom, #506 ruling: the fleet
1101
1152
  rail's inline drawer is REMOVED, not kept; the account-menu entry and
1102
1153
  the Agents-detected pill both open THIS). The cover is OPAQUE
1103
1154
  (var(--bg), not a scrim) and the [hidden] override is MANDATORY
@@ -1440,8 +1491,14 @@
1440
1491
  <aside id="agentscol" aria-label="Connected agents">
1441
1492
  <div class="col-head"><span class="t">Fleet</span><small id="ag-sub">0 &middot; auto-detected</small><span id="ag-circle" hidden></span></div>
1442
1493
  <div id="ag-list"></div>
1494
+ <!-- #642: the space management card — one lane per space + the Unassigned
1495
+ lane (first-prompt discovery). Chips drive PUT /spaces/assign and
1496
+ PUT /spaces/unassign (the AC-10 admin API — the same endpoints the
1497
+ CLI uses). Hidden entirely when the payload carries no spaces block
1498
+ (older server) or nothing to show (zero spaces + zero unassigned). -->
1499
+ <div id="ag-spaces" hidden></div>
1443
1500
  <!-- #506: the fleet rail's + connect-an-agent drawer lived here — REMOVED
1444
- (owner 2026-09-24). Both surviving connect entries (the account-menu
1501
+ (#506 ruling). Both surviving connect entries (the account-menu
1445
1502
  entry + the Agents-detected pill) open the #connect-overlay. -->
1446
1503
  </aside>
1447
1504
  </main>
@@ -1487,11 +1544,10 @@
1487
1544
  </div>
1488
1545
  </div>
1489
1546
 
1490
- <!-- ============ the PLAN & BILLING overlay (#371, owner amendment 2
1491
- 2026-09-23: the under-graph section was rejected after the live look —
1492
- "the plan and billing needs to open up as overlay, not under the
1493
- graph, it could not even find it first. needs to cover the normal dash
1494
- or be a separate tab or view"; the owner picked the full overlay).
1547
+ <!-- ============ the PLAN & BILLING overlay (#371, amendment 2:
1548
+ the under-graph section was rejected after the live look — the plan
1549
+ and billing surface must open as a full-cover overlay, not sit under
1550
+ the graph where it cannot be found; the full overlay was picked.
1495
1551
  Opens from the account menu's Subscription entry (round 3: the two
1496
1552
  billing entries merged into one); the opaque .po-cover fully hides
1497
1553
  the dash (not dimmed-partial). × / cover-click / ESC close and return
@@ -1522,7 +1578,7 @@
1522
1578
  <!-- ============ the CONNECT overlay (#506) — ONE full-cover surface for
1523
1579
  every "Connect an agent" entry. Before this there were two shapes: the
1524
1580
  account menu's inline expandable snippets and the fleet rail's +
1525
- drawer. Owner 2026-09-24: the rail entry is REMOVED, not kept; the
1581
+ drawer. #506 ruling: the rail entry is REMOVED, not kept; the
1526
1582
  account-menu entry and the Agents-detected pill both open THIS
1527
1583
  (#plan-overlay idiom: opaque cover, × / cover-click / ESC). The
1528
1584
  snippet <pre>s and copy buttons keep the acct-* ids so
@@ -1692,7 +1748,7 @@ async function api(path, opts = {}) {
1692
1748
  return resp.json();
1693
1749
  }
1694
1750
 
1695
- /* ---------- the four stages (owner ruling): Forming → Belief → Truth →
1751
+ /* ---------- the four stages (design ruling): Forming → Belief → Truth →
1696
1752
  Fading, colored blue → yellow → green → red. Wire keys
1697
1753
  forming/belief/truth/fading ride every surface; thresholds come from the
1698
1754
  field payload echo (calibration.ts server-side). ---------- */
@@ -1713,9 +1769,9 @@ const STAGE_KEYS = ['forming','belief','truth','fading'];
1713
1769
  screen-space floor in the draw path). */
1714
1770
  const DEPTH_BANDS = { truth:[.9,1.05], belief:[1.05,1.3], forming:[1.3,1.55], fading:[1.55,1.8] };
1715
1771
 
1716
- /* #409 fix round 2 — dot sizing (owner: "the green dots are so much bigger
1717
- than anything else… a few huge green balls while yellow and others are
1718
- barely visible"). Strength still encodes size, but the RANGE is
1772
+ /* #409 fix round 2 — dot sizing (the green dots rendered so much bigger
1773
+ than anything else — a few huge green balls while yellow and others were
1774
+ barely visible). Strength still encodes size, but the RANGE is
1719
1775
  compressed: sqrt over a 3px span (6→9) for the strength term, plus a
1720
1776
  softened depth divisor (dz^0.35, was dz^1.25 — Truth being nearest AND
1721
1777
  strongest used to compound into a ~3.3–4× rendered spread). Worst case
@@ -1725,7 +1781,7 @@ const DEPTH_BANDS = { truth:[.9,1.05], belief:[1.05,1.3], forming:[1.3,1.55], fa
1725
1781
  pre-#425 store shows no monsters. Robust by construction: the mapping is
1726
1782
  absolute (no min/max over the live distribution), so it cannot explode on
1727
1783
  a skewed store. Pure functions — the ratio is behaviorally tested.
1728
- #474 graph final (owner 2026-09-19): the balls at 30% — 1.8→2.7, exactly
1784
+ #474 graph final: the balls at 30% — 1.8→2.7, exactly
1729
1785
  0.30× of the 6→9 law; the depth divisor and the ruled ratio band are
1730
1786
  scale-invariant and unchanged. */
1731
1787
  function bubbleRadius(s){ return 1.8 + Math.sqrt(clamp(s??0,0,1))*0.9; }
@@ -1733,7 +1789,7 @@ function depthSizeDivisor(dz){ return Math.pow(Math.max(.14,dz),0.35); }
1733
1789
 
1734
1790
  /* ---------- live-data state ---------- */
1735
1791
  let RANGE=30; // days — the range selector's value (#452; 30-day default for
1736
- // ALL views, owner directive 2026-09-16). NO persistence: every
1792
+ // ALL views, #452 directive). NO persistence: every
1737
1793
  // load starts at 30 — it loads fast; longer is opt-in per click.
1738
1794
  let D=null; // /dashboard/data?range=RANGE d — band, series, digest
1739
1795
  let F=null; // /dashboard/field
@@ -1742,7 +1798,7 @@ let M=null; // /dashboard/model (#422) — null on failure: label-only degrad
1742
1798
  let TOTAL=0, removedNow=0;
1743
1799
  /* the store's static LIVE count (headline.live_memories ?? total): the
1744
1800
  overview counter shows THIS from login — it does not track the replay
1745
- clock (owner ruling 2026-09-13; only the boot reveal counts up) */
1801
+ clock (design ruling; only the boot reveal counts up) */
1746
1802
 
1747
1803
  /* =====================================================================
1748
1804
  WORLD — domains, memories, the dateline window (the visible set), real
@@ -1757,7 +1813,7 @@ const links = []; // real link edges, engine-decorated
1757
1813
  let crowdByStage = {}; // stage -> [mem refs] (EVERY memory paints)
1758
1814
  const bubbles = []; // the latest-N-by-dateline visible set (#474
1759
1815
  // return; owned by refreshWindow, rebuilt on T)
1760
- const FIELD_WINDOW_N = 1000; // #474 graph final (owner 2026-09-19): the field shows the latest N memories by dateline
1816
+ const FIELD_WINDOW_N = 1000; // #474 graph final: the field shows the latest N memories by dateline
1761
1817
  let WIN_ORDER = []; // every mem (live + ghosts), effCreated DESC, id ASC
1762
1818
  let winSet = new Set(); // ids in the window at the current T
1763
1819
  let winCount = []; // per-domain window counts (labels + tip)
@@ -1770,7 +1826,7 @@ let learnedL = [], mergedL = [], enrichedL = [];
1770
1826
  let NIGHTS = []; // the events payload's night list
1771
1827
  let WINDOW = 1, NOW_T = .999, REPLAY_OK = false;
1772
1828
 
1773
- /* Replay pacing (owner 2026-09-19: 2x faster default). Event-driven cruise:
1829
+ /* Replay pacing (#474: 2x faster default). Event-driven cruise:
1774
1830
  each ledger event lands every REPLAY_TICK_MS; a heralded (birth/merge)
1775
1831
  event holds the clock REPLAY_HERALD_MS then applies; boundary beats rest
1776
1832
  REPLAY_REST_MS. Halve all three to run 2x; the constants are the only
@@ -2027,7 +2083,7 @@ const THEMES = {
2027
2083
  add:true,
2028
2084
  /* #409 fix round 3: thread dimmed 160,190,210 → 108,128,144 — additive
2029
2085
  stacks on overlap, so a bright base read as foreground mesh, not
2030
- structure (owner: "the white lines … overtake most of the image") */
2086
+ structure (the white lines read as overtaking most of the image) */
2031
2087
  thread:[108,128,144],
2032
2088
  threadHot:[61,255,122],
2033
2089
  signal:[190,255,215],
@@ -2162,7 +2218,7 @@ function sprite(stage, r){
2162
2218
  const st = PAL.stages[stage] || PAL.stages.forming;
2163
2219
  const rgb = st.rgb;
2164
2220
  if(PAL.name==='dark'){
2165
- /* #474 final polish (owner 2026-09-20): plain dot — no glow halo, no
2221
+ /* #474 final polish: plain dot — no glow halo, no
2166
2222
  white core gradient. A filled circle with a slightly brighter edge;
2167
2223
  the maturity color carries the reading, the size stays small. */
2168
2224
  const S = Math.ceil(rad*PAL.sprK), c2 = document.createElement('canvas');
@@ -2484,16 +2540,16 @@ function draw(now, dt){
2484
2540
  permanently — a green mesh over the field. The hot style now rides
2485
2541
  only the formation window itself, as an overlay that fades out as
2486
2542
  prog -> 1 (heat pulses are kept in both styles).
2487
- - VISUAL WEIGHT (#409 fix round 3, owner: "the white lines … kind of
2488
- overtake most of the image"): the LOD culls COUNT at depth, but the
2543
+ - VISUAL WEIGHT (#409 fix round 3: the white lines kind of
2544
+ overtake most of the image): the LOD culls COUNT at depth, but the
2489
2545
  settled strokes themselves were too heavy — on the real store the
2490
2546
  additive composite stacks overlapping threads toward white. Strokes
2491
2547
  are now hairline-floored and roughly half as opaque, the dark-theme
2492
2548
  thread color is DIMMED to read as structure, not foreground, and the
2493
2549
  width law still tapers by link strength (use count). Dots stay
2494
2550
  dominant: the field is dots first, lines as connective tissue.
2495
- NO new-vs-old link highlighting — the owner considered and rejected
2496
- it as incorrect; links never encode age. */
2551
+ NO new-vs-old link highlighting — considered and rejected
2552
+ as incorrect; links never encode age. */
2497
2553
  ctx.globalCompositeOperation=ADD;
2498
2554
  const linkBoot = booting? clamp((bootP*1.7-.55)*2,0,1) : 1;
2499
2555
  const lodK = cam.s>=2.5 ? Infinity : Math.max(3, 3+(cam.s-1)*14);
@@ -2519,7 +2575,7 @@ function draw(now, dt){
2519
2575
  const drawP=Math.min(prog,linkBoot);
2520
2576
  if(drawP<=0) continue;
2521
2577
  /* #474 final polish: domain focus — a thread stays lit only if an
2522
- endpoint belongs to the focused domain (owner 2026-09-20) */
2578
+ endpoint belongs to the focused domain (#474) */
2523
2579
  const focusDim = (focusDom!=null && a.dom!==focusDom && b.dom!==focusDom) ? .15 : 1;
2524
2580
  const len=Math.hypot(x2-x1,y2-y1)*1.15;
2525
2581
  const superFam = L.rel==='superseded_by'||L.rel==='corrected_by';
@@ -2836,8 +2892,8 @@ function wake(){ lastActivity=performance.now(); }
2836
2892
 
2837
2893
  /* ---------- replay — time travel: drag to take the helm, else the G1
2838
2894
  auto-cruise walks the REAL event ledger (one memory action at a time)
2839
- ONCE to today, then rests there (#452, owner ruling 2026-09-16 —
2840
- supersedes the 2026-09-13 auto-loop). Pause/resume + "replay again" sit
2895
+ ONCE to today, then rests there (#452 —
2896
+ supersedes the earlier auto-loop). Pause/resume + "replay again" sit
2841
2897
  in the foot beside "return to now"; a manual take still pauses the
2842
2898
  cruise and re-engages ~12 s after idle, continuing toward today — where
2843
2899
  it now stops instead of looping.
@@ -2937,7 +2993,7 @@ function onTChanged(fromSeek){
2937
2993
  el('rp-pause').classList.toggle('show',REPLAY_OK&&!played);
2938
2994
  el('rp-again').classList.toggle('show',REPLAY_OK&&played);
2939
2995
  updateMeasures();
2940
- /* #422 owner ruling: the overview counter is STATIC (the store's live
2996
+ /* #422 ruling: the overview counter is STATIC (the store's live
2941
2997
  count, set once at boot + after writes) — scrubbing the replay no longer
2942
2998
  spins the number. Only the boot reveal counts up (tickCounter). */
2943
2999
  dirty=true;
@@ -2978,7 +3034,7 @@ el('rp-again').onclick=()=>{
2978
3034
  seek(.001); wake();
2979
3035
  };
2980
3036
 
2981
- /* #452 — the range selector: 7/30/90/180 days (the owner-fixed option
3037
+ /* #452 — the range selector: 7/30/90/180 days (the fixed option
2982
3038
  set), default 30, NO persistence — every load starts at 30 (loads fast).
2983
3039
  A click refetches BOTH range-scoped sources and rebuilds the world
2984
3040
  exactly like boot — the agents rail included (its "last night" line
@@ -3342,7 +3398,7 @@ function renderBand(){
3342
3398
  fills the card's remaining vertical space like the activity bars */
3343
3399
  buildTokNights(used, cap, tok?tok.period_start:null);
3344
3400
 
3345
- // Recall level — the designed U-band (#426 final ruling 2026-09-13; see
3401
+ // Recall level — the designed U-band (#426 final ruling; see
3346
3402
  // renderRecBand).
3347
3403
  renderRecBand(h?h.uses_per_showing:null);
3348
3404
  loadContested(); /* #593: presence needs the count — one guarded GET at render */
@@ -3389,17 +3445,17 @@ function buildTokNights(used, cap, periodStart){
3389
3445
  }
3390
3446
  }
3391
3447
 
3392
- /* ---------- Recall level — the designed U-band (#426 final ruling
3393
- 2026-09-13). A continuous red→green→red gradient spans the PROVISIONAL
3448
+ /* ---------- Recall level — the designed U-band (#426 final ruling).
3449
+ A continuous red→green→red gradient spans the PROVISIONAL
3394
3450
  zone edges (echoed by /dashboard/field as thresholds.recall_uses — the
3395
3451
  page NEVER hardcodes them; a pre-band server simply has no band).
3396
- #409 fix round 3 (owner, verbatim intent): the zone WORD is the card's
3452
+ #409 fix round 3 (the settled intent): the zone WORD is the card's
3397
3453
  big element — the same slot as the sibling cards' large numbers, colored
3398
3454
  by sampling the band gradient at the marker fraction; the band sits in
3399
3455
  the siblings' chart slot; "provisional" is hover-only (band tooltip).
3400
3456
  The raw ratio stays tooltip-only on the marker. Deliberately NO tick
3401
- marks or edge numerics: the owner's calibration state is "we have no
3402
- clue on how to calibrate yet", so no visual element may imply measured
3457
+ marks or edge numerics: there are no measured calibration
3458
+ boundaries yet, so no visual element may imply measured
3403
3459
  boundaries — gradient + sampled word + provisional tooltip. */
3404
3460
  function recallUsesZone(v,z){
3405
3461
  /* pure decision — the edges come in as the echo object; null when either
@@ -3410,7 +3466,7 @@ function recallUsesZone(v,z){
3410
3466
  if(v<z.normal_max) return 'normal';
3411
3467
  return 'over';
3412
3468
  }
3413
- /* vocabulary amendment (owner, 2026-09-14): the middle zone's word is
3469
+ /* vocabulary amendment: the middle zone's word is
3414
3470
  Healthy — Low / Healthy / Overfetching (keys + echo field names stay) */
3415
3471
  const RECALL_ZONE_WORD = {low:'Low',normal:'Healthy',over:'Overfetching'};
3416
3472
  const RECALL_ZONE_PLAIN={low:'shown memories are rarely picked up',normal:'shown memories get picked up at a healthy rate',over:'shown memories get picked up almost always'};
@@ -3508,7 +3564,7 @@ function renderRecBand(ups){
3508
3564
  row.hidden=false;
3509
3565
  const pct=v=>clamp(v/axis,0,1)*100;
3510
3566
  band.style.background=recallGradCss(z,theme);
3511
- /* the provisional marking is HOVER-ONLY now (owner: the visible word
3567
+ /* the provisional marking is HOVER-ONLY now (the visible word
3512
3568
  failed to communicate) — the tooltip IS the marking, still explicit
3513
3569
  about the calibration state */
3514
3570
  const prov='Zone edges are provisional until fleet telemetry locates the valley (#426) — shown for direction only.';
@@ -3541,7 +3597,7 @@ function renderRecBand(ups){
3541
3597
  word.style.color=''; word.style.textShadow='none';
3542
3598
  word.title='no showings yet';
3543
3599
  }
3544
- /* No trend arrow (owner 2026-09-20: removed — unclear). Its renderer and
3600
+ /* No trend arrow (removed — unclear). Its renderer and
3545
3601
  the element writes are removed WITH it: a leftover write to a removed
3546
3602
  element is a boot-killing TypeError whenever the recall band carries
3547
3603
  real data (a production instance on 0.22.2: "0 memories" — boot died
@@ -3735,9 +3791,9 @@ async function loadContested(force){
3735
3791
  }
3736
3792
 
3737
3793
  let MODEL_LABEL='';
3738
- /* #409 fix round 5 — owner ruling 2026-09-14 (verbatim): "I do NOT want to
3739
- know what it is compatible with, I want to know the fucking model." The
3740
- card face shows THE MODEL, nothing else: hero = the namespace-stripped
3794
+ /* #409 fix round 5 — the ruling: the card must show THE MODEL, not what
3795
+ it is compatible with.
3796
+ The card face shows THE MODEL, nothing else: hero = the namespace-stripped
3741
3797
  model name (fit-scaled, floor 20px), mono line = the raw config id,
3742
3798
  caption "detected from config", configure pill. NO protocol line, NO
3743
3799
  provider line — local and cloud endpoints render identically. (The
@@ -3926,14 +3982,14 @@ function buildRoll(){
3926
3982
  /* ---------- capture health — phase 2: per machine × harness rows from the
3927
3983
  /dashboard/data capture_health accounting; the counts-only rows remain
3928
3984
  the degrade for old servers / nothing recorded yet.
3929
- Fix round 7 (owner ruling 2026-09-14 — "the normal 30 day as the other
3985
+ Fix round 7 (#409 — "the normal 30 day as the other
3930
3986
  cards"): the card's face is the ROLLING window (capture_health
3931
3987
  window_rows, summed over the last window_days calendar days); the newest
3932
3988
  night rides as a per-row secondary suffix ("tonight: N sess" / the
3933
3989
  night's date when it is not today). Degradation ladder: pre-round-7
3934
3990
  server (no window_rows) → the newest-night view below; no activity rows
3935
3991
  at all → the counts-only rows. ---------- */
3936
- /* ---------- machine × harness grouping (#424 review fixes 4+5 + the owner's
3992
+ /* ---------- machine × harness grouping (#424 review fixes 4+5 + the
3937
3993
  model-B direction): source_agent is "harness/profile" and each context may
3938
3994
  carry a source_machine stamp (migration v15+). The rows a stats card and
3939
3995
  the rail can legibly show are per machine × harness bundles — never the
@@ -4060,16 +4116,26 @@ function circleCount(agentId){
4060
4116
  return typeof n==='number'?n:null;
4061
4117
  }
4062
4118
  /** Per-agent pill — '' for standard agents (no markup at all); the meaning
4063
- and the count live in the tooltip (tech detail in tooltips). */
4119
+ and the count live in the tooltip (tech detail in tooltips).
4120
+ #642: when fleet.spaces is present the SPACE BADGES replace the single
4121
+ amber pill (the confidential chip keeps the amber family). The D access
4122
+ is typeof-guarded so the #593 rig — which slices this fn out with only
4123
+ circleCount injected — still exercises the pre-#642 branch unchanged. */
4064
4124
  function circlePill(agentId){
4125
+ const sb=(typeof D!=='undefined'&&D&&D.fleet)?D.fleet.spaces:null;
4126
+ if(sb&&Array.isArray(sb.spaces)) return spaceBadges(agentId,sb);
4065
4127
  const n=circleCount(agentId);
4066
4128
  if(n===null) return '';
4067
4129
  return '<span class="conf-pill" title="Confidential circle — this agent\'s captures are confidential, hidden from other agents\' recall · '+n+' confidential '+(n===1?'memory':'memories')+'">confidential</span>';
4068
4130
  }
4069
4131
  /** Bundle-level pill (rail card header / capture rows) — the tooltip names
4070
- every member agent + its count; '' when none of the ids are members. */
4132
+ every member agent + its count; '' when none of the ids are members.
4133
+ #642: fleet.spaces present → one chip per space covering any of the ids
4134
+ (same typeof-D guard as circlePill). */
4071
4135
  function circleBundlePill(ids){
4072
4136
  if(!Array.isArray(ids)) return '';
4137
+ const sb=(typeof D!=='undefined'&&D&&D.fleet)?D.fleet.spaces:null;
4138
+ if(sb&&Array.isArray(sb.spaces)) return spaceBundleBadges(ids,sb);
4073
4139
  const hits=[];
4074
4140
  for(const id of ids){
4075
4141
  const n=circleCount(id);
@@ -4089,6 +4155,60 @@ function circleLegend(){
4089
4155
  const title='Confidential circle — amber pills mark agents whose captures are confidential, visible only to circle members (this dashboard shows everything). Roster ('+c.roster.length+'): '+c.roster.join(', ')+(capturing.length?' · capturing: '+capturing.join(', '):'');
4090
4156
  return {html:'<span class="conf-pill" role="img" aria-label="confidential agent" title="'+esc(title)+'"><svg viewBox="0 0 12 12" aria-hidden="true"><rect x="2.2" y="5.2" width="7.6" height="5.6" rx="1.2"/><path d="M4 5.2V3.8a2 2 0 0 1 4 0v1.4"/></svg></span>', title};
4091
4157
  }
4158
+ /* ---------- #642: spaces — fleet.spaces rides the same /dashboard/data
4159
+ payload (ALWAYS present; spaces [] when nothing is configured). The
4160
+ per-agent chips REPLACE the single amber circle pill when the block is
4161
+ there (circlePill/circleBundlePill delegate); the confidential chip keeps
4162
+ the amber family. Agents in no space show nothing extra — the management
4163
+ card's Unassigned lane is where they surface. D.fleet.spaces ABSENT on a
4164
+ pre-#642 server → every helper here is never reached (the pill helpers
4165
+ take their prior branch). The match grammar mirrors the server's
4166
+ isConfidentialSourceAgent: members carry BARE sanitized ids, observed
4167
+ source_agent ids are harness-qualified — exact, or exact after stripping
4168
+ the FIRST segment only. ---------- */
4169
+ function spacesBlock(){
4170
+ return (D&&D.fleet&&D.fleet.spaces)?D.fleet.spaces:null;
4171
+ }
4172
+ /** Does observed (possibly harness-qualified) id match member id m? The
4173
+ isConfidentialSourceAgent grammar, client-side. */
4174
+ function spaceMemberMatch(observedId,m){
4175
+ if(typeof observedId!=='string'||typeof m!=='string'||!m) return false;
4176
+ const a=observedId.toLowerCase(), b=m.toLowerCase();
4177
+ if(a===b) return true;
4178
+ const slash=a.indexOf('/');
4179
+ if(slash<0) return false;
4180
+ const bare=a.slice(slash+1);
4181
+ return bare.indexOf('/')<0 && bare===b;
4182
+ }
4183
+ /** One space chip. The confidential space keeps the amber family (.conf). */
4184
+ function spaceChip(id,title){
4185
+ return '<span class="space-chip'+(id==='confidential'?' conf':'')+'" title="'+esc(title)+'">'+esc(id)+'</span>';
4186
+ }
4187
+ /** Per-agent space badges — ONE chip per membership (config order); '' when
4188
+ the agent is in no space (honest absence, the unassigned lane surfaces). */
4189
+ function spaceBadges(agentId,b){
4190
+ if(typeof agentId!=='string'||!b||!Array.isArray(b.spaces)) return '';
4191
+ let out='';
4192
+ for(const s of b.spaces){
4193
+ if(!s||!Array.isArray(s.members)) continue;
4194
+ if(!s.members.some(m=>spaceMemberMatch(agentId,m))) continue;
4195
+ out+=spaceChip(s.id,'Space: '+s.id+' — this agent\'s captures are private to the '+s.id+' space (members only; this dashboard shows everything)');
4196
+ }
4197
+ return out;
4198
+ }
4199
+ /** Bundle-level chips (rail card header / capture rows) — one chip per space
4200
+ covering ANY of the bundle's ids; the tooltip names the member agents. */
4201
+ function spaceBundleBadges(ids,b){
4202
+ if(!Array.isArray(ids)||!b||!Array.isArray(b.spaces)) return '';
4203
+ let out='';
4204
+ for(const s of b.spaces){
4205
+ if(!s||!Array.isArray(s.members)) continue;
4206
+ const hits=ids.filter(id=>s.members.some(m=>spaceMemberMatch(id,m)));
4207
+ if(!hits.length) continue;
4208
+ out+='<span class="space-chip'+(s.id==='confidential'?' conf':'')+'" role="img" aria-label="'+esc(s.id)+' space" title="Space: '+esc(s.id)+' — agents in this bundle: '+esc(hits.join(', '))+'">'+esc(s.id)+'</span>';
4209
+ }
4210
+ return out;
4211
+ }
4092
4212
  function buildCapture(){
4093
4213
  const host=el('cap-rows');
4094
4214
  host.innerHTML='';
@@ -4345,7 +4465,7 @@ function buildAgents(){
4345
4465
  const detail=card.querySelector('.ctx-detail');
4346
4466
  let selected=null;
4347
4467
  /* bounded context list: ALL filtered rows render; the LIST itself caps at
4348
- 10 visible rows and scrolls internally (owner mechanics ruling); the
4468
+ 10 visible rows and scrolls internally (the #424 mechanics ruling); the
4349
4469
  filter narrows; identity is fetched ONLY for the selected context */
4350
4470
  const renderCtxList=()=>{
4351
4471
  listBox.innerHTML='';
@@ -4530,14 +4650,156 @@ function buildAgents(){
4530
4650
  listEl.appendChild(card);
4531
4651
  }
4532
4652
  }
4653
+ /* ---------- #642: the space management card — one lane per space + the
4654
+ Unassigned lane (first-prompt discovery, AC-11). Chips drive the SAME
4655
+ AC-10 admin API the CLI uses: click an unassigned chip → an inline picker
4656
+ of target spaces → PUT /spaces/assign; click an assigned chip → the
4657
+ dw-remove two-step confirm → PUT /spaces/unassign. Failures surface as
4658
+ toasts (the page's non-blocking error line). Graceful degrade: no
4659
+ fleet.spaces block (older server) or nothing to show (zero spaces AND
4660
+ zero unassigned — the zero-change dashboard) → the card stays hidden. */
4661
+ let spPickerAgent=null; // the unassigned agent whose inline assign picker is open
4662
+ async function spacesAssign(agent,space){
4663
+ try{
4664
+ await api('/spaces/assign',{
4665
+ method:'PUT',
4666
+ headers:{'content-type':'application/json'},
4667
+ body:JSON.stringify({agent:agent,space:space}),
4668
+ });
4669
+ toast('Assigned '+agent+' to space '+space+' — it sees the space from its next read');
4670
+ refreshFleet();
4671
+ }catch(err){ toast('Assign failed — '+err.message,5600); }
4672
+ }
4673
+ async function spacesUnassign(agent,space){
4674
+ try{
4675
+ await api('/spaces/unassign',{
4676
+ method:'PUT',
4677
+ headers:{'content-type':'application/json'},
4678
+ body:JSON.stringify({agent:agent,space:space}),
4679
+ });
4680
+ toast('Removed '+agent+' from space '+space+' — it sees shared only from its next read');
4681
+ refreshFleet();
4682
+ }catch(err){ toast('Unassign failed — '+err.message,5600); }
4683
+ }
4684
+ function buildSpaces(){
4685
+ const host=el('ag-spaces');
4686
+ const b=spacesBlock();
4687
+ /* hide entirely when: no block (pre-#642 server), or nothing to manage */
4688
+ if(!b||!Array.isArray(b.spaces)||(b.spaces.length===0&&!(Array.isArray(b.unassigned)&&b.unassigned.length))){
4689
+ spPickerAgent=null;
4690
+ host.hidden=true; host.innerHTML='';
4691
+ return;
4692
+ }
4693
+ host.hidden=false;
4694
+ host.innerHTML='';
4695
+ const head=document.createElement('div');
4696
+ head.className='sp-head';
4697
+ const totalAssigned=b.spaces.reduce((a,s)=>a+((s.members&&s.members.length)||0),0);
4698
+ head.innerHTML='<span class="t">Spaces</span><small>'+b.spaces.length+' space'+(b.spaces.length===1?'':'s')+' · '+totalAssigned+' assigned · spaces exist by config presence</small>';
4699
+ host.appendChild(head);
4700
+ /* one lane per space — chips = members; click (twice) to unassign */
4701
+ for(const s of b.spaces){
4702
+ const lane=document.createElement('div');
4703
+ lane.className='sp-lane';
4704
+ const counts=[];
4705
+ counts.push(fmt(s.memoryCount||0)+' mem');
4706
+ if(s.queuedCount) counts.push(s.queuedCount+' queued');
4707
+ const laneHead=document.createElement('div');
4708
+ laneHead.className='sp-lane-head';
4709
+ laneHead.innerHTML='<b'+(s.id==='confidential'?' class="space-chip conf" style="font-size:10px;padding:1px 6px"':'')+'>'+esc(s.id)+'</b><small>'+esc(counts.join(' · '))+'</small>';
4710
+ lane.appendChild(laneHead);
4711
+ const chips=document.createElement('div');
4712
+ chips.className='sp-chips';
4713
+ const members=Array.isArray(s.members)?s.members:[];
4714
+ if(!members.length){
4715
+ const note=document.createElement('span');
4716
+ note.className='sp-note';
4717
+ note.textContent='no members yet — assign from the Unassigned lane below';
4718
+ chips.appendChild(note);
4719
+ }
4720
+ for(const agent of members){
4721
+ const chip=document.createElement('button');
4722
+ chip.type='button'; chip.className='sp-agent';
4723
+ chip.textContent=agent;
4724
+ chip.title='Member of '+esc(s.id)+' — click twice to remove (the agent drops to shared-only; already-captured memories stay stamped)';
4725
+ chip.onclick=(e)=>{
4726
+ e.stopPropagation();
4727
+ /* the dw-remove pattern: first click arms, second fires */
4728
+ if(!chip.classList.contains('confirm')){
4729
+ chip.classList.add('confirm');
4730
+ chip.textContent='remove from '+s.id+'?';
4731
+ return;
4732
+ }
4733
+ spacesUnassign(agent,s.id);
4734
+ wake();
4735
+ };
4736
+ chips.appendChild(chip);
4737
+ }
4738
+ lane.appendChild(chips);
4739
+ host.appendChild(lane);
4740
+ }
4741
+ /* the Unassigned lane — observed on a first prompt, in no space (newest first) */
4742
+ const un=Array.isArray(b.unassigned)?b.unassigned:[];
4743
+ if(un.length){
4744
+ const lane=document.createElement('div');
4745
+ lane.className='sp-lane';
4746
+ const laneHead=document.createElement('div');
4747
+ laneHead.className='sp-lane-head';
4748
+ laneHead.innerHTML='<b>Unassigned</b><small>'+un.length+' seen on a first prompt — click one to assign</small>';
4749
+ lane.appendChild(laneHead);
4750
+ const chips=document.createElement('div');
4751
+ chips.className='sp-chips';
4752
+ for(const o of un){
4753
+ const agent=o.agent;
4754
+ /* the open picker renders IN PLACE of its chip (inline — the rail clips,
4755
+ never a positioned popover) */
4756
+ if(spPickerAgent===agent){
4757
+ const pick=document.createElement('span');
4758
+ pick.className='sp-pick';
4759
+ pick.setAttribute('role','group');
4760
+ pick.setAttribute('aria-label','assign '+agent+' to space');
4761
+ for(const s of b.spaces){
4762
+ const btn=document.createElement('button');
4763
+ btn.type='button'; btn.textContent=s.id;
4764
+ btn.title='Assign '+agent+' to space '+s.id+' — members see the shared pool + this space, everything else stays hidden';
4765
+ btn.onclick=(e)=>{ e.stopPropagation(); spacesAssign(agent,s.id); wake(); };
4766
+ pick.appendChild(btn);
4767
+ }
4768
+ const cancel=document.createElement('button');
4769
+ cancel.type='button'; cancel.className='cancel'; cancel.textContent='✕';
4770
+ cancel.title='cancel';
4771
+ cancel.onclick=(e)=>{ e.stopPropagation(); spPickerAgent=null; buildSpaces(); wake(); };
4772
+ pick.appendChild(cancel);
4773
+ chips.appendChild(pick);
4774
+ continue;
4775
+ }
4776
+ const chip=document.createElement('button');
4777
+ chip.type='button'; chip.className='sp-agent unassigned';
4778
+ chip.textContent=agent;
4779
+ chip.title='Unassigned — seen '+(agoLabel(o.last_seen)||'recently')+' (first seen '+o.first_seen.slice(0,10)+'). Shared-only until assigned. Click to pick a space.';
4780
+ chip.onclick=(e)=>{
4781
+ e.stopPropagation();
4782
+ spPickerAgent=agent;
4783
+ buildSpaces();
4784
+ wake();
4785
+ };
4786
+ chips.appendChild(chip);
4787
+ }
4788
+ lane.appendChild(chips);
4789
+ host.appendChild(lane);
4790
+ }
4791
+ }
4533
4792
  /** Post-pause refresh (#423 phase 3): pull a fresh /dashboard/data (the
4534
4793
  * fleet block is what changed) and rebuild the rail + capture card + band
4535
- * counts — the paused state and dots re-derive from the fresh payload. */
4794
+ * counts — the paused state and dots re-derive from the fresh payload.
4795
+ * #642: the space management card rebuilds here too — it is how the assign
4796
+ * flows refresh after their PUT (the fresh payload carries the new members). */
4536
4797
  async function refreshFleet(){
4537
4798
  try{
4538
4799
  const dd=await api('/dashboard/data?range='+RANGE+'d');
4539
4800
  D=dd;
4540
4801
  buildAgents();
4802
+ buildSpaces();
4541
4803
  buildCapture();
4542
4804
  renderBand();
4543
4805
  }catch(e){ toast('Refresh failed: '+e.message); }
@@ -4551,7 +4813,7 @@ el('mm-save').onclick=()=>{ saveModelSettings(); wake(); };
4551
4813
  el('mm-think').addEventListener('change',()=>{ mmThinkTouched=true; });
4552
4814
  /* #506: the Agents-detected pill opens the full-cover connect overlay —
4553
4815
  the rail drawer (+ button, open/scroll mechanics) it used to target is
4554
- REMOVED (owner 2026-09-24) */
4816
+ REMOVED (#506) */
4555
4817
  el('ag-cta').onclick=()=>{ openConnectOverlay(); wake(); };
4556
4818
 
4557
4819
  /* ---------- the memory browser — dropdown under the search pill ---------- */
@@ -4561,8 +4823,8 @@ let searchResults=null; // last /search result list (full ids)
4561
4823
  let searchFailed=false; // last /search attempt errored (honest fail state)
4562
4824
  /* #409 fix round — the results tail. With the relevance floor in place,
4563
4825
  limit=60 returns EVERYTHING above it, so one genuine match dragged ~59
4564
- 0.62–0.70 filler rows into view (owner live finding: "Sirnäs is now
4565
- first — but then followed by irrelevant mems"). PRESENTATION only (#425
4826
+ 0.62–0.70 filler rows into view (live finding: one genuine match
4827
+ surfaced first but was followed by irrelevant mems). PRESENTATION only (#425
4566
4828
  owns ranking/scoring): the strong window renders at full contrast, the
4567
4829
  tail collapses behind an expander and renders dimmed when shown. */
4568
4830
  const RESULTS_STRONG_N=10; // rows shown before the expander
@@ -4936,10 +5198,8 @@ async function refreshAfterWrite(){
4936
5198
  ===================================================================== */
4937
5199
  const $ = el; // the harvested block below uses the $ shorthand
4938
5200
  /* Pure decision — what the corner renders for an /account payload (#409 fix
4939
- round 2, owner ruling 2026-09-14: "It needs to be an account menu where
4940
- you can of course upgrade, but you should also be able to get the token —
4941
- that was the critical problem — and see who you're logged in as and
4942
- whatnot"). The chip + menu render for EVERY account shape /account
5201
+ round 2: an account menu where you can upgrade, get the token, and see
5202
+ who you're logged in as). The chip + menu render for EVERY account shape /account
4943
5203
  answers — including the all-null self-hosted default, which previously
4944
5204
  degraded the corner to a standalone Upgrade button and hid the token.
4945
5205
  The upgrade CTA is a MENU ITEM iff the plan is unset (the same
@@ -4956,7 +5216,7 @@ function acctMenuPlan(a) {
4956
5216
  avatar: ((typeof a.name === "string" && a.name) ? a.name : "?").slice(0, 2).toUpperCase(),
4957
5217
  };
4958
5218
  }
4959
- /* #411 — the overlay's currency state (owner rulings 2026-10-12): exactly
5219
+ /* #411 — the overlay's currency state: exactly
4960
5220
  USD + EUR; the first-visit default follows the browser timezone (an
4961
5221
  explicit US IANA zone list — exact zones + the Indiana/Kentucky/
4962
5222
  North_Dakota prefixes — → usd, anything else → eur, ANY error or
@@ -4977,14 +5237,14 @@ function tzDefaultCur() {
4977
5237
  }
4978
5238
  let PLAN_CUR = tzDefaultCur();
4979
5239
  try { const saved = localStorage.getItem("hctx-cur"); if (saved === "usd" || saved === "eur") PLAN_CUR = saved; } catch {}
4980
- /* Pure decision (#371) — the purchasable periods. Decided pricing (owner
4981
- 2026-08-19): ONE price, TWO periods — €12/mo and €108/yr. ANNUAL FIRST:
5240
+ /* Pure decision (#371) — the purchasable periods. Decided pricing:
5241
+ ONE price, TWO periods — €12/mo and €108/yr. ANNUAL FIRST:
4982
5242
  annual is the stated product default; its note is the numeric savings
4983
- sub-line (round-4 addendum 2026-09-24: it replaces the retired
5243
+ sub-line (round-4 addendum: it replaces the retired
4984
5244
  words-only annual tagline — same fact, numbers not words; effective
4985
5245
  monthly 108/12 = €9, discount (144−108)/144 = 25%, derived-pinned by
4986
- tests so a price change forces the sub-line update). #411 (rulings
4987
- 2026-10-12): the price/note literals are PER-CURRENCY data — USD
5246
+ tests so a price change forces the sub-line update). #411
5247
+ rulings: the price/note literals are PER-CURRENCY data — USD
4988
5248
  MIRRORS the EUR whole numbers ($12/mo, $108/yr), and the savings pair
4989
5249
  is derived per currency from the same-currency bases (never converted;
4990
5250
  no exchange-rate arithmetic anywhere). The router deliberately knows
@@ -4993,14 +5253,14 @@ try { const saved = localStorage.getItem("hctx-cur"); if (saved === "usd" || sav
4993
5253
  Round 3: a PURE DATA ARRAY and the single source of truth — the overlay
4994
5254
  cards are GENERATED from it (renderPlanCards) and the wiring loops it
4995
5255
  (wireChooseButtons); no two-plan hardcoding anywhere. #411 tax wording
4996
- (tax research brief, 2026-10-12): the price strings carry the VERBATIM
5256
+ (tax research brief): the price strings carry the VERBATIM
4997
5257
  pricing-card wording — EUR consumer prices read VAT-inclusive ("incl.
4998
5258
  25.5% VAT"), USD tax-exclusive ("excl. tax"); fixed wording, the 25.5%
4999
5259
  inside it is never a computed value. The savings note is a derived
5000
5260
  ANNOTATION, not a price point — it carries no qualifier. The bullets
5001
5261
  are the marketing site's Cloud feature lines, verbatim (lockstep-
5002
- pinned against web/index.html) — the seven owner-decided lines
5003
- (amendment 4, 2026-09-24: copy-first ruling; the agent-cap enforcement
5262
+ pinned against web/index.html) — the seven decided lines
5263
+ (amendment 4, copy-first ruling; the agent-cap enforcement
5004
5264
  rides its own issue); both periods are the same Cloud product, so both
5005
5265
  carry the same seven. */
5006
5266
  const PLAN_OPTIONS = [
@@ -5040,8 +5300,8 @@ function acctPlanLine(p) {
5040
5300
  /* Pure decision (#371 round 3) — the Subscription entry's Upgrade pill.
5041
5301
  The menu's two billing entries (Upgrade + Plan & billing) merged into
5042
5302
  ONE always-rendered "Subscription" item; the PILL is what the old
5043
- plan-unset eligibility gates (owner: "it can have an upgrade pill/label
5044
- after it before any subscription is active"). Returns the pill markup
5303
+ plan-unset eligibility gates (it can have an upgrade pill/label
5304
+ after it before any subscription is active). Returns the pill markup
5045
5305
  or "" — interpolated into the entry's label. */
5046
5306
  function acctPill(p) {
5047
5307
  return p.upgrade ? '<span class="acct-pill">Upgrade</span>' : "";
@@ -5184,7 +5444,7 @@ function wireSubscription() {
5184
5444
  const btn = $("acct-subscription");
5185
5445
  if (!btn) return;
5186
5446
  // #371 round 3: the ONE Subscription entry (Upgrade + Plan & billing
5187
- // merged, owner) opens the FULL-COVER plan & billing overlay; the entry
5447
+ // merged) opens the FULL-COVER plan & billing overlay; the entry
5188
5448
  // always renders — the Upgrade pill alone marks the plan-unset state.
5189
5449
  // Menu closes first; × / cover-click / ESC return.
5190
5450
  btn.addEventListener("click", () => {
@@ -5502,6 +5762,7 @@ async function boot(){
5502
5762
  buildRoll();
5503
5763
  buildCapture();
5504
5764
  buildAgents();
5765
+ buildSpaces(); /* #642: the space management card — degrades to hidden */
5505
5766
  buildChips(); renderList();
5506
5767
  T=WINDOW; lastT=WINDOW;
5507
5768
  onTChanged(true);