@pellux/goodvibes-transport-core 0.18.3

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/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @pellux/goodvibes-transport-core
2
+
3
+ Shared client transport and event-feed primitives used by the GoodVibes SDK packages.
4
+
5
+ Install:
6
+
7
+ ```bash
8
+ npm install @pellux/goodvibes-transport-core
9
+ ```
10
+
11
+ Use this package only when you are composing your own transport/client abstraction.
12
+
13
+ Exports include:
14
+ - event envelope helpers
15
+ - runtime event feed primitives
16
+ - generic client transport helpers
17
+
18
+ Most consumers should use `@pellux/goodvibes-sdk`, `@pellux/goodvibes-operator-sdk`, or `@pellux/goodvibes-peer-sdk` instead.
@@ -0,0 +1,9 @@
1
+ export interface ClientTransport<TKind extends string, TOperator, TPeer> {
2
+ readonly kind: TKind;
3
+ readonly operator: TOperator;
4
+ readonly peer: TPeer;
5
+ getOperatorClient(): TOperator;
6
+ getPeerClient(): TPeer;
7
+ }
8
+ export declare function createClientTransport<TKind extends string, TOperator, TPeer>(kind: TKind, operator: TOperator, peer: TPeer): ClientTransport<TKind, TOperator, TPeer>;
9
+ //# sourceMappingURL=client-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-transport.d.ts","sourceRoot":"","sources":["../src/client-transport.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe,CAAC,KAAK,SAAS,MAAM,EAAE,SAAS,EAAE,KAAK;IACrE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,iBAAiB,IAAI,SAAS,CAAC;IAC/B,aAAa,IAAI,KAAK,CAAC;CACxB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,EAAE,SAAS,EAAE,KAAK,EAC1E,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,KAAK,GACV,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAY1C"}
@@ -0,0 +1,13 @@
1
+ export function createClientTransport(kind, operator, peer) {
2
+ return Object.freeze({
3
+ kind,
4
+ operator,
5
+ peer,
6
+ getOperatorClient() {
7
+ return operator;
8
+ },
9
+ getPeerClient() {
10
+ return peer;
11
+ },
12
+ });
13
+ }
@@ -0,0 +1,21 @@
1
+ export interface EventEnvelope<TType extends string, TPayload> {
2
+ readonly type: TType;
3
+ readonly ts: number;
4
+ readonly traceId: string;
5
+ readonly sessionId: string;
6
+ readonly turnId?: string;
7
+ readonly agentId?: string;
8
+ readonly taskId?: string;
9
+ readonly source: string;
10
+ readonly payload: TPayload;
11
+ }
12
+ export interface EventEnvelopeContext {
13
+ readonly sessionId: string;
14
+ readonly source: string;
15
+ readonly traceId?: string;
16
+ readonly turnId?: string;
17
+ readonly agentId?: string;
18
+ readonly taskId?: string;
19
+ }
20
+ export declare function createEventEnvelope<TType extends string, TPayload>(type: TType, payload: TPayload, context: EventEnvelopeContext): EventEnvelope<TType, TPayload>;
21
+ //# sourceMappingURL=event-envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ;IAC3D,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAMD,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,EAChE,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAYhC"}
@@ -0,0 +1,16 @@
1
+ function generateTraceId() {
2
+ return crypto.randomUUID();
3
+ }
4
+ export function createEventEnvelope(type, payload, context) {
5
+ return Object.freeze({
6
+ type,
7
+ ts: Date.now(),
8
+ traceId: context.traceId ?? generateTraceId(),
9
+ sessionId: context.sessionId,
10
+ turnId: context.turnId,
11
+ agentId: context.agentId,
12
+ taskId: context.taskId,
13
+ source: context.source,
14
+ payload,
15
+ });
16
+ }
@@ -0,0 +1,22 @@
1
+ import type { EventEnvelope } from './event-envelope.js';
2
+ type EventLike = {
3
+ readonly type: string;
4
+ };
5
+ type EventForType<TEvent extends EventLike, TType extends TEvent['type']> = Extract<TEvent, {
6
+ type: TType;
7
+ }>;
8
+ export interface RuntimeEventFeed<TEvent extends EventLike = EventLike> {
9
+ on<TType extends TEvent['type']>(type: TType, listener: (payload: EventForType<TEvent, TType>) => void): () => void;
10
+ onEnvelope<TType extends TEvent['type']>(type: TType, listener: (envelope: EventEnvelope<TType, EventForType<TEvent, TType>>) => void): () => void;
11
+ }
12
+ export type RuntimeEventFeeds<TDomain extends string, TEvent extends EventLike = EventLike> = {
13
+ readonly domains: readonly TDomain[];
14
+ domain(domain: TDomain): RuntimeEventFeed<TEvent>;
15
+ } & {
16
+ readonly [K in TDomain]: RuntimeEventFeed<TEvent>;
17
+ };
18
+ export type EnvelopeSubscriber<TEvent extends EventLike> = <TType extends TEvent['type']>(type: TType, listener: (envelope: EventEnvelope<TType, EventForType<TEvent, TType>>) => void) => () => void;
19
+ export declare function createRuntimeEventFeed<TEvent extends EventLike>(subscribe: EnvelopeSubscriber<TEvent>): RuntimeEventFeed<TEvent>;
20
+ export declare function createRuntimeEventFeeds<TDomain extends string, TEvent extends EventLike>(domains: readonly TDomain[], createFeed: (domain: TDomain) => RuntimeEventFeed<TEvent>): RuntimeEventFeeds<TDomain, TEvent>;
21
+ export {};
22
+ //# sourceMappingURL=event-feeds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-feeds.d.ts","sourceRoot":"","sources":["../src/event-feeds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,KAAK,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KAAK,YAAY,CACf,MAAM,SAAS,SAAS,EACxB,KAAK,SAAS,MAAM,CAAC,MAAM,CAAC,IAC1B,OAAO,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAErC,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,SAAS,GAAG,SAAS;IACpE,EAAE,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,GACvD,MAAM,IAAI,CAAC;IACd,UAAU,CAAC,KAAK,SAAS,MAAM,CAAC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 listener(envelope.payload);
6
+ });
7
+ },
8
+ onEnvelope(type, listener) {
9
+ return subscribe(type, listener);
10
+ },
11
+ };
12
+ }
13
+ export function createRuntimeEventFeeds(domains, createFeed) {
14
+ const feeds = {};
15
+ for (const domain of domains) {
16
+ feeds[domain] = createFeed(domain);
17
+ }
18
+ return Object.freeze({
19
+ ...feeds,
20
+ domains,
21
+ domain(domain) {
22
+ return feeds[domain];
23
+ },
24
+ });
25
+ }
@@ -0,0 +1,7 @@
1
+ export type { EventEnvelope, EventEnvelopeContext } from './event-envelope.js';
2
+ export { createEventEnvelope } from './event-envelope.js';
3
+ export type { RuntimeEventFeed, RuntimeEventFeeds, EnvelopeSubscriber } from './event-feeds.js';
4
+ export { createRuntimeEventFeed, createRuntimeEventFeeds } from './event-feeds.js';
5
+ export type { ClientTransport } from './client-transport.js';
6
+ export { createClientTransport } from './client-transport.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACnF,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { createEventEnvelope } from './event-envelope.js';
2
+ export { createRuntimeEventFeed, createRuntimeEventFeeds } from './event-feeds.js';
3
+ export { createClientTransport } from './client-transport.js';
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@pellux/goodvibes-transport-core",
3
+ "version": "0.18.3",
4
+ "description": "Shared GoodVibes client transport primitives for direct, HTTP, and realtime integrations.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "sideEffects": false,
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/mgd34msu/goodvibes-sdk.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/mgd34msu/goodvibes-sdk/issues"
26
+ },
27
+ "homepage": "https://github.com/mgd34msu/goodvibes-sdk",
28
+ "keywords": [
29
+ "goodvibes",
30
+ "sdk",
31
+ "transport",
32
+ "events",
33
+ "client"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }