codemem 0.47.0-beta.4 → 0.47.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.
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,
@@ -9244,6 +9262,7 @@ function createViewerAccountLink(store, invocation, serverModule) {
9244
9262
  readContext,
9245
9263
  registry,
9246
9264
  ownerRecovery,
9265
+ identityName,
9247
9266
  getListenerAddress: () => actualBoundPort === null ? null : {
9248
9267
  host: invocation.host,
9249
9268
  port: actualBoundPort