gambiarra 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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Participant management namespace
3
+ *
4
+ * Provides functions for creating and configuring participants.
5
+ * Participants are entities that can join rooms and contribute LLM capabilities.
6
+ */
7
+ export declare const participants: {
8
+ /** Create a new participant */
9
+ readonly create: (options: import("@gambiarra/core/participant").CreateParticipantOptions) => import("@gambiarra/core/types").ParticipantInfo;
10
+ /** Merge configuration with defaults */
11
+ readonly mergeConfig: (base: import("@gambiarra/core/types").GenerationConfig, overrides?: Partial<import("@gambiarra/core/types").GenerationConfig>) => import("@gambiarra/core/types").GenerationConfig;
12
+ };
13
+ //# sourceMappingURL=participants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participants.d.ts","sourceRoot":"","sources":["../src/participants.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB,+BAA+B;;IAG/B,wCAAwC;;CAEhC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type * from "@gambiarra/core/protocol";
2
+ export * from "@gambiarra/core/protocol";
3
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AACA,mBAAmB,0BAA0B,CAAC;AAC9C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
2
+ import type { ParticipantInfo } from "@gambiarra/core/types";
3
+ export interface GambiarraOptions {
4
+ hubUrl?: string;
5
+ roomCode: string;
6
+ }
7
+ export interface GambiarraModel {
8
+ id: string;
9
+ nickname: string;
10
+ model: string;
11
+ endpoint: string;
12
+ }
13
+ export interface GambiarraProvider {
14
+ /** Use a specific participant by ID */
15
+ participant: (id: string) => ReturnType<ReturnType<typeof createOpenAICompatible>>;
16
+ /** Use a specific model name (routes to first participant with that model) */
17
+ model: (name: string) => ReturnType<ReturnType<typeof createOpenAICompatible>>;
18
+ /** Use any available participant */
19
+ any: () => ReturnType<ReturnType<typeof createOpenAICompatible>>;
20
+ /** List all participants in the room */
21
+ listParticipants: () => Promise<ParticipantInfo[]>;
22
+ /** List available models (OpenAI-compatible format) */
23
+ listModels: () => Promise<GambiarraModel[]>;
24
+ /** Base URL for direct API access */
25
+ baseURL: string;
26
+ }
27
+ /**
28
+ * Create a Gambiarra provider for use with AI SDK.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * import { createGambiarra } from "@gambiarra/sdk";
33
+ * import { generateText } from "ai";
34
+ *
35
+ * const gambiarra = createGambiarra({ roomCode: "ABC123" });
36
+ *
37
+ * // Use any available participant
38
+ * const result = await generateText({
39
+ * model: gambiarra.any(),
40
+ * prompt: "Hello!",
41
+ * });
42
+ *
43
+ * // Use a specific participant
44
+ * const result2 = await generateText({
45
+ * model: gambiarra.participant("participant-id"),
46
+ * prompt: "Hello!",
47
+ * });
48
+ *
49
+ * // Use a specific model type
50
+ * const result3 = await generateText({
51
+ * model: gambiarra.model("llama3"),
52
+ * prompt: "Hello!",
53
+ * });
54
+ * ```
55
+ */
56
+ export declare function createGambiarra(options: GambiarraOptions): GambiarraProvider;
57
+ export type { ParticipantInfo } from "@gambiarra/core/types";
58
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqBD,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,WAAW,EAAE,CACX,EAAE,EAAE,MAAM,KACP,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,KAAK,EAAE,CACL,IAAI,EAAE,MAAM,KACT,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;IAC3D,oCAAoC;IACpC,GAAG,EAAE,MAAM,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;IACjE,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACnD,uDAAuD;IACvD,UAAU,EAAE,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5C,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,iBAAiB,CA6C5E;AAGD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Room management namespace
3
+ *
4
+ * Provides functions for creating, managing, and querying rooms.
5
+ * Rooms are the core organizational unit in Gambiarra, containing participants
6
+ * and managing their lifecycle.
7
+ */
8
+ export declare const rooms: {
9
+ /** Create a new room */
10
+ readonly create: (name: string, hostId: string) => import("@gambiarra/core/types").RoomInfo;
11
+ /** Get room by ID */
12
+ readonly get: (id: string) => import("@gambiarra/core/types").RoomInfo | undefined;
13
+ /** Get room by code (case-insensitive) */
14
+ readonly getByCode: (code: string) => import("@gambiarra/core/types").RoomInfo | undefined;
15
+ /** List all rooms */
16
+ readonly list: () => import("@gambiarra/core/types").RoomInfo[];
17
+ /** List all rooms with participant count */
18
+ readonly listWithParticipantCount: () => (import("@gambiarra/core/types").RoomInfo & {
19
+ participantCount: number;
20
+ })[];
21
+ /** Remove a room */
22
+ readonly remove: (id: string) => boolean;
23
+ /** Add a participant to a room */
24
+ readonly addParticipant: (roomId: string, participant: import("@gambiarra/core/types").ParticipantInfo) => boolean;
25
+ /** Remove a participant from a room */
26
+ readonly removeParticipant: (roomId: string, participantId: string) => boolean;
27
+ /** Get all participants in a room */
28
+ readonly getParticipants: (roomId: string) => import("@gambiarra/core/types").ParticipantInfo[];
29
+ /** Get a specific participant in a room */
30
+ readonly getParticipant: (roomId: string, participantId: string) => import("@gambiarra/core/types").ParticipantInfo | undefined;
31
+ /** Update participant status */
32
+ readonly updateParticipantStatus: (roomId: string, participantId: string, status: import("@gambiarra/core/types").ParticipantInfo["status"]) => boolean;
33
+ /** Update participant's last seen timestamp */
34
+ readonly updateLastSeen: (roomId: string, participantId: string) => boolean;
35
+ /** Find online participant by model name */
36
+ readonly findParticipantByModel: (roomId: string, model: string) => import("@gambiarra/core/types").ParticipantInfo | undefined;
37
+ /** Get random online participant from room */
38
+ readonly getRandomOnlineParticipant: (roomId: string) => import("@gambiarra/core/types").ParticipantInfo | undefined;
39
+ /** Check for stale participants and mark them offline */
40
+ readonly checkStaleParticipants: () => {
41
+ roomId: string;
42
+ participantId: string;
43
+ }[];
44
+ /** Clear all rooms (useful for testing) */
45
+ readonly clear: () => void;
46
+ };
47
+ //# sourceMappingURL=rooms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../src/rooms.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;IAChB,wBAAwB;;IAGxB,qBAAqB;;IAGrB,0CAA0C;;IAG1C,qBAAqB;;IAGrB,4CAA4C;;;;IAG5C,oBAAoB;;IAGpB,kCAAkC;;IAGlC,uCAAuC;;IAGvC,qCAAqC;;IAGrC,2CAA2C;;IAG3C,gCAAgC;;IAGhC,+CAA+C;;IAG/C,4CAA4C;;IAG5C,8CAA8C;;IAG9C,yDAAyD;;;;;IAGzD,2CAA2C;;CAEnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { ChatCompletion, ChatCompletionChunk, ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam, GenerationConfig, HubConfig, LlmMetrics, MachineSpecs, Model, ModelDeleted, NetworkConfig, OllamaConfig, ParticipantInfo, ParticipantStatus, RoomInfo, } from "@gambiarra/core/types";
2
+ export { GenerationConfig as GenerationConfigSchema, HEALTH_CHECK_INTERVAL, HubConfig as HubConfigSchema, LlmMetrics as LlmMetricsSchema, MachineSpecs as MachineSpecsSchema, NetworkConfig as NetworkConfigSchema, OllamaConfig as OllamaConfigSchema, PARTICIPANT_TIMEOUT, ParticipantInfo as ParticipantInfoSchema, ParticipantStatus as ParticipantStatusSchema, RoomInfo as RoomInfoSchema, } from "@gambiarra/core/types";
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,gBAAgB,IAAI,sBAAsB,EAC1C,qBAAqB,EACrB,SAAS,IAAI,eAAe,EAC5B,UAAU,IAAI,gBAAgB,EAC9B,YAAY,IAAI,kBAAkB,EAClC,aAAa,IAAI,mBAAmB,EACpC,YAAY,IAAI,kBAAkB,EAClC,mBAAmB,EACnB,eAAe,IAAI,qBAAqB,EACxC,iBAAiB,IAAI,uBAAuB,EAC5C,QAAQ,IAAI,cAAc,GAC3B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LOGO, LOGO_COMPACT, printLogo } from "@gambiarra/core/logo";
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "gambiarra",
3
+ "version": "0.1.0",
4
+ "description": "Share local LLMs across your network, effortlessly",
5
+ "keywords": [
6
+ "llm",
7
+ "ollama",
8
+ "ai",
9
+ "vercel-ai-sdk",
10
+ "local-ai",
11
+ "local-llm",
12
+ "machine-learning",
13
+ "lm-studio",
14
+ "localai"
15
+ ],
16
+ "author": "Arthur BM",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/arthurbm/gambiarra.git",
21
+ "directory": "packages/sdk"
22
+ },
23
+ "homepage": "https://github.com/arthurbm/gambiarra",
24
+ "bugs": "https://github.com/arthurbm/gambiarra/issues",
25
+ "type": "module",
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "build": "bun run build.ts",
40
+ "prepublishOnly": "bun run build",
41
+ "check-types": "tsc --noEmit"
42
+ },
43
+ "dependencies": {
44
+ "@ai-sdk/openai-compatible": "^2.0.2",
45
+ "zod": "^4.3.5"
46
+ },
47
+ "peerDependencies": {
48
+ "ai": "^4 || ^5 || ^6",
49
+ "typescript": "^5"
50
+ },
51
+ "devDependencies": {
52
+ "@ai-sdk/provider": "^3.0.1",
53
+ "@types/bun": "latest",
54
+ "ai": "^6.0.6"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ }
59
+ }