Merge remote-tracking branch 'origin/feature/v0.9.0-dev-a-org-foundation' into feature/v0.9.0-dev-b-org-read-ui

This commit is contained in:
adlee-was-taken
2026-06-26 23:06:29 -04:00
25 changed files with 2058 additions and 94 deletions

View File

@@ -1,7 +1,7 @@
import type {
Item, ItemId, Manifest, ManifestEntry, VaultConfig, SetupState,
DeviceSettings, GeneratorRequest, VaultSettings, AttachmentRef, Device,
FieldHistoryView,
FieldHistoryView, OrgConfigSummary, OrgManifestEntry, Collection,
} from './types';
// --- Session timeout config ---
@@ -68,7 +68,12 @@ export type PopupMessage =
carrierImageBytes: ArrayBuffer; deviceName: string }
| { type: 'attach_vault'; config: VaultConfig; passphrase: string;
referenceImageBytes: ArrayBuffer; deviceName: string }
| { type: 'get_vault_status' };
| { type: 'get_vault_status' }
| { type: 'org_list_configs' }
| { type: 'org_switch'; context: string }
| { type: 'org_list_items' }
| { type: 'org_get_item'; id: string }
| { type: 'org_list_collections' };
// --- Messages a content script may send ---
@@ -182,6 +187,8 @@ export const POPUP_ONLY_TYPES: ReadonlySet<PopupMessage['type']> = new Set([
'preview_totp_from_secret',
'generate_recovery_qr', 'unwrap_recovery_qr',
'create_vault', 'attach_vault', 'get_vault_status',
'org_list_configs',
'org_switch', 'org_list_items', 'org_get_item', 'org_list_collections',
] as PopupMessage['type'][]);
export interface ExportBackupResponse extends Extract<Response, { ok: true }> {
@@ -221,6 +228,26 @@ export interface GetVaultStatusResponse extends Extract<Response, { ok: true }>
pendingItems: number };
}
export interface OrgListConfigsResponse extends Extract<Response, { ok: true }> {
data: OrgConfigSummary[];
}
export interface OrgSwitchResponse extends Extract<Response, { ok: true }> {
data: { context: string; offline: boolean };
}
export interface OrgListItemsResponse extends Extract<Response, { ok: true }> {
data: OrgManifestEntry[];
}
export interface OrgGetItemResponse extends Extract<Response, { ok: true }> {
data: Item;
}
export interface OrgListCollectionsResponse extends Extract<Response, { ok: true }> {
data: Collection[];
}
export const CONTENT_CALLABLE_TYPES: ReadonlySet<ContentMessage['type']> = new Set([
'get_autofill_candidates', 'get_credentials', 'check_credential', 'blacklist_site',
'capture_save_login',

View File

@@ -206,6 +206,83 @@ export interface ManifestEntry {
attachment_summaries: AttachmentSummary[];
}
// --- Org config (device-local storage) ---
/** Full org config stored in the SW only — never sent to the popup. */
export interface OrgConfig {
orgId: string;
displayName: string;
hostType: 'gitea' | 'github';
hostUrl: string;
repoPath: string;
apiToken: string;
memberId: string;
}
/** Safe subset returned by org_list_configs — no tokens, no remote details. */
export interface OrgConfigSummary {
orgId: string;
displayName: string;
}
// --- Org members + collections (mirror Rust org.rs shapes) ---
export type OrgRole = 'owner' | 'admin' | 'member';
export interface OrgMember {
member_id: string;
display_name: string;
role: OrgRole;
/** SSH public key string (openssh format: "ssh-ed25519 AAAA...") */
ed25519_pubkey: string;
/** Collection slugs this member can access. */
collections: string[];
added_at: number;
added_by: string;
}
export interface OrgMembers {
schema_version: number;
members: OrgMember[];
}
export interface CollectionDef {
slug: string;
display_name: string;
created_by: string;
created_at: number;
}
export interface OrgCollections {
schema_version: number;
collections: CollectionDef[];
}
/** Public shape returned by listOrgCollections — slug + display_name only. */
export interface Collection {
slug: string;
display_name: string;
}
// --- Org manifest ---
// Org manifest — a dedicated, leaner shape than the personal ManifestEntry.
// Faithful to relicario-core OrgManifestEntry; collection is REQUIRED.
export interface OrgManifestEntry {
id: ItemId;
type: ItemType; // Rust r#type → JSON key "type"
title: string;
tags: string[];
modified: number;
trashed_at?: number;
collection: string;
}
export interface OrgManifest {
schema_version: number;
entries: OrgManifestEntry[];
}
// --- Vault settings ---
// Full shape lives on the Rust side and in docs/superpowers/specs/2026-04-18-relicario-typed-items-design.md
// β₂ tightens retention + generator_defaults; γ owns attachment_caps.