@ai-matrx/vault 0.1.28 → 0.1.30

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.d.cts CHANGED
@@ -899,6 +899,15 @@ declare function createVaultKnobs(client: KnobClient, address: {
899
899
  organizationId: string;
900
900
  userId: string;
901
901
  }): VaultKnobs;
902
+ /**
903
+ * The organization's reveal and backup settings every host obeys. They were first set for the desktop
904
+ * app (`desktop.vault`), and are the only organization settings for them, so the website and the
905
+ * extension read the same two: a host's own `revealSeconds` / `backupPassphraseMinLength` wins.
906
+ */
907
+ declare const REVEAL_SECONDS_KNOB = "desktop.vault.reveal_hide_seconds";
908
+ declare const BACKUP_PASSPHRASE_MIN_KNOB = "desktop.vault.backup_passphrase_min_length";
909
+ /** A positive whole number from the organization's settings, else null (unset, unreadable, nonsense). */
910
+ declare function positiveKnob(resolved: Readonly<Record<string, unknown>>, key: string): number | null;
902
911
 
903
912
  /** Bringing items in and taking them out: imports, login CSV export, encrypted backup and restore. */
904
913
 
@@ -1252,8 +1261,16 @@ interface VaultHostCapabilities {
1252
1261
  lock?: VaultLock;
1253
1262
  /** The host's clipboard: every copy goes through it; a secret is the host's to clear (`lock.ts`). */
1254
1263
  clipboard?: VaultClipboard;
1255
- /** How long a shown value stays shown, in seconds (an organization knob the host reads); default 20. */
1264
+ /**
1265
+ * How long a shown value stays shown, in seconds. Without it the organization's setting
1266
+ * (`REVEAL_SECONDS_KNOB`, read through `knobs`) decides; with neither, 20.
1267
+ */
1256
1268
  revealSeconds?: number;
1269
+ /**
1270
+ * The shortest passphrase an encrypted backup takes. Without it the organization's setting
1271
+ * (`BACKUP_PASSPHRASE_MIN_KNOB`, read through `knobs`) decides; with neither, any passphrase.
1272
+ */
1273
+ backupPassphraseMinLength?: number;
1257
1274
  /**
1258
1275
  * How often the list re-reads itself while the vault is on screen, in seconds (the desktop's
1259
1276
  * refresh knob). Without it the organization's `vault.list.refresh_seconds` knob decides; with
@@ -1300,9 +1317,18 @@ interface VaultLock {
1300
1317
  * the host to take custody: clear it after a while if it is still there, and on lock or quit.
1301
1318
  */
1302
1319
  interface VaultClipboard {
1320
+ /**
1321
+ * Writes `text`. A host that clears a secret later may answer when (`clearsAtMs`, epoch ms): the
1322
+ * copied line then says "Clears at 3:42 PM". Answering nothing says only "<label> copied".
1323
+ */
1303
1324
  copy(text: string, how: {
1304
1325
  secret: boolean;
1305
- }): Promise<void>;
1326
+ }): Promise<void | VaultCopied>;
1327
+ }
1328
+ /** What a host clipboard may answer after a copy. */
1329
+ interface VaultCopied {
1330
+ /** When the host will clear what it just wrote (epoch ms); null or absent = it will not. */
1331
+ clearsAtMs?: number | null;
1306
1332
  }
1307
1333
  declare const LOCKED_MESSAGE = "The vault is locked. Unlock it first.";
1308
1334
  declare class VaultLockedError extends Error {
@@ -1329,6 +1355,8 @@ declare function copyValue(text: string, label: string, options: CopyOptions, de
1329
1355
  clipboard?: VaultClipboard | undefined;
1330
1356
  notify: Notify;
1331
1357
  }): Promise<boolean>;
1358
+ /** "Password copied", or "Password copied. Clears at 3:42 PM" when the host says when it clears it. */
1359
+ declare function copiedLine(label: string, clearsAtMs: number | null): string;
1332
1360
 
