@vibes.diy/vibe-runtime 14.3.386 → 14.3.387

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/vibe-runtime",
3
- "version": "14.3.386",
3
+ "version": "14.3.387",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -36,9 +36,9 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@adviser/cement": "~0.5.37",
39
- "@vibes.diy/api-types": "14.3.386",
40
- "@vibes.diy/base": "14.3.386",
41
- "@vibes.diy/vibe-types": "14.3.386",
39
+ "@vibes.diy/api-types": "14.3.387",
40
+ "@vibes.diy/base": "14.3.387",
41
+ "@vibes.diy/vibe-types": "14.3.387",
42
42
  "arktype": "~2.2.9",
43
43
  "charwise": "~3.0.1",
44
44
  "es-module-lexer": "~3.0.4",
@@ -37,6 +37,10 @@ interface RequestOpts {
37
37
  wait(x: unknown): boolean;
38
38
  onEvent?(x: unknown): void;
39
39
  }
40
+ export interface RequestLoginOptions {
41
+ readonly handleHint?: string;
42
+ }
43
+ export declare function handleHintFrom(opts: unknown): string | undefined;
40
44
  export declare class VibeSandboxApi {
41
45
  readonly svc: VibeSandboxApiOptions;
42
46
  readonly runtimeId: `${string}-${string}-${string}-${string}-${string}`;
@@ -102,7 +106,7 @@ export declare class VibeSandboxApi {
102
106
  socialInvite(contact: string): Promise<Result<ResVibeSocialInvite>>;
103
107
  inviteByEmail(contact: string): Promise<Result<ResVibeInviteByEmail>>;
104
108
  resolveInviteSubjects(subjects: string[]): Promise<Result<ResVibeResolveInviteSubjects>>;
105
- requestLogin(): void;
109
+ requestLogin(opts?: RequestLoginOptions): void;
106
110
  updateAvatarCid(cid: string, handle: string, mimeType?: string): Promise<Result<ResVibeUpdateAvatarCid>>;
107
111
  linkAccount(provider: string): Promise<Result<ResVibeLinkAccount>>;
108
112
  connectionStatus(provider: string): Promise<Result<ResVibeConnectionStatus>>;
@@ -24,6 +24,16 @@ import { RUNTIME_BUILD, announceRuntimeBuild, formatRuntimeBuild } from "./runti
24
24
  import { getActiveImportMap, getHotSwapBaseUrl, rewriteBareSpecifiers, rewriteRelativeSpecifiersWithBlobs, rewriteHotSwapEntrySpecifiers, orderCompanionGraph, } from "./bare-specifier-rewrite.js";
25
25
  import { lazyType } from "@vibes.diy/api-types/lazy-type";
26
26
  import { createTypingHold } from "./typing-hold.js";
27
+ const MAX_HANDLE_HINT_CHARS = 64;
28
+ export function handleHintFrom(opts) {
29
+ if (typeof opts !== "object" || opts === null)
30
+ return undefined;
31
+ const raw = opts.handleHint;
32
+ if (typeof raw !== "string")
33
+ return undefined;
34
+ const hint = raw.trim().slice(0, MAX_HANDLE_HINT_CHARS);
35
+ return hint.length === 0 ? undefined : hint;
36
+ }
27
37
  export class VibeSandboxApi {
28
38
  svc;
29
39
  runtimeId = crypto.randomUUID();
@@ -404,12 +414,18 @@ export class VibeSandboxApi {
404
414
  resolveInviteSubjects(subjects) {
405
415
  return this.request({ type: "vibe.req.resolveInviteSubjects", subjects, ...this.svc.vibeApp }, { wait: isResVibeResolveInviteSubjects, timeout: 10000 });
406
416
  }
407
- requestLogin() {
417
+ requestLogin(opts) {
408
418
  if (this.svc.vibeApp.captureRender === true)
409
419
  return;
410
420
  const tid = crypto.randomUUID();
421
+ const handleHint = handleHintFrom(opts);
411
422
  void this.ackReady.asPromise().then(() => {
412
- this.svc.postMessage({ tid, type: "vibe.req.login", ...this.svc.vibeApp }, "*");
423
+ this.svc.postMessage({
424
+ tid,
425
+ type: "vibe.req.login",
426
+ ...this.svc.vibeApp,
427
+ ...(handleHint === undefined ? {} : { handleHint }),
428
+ }, "*");
413
429
  });
414
430
  }
415
431
  updateAvatarCid(cid, handle, mimeType) {
package/use-viewer.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { type RequestLoginOptions } from "./register-dependencies.js";
2
3
  import { type ViewerEnv } from "./vibe.js";
3
4
  import { type ViewerTagProps } from "./use-viewer-tag.js";
4
5
  import type { HandleInputProps } from "./use-handle-input.js";
@@ -19,7 +20,7 @@ export interface UseViewerResult {
19
20
  readonly viewerLapsed: boolean;
20
21
  readonly ViewerTag: React.FC<ViewerTagProps>;
21
22
  readonly HandleInput: React.FC<HandleInputProps>;
22
- readonly requestLogin: () => void;
23
+ readonly requestLogin: (opts?: RequestLoginOptions) => void;
23
24
  }
24
25
  export declare function useViewer(): UseViewerResult;
25
26
  export declare function ViewerTag(props: ViewerTagProps): React.ReactElement;
package/use-viewer.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { canRead, canWrite } from "./db-acl-allows.js";
3
- import { getRegisteredVibeApi } from "./register-dependencies.js";
3
+ import { getRegisteredVibeApi, handleHintFrom } from "./register-dependencies.js";
4
4
  import { useVibeContext } from "./VibeContext.js";
5
5
  import { isViewerEnvPending } from "./vibe.js";
6
6
  import { ViewerTagImpl } from "./use-viewer-tag.js";
@@ -27,8 +27,9 @@ export function useViewer() {
27
27
  return action === "read" ? canRead(access) : canWrite(access);
28
28
  }
29
29
  const ViewerTag = React.useCallback((props) => React.createElement(ViewerTagImpl, { ...props, _viewer: viewer, _pending: isViewerPending }), [viewer, isViewerPending]);
30
- const requestLogin = React.useCallback(() => {
31
- getRegisteredVibeApi()?.requestLogin();
30
+ const requestLogin = React.useCallback((opts) => {
31
+ const handleHint = handleHintFrom(opts);
32
+ getRegisteredVibeApi()?.requestLogin(handleHint === undefined ? undefined : { handleHint });
32
33
  }, []);
33
34
  return {
34
35
  viewer,