@olares/lares-core 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ Import surfaces (`@olares/lares-core/<export>`):
13
13
  - `drive/*`: path policy, tool execution, present cards, and agent tool definitions.
14
14
  - `voice/*`, `search/*`: STT/search settings, Host payloads, and client API contracts.
15
15
  - `olares/*`: Olares entrance identity, trusted-host loopback, and CLI session materialization.
16
- - `larepass/host`: find the Lares entrance from LarePass `myApps`, PC-test proxy URLs, Host probe, and `hostConfigFromEnv`.
16
+ - `larepass/host`: find the Lares entrance from LarePass `myApps`, PC-test proxy URLs, Host probe, `hostConfigFromEnv` / `hostTarget` / `hostKey`, and `laresPortsFromAccount`.
17
17
  - `larepass/rpc`, `larepass/transcript`, `larepass/context-provenance`, `larepass/tool-row`, `larepass/stage-copy`, `larepass/chat`, `larepass/mux`, `larepass/session-cache`, `larepass/runtime`, `larepass/settings`: dsh host-RPC envelope, session timeline fold (user / context / reasoning / tool / retry / files; same classification as dsh conversation nodes), English stage chrome copy and tool-row variants, browser mux as WebSocket (same frames as PC), per-session page cache (switch reads cache; history/mux write only on change), the LarePass chat runtime (UI only subscribes), and Host HTTP for model / voice / search settings.
18
18
  - `brand/identity`, `brand/manifest`: product identity and PWA manifest consumed by the Host and clients.
19
19
  - `icons/*`: product mark SVG and public icon paths (no React).
package/larepass/host.js CHANGED
@@ -45,6 +45,33 @@ export function hostConfigFromEnv(env = {}) {
45
45
  };
46
46
  }
47
47
 
48
+ /** Resolve the live Host origin. Explicit baseUrl/proxyPrefix win over env. */
49
+ export function hostTarget(ports = {}) {
50
+ const fromEnv = hostConfigFromEnv(ports.env);
51
+ return {
52
+ baseUrl: ports.baseUrl ?? fromEnv.baseUrl,
53
+ proxyPrefix: ports.proxyPrefix ?? fromEnv.proxyPrefix,
54
+ };
55
+ }
56
+
57
+ export function hostKey(ports = {}) {
58
+ const { baseUrl, proxyPrefix } = hostTarget(ports);
59
+ return hostUrl({ baseUrl, proxyPrefix, path: "/api" });
60
+ }
61
+
62
+ /**
63
+ * LarePass → Host ports. PC preview keeps the webpack env + /laresHost proxy.
64
+ * A logged-in account uses the current myApps entrance, never a baked subdomain.
65
+ */
66
+ export function laresPortsFromAccount({ env, apps } = {}) {
67
+ const fromEnv = hostConfigFromEnv(env);
68
+ if (fromEnv.proxyPrefix) {
69
+ return { env, proxyPrefix: fromEnv.proxyPrefix, baseUrl: undefined };
70
+ }
71
+ const baseUrl = findLaresEntrance(apps);
72
+ return { baseUrl: baseUrl || undefined, env: undefined, proxyPrefix: undefined };
73
+ }
74
+
48
75
  export function hostUrl({ baseUrl = "", proxyPrefix = "", path }) {
49
76
  const suffix = path.startsWith("/") ? path : `/${path}`;
50
77
  if (proxyPrefix) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olares/lares-core",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Lares 共享业务核心:Router、workspace、文件/媒体、Olares 身份(无 UI、无平台壳)",
5
5
  "type": "module",
6
6
  "repository": {