1333
1361
  /**
1334
1362
  * What an agent may know about the vault: its NON-SECRET shape, never a value.
@@ -1392,7 +1420,7 @@ interface VaultAppProps {
1392
1420
  onInventory?: (inventory: VaultInventory) => void;
1393
1421
  }
1394
1422
  /** THE VAULT WORKSPACE: one component for the web app, the extension side panel and the desktop app. */
1395
- declare function VaultApp(props: VaultAppProps): react.JSX.Element;
1423
+ declare function VaultApp(given: VaultAppProps): react.JSX.Element;
1396
1424
 
1397
1425
  interface SharingPortOptions {
1398
1426
  /**
@@ -1452,13 +1480,24 @@ declare function GenerateButton({ onUse, label, limits, disabled }: {
1452
1480
  disabled?: boolean;
1453
1481
  }): react.JSX.Element | null;
1454
1482
 
1483
+ /**
1484
+ * A HOST OBJECT THE SCREEN OWNS (a port to the page, a subscription to main): made and disposed in
1485
+ * the SAME effect, so React's StrictMode mount → cleanup → mount (and any remount) leaves a live one,
1486
+ * never the disposed first copy a `useMemo` + cleanup-only effect would keep. null until the first
1487
+ * effect runs (render a placeholder, never a host without it). `deps` re-make it, as `useEffect`'s.
1488
+ */
1489
+ declare function useDisposable<T extends {
1490
+ dispose(): void;
1491
+ }>(create: () => T, deps: readonly unknown[]): T | null;
1492
+
1455
1493
  /**
1456
1494
  * THE row menu's entries, one source for every menu that offers them: the row's own More button and
1457
1495
  * right-click menu, and a host's own right-click menu (the website's v3 menu, which wraps the vault
1458
1496
  * and so cannot render the package's hooks). Each list row registers a reader of its CURRENT entries
1459
1497
  * on its element; `rowMenuEntriesAt(target)` reads them for whatever a right-click landed on.
1460
1498
  */
1461
- type RowMenuEntryKind = "copy" | "favorite" | "open" | "copy-name" | "host";
1499
+ /** `manage`: Activity, Share and Delete, the item's own actions offered on its row. */
1500
+ type RowMenuEntryKind = "copy" | "favorite" | "open" | "copy-name" | "manage" | "host";
1462
1501
  interface RowMenuEntry {
1463
1502
  label: string;
1464
1503
  onSelect: () => void;
@@ -1470,6 +1509,8 @@ interface RowMenuEntry {
1470
1509
  }
1471
1510
  /** The entries of the row a right-click landed on (`[data-item]`), else none. */
1472
1511
  declare function rowMenuEntriesAt(target: Element | null | undefined): readonly RowMenuEntry[];
1512
+ /** The item actions a row's menu offers beside copy and open (every host, one list). */
1513
+ type RowItemAction = "activity" | "share" | "delete";
1473
1514
 
1474
1515
  /**
1475
1516
  * AN EMPTY CREDENTIAL IS A FACT; AN EMPTY READ OF A FULL ONE IS A FAILURE (DD-160, lane
@@ -1515,4 +1556,4 @@ declare function holdingsDoorIsAbsent(code: string | undefined | null): boolean;
1515
1556
  */
1516
1557
  declare function emptyReadAlarm(total: number, emptyIds: readonly string[], holdings: Holdings): string | null;
1517
1558
 
1518
- export { type ApiVaultPortOptions, CATEGORIES, CONFIRM_RETURN_KEY, type CategoryId, type Confirmed, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copyValue, createApiVaultPort, createSupabaseIdentity, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useConfirmed, vaultInventoryScope, vaultItemFacts, wasCancelled };
1559
+ export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES, CONFIRM_RETURN_KEY, type CategoryId, type Confirmed, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, REVEAL_SECONDS_KNOB, type ReturnStore, type RowItemAction, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCopied, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copiedLine, copyValue, createApiVaultPort, createSupabaseIdentity, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, positiveKnob, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useConfirmed, useDisposable, vaultInventoryScope, vaultItemFacts, wasCancelled };
package/dist/index.d.ts CHANGED
@@ -899,6 +899,15 @@ declare function createVaultKnobs(client: KnobClient, address: {
899
899
  organizationId: string;
900
900
  userId: string;
901
901
  }): VaultKnobs;
902
+ /**
903
+ * The organization's reveal and backup settings every host obeys. They were first set for the desktop
904
+ * app (`desktop.vault`), and are the only organization settings for them, so the website and the
905
+ * extension read the same two: a host's own `revealSeconds` / `backupPassphraseMinLength` wins.
906
+ */
907
+ declare const REVEAL_SECONDS_KNOB = "desktop.vault.reveal_hide_seconds";
908
+ declare const BACKUP_PASSPHRASE_MIN_KNOB = "desktop.vault.backup_passphrase_min_length";
909
+ /** A positive whole number from the organization's settings, else null (unset, unreadable, nonsense). */
910
+ declare function positiveKnob(resolved: Readonly<Record<string, unknown>>, key: string): number | null;
902
911
 
903
912
  /** Bringing items in and taking them out: imports, login CSV export, encrypted backup and restore. */
904
913
 
@@ -1252,8 +1261,16 @@ interface VaultHostCapabilities {
1252
1261
  lock?: VaultLock;
1253
1262
  /** The host's clipboard: every copy goes through it; a secret is the host's to clear (`lock.ts`). */
1254
1263
  clipboard?: VaultClipboard;
1255
- /** How long a shown value stays shown, in seconds (an organization knob the host reads); default 20. */
1264
+ /**
1265
+ * How long a shown value stays shown, in seconds. Without it the organization's setting
1266
+ * (`REVEAL_SECONDS_KNOB`, read through `knobs`) decides; with neither, 20.
1267
+ */
1256
1268
  revealSeconds?: number;
1269
+ /**
1270
+ * The shortest passphrase an encrypted backup takes. Without it the organization's setting
1271
+ * (`BACKUP_PASSPHRASE_MIN_KNOB`, read through `knobs`) decides; with neither, any passphrase.
1272
+ */
1273
+ backupPassphraseMinLength?: number;
1257
1274
  /**
1258
1275
  * How often the list re-reads itself while the vault is on screen, in seconds (the desktop's
1259
1276
  * refresh knob). Without it the organization's `vault.list.refresh_seconds` knob decides; with
@@ -1300,9 +1317,18 @@ interface VaultLock {
1300
1317
  * the host to take custody: clear it after a while if it is still there, and on lock or quit.
1301
1318
  */
1302
1319
  interface VaultClipboard {
1320
+ /**
1321
+ * Writes `text`. A host that clears a secret later may answer when (`clearsAtMs`, epoch ms): the
1322
+ * copied line then says "Clears at 3:42 PM". Answering nothing says only "<label> copied".
1323
+ */
1303
1324
  copy(text: string, how: {
1304
1325
  secret: boolean;
1305
- }): Promise<void>;
1326
+ }): Promise<void | VaultCopied>;
1327
+ }
1328
+ /** What a host clipboard may answer after a copy. */
1329
+ interface VaultCopied {
1330
+ /** When the host will clear what it just wrote (epoch ms); null or absent = it will not. */
1331
+ clearsAtMs?: number | null;
1306
1332
  }
