codemem 0.47.0-beta.4 → 0.47.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/dist/index.js CHANGED
@@ -3290,7 +3290,8 @@ function* controllerHistoryRows(preview, subject) {
3290
3290
  decisions: 0
3291
3291
  };
3292
3292
  for (const decision of record.manifest.device_decisions) {
3293
- const identity = decision.identity_id === null ? "none" : terminalIdentifier(decision.identity_id);
3293
+ let identity = decision.identity_id === null ? "none" : terminalIdentifier(decision.identity_id);
3294
+ if (decision.identity_evidence === "label") identity += " (guessed by another device)";
3294
3295
  yield {
3295
3296
  text: ` ${decision.decision}; Identity: ${identity}; enabled: ${decision.enabled ? "yes" : "no"}\n Device: ${terminalIdentifier(decision.device_id)}; fingerprint: ${terminalIdentifier(decision.key_fingerprint)}\n ${historyAssociation(decision.device_id, decision.key_fingerprint, subject)}`,
3296
3297
  records: 0,
@@ -9204,9 +9205,19 @@ function createOptionalOwnerRecovery(serverModule, options) {
9204
9205
  if (!("createAccountOwnerRecoveryService" in serverModule) || typeof serverModule.createAccountOwnerRecoveryService !== "function") return void 0;
9205
9206
  return serverModule.createAccountOwnerRecoveryService(options);
9206
9207
  }
9208
+ /** The People name Sharing shows for an Identity; absent when the local store has none. */
9209
+ function localIdentityName(store, identityId) {
9210
+ try {
9211
+ const row = store.db.prepare("SELECT display_name FROM actors WHERE actor_id = ? AND status <> 'deactivated'").get(identityId);
9212
+ return (typeof row?.display_name === "string" ? row.display_name.trim() : "") || void 0;
9213
+ } catch {
9214
+ return;
9215
+ }
9216
+ }
9207
9217
  function createViewerAccountLink(store, invocation, serverModule) {
9208
9218
  const configPath = resolveCodememConfigPath(invocation.configPath ?? void 0).resolved.path;
9209
9219
  const keysDir = dirname(resolveKeyPaths(process.env.CODEMEM_KEYS_DIR?.trim() || void 0)[0]);
9220
+ const identityName = (identityId) => localIdentityName(store, identityId);
9210
9221
  const readContext = serverModule.createAccountContextReader({
9211
9222
  getProfile: () => ({
9212
9223
  dbPath: store.dbPath,
@@ -9218,7 +9229,14 @@ function createViewerAccountLink(store, invocation, serverModule) {
9218
9229
  configPath,
9219
9230
  keysDir
9220
9231
  });
9221
- const registry = serverModule.createAccountLinkRegistry({ readContext });
9232
+ const registry = serverModule.createAccountLinkRegistry({
9233
+ readContext,
9234
+ rebind: serverModule.createAccountRebindRunner(store)
9235
+ });
9236
+ serverModule.resumeAccountRebind(store, {
9237
+ keysDir,
9238
+ configPath
9239
+ }).catch(() => {});
9222
9240
  const ownerRecovery = createOptionalOwnerRecovery(serverModule, {
9223
9241
  readContext,
9224
9242
  registry,
@@ -9227,7 +9245,8 @@ function createViewerAccountLink(store, invocation, serverModule) {
9227
9245
  if (envSecret) return envSecret;
9228
9246
  const secret = readCodememConfigFileAtPath(configPath).sync_coordinator_admin_secret;
9229
9247
  return typeof secret === "string" ? secret.trim() : null;
9230
- }
9248
+ },
9249
+ readCoordinatorTimeoutS: () => readCoordinatorSyncConfig(readCodememConfigFileAtPath(configPath)).syncCoordinatorTimeoutS
9231
9250
  });
9232
9251
  let actualBoundPort = null;
9233
9252
  return {
@@ -9244,6 +9263,7 @@ function createViewerAccountLink(store, invocation, serverModule) {
9244
9263
  readContext,
9245
9264
  registry,
9246
9265
  ownerRecovery,
9266
+ identityName,
9247
9267
  getListenerAddress: () => actualBoundPort === null ? null : {
9248
9268
  host: invocation.host,
9249
9269
  port: actualBoundPort