@ai-matrx/vault 0.1.14 → 0.1.16

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
@@ -100,7 +100,8 @@ interface VaultOrganizationRef {
100
100
  id: string;
101
101
  name: string;
102
102
  }
103
- type VaultSort = "name" | "website" | "updated" | "created";
103
+ /** `name` A–Z, `name-desc` Z–A, `viewed` = most recently opened first (needs the host's Recently opened door). */
104
+ type VaultSort = "name" | "name-desc" | "website" | "updated" | "created" | "viewed";
104
105
  /** Which vault to look in. `all` is everything the person can see, shared with them included. */
105
106
  type VaultSelection = "all" | "mine" | "shared" | (string & {});
106
107
  interface VaultLocation {
@@ -123,7 +124,6 @@ declare const DEFAULT_LOCATION: VaultLocation;
123
124
  declare function locationFromParams(params: URLSearchParams, itemId?: string | null): VaultLocation;
124
125
  /** Writes everything that is not a default (and not the item id, which the host places). */
125
126
  declare function locationToParams(loc: VaultLocation): URLSearchParams;
126
- /** The one search every list shares: name, type, tags, URLs, then plaintext custom fields. */
127
127
  declare function matchesQuery(item: VaultItem, query: string): boolean;
128
128
  /**
129
129
  * The authenticator's own storage on an item (the seed, digits, period, issuer…): shown only as the
@@ -145,11 +145,26 @@ declare function loginSiteOf(item: Pick<VaultItem, "loginUrls">): string;
145
145
  * `shop.example.co.uk` → `example.co.uk`. An address or a one-label host is returned as it is.
146
146
  */
147
147
  declare function siteDomainOf(host: string): string;
148
- declare function sortItems(items: readonly VaultItem[], sort: VaultSort): VaultItem[];
148
+ /**
149
+ * `recents` is the person's Recently opened ids, newest first: `viewed` puts those first in that
150
+ * order, then everything never opened by name. Without it `viewed` sorts by name.
151
+ */
152
+ declare function sortItems(items: readonly VaultItem[], sort: VaultSort, recents?: readonly string[] | null): VaultItem[];
149
153
  interface NewSecretField {
150
154
  key: string;
151
155
  label: string;
152
156
  value: string;
157
+ /** The name sandboxes and workflows find it by (`GITHUB_TOKEN`); absent = none. */
158
+ envKey?: string;
159
+ /** Who may see it; absent = `revealable` (shown after "Confirm it's you"). */
160
+ handling?: FieldHandling;
161
+ /** Sandboxes get it as an env variable (needs `envKey`). */
162
+ injectIntoSandbox?: boolean;
163
+ }
164
+ /** How the browser treats a NEW item, chosen before its first save (afterwards: item settings). */
165
+ interface DraftBrowserSettings {
166
+ uriMatchMode: UriMatchMode;
167
+ browserFillEnabled: boolean;
153
168
  }
154
169
  interface ItemDraft {
155
170
  name: string;
@@ -167,6 +182,8 @@ interface ItemDraft {
167
182
  removed: string[];
168
183
  /** A seed or otpauth address to enrol as the item's one-time password; empty = leave alone. */
169
184
  authenticator: string;
185
+ /** New item only: website matching and browser fill chosen before the first save; absent = the defaults. */
186
+ browser?: DraftBrowserSettings;
170
187
  }
171
188
 
172
189
  /** One recorded earlier value of a secret field. Value-free: the value comes only from `revealHistory`. */
@@ -1173,6 +1190,10 @@ interface VaultHostCapabilities {
1173
1190
  /** Desktop: the native passkey importer (file chooser, parsing and keys stay native). */
1174
1191
  nativeImport?: NativeImportBridge;
1175
1192
  openUrl?: (url: string) => void;
1193
+ /** The browser extension: opens the full vault on the website. Without it there is no "Open on the web". */
1194
+ openWebVault?: () => void;
1195
+ /** Opens one item in a new browser tab (the web app: `/vault/<id>`). Without it there is no "Open in new tab". */
1196
+ openItemInNewTab?: (itemId: string) => void;
1176
1197
  /** The host's own sign-in, offered when the session has ended (the web app: its login page, back here after). */
1177
1198
  signIn?: () => void;
1178
1199
  /** A lock the host holds (`lock.ts`): while locked the vault shows Unlock and refuses every port call. */
@@ -1240,6 +1261,40 @@ declare function copyValue(text: string, label: string, options: CopyOptions, de
1240
1261
  notify: Notify;
1241
1262
  }): Promise<boolean>;
1242
1263
 
1264
+ /**
1265
+ * What an agent may know about the vault: its NON-SECRET shape, never a value.
1266
+ *
1267
+ * A host that offers agents on the vault (the web app's right-click menu and its Agents menu, surface
1268
+ * `matrx-user/vault`) builds their context here, so every host says the same thing and none can leak
1269
+ * more. `VaultItem` carries no plaintext (a revealed value lives only in the row that showed it), but
1270
+ * a person can type a secret into a free-text box, so notes, descriptions and custom-field VALUES are
1271
+ * left out on purpose: names, type, provider, websites' hosts, status, tags and field KEYS only.
1272
+ */
1273
+
1274
+ /** Everything the person can see, as `VaultApp`'s `onInventory` reports it. */
1275
+ interface VaultInventory {
1276
+ items: readonly VaultItem[];
1277
+ definitions: readonly VaultDefinition[];
1278
+ }
1279
+ /** The surface values `matrx-user/vault` declares (count, names, providers) plus the menu's content. */
1280
+ interface VaultAgentScope {
1281
+ content: string;
1282
+ credential_count: number;
1283
+ credential_labels: string[];
1284
+ credential_providers: string[];
1285
+ }
1286
+ /** The provider an item is for (`github`, `openai`), from its type; null for generic types. */
1287
+ declare function providerOf(item: VaultItem, definitions: readonly VaultDefinition[]): string | null;
1288
+ /** One item, as lines an agent may read. Never a value: field KEYS only. */
1289
+ declare function vaultItemFacts(item: VaultItem, definitions: readonly VaultDefinition[]): string[];
1290
+ /**
1291
+ * The vault scope for an agent: the right-clicked item's facts when there is one, else the whole
1292
+ * inventory by name and type; plus the three values the surface always carries.
1293
+ */
1294
+ declare function vaultInventoryScope(inventory: VaultInventory, clicked?: VaultItem | null): VaultAgentScope;
1295
+ /** The item a right-click landed on: every list row carries `data-item="<id>"`. */
1296
+ declare function itemIdAt(target: Element | null | undefined): string | null;
1297
+
1243
1298
  type VaultLayout = "auto" | "full" | "split" | "stack";
1244
1299
  interface VaultAppProps {
1245
1300
  port: VaultPort;
@@ -1261,6 +1316,11 @@ interface VaultAppProps {
1261
1316
  * Apple's text styles, AppKit controls and grouped boxes, sheets for panels, light and dark).
1262
1317
  */
1263
1318
  look?: Look;
1319
+ /**
1320
+ * Every item the person can see, each time the list changes: the host builds its agent context
1321
+ * from it (`vaultInventoryScope`), never from secrets — items carry none.
1322
+ */
1323
+ onInventory?: (inventory: VaultInventory) => void;
1264
1324
  }
1265
1325
  /** THE VAULT WORKSPACE: one component for the web app, the extension side panel and the desktop app. */
1266
1326
  declare function VaultApp(props: VaultAppProps): react.JSX.Element;
@@ -1323,4 +1383,4 @@ declare function GenerateButton({ onUse, label, limits, disabled }: {
1323
1383
  disabled?: boolean;
1324
1384
  }): react.JSX.Element | null;
1325
1385
 
1326
- 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, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, 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, guardPort, inferFromUrl, isHiddenItem, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, siteDomainOf, sortItems, useConfirmed, wasCancelled };
1386
+ 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, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, 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, guardPort, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, providerOf, siteDomainOf, sortItems, useConfirmed, vaultInventoryScope, vaultItemFacts, wasCancelled };
package/dist/index.d.ts CHANGED
@@ -100,7 +100,8 @@ interface VaultOrganizationRef {
100
100
  id: string;
101
101
  name: string;
102
102
  }
103
- type VaultSort = "name" | "website" | "updated" | "created";
103
+ /** `name` A–Z, `name-desc` Z–A, `viewed` = most recently opened first (needs the host's Recently opened door). */
104
+ type VaultSort = "name" | "name-desc" | "website" | "updated" | "created" | "viewed";
104
105
  /** Which vault to look in. `all` is everything the person can see, shared with them included. */
105
106
  type VaultSelection = "all" | "mine" | "shared" | (string & {});
106
107
  interface VaultLocation {
@@ -123,7 +124,6 @@ declare const DEFAULT_LOCATION: VaultLocation;
123
124
  declare function locationFromParams(params: URLSearchParams, itemId?: string | null): VaultLocation;
124
125
  /** Writes everything that is not a default (and not the item id, which the host places). */
125
126
  declare function locationToParams(loc: VaultLocation): URLSearchParams;
126
- /** The one search every list shares: name, type, tags, URLs, then plaintext custom fields. */
127
127
  declare function matchesQuery(item: VaultItem, query: string): boolean;
128
128
  /**
129
129
  * The authenticator's own storage on an item (the seed, digits, period, issuer…): shown only as the
@@ -145,11 +145,26 @@ declare function loginSiteOf(item: Pick<VaultItem, "loginUrls">): string;
145
145
  * `shop.example.co.uk` → `example.co.uk`. An address or a one-label host is returned as it is.
146
146
  */
147
147
  declare function siteDomainOf(host: string): string;
148
- declare function sortItems(items: readonly VaultItem[], sort: VaultSort): VaultItem[];
148
+ /**
149
+ * `recents` is the person's Recently opened ids, newest first: `viewed` puts those first in that
150
+ * order, then everything never opened by name. Without it `viewed` sorts by name.
151
+ */
152
+ declare function sortItems(items: readonly VaultItem[], sort: VaultSort, recents?: readonly string[] | null): VaultItem[];
149
153
  interface NewSecretField {
150
154
  key: string;
151
155
  label: string;
152
156
  value: string;
157
+ /** The name sandboxes and workflows find it by (`GITHUB_TOKEN`); absent = none. */
158
+ envKey?: string;
159
+ /** Who may see it; absent = `revealable` (shown after "Confirm it's you"). */
160
+ handling?: FieldHandling;
161
+ /** Sandboxes get it as an env variable (needs `envKey`). */
162
+ injectIntoSandbox?: boolean;
163
+ }
164
+ /** How the browser treats a NEW item, chosen before its first save (afterwards: item settings). */
165
+ interface DraftBrowserSettings {
166
+ uriMatchMode: UriMatchMode;
167
+ browserFillEnabled: boolean;
153
168
  }
154
169
  interface ItemDraft {
155
170
  name: string;
@@ -167,6 +182,8 @@ interface ItemDraft {
167
182
  removed: string[];
168
183
  /** A seed or otpauth address to enrol as the item's one-time password; empty = leave alone. */
169
184
  authenticator: string;
185
+ /** New item only: website matching and browser fill chosen before the first save; absent = the defaults. */
186
+ browser?: DraftBrowserSettings;
170
187
  }
171
188
 
172
189
  /** One recorded earlier value of a secret field. Value-free: the value comes only from `revealHistory`. */
@@ -1173,6 +1190,10 @@ interface VaultHostCapabilities {
1173
1190
  /** Desktop: the native passkey importer (file chooser, parsing and keys stay native). */
1174
1191
  nativeImport?: NativeImportBridge;
1175
1192
  openUrl?: (url: string) => void;
1193
+ /** The browser extension: opens the full vault on the website. Without it there is no "Open on the web". */
1194
+ openWebVault?: () => void;
1195
+ /** Opens one item in a new browser tab (the web app: `/vault/<id>`). Without it there is no "Open in new tab". */
1196
+ openItemInNewTab?: (itemId: string) => void;
1176
1197
  /** The host's own sign-in, offered when the session has ended (the web app: its login page, back here after). */
1177
1198
  signIn?: () => void;
1178
1199
  /** A lock the host holds (`lock.ts`): while locked the vault shows Unlock and refuses every port call. */
@@ -1240,6 +1261,40 @@ declare function copyValue(text: string, label: string, options: CopyOptions, de
1240
1261
  notify: Notify;
1241
1262
  }): Promise<boolean>;
1242
1263
 
1264
+ /**
1265
+ * What an agent may know about the vault: its NON-SECRET shape, never a value.
1266
+ *
1267
+ * A host that offers agents on the vault (the web app's right-click menu and its Agents menu, surface
1268
+ * `matrx-user/vault`) builds their context here, so every host says the same thing and none can leak
1269
+ * more. `VaultItem` carries no plaintext (a revealed value lives only in the row that showed it), but
1270
+ * a person can type a secret into a free-text box, so notes, descriptions and custom-field VALUES are
1271
+ * left out on purpose: names, type, provider, websites' hosts, status, tags and field KEYS only.
1272
+ */
1273
+
1274
+ /** Everything the person can see, as `VaultApp`'s `onInventory` reports it. */
1275
+ interface VaultInventory {
1276
+ items: readonly VaultItem[];
1277
+ definitions: readonly VaultDefinition[];
1278
+ }
1279
+ /** The surface values `matrx-user/vault` declares (count, names, providers) plus the menu's content. */
1280
+ interface VaultAgentScope {
1281
+ content: string;
1282
+ credential_count: number;
1283
+ credential_labels: string[];
1284
+ credential_providers: string[];
1285
+ }
1286
+ /** The provider an item is for (`github`, `openai`), from its type; null for generic types. */
1287
+ declare function providerOf(item: VaultItem, definitions: readonly VaultDefinition[]): string | null;
1288
+ /** One item, as lines an agent may read. Never a value: field KEYS only. */
1289
+ declare function vaultItemFacts(item: VaultItem, definitions: readonly VaultDefinition[]): string[];
1290
+ /**
1291
+ * The vault scope for an agent: the right-clicked item's facts when there is one, else the whole
1292
+ * inventory by name and type; plus the three values the surface always carries.
1293
+ */
1294
+ declare function vaultInventoryScope(inventory: VaultInventory, clicked?: VaultItem | null): VaultAgentScope;
1295
+ /** The item a right-click landed on: every list row carries `data-item="<id>"`. */
1296
+ declare function itemIdAt(target: Element | null | undefined): string | null;
1297
+
1243
1298
  type VaultLayout = "auto" | "full" | "split" | "stack";
1244
1299
  interface VaultAppProps {
1245
1300
  port: VaultPort;
@@ -1261,6 +1316,11 @@ interface VaultAppProps {
1261
1316
  * Apple's text styles, AppKit controls and grouped boxes, sheets for panels, light and dark).
1262
1317
  */
1263
1318
  look?: Look;
1319
+ /**
1320
+ * Every item the person can see, each time the list changes: the host builds its agent context
1321
+ * from it (`vaultInventoryScope`), never from secrets — items carry none.
1322
+ */
1323
+ onInventory?: (inventory: VaultInventory) => void;
1264
1324
  }
1265
1325
  /** THE VAULT WORKSPACE: one component for the web app, the extension side panel and the desktop app. */
1266
1326
  declare function VaultApp(props: VaultAppProps): react.JSX.Element;
@@ -1323,4 +1383,4 @@ declare function GenerateButton({ onUse, label, limits, disabled }: {
1323
1383
  disabled?: boolean;
1324
1384
  }): react.JSX.Element | null;
1325
1385
 
1326
- 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, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, type SaveResult, type SupabaseAuthLike, type SupabaseIdentityOptions, type TotpReading, type UriMatchMode, type UrlGuess, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, type VaultIdentity, 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, guardPort, inferFromUrl, isHiddenItem, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, siteDomainOf, sortItems, useConfirmed, wasCancelled };
1386
+ 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, type IdentityAccount, IdentityGate, type IdentityMethod, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, type ReturnStore, 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, guardPort, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, needsRecentSignIn, parseDefinitions, providerOf, siteDomainOf, sortItems, useConfirmed, vaultInventoryScope, vaultItemFacts, wasCancelled };