livedesk 0.1.450 → 0.1.451

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/bin/livedesk.js CHANGED
@@ -2794,6 +2794,10 @@ async function runClient(args, resolvedRole = null, runtimeLock = null) {
2794
2794
  : String(process.env.LIVEDESK_SKIP_BROWSER_OPEN || ''),
2795
2795
  LIVEDESK_DEVICE_ID: String(resolvedRole?.deviceId || process.env.LIVEDESK_DEVICE_ID || ''),
2796
2796
  LIVEDESK_ROLE_SOURCE: String(resolvedRole?.source || process.env.LIVEDESK_ROLE_SOURCE || ''),
2797
+ LIVEDESK_ASSIGNED_HUB_ID: String(resolvedRole?.assignedHubId || ''),
2798
+ LIVEDESK_ROLE_VERSION: Number.isInteger(resolvedRole?.roleVersion) && resolvedRole.roleVersion >= 0
2799
+ ? String(resolvedRole.roleVersion)
2800
+ : '0',
2797
2801
  LIVEDESK_RUNTIME_OWNER_PID: String(runtimeOwner?.pid || ''),
2798
2802
  LIVEDESK_RUNTIME_OWNER_TOKEN: String(runtimeOwner?.ownerToken || ''),
2799
2803
  LIVEDESK_RUNTIME_OWNER_INSTANCE_MARKER: String(runtimeOwner?.ownerInstanceMarker || ''),
@@ -3301,6 +3301,8 @@ async function chooseClientConnection(supabase, options = {}) {
3301
3301
  deviceId: options.deviceId,
3302
3302
  engine: options.engine,
3303
3303
  slot: options.slot,
3304
+ assignedHubId: process.env.LIVEDESK_ASSIGNED_HUB_ID,
3305
+ roleVersion: process.env.LIVEDESK_ROLE_VERSION,
3304
3306
  savedSession: options.savedSession,
3305
3307
  initialChoice: options.initialChoice,
3306
3308
  initialChoiceMessage: options.initialChoiceMessage,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.205",
3
+ "version": "0.1.206",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {
@@ -150,6 +150,11 @@ function normalizeSlotNumber(value) {
150
150
  : 0;
151
151
  }
152
152
 
153
+ function normalizeRoleVersion(value) {
154
+ const roleVersion = Number(String(value ?? '').trim());
155
+ return Number.isInteger(roleVersion) && roleVersion >= 0 ? roleVersion : 0;
156
+ }
157
+
153
158
  function readCpuTotals() {
154
159
  return os.cpus().reduce((totals, cpu) => {
155
160
  const times = Object.values(cpu.times || {}).map(Number);
@@ -655,9 +660,9 @@ export function createClientRuntimeServer(options = {}) {
655
660
  manager: '',
656
661
  pairToken: '',
657
662
  slotNumber: normalizeSlotNumber(options.slot),
658
- assignedHubId: '',
663
+ assignedHubId: normalizeString(options.assignedHubId ?? process.env.LIVEDESK_ASSIGNED_HUB_ID, 160),
659
664
  endpointCandidates: [],
660
- roleVersion: 0,
665
+ roleVersion: normalizeRoleVersion(options.roleVersion ?? process.env.LIVEDESK_ROLE_VERSION),
661
666
  connectedAt: '',
662
667
  message: 'Sign in with Google or enter a Hub PIN to start this Client.',
663
668
  startup: false,
@@ -788,6 +793,12 @@ export function createClientRuntimeServer(options = {}) {
788
793
  name: accountProfile.name || state.auth.name,
789
794
  avatarUrl: accountProfile.avatarUrl || state.auth.avatarUrl
790
795
  };
796
+ state.lastError = '';
797
+ if (state.message.startsWith('Client authentication needs attention:')) {
798
+ state.message = state.agent.state === 'running'
799
+ ? 'Connected to the LiveDesk Hub.'
800
+ : normalizeString(message, 1000) || 'Client credentials accepted. Finding the Hub.';
801
+ }
791
802
  }
792
803
  return;
793
804
  }
@@ -795,7 +806,9 @@ export function createClientRuntimeServer(options = {}) {
795
806
  loggedOut = false;
796
807
  state.connectedAt = new Date().toISOString();
797
808
  state.manager = normalizeString(choice?.manager, 256);
798
- state.assignedHubId = normalizeString(choice?.hubDeviceId, 160);
809
+ if (Object.prototype.hasOwnProperty.call(choice || {}, 'hubDeviceId')) {
810
+ state.assignedHubId = normalizeString(choice?.hubDeviceId, 160);
811
+ }
799
812
  state.endpointCandidates = Array.isArray(choice?.endpointCandidates)
800
813
  ? choice.endpointCandidates.map(value => normalizeString(value, 256)).filter(Boolean)
801
814
  : [];
@@ -1337,7 +1350,9 @@ export function createClientRuntimeServer(options = {}) {
1337
1350
  if (patch.manager) state.manager = normalizeString(patch.manager, 256);
1338
1351
  if (patch.pairToken) state.pairToken = normalizeString(patch.pairToken, 256);
1339
1352
  if (normalizeSlotNumber(patch.slotNumber)) state.slotNumber = normalizeSlotNumber(patch.slotNumber);
1340
- if (patch.assignedHubId) state.assignedHubId = normalizeString(patch.assignedHubId, 160);
1353
+ if (Object.prototype.hasOwnProperty.call(patch, 'assignedHubId')) {
1354
+ state.assignedHubId = normalizeString(patch.assignedHubId, 160);
1355
+ }
1341
1356
  if (patch.message) state.message = normalizeString(patch.message, 1000);
1342
1357
  if (Number.isInteger(patch.roleVersion)) state.roleVersion = patch.roleVersion;
1343
1358
  if (Array.isArray(patch.endpointCandidates)) state.endpointCandidates = patch.endpointCandidates;
package/hub/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/hub",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "LiveDesk local Hub API and browser frame bridge",
5
5
  "type": "module",
6
6
  "main": "src/server.js",
@@ -42,7 +42,11 @@ export function createAgentManager({
42
42
 
43
43
  async function publicSettings() {
44
44
  const current = await settings.get();
45
- const { codexMaxTurns: _codexMaxTurns, ...exposedSettings } = current;
45
+ const {
46
+ codexMaxTurns: _codexMaxTurns,
47
+ provider: _provider,
48
+ ...exposedSettings
49
+ } = current;
46
50
  const codex = await getCodexStatus();
47
51
  const securityStatus = runtime?.getSecurityStatus?.() || {
48
52
  isolatedCodexHome: false,
@@ -55,7 +59,6 @@ export function createAgentManager({
55
59
  };
56
60
  return {
57
61
  ...exposedSettings,
58
- provider: AGENT_PROVIDER_CODEX,
59
62
  codexInstallation: codex.installed ? 'installed' : 'not-installed',
60
63
  codexAuth: codex.authenticated,
61
64
  codexStatus: codex.status,
@@ -3,10 +3,9 @@ import { access, link, mkdir, stat, unlink } from 'node:fs/promises';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { spawn } from 'node:child_process';
6
- import { createRequire } from 'node:module';
7
- import { AgentProviderError } from './provider-errors.js';
8
- import { AGENT_PROVIDER_CODEX } from './agent-settings.js';
9
- import { AGENT_TOOL_NAMES } from './agent-tool-registry.js';
6
+ import { createRequire } from 'node:module';
7
+ import { AgentProviderError } from './provider-errors.js';
8
+ import { AGENT_TOOL_NAMES } from './agent-tool-registry.js';
10
9
  import { createAgentPermissionPolicy, hashAgentPermissionPolicy } from './agent-permissions.js';
11
10
 
12
11
  const require = createRequire(import.meta.url);
@@ -427,11 +426,10 @@ export function createCodexAgentRuntime({
427
426
  }
428
427
 
429
428
  function publicRun(run) {
430
- return {
431
- runId: run.runId,
432
- status: run.status,
433
- provider: AGENT_PROVIDER_CODEX,
434
- instruction: run.instruction,
429
+ return {
430
+ runId: run.runId,
431
+ status: run.status,
432
+ instruction: run.instruction,
435
433
  threadId: run.threadId,
436
434
  finalResponse: run.finalResponse,
437
435
  error: run.error,
@@ -654,10 +652,9 @@ export function createCodexAgentRuntime({
654
652
  const permissionPolicy = freezeAgentPermissionPolicy(input.permissionPolicy && typeof input.permissionPolicy === 'object'
655
653
  ? input.permissionPolicy
656
654
  : createAgentPermissionPolicy({ mode: input.permissionMode || 'safe-auto', deviceIds, maxToolCalls: settings.codexMaxToolCalls }));
657
- const run = {
658
- runId: crypto.randomUUID(),
659
- status: 'queued',
660
- provider: AGENT_PROVIDER_CODEX,
655
+ const run = {
656
+ runId: crypto.randomUUID(),
657
+ status: 'queued',
661
658
  instruction,
662
659
  deviceIds,
663
660
  threadId: '',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.450",
4
- "livedeskClientVersion": "0.1.205",
3
+ "version": "0.1.451",
4
+ "livedeskClientVersion": "0.1.206",
5
5
  "buildFlavor": "production",
6
6
  "description": "LiveDesk Hub and client launcher",
7
7
  "type": "module",