vibeshare-live 0.1.0
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/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/chunk-5OLI3WTU.js +233 -0
- package/dist/cli.d.ts +42 -0
- package/dist/cli.js +277 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +32 -0
- package/dist/mcp.d.ts +41 -0
- package/dist/mcp.js +14635 -0
- package/dist/share-CoX608sF.d.ts +188 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export { a as AccessGate, b as AccessGateOptions, A as AccessMode, C as ConsentError, c as ControlRequestResult, D as DEFAULT_ACCESS, d as DenialReason, E as ExpirySpec, H as HOST_PARTICIPANT_NAME, R as RevokeReason, S as SHARE_SESSION_SCOPE, e as ShareHandle, f as ShareOptions, V as Viewer, g as ViewerRole, h as ViewerRoster, i as createAccessGate, j as createShare, p as parseExpiry } from './share-CoX608sF.js';
|
|
2
|
+
import 'vibelive-cli';
|
|
3
|
+
import '@pooriaarab/vibe-core';
|
|
4
|
+
|
|
5
|
+
/** vibeshare package version (single source of truth for CLI + MCP). */
|
|
6
|
+
declare const VERSION = "0.1.0";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The URL / capability-id layer of vibeshare.
|
|
10
|
+
*
|
|
11
|
+
* Pure logic — no IO — so every function here is directly unit-tested in
|
|
12
|
+
* `src/url.test.ts`. A share link is a **capability URL**: the id is the only
|
|
13
|
+
* thing that grants access, so it must be unguessable. The human-facing host is
|
|
14
|
+
* vibeshare's own domain (`vibeshare.stream`); the actual transport is the
|
|
15
|
+
* local/LAN ws relay owned by vibelive, which the URL only *represents*.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The display origin for vibeshare share links. This is vibeshare's OWN domain —
|
|
19
|
+
* not vibe.live — so a shared link reads as vibeshare even though the bytes flow
|
|
20
|
+
* over a self-hostable e2e relay (see docs/spec.md · "its OWN domain, not
|
|
21
|
+
* vibe.live").
|
|
22
|
+
*/
|
|
23
|
+
declare const SHARE_ORIGIN = "https://vibeshare.stream";
|
|
24
|
+
/** Path prefix for share links: `<origin>/s/<id>`. */
|
|
25
|
+
declare const SHARE_PATH_PREFIX = "/s/";
|
|
26
|
+
/**
|
|
27
|
+
* Mint an unguessable capability id. Uses the platform CSPRNG (`crypto.randomUUID`,
|
|
28
|
+
* 122 bits of entropy) so a link is a genuine capability — guessing it is
|
|
29
|
+
* infeasible, which is the whole basis of the access model.
|
|
30
|
+
*/
|
|
31
|
+
declare function newShareId(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Build the human-facing share URL for a capability id.
|
|
34
|
+
*
|
|
35
|
+
* The URL is for *display and parsing only* — opening it resolves to the
|
|
36
|
+
* vibeshare spectator view, which then connects to the host's local/LAN relay.
|
|
37
|
+
* The relay URL is carried out-of-band (printed next to the share URL by the CLI).
|
|
38
|
+
*/
|
|
39
|
+
declare function buildShareUrl(id: string, origin?: string): string;
|
|
40
|
+
/** Error thrown when a string cannot be parsed as a vibeshare share URL. */
|
|
41
|
+
declare class ShareUrlParseError extends Error {
|
|
42
|
+
constructor(message: string);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse a vibeshare share URL (or bare `/s/<id>` path) back into its capability id.
|
|
46
|
+
*
|
|
47
|
+
* Accepts:
|
|
48
|
+
* - full URLs: `https://vibeshare.stream/s/<id>`, `http://...`, with or without
|
|
49
|
+
* a trailing slash or query string;
|
|
50
|
+
* - bare paths: `/s/<id>`;
|
|
51
|
+
* - any origin host (we key off the `/s/` segment, not the host, so self-hosted
|
|
52
|
+
* / vanity domains round-trip too).
|
|
53
|
+
*
|
|
54
|
+
* Pure and total: throws {@link ShareUrlParseError} on input with no `/s/` segment.
|
|
55
|
+
* Round-trips {@link buildShareUrl}: `parseShareUrl(buildShareUrl(id)).id === id`.
|
|
56
|
+
*/
|
|
57
|
+
declare function parseShareUrl(url: string): {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { SHARE_ORIGIN, SHARE_PATH_PREFIX, ShareUrlParseError, VERSION, buildShareUrl, newShareId, parseShareUrl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConsentError,
|
|
3
|
+
DEFAULT_ACCESS,
|
|
4
|
+
HOST_PARTICIPANT_NAME,
|
|
5
|
+
SHARE_ORIGIN,
|
|
6
|
+
SHARE_PATH_PREFIX,
|
|
7
|
+
SHARE_SESSION_SCOPE,
|
|
8
|
+
ShareUrlParseError,
|
|
9
|
+
VERSION,
|
|
10
|
+
buildShareUrl,
|
|
11
|
+
createAccessGate,
|
|
12
|
+
createShare,
|
|
13
|
+
newShareId,
|
|
14
|
+
parseExpiry,
|
|
15
|
+
parseShareUrl
|
|
16
|
+
} from "./chunk-5OLI3WTU.js";
|
|
17
|
+
export {
|
|
18
|
+
ConsentError,
|
|
19
|
+
DEFAULT_ACCESS,
|
|
20
|
+
HOST_PARTICIPANT_NAME,
|
|
21
|
+
SHARE_ORIGIN,
|
|
22
|
+
SHARE_PATH_PREFIX,
|
|
23
|
+
SHARE_SESSION_SCOPE,
|
|
24
|
+
ShareUrlParseError,
|
|
25
|
+
VERSION,
|
|
26
|
+
buildShareUrl,
|
|
27
|
+
createAccessGate,
|
|
28
|
+
createShare,
|
|
29
|
+
newShareId,
|
|
30
|
+
parseExpiry,
|
|
31
|
+
parseShareUrl
|
|
32
|
+
};
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { RelayHandle } from 'vibelive-cli';
|
|
3
|
+
import { e as ShareHandle } from './share-CoX608sF.js';
|
|
4
|
+
import '@pooriaarab/vibe-core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* vibeshare MCP server (stdio). Exposes two tools an agent can call:
|
|
8
|
+
*
|
|
9
|
+
* - create_share — host a vibelive session wrapping a command, mint a share URL
|
|
10
|
+
* with an access policy (+ optional expiry/passphrase), and
|
|
11
|
+
* return the capability URL + relay URL. Lives for the MCP
|
|
12
|
+
* process lifetime (or until the wrapped agent exits).
|
|
13
|
+
* - viewers — list active shares and their viewer rosters (connected
|
|
14
|
+
* spectators/participants + pending join requests).
|
|
15
|
+
*
|
|
16
|
+
* Uses the high-level `McpServer` API from `@modelcontextprotocol/sdk`. Input
|
|
17
|
+
* schemas are Zod raw shapes (the SDK's expected form); zod is a transitive
|
|
18
|
+
* dependency of the SDK and gets bundled into dist/mcp.js by tsup.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface ActiveShare {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly url: string;
|
|
24
|
+
readonly relayUrl: string;
|
|
25
|
+
readonly access: string;
|
|
26
|
+
readonly command: readonly string[];
|
|
27
|
+
readonly share: ShareHandle;
|
|
28
|
+
readonly relay: RelayHandle;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the vibeshare MCP server (tools registered, not yet connected).
|
|
32
|
+
*
|
|
33
|
+
* `sessions` defaults to a fresh module-level map so independent `createMcpServer`
|
|
34
|
+
* calls don't share state, but a single stdio process keeps one map for its
|
|
35
|
+
* lifetime (so `viewers` sees shares started via `create_share`).
|
|
36
|
+
*/
|
|
37
|
+
declare function createMcpServer(sessions?: Map<string, ActiveShare>): McpServer;
|
|
38
|
+
/** Create the server, wire it to stdio, and run until the client disconnects. */
|
|
39
|
+
declare function runMcpStdio(): Promise<void>;
|
|
40
|
+
|
|
41
|
+
export { createMcpServer, runMcpStdio };
|