1307
1333
  declare const LOCKED_MESSAGE = "The vault is locked. Unlock it first.";
1308
1334
  declare class VaultLockedError extends Error {
@@ -1329,6 +1355,8 @@ declare function copyValue(text: string, label: string, options: CopyOptions, de
1329
1355
  clipboard?: VaultClipboard | undefined;
1330
1356
  notify: Notify;
1331
1357
  }): Promise<boolean>;
1358
+ /** "Password copied", or "Password copied. Clears at 3:42 PM" when the host says when it clears it. */
1359
+ declare function copiedLine(label: string, clearsAtMs: number | null): string;
1332
1360
 
1333
1361
  /**
1334
1362
  * What an agent may know about the vault: its NON-SECRET shape, never a value.
@@ -1392,7 +1420,7 @@ interface VaultAppProps {
1392
1420
  onInventory?: (inventory: VaultInventory) => void;
1393
1421
  }
1394
1422
  /** THE VAULT WORKSPACE: one component for the web app, the extension side panel and the desktop app. */
1395
- declare function VaultApp(props: VaultAppProps): react.JSX.Element;
1423
+ declare function VaultApp(given: VaultAppProps): react.JSX.Element;
1396
1424
 
1397
1425
  interface SharingPortOptions {
1398
1426
  /**
@@ -1452,13 +1480,24 @@ declare function GenerateButton({ onUse, label, limits, disabled }: {
1452
1480
  disabled?: boolean;
1453
1481
  }): react.JSX.Element | null;
1454
1482
 
1483
+ /**
1484
+ * A HOST OBJECT THE SCREEN OWNS (a port to the page, a subscription to main): made and disposed in
1485
+ * the SAME effect, so React's StrictMode mount → cleanup → mount (and any remount) leaves a live one,
1486
+ * never the disposed first copy a `useMemo` + cleanup-only effect would keep. null until the first
1487
+ * effect runs (render a placeholder, never a host without it). `deps` re-make it, as `useEffect`'s.
1488
+ */
1489
+ declare function useDisposable<T extends {
1490
+ dispose(): void;
1491
+ }>(create: () => T, deps: readonly unknown[]): T | null;
1492
+
1455
1493
  /**
1456
1494
  * THE row menu's entries, one source for every menu that offers them: the row's own More button and
1457
1495
  * right-click menu, and a host's own right-click menu (the website's v3 menu, which wraps the vault
1458
1496
  * and so cannot render the package's hooks). Each list row registers a reader of its CURRENT entries
1459
1497
  * on its element; `rowMenuEntriesAt(target)` reads them for whatever a right-click landed on.
1460
1498
  */
1461
- type RowMenuEntryKind = "copy" | "favorite" | "open" | "copy-name" | "host";
1499
+ /** `manage`: Activity, Share and Delete, the item's own actions offered on its row. */
1500
+ type RowMenuEntryKind = "copy" | "favorite" | "open" | "copy-name" | "manage" | "host";
1462
1501
  interface RowMenuEntry {
1463
1502
  label: string;
1464
1503
  onSelect: () => void;
@@ -1470,6 +1509,8 @@ interface RowMenuEntry {
1470
1509
  }
1471
1510
  /** The entries of the row a right-click landed on (`[data-item]`), else none. */
1472
1511
  declare function rowMenuEntriesAt(target: Element | null | undefined): readonly RowMenuEntry[];
1512
+ /** The item actions a row's menu offers beside copy and open (every host, one list). */
1513
+ type RowItemAction = "activity" | "share" | "delete";
1473
1514
 
1474
1515
  /**
1475
1516
  * AN EMPTY CREDENTIAL IS A FACT; AN EMPTY READ OF A FULL ONE IS A FAILURE (DD-160, lane
@@ -1515,4 +1556,4 @@ declare function holdingsDoorIsAbsent(code: string | undefined | null): boolean;
1515
1556
  */
1516
1557
  declare function emptyReadAlarm(total: number, emptyIds: readonly string[], holdings: Holdings): string | null;
1517
1558
 
1518
- export { type ApiVaultPortOptions, CATEGORIES, CONFIRM_RETURN_KEY, type CategoryId, type Confirmed, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copyValue, createApiVaultPort, createSupabaseIdentity, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useConfirmed, vaultInventoryScope, vaultItemFacts, wasCancelled };
1559
+ export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES, CONFIRM_RETURN_KEY, type CategoryId, type Confirmed, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, REVEAL_SECONDS_KNOB, type ReturnStore, type RowItemAction, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCopied, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copiedLine, copyValue, createApiVaultPort, createSupabaseIdentity, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, positiveKnob, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useConfirmed, useDisposable, vaultInventoryScope, vaultItemFacts, wasCancelled };