@wyxos/vibe 5.1.0 → 5.2.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/lib/core/autofill.d.ts +2 -0
- package/lib/core/exactMediaRemovalController.d.ts +2 -0
- package/lib/core/fill.d.ts +2 -0
- package/lib/core/fillController.d.ts +2 -0
- package/lib/core/initialAutofill.d.ts +3 -1
- package/lib/core/page.d.ts +7 -1
- package/lib/core/pageRequest.d.ts +18 -0
- package/lib/core/removalControllers.d.ts +2 -0
- package/lib/core/removalReconciliationController.d.ts +35 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +677 -492
- package/lib/types.d.ts +5 -0
- package/package.json +1 -1
package/lib/core/autofill.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { VibeAutofillOptions, VibeAutofillSessionSnapshot, VibeAutofillState, VibeCursor, VibeFrontendAutofillOptions, VibeItem, VibePageLoader } from '../types';
|
|
2
2
|
import type { VibeRuntimeState } from './runtime';
|
|
3
|
+
import { type LoadedPageRecord } from './page';
|
|
3
4
|
import { type RequestDelaySnapshot } from './requestDelay';
|
|
4
5
|
export declare const DEFAULT_MAX_ADDITIONAL_PAGES = 10;
|
|
5
6
|
export declare function frontendAutofillRequestLimit(options: VibeFrontendAutofillOptions, includeInitialRequest?: boolean): number;
|
|
@@ -15,6 +16,7 @@ export interface FrontendAutofillCollection extends FrontendAutofillProgress {
|
|
|
15
16
|
total?: number;
|
|
16
17
|
}
|
|
17
18
|
export interface FrontendAutofillResult extends FrontendAutofillCollection {
|
|
19
|
+
pages: LoadedPageRecord[];
|
|
18
20
|
status: 'complete' | 'exhausted';
|
|
19
21
|
}
|
|
20
22
|
interface CollectFrontendAutofillOptions {
|
|
@@ -3,6 +3,8 @@ import type { VibeRuntimeState } from './runtime';
|
|
|
3
3
|
import type { VibeItemId, VibeMediaRemoval, VibeMediaTarget } from '../types';
|
|
4
4
|
interface ExactMediaRemovalControllerOptions {
|
|
5
5
|
onActivate: (postId: VibeItemId) => void;
|
|
6
|
+
onPostRemoved: (postId: VibeItemId) => void;
|
|
7
|
+
onPostRestored: (postId: VibeItemId) => void;
|
|
6
8
|
reelForward: ReelForwardController;
|
|
7
9
|
state: VibeRuntimeState;
|
|
8
10
|
}
|
package/lib/core/fill.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LoadedPageRecord } from './page';
|
|
1
2
|
import type { VibeFillOptions, VibeFillSessionSnapshot, VibeFillState, VibeFillTarget, VibeCursor, VibeFrontendFillOptions, VibeItem, VibePageLoader } from '../types';
|
|
2
3
|
import { type RequestDelaySnapshot } from './requestDelay';
|
|
3
4
|
export interface FrontendFillProgress {
|
|
@@ -8,6 +9,7 @@ export interface FrontendFillProgress {
|
|
|
8
9
|
export interface FrontendFillResult extends FrontendFillProgress {
|
|
9
10
|
items: VibeItem[];
|
|
10
11
|
lastCursor: VibeCursor;
|
|
12
|
+
pages: LoadedPageRecord[];
|
|
11
13
|
status: 'complete' | 'exhausted';
|
|
12
14
|
total?: number;
|
|
13
15
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { LoadedPageRecord } from './page';
|
|
1
2
|
import type { VibeRuntimeState } from './runtime';
|
|
2
3
|
import type { VibeBackendFillUpdate, VibeCursor, VibeFillOptions, VibeFillSessionSnapshot, VibeFillTarget, VibePageLoader } from '../types';
|
|
3
4
|
interface FillControllerOptions {
|
|
4
5
|
fill?: VibeFillOptions;
|
|
5
6
|
loadPage?: VibePageLoader;
|
|
6
7
|
onLastCursor: (cursor: VibeCursor) => void;
|
|
8
|
+
onPages: (pages: readonly LoadedPageRecord[]) => void;
|
|
7
9
|
state: VibeRuntimeState;
|
|
8
10
|
}
|
|
9
11
|
export declare class VibeFillController {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FrontendAutofillCollection } from './autofill';
|
|
2
|
+
import type { LoadedPageRecord } from './page';
|
|
2
3
|
import type { VibeRuntimeState } from './runtime';
|
|
3
4
|
import type { CreateVibeOptions, VibeCursor } from '../types';
|
|
4
5
|
interface InitialAutofillContext {
|
|
@@ -6,9 +7,10 @@ interface InitialAutofillContext {
|
|
|
6
7
|
isCurrent: () => boolean;
|
|
7
8
|
onCollection: (collection: FrontendAutofillCollection) => void;
|
|
8
9
|
onLastCursor: (cursor: VibeCursor) => void;
|
|
10
|
+
onPages: (pages: readonly LoadedPageRecord[]) => void;
|
|
9
11
|
options: CreateVibeOptions;
|
|
10
12
|
signal: AbortSignal;
|
|
11
13
|
state: VibeRuntimeState;
|
|
12
14
|
}
|
|
13
|
-
export declare function autofillInitialPage({ cycleId, isCurrent, onCollection, onLastCursor, options, signal, state, }: InitialAutofillContext): Promise<void>;
|
|
15
|
+
export declare function autofillInitialPage({ cycleId, isCurrent, onCollection, onLastCursor, onPages, options, signal, state, }: InitialAutofillContext): Promise<void>;
|
|
14
16
|
export {};
|
package/lib/core/page.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type { VibeItem, VibePage } from '../types';
|
|
1
|
+
import type { VibeCursor, VibeItem, VibeItemId, VibePage } from '../types';
|
|
2
|
+
export interface LoadedPageRecord {
|
|
3
|
+
contributionIds: VibeItemId[];
|
|
4
|
+
cursor: VibeCursor;
|
|
5
|
+
next: VibeCursor;
|
|
6
|
+
returnedIds: VibeItemId[];
|
|
7
|
+
}
|
|
2
8
|
export declare function validatePage(page: VibePage): VibePage;
|
|
3
9
|
export declare function appendUniqueItems(current: readonly VibeItem[], incoming: readonly VibeItem[]): VibeItem[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CreateVibeOptions, VibeCursor, VibePageRequest } from '../types';
|
|
2
|
+
import type { VibeAutofillController } from './autofillController';
|
|
3
|
+
import { type LoadedPageRecord } from './page';
|
|
4
|
+
import type { VibeRuntimeState } from './runtime';
|
|
5
|
+
interface PageRequestOptions {
|
|
6
|
+
append: boolean;
|
|
7
|
+
autofillController: VibeAutofillController;
|
|
8
|
+
cursor: VibeCursor;
|
|
9
|
+
isCurrent: () => boolean;
|
|
10
|
+
loadPage: (request: VibePageRequest) => ReturnType<NonNullable<CreateVibeOptions['loadPage']>>;
|
|
11
|
+
onLastCursor: (cursor: VibeCursor) => void;
|
|
12
|
+
onPages: (pages: readonly LoadedPageRecord[]) => void;
|
|
13
|
+
options: CreateVibeOptions;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
state: VibeRuntimeState;
|
|
16
|
+
}
|
|
17
|
+
export declare function performPageRequest({ append, autofillController, cursor, isCurrent, loadPage, onLastCursor, onPages, options, signal, state, }: PageRequestOptions): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -9,6 +9,8 @@ interface RemovalControllerOptions {
|
|
|
9
9
|
historyLimit: number | undefined;
|
|
10
10
|
loadNext: () => Promise<void>;
|
|
11
11
|
onActivate: (postId: VibeItemId) => void;
|
|
12
|
+
onItemsRemoved: (postIds: readonly VibeItemId[]) => void;
|
|
13
|
+
onItemsRestored: (postIds: readonly VibeItemId[]) => void;
|
|
12
14
|
retryEnd: () => Promise<void>;
|
|
13
15
|
state: VibeRuntimeState;
|
|
14
16
|
surface: () => VibeSurfaceExpose | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CreateVibeOptions, VibeCursor, VibeItem, VibeItemId, VibePageLoader } from '../types';
|
|
2
|
+
import { type LoadedPageRecord } from './page';
|
|
3
|
+
interface ReconciliationResult {
|
|
4
|
+
items: VibeItem[];
|
|
5
|
+
lastCursor: VibeCursor;
|
|
6
|
+
next: VibeCursor;
|
|
7
|
+
pages: LoadedPageRecord[];
|
|
8
|
+
replaceFrom: number;
|
|
9
|
+
total?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ReconcileOptions {
|
|
12
|
+
existingItems: readonly VibeItem[];
|
|
13
|
+
loadPage: VibePageLoader;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
export declare class RemovalReconciliationController {
|
|
17
|
+
private readonly delay;
|
|
18
|
+
private readonly enabled;
|
|
19
|
+
private readonly maxReplayPages;
|
|
20
|
+
private readonly pageSize;
|
|
21
|
+
private pages;
|
|
22
|
+
private readonly tombstones;
|
|
23
|
+
constructor(options: CreateVibeOptions);
|
|
24
|
+
completeReconciliation(result: ReconciliationResult): void;
|
|
25
|
+
filterItems(items: readonly VibeItem[]): VibeItem[];
|
|
26
|
+
needsReconciliation(items: readonly VibeItem[]): boolean;
|
|
27
|
+
recordPages(records: readonly LoadedPageRecord[]): void;
|
|
28
|
+
remove(postIds: readonly VibeItemId[]): void;
|
|
29
|
+
reset(): void;
|
|
30
|
+
restore(postIds: readonly VibeItemId[]): void;
|
|
31
|
+
reconcile({ existingItems, loadPage, signal, }: ReconcileOptions): Promise<ReconciliationResult>;
|
|
32
|
+
private findUnderfilledPage;
|
|
33
|
+
private recordPage;
|
|
34
|
+
}
|
|
35
|
+
export {};
|