🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ixo/oracles-events

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ixo/oracles-events - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+3
dist/events/reasoning-event/index.d.ts
export { ReasoningEvent } from './reasoning-event';
export type { IReasoningEvent } from './types';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/reasoning-event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReasoningEvent = void 0;
var reasoning_event_1 = require("./reasoning-event");
Object.defineProperty(exports, "ReasoningEvent", { enumerable: true, get: function () { return reasoning_event_1.ReasoningEvent; } });
import { BaseEvent, type WithRequiredEventProps } from '../base-event/base-event';
import { IReasoningEvent } from './types';
export declare class ReasoningEvent extends BaseEvent<IReasoningEvent> {
static readonly eventName: "reasoning";
readonly eventName: "reasoning";
payload: WithRequiredEventProps<IReasoningEvent>;
constructor(payload: WithRequiredEventProps<IReasoningEvent>);
/**
* Append additional reasoning text to the current reasoning
*/
appendReasoning(reasoning: string): void;
/**
* Set the reasoning as complete
*/
markComplete(): void;
/**
* Create a new ReasoningEvent with updated reasoning
*/
static createChunk(sessionId: string, requestId: string, reasoning: string, reasoningDetails?: IReasoningEvent['reasoningDetails'], isComplete?: boolean): ReasoningEvent;
}
//# sourceMappingURL=reasoning-event.d.ts.map
{"version":3,"file":"reasoning-event.d.ts","sourceRoot":"","sources":["../../../src/events/reasoning-event/reasoning-event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAc,eAAe,EAAE,MAAM,SAAS,CAAC;AAEtD,qBAAa,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,gBAAyB,SAAS,cAAc;IAChD,QAAQ,CAAC,SAAS,cAA4B;IACvC,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC;gBAE5C,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC;IAc5D;;OAEG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/C;;OAEG;IACI,YAAY,IAAI,IAAI;IAI3B;;OAEG;WACW,WAAW,CACvB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,EACtD,UAAU,UAAQ,GACjB,cAAc;CAUlB"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReasoningEvent = void 0;
const base_event_1 = require("../base-event/base-event");
const types_1 = require("./types");
class ReasoningEvent extends base_event_1.BaseEvent {
static eventName = types_1.EVENT_NAME;
eventName = ReasoningEvent.eventName;
payload;
constructor(payload) {
super();
(0, base_event_1.shouldHaveSessionId)(payload);
// Validate specific payload properties
if (typeof payload.reasoning !== 'string') {
throw new TypeError('ReasoningEvent payload must include a reasoning string.');
}
this.payload = payload;
}
/**
* Append additional reasoning text to the current reasoning
*/
appendReasoning(reasoning) {
this.payload.reasoning += reasoning;
}
/**
* Set the reasoning as complete
*/
markComplete() {
this.payload.isComplete = true;
}
/**
* Create a new ReasoningEvent with updated reasoning
*/
static createChunk(sessionId, requestId, reasoning, reasoningDetails, isComplete = false) {
return new ReasoningEvent({
sessionId,
requestId,
reasoning,
reasoningDetails,
isComplete,
timestamp: new Date().toISOString(),
});
}
}
exports.ReasoningEvent = ReasoningEvent;
export interface IReasoningEvent {
/**
* The reasoning text content
*/
reasoning: string;
/**
* Detailed reasoning information
*/
reasoningDetails?: Array<{
type: string;
text: string;
}>;
/**
* Whether this is a complete reasoning or partial chunk
*/
isComplete?: boolean;
/**
* Timestamp when the reasoning was generated
*/
timestamp?: string;
}
export declare const EVENT_NAME: "reasoning";
//# sourceMappingURL=types.d.ts.map
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/events/reasoning-event/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IAEH;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,EAAG,WAAoB,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EVENT_NAME = void 0;
exports.EVENT_NAME = 'reasoning';
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"base-event.d.ts","sourceRoot":"","sources":["../../../src/events/base-event/base-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAG/D,eAAO,MAAM,mBAAmB,GAAI,CAAC,WAC1B,CAAC,KACT,sBAAsB,CAAC,CAAC,CAiB1B,CAAC;AAEF;;;GAGG;AACH,8BAAsB,SAAS,CAAC,CAAC;IAC/B,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAEpC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;;IAclC;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAC1B,MAAM,EAAE,MAAM,CAAC,g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AC;CAC3B,CAAC"}
export * from './base-event';
export * from './browser-tool-call';
export * from './message-cache-invalidation/message-cache-invalidation.event';
export * from './reasoning-event';
export * from './render-component/render-component.event';

@@ -5,0 +6,0 @@ export * from './router-event/router.event';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+DAA+D,CAAC;AAC9E,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+DAA+D,CAAC;AAC9E,cAAc,mBAAmB,CAAC;AAClC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}

@@ -20,2 +20,3 @@ "use strict";

__exportStar(require("./message-cache-invalidation/message-cache-invalidation.event"), exports);
__exportStar(require("./reasoning-event"), exports);
__exportStar(require("./render-component/render-component.event"), exports);

@@ -22,0 +23,0 @@ __exportStar(require("./router-event/router.event"), exports);

@@ -1,1 +0,1 @@

{"version":3,"file":"message-cache-invalidation.event.d.ts","sourceRoot":"","sources":["../../../src/events/message-cache-invalidation/message-cache-invalidation.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CAC/B;AAED,qBAAa,6BAA8B,SAAQ,SAAS,CAAC,yBAAyB,CAAC;IAE5E,OAAO,EAAE,sBAAsB,CAAC,yBAAyB,CAAC;gBAA1D,OAAO,EAAE,sBAAsB,CAAC,yBAAyB,CAAC;IAM5D,SAAS,SAAgC;IAEhD,MAAM,CAAC,SAAS,+BAAyC;CAC1D"}
{"version":3,"file":"message-cache-invalidation.event.d.ts","sourceRoot":"","sources":["../../../src/events/message-cache-invalidation/message-cache-invalidation.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CAC/B;AAED,qBAAa,6BAA8B,SAAQ,SAAS,CAAC,yBAAyB,CAAC;IAE5E,OAAO,EAAE,sBAAsB,CAAC,yBAAyB,CAAC;gBAA1D,OAAO,EAAE,sBAAsB,CAAC,yBAAyB,CAAC;IAM5D,SAAS,SAAgC;IAEhD,MAAM,CAAC,SAAS,EAAG,4BAA4B,CAAU;CAC1D"}

@@ -1,1 +0,1 @@

{"version":3,"file":"render-component.event.d.ts","sourceRoot":"","sources":["../../../src/events/render-component/render-component.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,qBAAqB,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/D,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oBAAoB,CAC/B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC/D,SAAQ,SAAS,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAA7D,OAAO,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAM/D,SAAS,SAAsB;IAEtC,MAAM,CAAC,SAAS,qBAA+B;CAChD"}
{"version":3,"file":"render-component.event.d.ts","sourceRoot":"","sources":["../../../src/events/render-component/render-component.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,qBAAqB,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/D,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oBAAoB,CAC/B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC/D,SAAQ,SAAS,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAA7D,OAAO,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAM/D,SAAS,SAAsB;IAEtC,MAAM,CAAC,SAAS,EAAG,kBAAkB,CAAU;CAChD"}

@@ -1,1 +0,1 @@

{"version":3,"file":"router.event.d.ts","sourceRoot":"","sources":["../../../src/events/router-event/router.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,YAAY,CAAC;IACnC,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC;gBAA7C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC;IAIzD,SAAS,SAAmB;IAEnC,MAAM,CAAC,SAAS,kBAA4B;IAErC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGtC"}
{"version":3,"file":"router.event.d.ts","sourceRoot":"","sources":["../../../src/events/router-event/router.event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,YAAY,CAAC;IACnC,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC;gBAA7C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC;IAIzD,SAAS,SAAmB;IAEnC,MAAM,CAAC,SAAS,EAAG,eAAe,CAAU;IAErC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGtC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/events/test-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,CAAC,OAAO,gBAAgB,EAAE,MAAM,CAAC,cAE/B,CAAC,WACJ,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAClC,OAeF,CAAC"}
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/events/test-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,CAAC,OAAO,gBAAgB,EAAE,MAAM,CAAC,EAE3C,YAAY,CAAC,EACb,SAAS,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAClC,OAeF,CAAC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/events/tool-call/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,UAAU,aAAuB,CAAC"}
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/events/tool-call/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,UAAU,EAAG,WAAoB,CAAC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"graph-event-emitter.d.ts","sourceRoot":"","sources":["../src/graph-event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAO/D,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,qBAAqB,CAC1B,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GACjD,IAAI;CAOR"}
{"version":3,"file":"graph-event-emitter.d.ts","sourceRoot":"","sources":["../src/graph-event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAW/D,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,qBAAqB,CAC1B,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GACjD,IAAI;CAQR"}

@@ -16,4 +16,5 @@ "use strict";

events_1.BrowserToolCallEvent.registerEventHandlers(server);
events_1.ReasoningEvent.registerEventHandlers(server);
}
}
exports.GraphEventEmitter = GraphEventEmitter;
import { type WithRequiredEventProps } from '../events/base-event/base-event';
import { BrowserToolCallEvent } from '../events/browser-tool-call/browser-tool-call.event';
import { MessageCacheInvalidationEvent } from '../events/message-cache-invalidation';
import { ReasoningEvent } from '../events/reasoning-event';
import { RenderComponentEvent } from '../events/render-component/render-component.event';

@@ -8,5 +9,6 @@ import { RouterEvent } from '../events/router-event/router.event';

import { type IBrowserToolCallEvent } from '../events/browser-tool-call/types';
import { type IReasoningEvent } from '../events/reasoning-event/types';
import { type IToolCallEvent } from '../events/tool-call/types';
export type AllEvents = RouterEvent | ToolCallEvent | RenderComponentEvent | MessageCacheInvalidationEvent | BrowserToolCallEvent;
export declare const AllEventsAsClass: (typeof BrowserToolCallEvent | typeof MessageCacheInvalidationEvent | typeof RenderComponentEvent | typeof RouterEvent | typeof ToolCallEvent)[];
export type AllEvents = RouterEvent | ToolCallEvent | RenderComponentEvent | MessageCacheInvalidationEvent | BrowserToolCallEvent | ReasoningEvent;
export declare const AllEventsAsClass: (typeof BrowserToolCallEvent | typeof MessageCacheInvalidationEvent | typeof ReasoningEvent | typeof RenderComponentEvent | typeof RouterEvent | typeof ToolCallEvent)[];
export type ToolCallEventPayload = WithRequiredEventProps<IToolCallEvent>;

@@ -26,2 +28,3 @@ export type RouterEventPayload = WithRequiredEventProps<{

export type BrowserToolCallEventPayload = WithRequiredEventProps<IBrowserToolCallEvent>;
export type ReasoningEventPayload = WithRequiredEventProps<IReasoningEvent>;
export type EventNames = {

@@ -33,6 +36,8 @@ ToolCall: ToolCallEvent['eventName'];

BrowserToolCall: BrowserToolCallEvent['eventName'];
Reasoning: ReasoningEvent['eventName'];
};
export type { WithRequiredEventProps } from '../events/base-event/base-event';
export type { IBrowserToolCallEvent } from '../events/browser-tool-call/types';
export type { IReasoningEvent } from '../events/reasoning-event/types';
export type { IToolCallEvent } from '../events/tool-call/types';
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAGpE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,6BAA6B,GAC7B,oBAAoB,CAAC;AACzB,eAAO,MAAM,gBAAgB,kJAM5B,CAAC;AAGF,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B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BAAsB,EAAE,MAAM,iCAAiC,CAAC;AAG9E,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}

@@ -6,2 +6,3 @@ "use strict";

const message_cache_invalidation_1 = require("../events/message-cache-invalidation");
const reasoning_event_1 = require("../events/reasoning-event");
const render_component_event_1 = require("../events/render-component/render-component.event");

@@ -16,2 +17,3 @@ const router_event_1 = require("../events/router-event/router.event");

browser_tool_call_event_1.BrowserToolCallEvent,
reasoning_event_1.ReasoningEvent,
];
{
"name": "@ixo/oracles-events",
"version": "1.0.1",
"version": "1.0.2",
"description": "Events for the IXO Oracles",

@@ -5,0 +5,0 @@ "private": false,

+414
-69
# `@ixo/oracles-events`
Real-time event system for the IXO Oracles Framework. Handles streaming communication between your oracle (server) and client applications via **Server-Sent Events (SSE)** and **WebSocket (WS)** connections.
**Table of Contents**
- [Overview](#overview)
- [When Should You Use an Event?](#when-should-you-use-an-event)
- [Communication Channels](#communication-channels)
- [Event Types](#event-types)
- [Installation](#installation)
- [Creating a New Event](#creating-a-new-event)
- [1. Extend the BaseEvent Class](#1-extend-the-baseevent-class)
- [2. Register the Event in GraphEventEmitter](#2-register-the-event-in-grapheventemitter)
- [3. Emit the Event](#3-emit-the-event)
- [Core Events](#core-events)
- [Advanced Usage](#advanced-usage)
- [Testing](#testing)

@@ -20,24 +20,106 @@ - [Contributing](#contributing)

The `@ixo/oracles-events` package provides a robust, event-driven system for real-time communication throughout the ixo Oracles platform. It uses a combination of `EventEmitter2` for internal event handling and `socket.io` for WebSocket-based client communication.
The `@ixo/oracles-events` package enables real-time communication between your oracle and client applications. While your LLM processes conversations using LangGraph, events stream live updates to clients showing tool execution, rendering custom UI components, and enabling browser-side interactions.
Key features:
**Key Features:**
- Type-safe event payloads with TypeScript
- Automatic WebSocket broadcasting to connected clients
- Required session tracking via `connectionId`, `sessionId`, and `requestId`
- Server-side only implementation (browser usage is prevented)
- **Dual Communication**: SSE for one-way streaming, WebSocket for bidirectional communication
- **Type-Safe Events**: Full TypeScript support with payload validation
- **Session Management**: Automatic session isolation and request tracking
- **Client Integration**: Seamless integration with `@ixo/oracles-client-sdk`
- **Browser Tools**: Reverse tool calls that execute in the user's browser
---
## When Should You Use an Event?
## Communication Channels
Events are ideal for:
### Server-Sent Events (SSE)
1. **Cross-Service Communication**: When different services need to react to changes or actions
2. **Real-time Updates**: Pushing updates to connected WebSocket clients
3. **Loose Coupling**: Keeping services independent while allowing them to interact
4. **State Change Notifications**: Broadcasting important state changes across the system
**Use Case**: One-way streaming from server to client
**Best For**: Tool call updates, component rendering, status notifications
**Endpoint**: `/sse/events?sessionId={sessionId}`
### WebSocket (WS)
**Use Case**: Bidirectional real-time communication
**Best For**: Browser tool calls, interactive features, immediate responses
**Implementation**: Socket.IO with session-based rooms
---
## Event Types
### 1. ToolCallEvent
**Purpose**: Notifies clients when LLM executes tools on the server
**Use Cases**: API calls, database queries, long-running operations
```typescript
// Start tool execution
new ToolCallEvent({
sessionId: 'user-session-123',
requestId: 'request-456',
toolName: 'get_weather',
args: { location: 'New York' },
status: 'isRunning',
}).emit();
// Tool completes
new ToolCallEvent({
sessionId: 'user-session-123',
requestId: 'request-456',
toolName: 'get_weather',
status: 'done',
output: 'Temperature: 72°F, Sunny',
}).emit();
```
### 2. RenderComponentEvent
**Purpose**: Instructs client to render custom UI components
**Use Cases**: Dynamic lists, charts, forms, interactive elements
```typescript
new RenderComponentEvent({
sessionId: 'user-session-123',
requestId: 'request-456',
componentName: 'ProductList',
args: {
products: [
{ name: 'Product A', price: 29.99 },
{ name: 'Product B', price: 39.99 },
],
},
status: 'done',
}).emit();
```
### 3. BrowserToolCallEvent
**Purpose**: Enables LLM to execute tools directly in user's browser
**Use Cases**: UI navigation, DOM manipulation, browser-specific operations
```typescript
// Server-side: Call browser tool
import { callBrowserTool } from '@ixo/common';
const result = await callBrowserTool({
sessionId: 'user-session-123',
toolCallId: 'tool-call-789',
toolName: 'navigateToPage',
args: { url: '/products' },
});
```
### 4. MessageCacheInvalidationEvent
**Purpose**: Notifies clients to refresh message cache
**Use Cases**: New messages, conversation state changes
### 5. RouterEvent
**Purpose**: Manages conversation flow and navigation state
**Use Cases**: Multi-step conversations, wizard flows
---
## Installation

@@ -53,43 +135,47 @@

### 1. Extend the BaseEvent Class
### 1. Define Event Interface & Class
Create a new event by extending `BaseEvent` with your payload type:
Create your event by extending `BaseEvent`:
```typescript
import { BaseEvent, WithRequiredEventProps } from '@ixo/oracles-events';
// src/events/my-custom-event/types.ts
export const EVENT_NAME = 'my_custom_event' as const;
interface IMyCustomEventPayload {
export interface IMyCustomEvent {
message: string;
// Add any custom payload properties
priority: 'high' | 'normal' | 'low';
metadata?: Record<string, any>;
}
```
export class MyCustomEvent extends BaseEvent<IMyCustomEventPayload> {
static readonly eventName = 'my.custom.event';
public readonly eventName = MyCustomEvent.eventName;
```typescript
// src/events/my-custom-event/my-custom-event.ts
import {
BaseEvent,
shouldHaveSessionId,
WithRequiredEventProps,
} from '../base-event/base-event';
import { EVENT_NAME, IMyCustomEvent } from './types';
constructor(public payload: WithRequiredEventProps<IMyCustomEventPayload>) {
export class MyCustomEvent extends BaseEvent<IMyCustomEvent> {
constructor(public payload: WithRequiredEventProps<IMyCustomEvent>) {
super();
shouldHaveSessionId(payload);
}
public eventName = EVENT_NAME;
static eventName = EVENT_NAME;
}
```
**Required Payload Properties**
Every event payload must include:
### 2. Register Event in GraphEventEmitter
- `connectionId`: Identifies the WebSocket connection
- `sessionId`: Identifies the chat session
- `requestId`: Identifies the specific request within a session
### 2. Register the Event in GraphEventEmitter
Register your event in `graph-event-emitter.ts`:
```typescript
import { Socket } from 'socket.io';
import { MyCustomEvent } from './events/my-custom.event';
// src/graph-event-emitter.ts
import { MyCustomEvent } from './events/my-custom-event/my-custom-event';
export class GraphEventEmitter {
static registerEventHandlers(server: Socket): void {
static registerEventHandlers(server: Server): void {
MyCustomEvent.registerEventHandlers(server);
// Register other events...
// ... other events
}

@@ -99,30 +185,230 @@ }

### 3. Emit the Event
### 3. Export Event
Emit your event from any server-side code:
```typescript
// src/events/index.ts
export { MyCustomEvent } from './my-custom-event/my-custom-event';
export type { IMyCustomEvent } from './my-custom-event/types';
```
### 4. Add to Types
```typescript
const event = new MyCustomEvent({
connectionId: 'ws-connection-id',
sessionId: 'chat-session-id',
requestId: 'message-request-id',
message: 'Hello from custom event!',
// src/types/index.ts
import type { MyCustomEvent } from '../events';
export type AllEvents =
| ToolCallEvent
| RenderComponentEvent
| BrowserToolCallEvent
| MessageCacheInvalidationEvent
| RouterEvent
| MyCustomEvent; // Add your event here
export type MyCustomEventPayload = WithRequiredEventProps<IMyCustomEvent>;
```
### 5. Emit Your Event
There are **two ways** to emit events depending on your use case:
#### Method 1: Standard Event Emission (Recommended)
**Use Case**: Standard event flow that automatically reaches clients via WebSocket
**How it works**: `event.emit()` → `rootEventEmitter` → `GraphEventEmitter` (if registered) → WebSocket clients
```typescript
// In your LangGraph node or service
import { ToolCallEvent } from '@ixo/oracles-events';
const event = new ToolCallEvent({
sessionId: 'user-session-123',
requestId: 'request-456',
toolName: 'get_weather',
args: { location: 'New York' },
status: 'isRunning',
});
// This follows the complete flow:
// 1. event.emit() → rootEventEmitter.emit(eventName, payload)
// 2. GraphEventEmitter (registered in ws.gateway.ts) listens to rootEventEmitter
// 3. Automatically broadcasts to WebSocket clients in the session
event.emit();
```
**Complete Event Flow**:
```
Your Code → event.emit() → rootEventEmitter → GraphEventEmitter → WebSocket Server → Client
```
**Registered Events**: `ToolCallEvent`, `RenderComponentEvent`, `BrowserToolCallEvent`, `MessageCacheInvalidationEvent`, `RouterEvent`
#### Method 2: Direct Service Emission
**Use Case**: Direct emission to specific communication channels
**How it works**: Bypass event system and emit directly to SSE/WebSocket services
```typescript
// Direct SSE emission (like in messages.service.ts)
import { SseService } from 'src/sse/sse.service';
@Injectable()
export class MyService {
constructor(private readonly sseService: SseService) {}
sendEventToClient(sessionId: string) {
const event = new MyCustomEvent({
sessionId,
requestId: 'request-456',
message: 'Direct emission',
priority: 'high',
});
// Direct emission to SSE clients
this.sseService.publishToSession(sessionId, event);
}
}
```
#### Method 3: Internal Communication
**Use Case**: Emit events back into the internal events system
**How it works**: Direct `rootEventEmitter` usage for service-to-service communication
```typescript
// Internal emission (like in ws.gateway.ts)
import { rootEventEmitter } from '@ixo/oracles-events';
// Emit back into the events system for internal processing
rootEventEmitter.emit('browser_tool_result', {
sessionId: 'user-session-123',
toolCallId: 'tool-123',
result: { success: true },
timestamp: new Date().toISOString(),
});
```
**When to use each method:**
- **Method 1**: Standard registered events that automatically reach WebSocket clients (ToolCallEvent, RenderComponentEvent, etc.)
- **Method 2**: Real-time streaming scenarios, direct SSE client communication
- **Method 3**: Internal service communication, responding to WebSocket events and triggering internal workflows
---
## Core Events
## 📊 Event Flow Diagram
The package includes several core events:
The following diagram shows the complete flow from your code to the client:
- **RouterEvent**: Navigation and routing state changes
- **ToolCallEvent**: Tool/microservice invocation tracking
- **RenderComponentEvent**: UI update instructions
- **MessageCacheInvalidationEvent**: Cache invalidation signals
```mermaid
graph LR
A["🧠 Your Code<br/>event.emit()"] --> B["📡 rootEventEmitter"]
B --> C["🎯 GraphEventEmitter<br/>(listens to rootEventEmitter)"]
C --> D["📱 WebSocket → Client"]
Each core event is designed for a specific use case and follows the same pattern as custom events.
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
style B fill:#fff3e0,stroke:#f57c00,stroke-width:2px
style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
style D fill:#fce4ec,stroke:#d81b60,stroke-width:2px
```
**How it works**:
1. You call `event.emit()` in your code
2. This triggers `rootEventEmitter` (internal event bus)
3. `GraphEventEmitter` listens to `rootEventEmitter` and forwards to WebSocket
4. Client receives the event automatically
**That's it!** Once `GraphEventEmitter` is registered in `ws.gateway.ts`, all events automatically reach clients.
### Event Status Management
Many events support status tracking:
```typescript
// Start long-running operation
new ToolCallEvent({
sessionId,
requestId,
toolName: 'complex_analysis',
status: 'isRunning',
}).emit();
// Update with progress (optional)
new ToolCallEvent({
sessionId,
requestId,
toolName: 'complex_analysis',
status: 'isRunning',
output: 'Progress: 50% complete',
}).emit();
// Complete operation
new ToolCallEvent({
sessionId,
requestId,
toolName: 'complex_analysis',
status: 'done',
output: 'Analysis complete: Found 25 insights',
}).emit();
```
### Event Chaining
Chain multiple events for complex workflows:
```typescript
// 1. Show tool execution
new ToolCallEvent({
sessionId,
requestId,
toolName: 'data_analysis',
status: 'isRunning',
}).emit();
// 2. Complete tool and render results
const data = await performAnalysis();
new ToolCallEvent({
sessionId,
requestId,
toolName: 'data_analysis',
status: 'done',
output: `Analyzed ${data.length} records`,
}).emit();
// 3. Render custom component with results
new RenderComponentEvent({
sessionId,
requestId,
componentName: 'AnalysisChart',
args: { data, chartType: 'bar' },
status: 'done',
}).emit();
```
### Required Payload Properties
Every event payload **must** include:
```typescript
interface RequiredEventProps {
sessionId: string; // Chat session identifier
requestId: string; // Request identifier (for tracking)
}
```
### Session and Request Management
```typescript
// Use consistent IDs for related events
const sessionId = 'user-session-123';
const requestId = 'message-request-456';
// Multiple events for the same request
new ToolCallEvent({ sessionId, requestId /* ... */ });
new RenderComponentEvent({ sessionId, requestId /* ... */ });
```
---

@@ -132,17 +418,57 @@

The package provides test utilities in `test-utils.ts` to help test event implementations:
### Basic Event Testing
```typescript
import { createTestEvent } from '@ixo/oracles-events/test-utils';
import { MyCustomEvent } from '../my-custom-event';
import { rootEventEmitter } from '../../root-event-emitter';
describe('MyCustomEvent', () => {
it('should emit with correct payload', () => {
const event = createTestEvent(MyCustomEvent, {
const payload = {
sessionId: 'test-session',
requestId: 'test-request',
message: 'test message',
});
// Add your test assertions
priority: 'high' as const,
};
const event = new MyCustomEvent(payload);
const emitSpy = jest.spyOn(rootEventEmitter, 'emit');
event.emit();
expect(emitSpy).toHaveBeenCalledWith(MyCustomEvent.eventName, payload);
});
it('should require sessionId', () => {
expect(() => {
new MyCustomEvent({
requestId: 'test-request',
message: 'test',
priority: 'normal',
} as any);
}).toThrow();
});
});
```
### Integration Testing
```typescript
import { createTestEvent } from '../test-utils';
it('should register event handlers correctly', () => {
const mockServer = {
on: jest.fn(),
emit: jest.fn(),
};
MyCustomEvent.registerEventHandlers(mockServer as any);
expect(mockServer.on).toHaveBeenCalledWith(
MyCustomEvent.eventName,
expect.any(Function),
);
});
```
---

@@ -152,18 +478,37 @@

To contribute:
### Event Naming Conventions
1. Ensure your event extends `BaseEvent`
2. Include proper TypeScript types for your payload
3. Add test coverage using the provided test utilities
4. Follow the existing pattern for event registration
5. Submit a PR with your changes
- Use snake_case: `tool_call`, `render_component`, `my_custom_event`
- Be descriptive: `user_preferences_updated` not `update`
- Include domain if needed: `payment_status_changed`
**Important Notes**:
### TypeScript Best Practices
- Events are server-side only
- Always include required payload properties
- Use semantic event names (e.g., 'domain.action.event')
- Always define interfaces for payload types
- Use `WithRequiredEventProps<T>` for constructor parameters
- Export both the event class and interface
- Add proper JSDoc comments
### Performance Considerations
- **Batch events** when possible instead of emitting many small events
- **Use appropriate channels**: SSE for notifications, WS for interactions
- **Validate payloads** before emission to catch errors early
- **Avoid large payloads**: Keep event data focused and minimal
### Security Guidelines
- **Validate all inputs** in event payloads
- **Sanitize user data** before including in events
- **Ensure session isolation** - events only go to correct sessions
- **Never include sensitive data** in event payloads
---
## Architecture Documentation
For comprehensive system architecture, event flows, and integration patterns, see [Events System Architecture](../../docs/architecture/events.md).
---
**Thank you for using `@ixo/oracles-events`!**