@assistant-ui/eve 0.0.17 → 0.0.19

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.
@@ -1,20 +1,19 @@
1
- import { AppendMessage, RespondToToolApprovalOptions, ThreadMessage } from "@assistant-ui/core";
2
- import { EveAuthorizationOutcome, EveAuthorizationPart, EveMessage, EveMessageData, EveMessageInputRequest } from "eve/react";
3
- import { InputResponse } from "eve/client";
4
- //#region src/convertEveMessages.d.ts
5
- type ConvertEveMessagesOptions = {
6
- /**
7
- * Marks the last assistant message as running while Eve is submitting or
8
- * streaming. When omitted, a message carrying Eve's `"streaming"` marker is
9
- * treated as running; pass `false` to settle interrupted messages to a
10
- * terminal status.
11
- */
12
- readonly isRunning?: boolean | undefined;
13
- /**
14
- * The Eve session error, mapped onto the assistant message it interrupted.
15
- */
16
- readonly error?: unknown;
17
- readonly getCreatedAt?: ((message: EveMessage) => Date) | undefined;
1
+ import { type AppendMessage, type RespondToToolApprovalOptions, type ThreadMessage } from "@assistant-ui/core";
2
+ import type { EveAuthorizationOutcome, EveAuthorizationPart, EveMessage, EveMessageData, EveMessageInputRequest } from "eve/react";
3
+ import type { InputResponse } from "eve/client";
4
+ export type ConvertEveMessagesOptions = {
5
+ /**
6
+ * Marks the last assistant message as running while Eve is submitting or
7
+ * streaming. When omitted, a message carrying Eve's `"streaming"` marker is
8
+ * treated as running; pass `false` to settle interrupted messages to a
9
+ * terminal status.
10
+ */
11
+ readonly isRunning?: boolean | undefined;
12
+ /**
13
+ * The Eve session error, mapped onto the assistant message it interrupted.
14
+ */
15
+ readonly error?: unknown;
16
+ readonly getCreatedAt?: ((message: EveMessage) => Date) | undefined;
18
17
  };
19
18
  /**
20
19
  * Payload of the `authorization` data part the Eve runtime emits for a
@@ -27,50 +26,50 @@ type ConvertEveMessagesOptions = {
27
26
  * one part it renders, in Eve's own step order, so display never has to
28
27
  * re-identify a challenge among several.
29
28
  */
30
- type EveAuthorizationData = {
31
- readonly state: EveAuthorizationPart["state"];
32
- readonly name: string;
33
- readonly displayName?: string;
34
- readonly description?: string;
35
- readonly url?: string;
36
- readonly userCode?: string;
37
- readonly instructions?: string;
38
- readonly expiresAt?: string;
39
- readonly outcome?: EveAuthorizationOutcome;
40
- readonly reason?: string;
29
+ export type EveAuthorizationData = {
30
+ readonly state: EveAuthorizationPart["state"];
31
+ readonly name: string;
32
+ readonly displayName?: string;
33
+ readonly description?: string;
34
+ readonly url?: string;
35
+ readonly userCode?: string;
36
+ readonly instructions?: string;
37
+ readonly expiresAt?: string;
38
+ readonly outcome?: EveAuthorizationOutcome;
39
+ readonly reason?: string;
41
40
  };
42
41
  /**
43
42
  * Converts a single Eve message into an assistant-ui thread message.
44
43
  */
45
- declare const convertEveMessage: (message: EveMessage, index: number, messages: readonly EveMessage[], options?: ConvertEveMessagesOptions) => ThreadMessage;
44
+ export declare const convertEveMessage: (message: EveMessage, index: number, messages: readonly EveMessage[], options?: ConvertEveMessagesOptions) => ThreadMessage;
46
45
  /**
47
46
  * Converts the full Eve message data object into assistant-ui thread messages.
48
47
  */
49
- declare const convertEveMessages: (data: EveMessageData, options?: ConvertEveMessagesOptions) => ThreadMessage[];
48
+ export declare const convertEveMessages: (data: EveMessageData, options?: ConvertEveMessagesOptions) => ThreadMessage[];
50
49
  /**
51
50
  * Structural subset of the `string | UserContent` message content Eve's `send`
52
51
  * API accepts. The helpers declare the shapes they produce and leave
53
52
  * assignability to the send call site, checked against the installed version.
54
53
  */
55
- type EveMessageContent = string | ({
56
- readonly type: "text";
57
- readonly text: string;
54
+ export type EveMessageContent = string | ({
55
+ readonly type: "text";
56
+ readonly text: string;
58
57
  } | {
59
- readonly type: "file";
60
- readonly data: string;
61
- readonly mediaType: string;
62
- readonly filename?: string;
58
+ readonly type: "file";
59
+ readonly data: string;
60
+ readonly mediaType: string;
61
+ readonly filename?: string;
63
62
  })[];
64
63
  /**
65
64
  * Converts an assistant-ui append message into the message payload accepted by
66
65
  * Eve's `send` API.
67
66
  */
68
- declare const getEveMessageContent: (message: AppendMessage) => EveMessageContent;
67
+ export declare const getEveMessageContent: (message: AppendMessage) => EveMessageContent;
69
68
  /**
70
69
  * Finds the pending input request answered by the given approval id, so the
71
70
  * response mapping can honor the request's display mode.
72
71
  */
73
- declare const findEveInputRequest: (data: EveMessageData, approvalId: string) => EveMessageInputRequest | undefined;
72
+ export declare const findEveInputRequest: (data: EveMessageData, approvalId: string) => EveMessageInputRequest | undefined;
74
73
  /**
75
74
  * Converts an assistant-ui tool approval response into an Eve input response.
76
75
  *
@@ -96,7 +95,5 @@ declare const findEveInputRequest: (data: EveMessageData, approvalId: string) =>
96
95
  * a display mode is what this mapper stopped doing; an unknown request is not
97
96
  * a guess about one.
98
97
  */
99
- declare const toEveInputResponse: (response: RespondToToolApprovalOptions, inputRequest?: EveMessageInputRequest) => InputResponse;
100
- //#endregion
101
- export { ConvertEveMessagesOptions, EveAuthorizationData, EveMessageContent, convertEveMessage, convertEveMessages, findEveInputRequest, getEveMessageContent, toEveInputResponse };
98
+ export declare const toEveInputResponse: (response: RespondToToolApprovalOptions, inputRequest?: EveMessageInputRequest) => InputResponse;
102
99
  //# sourceMappingURL=convertEveMessages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertEveMessages.d.ts","names":[],"sources":["../src/convertEveMessages.ts"],"mappings":";;;;KAqDY;;;;;;;WAOD;;;;WAIA;WACA,iBAAiB,SAAS,eAAe;;;;;;;;;;;;;KA0PxC;WACD,OAAO;WACP;WACA;WACA;WACA;WACA;WACA;WACA;WACA,UAAU;WACV;;;;;cA6IE,oBACX,SAAS,YACT,eACA,mBAAmB,cACnB,UAAS,8BACR;;;;cAuCU,qBACX,MAAM,gBACN,UAAS,8BACR;;;;;;KAUS;WAGO;WAAuB;;WAEvB;WACA;WACA;WACA;;;;;;cAQN,uBACX,SAAS,kBACR;;;;;cAuEU,sBACX,MAAM,gBACN,uBACC;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCU,qBAC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1B,CAAC;AAyIF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,UAAU,EACnB,OAAO,MAAM,EACb,UAAU,SAAS,UAAU,EAAE,EAC/B,UAAS,yBAA8B,KACtC,aAkCF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,cAAc,EACpB,UAAS,yBAA8B,KACtC,aAAa,EAGb,CAAC;AAEJ;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,CACI;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CACJ,EAAE,CAAC;AAER;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,aAAa,KACrB,iBAiEF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,cAAc,EACpB,YAAY,MAAM,KACjB,sBAAsB,GAAG,SAS3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,4BAA4B,EACtC,eAAe,sBAAsB,KACpC,aAyDF,CAAC"}
@@ -1,14 +1,13 @@
1
- import { MessageStreamEvent } from "eve/client";
2
- //#region src/deriveCreatedAt.d.ts
3
- type TurnTimestamps = {
4
- readonly user?: Date;
5
- readonly assistant?: Date;
1
+ import type { MessageStreamEvent } from "eve/client";
2
+ export type TurnTimestamps = {
3
+ readonly user?: Date;
4
+ readonly assistant?: Date;
6
5
  };
7
- type TurnTimestampCache = {
8
- lastEvents: readonly MessageStreamEvent[];
9
- timestamps: ReadonlyMap<string, TurnTimestamps>;
6
+ export type TurnTimestampCache = {
7
+ lastEvents: readonly MessageStreamEvent[];
8
+ timestamps: ReadonlyMap<string, TurnTimestamps>;
10
9
  };
11
- declare const createTurnTimestampCache: () => TurnTimestampCache;
10
+ export declare const createTurnTimestampCache: () => TurnTimestampCache;
12
11
  /**
13
12
  * Eve appends to its log (`[...events, event]`), so a snapshot that keeps the
14
13
  * previous scan's last element by identity shares the whole prefix and the
@@ -17,7 +16,5 @@ declare const createTurnTimestampCache: () => TurnTimestampCache;
17
16
  * must not outlive the log that produced them. Re-derivation is also what
18
17
  * makes the render-phase cache writes safe when React discards a render.
19
18
  */
20
- declare const collectTurnTimestamps: (events: readonly MessageStreamEvent[], cache: TurnTimestampCache) => ReadonlyMap<string, TurnTimestamps>;
21
- //#endregion
22
- export { TurnTimestampCache, TurnTimestamps, collectTurnTimestamps, createTurnTimestampCache };
19
+ export declare const collectTurnTimestamps: (events: readonly MessageStreamEvent[], cache: TurnTimestampCache) => ReadonlyMap<string, TurnTimestamps>;
23
20
  //# sourceMappingURL=deriveCreatedAt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deriveCreatedAt.d.ts","names":[],"sources":["../src/deriveCreatedAt.ts"],"mappings":";;KAEY;WACD,OAAO;WACP,YAAY;;KAGX;EACV,qBAAqB;EACrB,YAAY,oBAAoB;;cAiCrB,gCAA+B;;;;;;;;;cAa/B,wBACX,iBAAiB,sBACjB,OAAO,uBACN,oBAAoB"}
1
+ {"version":3,"file":"deriveCreatedAt.d.ts","sourceRoot":"","sources":["../src/deriveCreatedAt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC1C,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACjD,CAAC;AAgCF,eAAO,MAAM,wBAAwB,QAAO,kBAG1C,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,SAAS,kBAAkB,EAAE,EACrC,OAAO,kBAAkB,KACxB,WAAW,CAAC,MAAM,EAAE,cAAc,CA0CpC,CAAC"}
@@ -50,6 +50,7 @@ const collectTurnTimestamps = (events, cache) => {
50
50
  }
51
51
  for (let i = resumesScan ? scanned.length : 0; i < events.length; i++) {
52
52
  const event = events[i];
53
+ if (!Object.prototype.hasOwnProperty.call(ROLE_BY_EVENT_TYPE, event.type)) continue;
53
54
  const role = ROLE_BY_EVENT_TYPE[event.type];
54
55
  if (role === void 0) continue;
55
56
  const data = event.data;
@@ -1 +1 @@
1
- {"version":3,"file":"deriveCreatedAt.js","names":[],"sources":["../src/deriveCreatedAt.ts"],"sourcesContent":["import type { MessageStreamEvent } from \"eve/client\";\n\nexport type TurnTimestamps = {\n readonly user?: Date;\n readonly assistant?: Date;\n};\n\nexport type TurnTimestampCache = {\n lastEvents: readonly MessageStreamEvent[];\n timestamps: ReadonlyMap<string, TurnTimestamps>;\n};\n\n/**\n * The reducer cases eve projects into a message: `message.received` creates\n * `${turnId}:user`, and every assistant entry reaches `updateAssistantMessage`,\n * which creates `${turnId}:assistant` for a turn that has none. It enumerates\n * that reducer across the `>=0.32.0` peer range rather than stating a rule\n * about turn ids, because `turn.started` and the compaction events carry one\n * before the model runs. An event eve adds to the creating set later is absent\n * here and falls back to the wall clock instead of stamping a wrong time.\n */\nconst ROLE_BY_EVENT_TYPE: Partial<\n Record<MessageStreamEvent[\"type\"], keyof TurnTimestamps>\n> = {\n \"message.received\": \"user\",\n \"step.started\": \"assistant\",\n \"reasoning.appended\": \"assistant\",\n \"reasoning.completed\": \"assistant\",\n \"action.input.appended\": \"assistant\",\n \"actions.requested\": \"assistant\",\n \"input.requested\": \"assistant\",\n \"action.result\": \"assistant\",\n \"action.partial\": \"assistant\",\n \"authorization.required\": \"assistant\",\n \"authorization.completed\": \"assistant\",\n \"message.appended\": \"assistant\",\n \"message.completed\": \"assistant\",\n \"result.completed\": \"assistant\",\n \"turn.completed\": \"assistant\",\n \"turn.cancelled\": \"assistant\",\n};\n\nexport const createTurnTimestampCache = (): TurnTimestampCache => ({\n lastEvents: [],\n timestamps: new Map(),\n});\n\n/**\n * Eve appends to its log (`[...events, event]`), so a snapshot that keeps the\n * previous scan's last element by identity shares the whole prefix and the\n * scan resumes there. Any other snapshot is re-derived into a fresh map: turn\n * ids are per-session sequence numbers that recur after `reset()`, so entries\n * must not outlive the log that produced them. Re-derivation is also what\n * makes the render-phase cache writes safe when React discards a render.\n */\nexport const collectTurnTimestamps = (\n events: readonly MessageStreamEvent[],\n cache: TurnTimestampCache,\n): ReadonlyMap<string, TurnTimestamps> => {\n if (events === cache.lastEvents) return cache.timestamps;\n\n const scanned = cache.lastEvents;\n const resumesScan =\n scanned.length === 0 ||\n events[scanned.length - 1] === scanned[scanned.length - 1];\n\n let timestamps = cache.timestamps;\n let draft: Map<string, TurnTimestamps> | undefined;\n if (!resumesScan) {\n draft = new Map();\n timestamps = draft;\n }\n for (let i = resumesScan ? scanned.length : 0; i < events.length; i++) {\n const event = events[i]!;\n const role = ROLE_BY_EVENT_TYPE[event.type];\n if (role === undefined) continue;\n const data: unknown = (event as { readonly data?: unknown }).data;\n if (typeof data !== \"object\" || data === null) continue;\n const turnId = (data as { readonly turnId?: unknown }).turnId;\n if (typeof turnId !== \"string\") continue;\n const known = timestamps.get(turnId);\n if (known?.[role] !== undefined) continue;\n const at: unknown = (event as { readonly meta?: { readonly at?: unknown } })\n .meta?.at;\n if (typeof at !== \"string\") continue;\n const date = new Date(at);\n if (Number.isNaN(date.getTime())) continue;\n draft ??= new Map(timestamps);\n draft.set(turnId, { ...known, [role]: date });\n timestamps = draft;\n }\n\n cache.lastEvents = events;\n cache.timestamps = timestamps;\n return timestamps;\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,qBAEF;CACF,oBAAoB;CACpB,gBAAgB;CAChB,sBAAsB;CACtB,uBAAuB;CACvB,yBAAyB;CACzB,qBAAqB;CACrB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,0BAA0B;CAC1B,2BAA2B;CAC3B,oBAAoB;CACpB,qBAAqB;CACrB,oBAAoB;CACpB,kBAAkB;CAClB,kBAAkB;AACpB;AAEA,MAAa,kCAAsD;CACjE,YAAY,CAAC;CACb,4BAAY,IAAI,IAAI;AACtB;;;;;;;;;AAUA,MAAa,yBACX,QACA,UACwC;CACxC,IAAI,WAAW,MAAM,YAAY,OAAO,MAAM;CAE9C,MAAM,UAAU,MAAM;CACtB,MAAM,cACJ,QAAQ,WAAW,KACnB,OAAO,QAAQ,SAAS,OAAO,QAAQ,QAAQ,SAAS;CAE1D,IAAI,aAAa,MAAM;CACvB,IAAI;CACJ,IAAI,CAAC,aAAa;EAChB,wBAAQ,IAAI,IAAI;EAChB,aAAa;CACf;CACA,KAAK,IAAI,IAAI,cAAc,QAAQ,SAAS,GAAG,IAAI,OAAO,QAAQ,KAAK;EACrE,MAAM,QAAQ,OAAO;EACrB,MAAM,OAAO,mBAAmB,MAAM;EACtC,IAAI,SAAS,KAAA,GAAW;EACxB,MAAM,OAAiB,MAAsC;EAC7D,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC/C,MAAM,SAAU,KAAuC;EACvD,IAAI,OAAO,WAAW,UAAU;EAChC,MAAM,QAAQ,WAAW,IAAI,MAAM;EACnC,IAAI,QAAQ,UAAU,KAAA,GAAW;EACjC,MAAM,KAAe,MAClB,MAAM;EACT,IAAI,OAAO,OAAO,UAAU;EAC5B,MAAM,OAAO,IAAI,KAAK,EAAE;EACxB,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG;EAClC,UAAU,IAAI,IAAI,UAAU;EAC5B,MAAM,IAAI,QAAQ;GAAE,GAAG;IAAQ,OAAO;EAAK,CAAC;EAC5C,aAAa;CACf;CAEA,MAAM,aAAa;CACnB,MAAM,aAAa;CACnB,OAAO;AACT"}
1
+ {"version":3,"file":"deriveCreatedAt.js","names":[],"sources":["../src/deriveCreatedAt.ts"],"sourcesContent":["import type { MessageStreamEvent } from \"eve/client\";\n\nexport type TurnTimestamps = {\n readonly user?: Date;\n readonly assistant?: Date;\n};\n\nexport type TurnTimestampCache = {\n lastEvents: readonly MessageStreamEvent[];\n timestamps: ReadonlyMap<string, TurnTimestamps>;\n};\n\n/**\n * The reducer cases eve projects into a message: `message.received` creates\n * `${turnId}:user`, and every assistant entry reaches `updateAssistantMessage`,\n * which creates `${turnId}:assistant` for a turn that has none. It enumerates\n * that reducer across the `>=0.32.0` peer range rather than stating a rule\n * about turn ids, because `turn.started` and the compaction events carry one\n * before the model runs. An event eve adds to the creating set later is absent\n * here and falls back to the wall clock instead of stamping a wrong time.\n */\nconst ROLE_BY_EVENT_TYPE: Partial<\n Record<MessageStreamEvent[\"type\"], keyof TurnTimestamps>\n> = {\n \"message.received\": \"user\",\n \"step.started\": \"assistant\",\n \"reasoning.appended\": \"assistant\",\n \"reasoning.completed\": \"assistant\",\n \"action.input.appended\": \"assistant\",\n \"actions.requested\": \"assistant\",\n \"input.requested\": \"assistant\",\n \"action.result\": \"assistant\",\n \"action.partial\": \"assistant\",\n \"authorization.required\": \"assistant\",\n \"authorization.completed\": \"assistant\",\n \"message.appended\": \"assistant\",\n \"message.completed\": \"assistant\",\n \"result.completed\": \"assistant\",\n \"turn.completed\": \"assistant\",\n \"turn.cancelled\": \"assistant\",\n};\n\nexport const createTurnTimestampCache = (): TurnTimestampCache => ({\n lastEvents: [],\n timestamps: new Map(),\n});\n\n/**\n * Eve appends to its log (`[...events, event]`), so a snapshot that keeps the\n * previous scan's last element by identity shares the whole prefix and the\n * scan resumes there. Any other snapshot is re-derived into a fresh map: turn\n * ids are per-session sequence numbers that recur after `reset()`, so entries\n * must not outlive the log that produced them. Re-derivation is also what\n * makes the render-phase cache writes safe when React discards a render.\n */\nexport const collectTurnTimestamps = (\n events: readonly MessageStreamEvent[],\n cache: TurnTimestampCache,\n): ReadonlyMap<string, TurnTimestamps> => {\n if (events === cache.lastEvents) return cache.timestamps;\n\n const scanned = cache.lastEvents;\n const resumesScan =\n scanned.length === 0 ||\n events[scanned.length - 1] === scanned[scanned.length - 1];\n\n let timestamps = cache.timestamps;\n let draft: Map<string, TurnTimestamps> | undefined;\n if (!resumesScan) {\n draft = new Map();\n timestamps = draft;\n }\n for (let i = resumesScan ? scanned.length : 0; i < events.length; i++) {\n const event = events[i]!;\n // `type` arrives off the wire, so an inherited member such as\n // `__proto__` would resolve here instead of missing, and be used as a\n // timestamp key. Only the table's own entries count.\n if (!Object.prototype.hasOwnProperty.call(ROLE_BY_EVENT_TYPE, event.type))\n continue;\n const role = ROLE_BY_EVENT_TYPE[event.type];\n if (role === undefined) continue;\n const data: unknown = (event as { readonly data?: unknown }).data;\n if (typeof data !== \"object\" || data === null) continue;\n const turnId = (data as { readonly turnId?: unknown }).turnId;\n if (typeof turnId !== \"string\") continue;\n const known = timestamps.get(turnId);\n if (known?.[role] !== undefined) continue;\n const at: unknown = (event as { readonly meta?: { readonly at?: unknown } })\n .meta?.at;\n if (typeof at !== \"string\") continue;\n const date = new Date(at);\n if (Number.isNaN(date.getTime())) continue;\n draft ??= new Map(timestamps);\n draft.set(turnId, { ...known, [role]: date });\n timestamps = draft;\n }\n\n cache.lastEvents = events;\n cache.timestamps = timestamps;\n return timestamps;\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,qBAEF;CACF,oBAAoB;CACpB,gBAAgB;CAChB,sBAAsB;CACtB,uBAAuB;CACvB,yBAAyB;CACzB,qBAAqB;CACrB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,0BAA0B;CAC1B,2BAA2B;CAC3B,oBAAoB;CACp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/eveExtras.d.ts
3
- type EveRuntimeExtras = Pick<UseEveAgentHelpers<EveMessageData>, "error" | "events" | "session" | "reset">;
4
- declare const eveExtras: import("@assistant-ui/core/react").RuntimeExtras<EveRuntimeExtras>;
5
- //#endregion
6
- export { EveRuntimeExtras, eveExtras };
1
+ import type { EveMessageData, UseEveAgentHelpers } from "eve/react";
2
+ export type EveRuntimeExtras = Pick<UseEveAgentHelpers<EveMessageData>, "error" | "events" | "session" | "reset">;
3
+ export declare const eveExtras: import("@assistant-ui/core/react").RuntimeExtras<EveRuntimeExtras>;
7
4
  //# sourceMappingURL=eveExtras.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eveExtras.d.ts","names":[],"sources":["../src/eveExtras.ts"],"mappings":";;KAGY,mBAAmB,KAC7B,mBAAmB;cAIR,8CAAS,cAAA"}
1
+ {"version":3,"file":"eveExtras.d.ts","sourceRoot":"","sources":["../src/eveExtras.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,kBAAkB,CAAC,cAAc,CAAC,EAClC,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CACzC,CAAC;AAEF,eAAO,MAAM,SAAS,oEACuC,CAAC"}
package/dist/hooks.d.ts CHANGED
@@ -1,25 +1,22 @@
1
- import { EveRuntimeExtras } from "./eveExtras.js";
2
- //#region src/hooks.d.ts
1
+ import type { EveRuntimeExtras } from "./eveExtras.js";
3
2
  /** Read the last Eve session error from the runtime extras. */
4
- declare const useEveError: () => Error | undefined;
3
+ export declare const useEveError: () => Error | undefined;
5
4
  /**
6
5
  * Read the current Eve session cursor from the runtime extras. Persist it to
7
6
  * resume the session later via `initialSession`. `undefined` when no session
8
7
  * exists yet or outside an Eve runtime.
9
8
  */
10
- declare const useEveSession: () => EveRuntimeExtras["session"] | undefined;
9
+ export declare const useEveSession: () => EveRuntimeExtras["session"] | undefined;
11
10
  /**
12
11
  * Read the authoritative Eve server event stream from the runtime extras.
13
12
  * Defaults to an empty array outside an Eve runtime.
14
13
  */
15
- declare const useEveEvents: () => EveRuntimeExtras["events"];
14
+ export declare const useEveEvents: () => EveRuntimeExtras["events"];
16
15
  /**
17
16
  * Returns a function that resets the Eve session: aborts any in-flight turn,
18
17
  * recreates the owned session, and clears events and projected data. Pending
19
18
  * staged messages and tool execution state are discarded. Safe to render
20
19
  * outside an Eve runtime; invoking the returned function there throws.
21
20
  */
22
- declare const useEveReset: () => () => void;
23
- //#endregion
24
- export { useEveError, useEveEvents, useEveReset, useEveSession };
21
+ export declare const useEveReset: () => () => void;
25
22
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks.ts"],"mappings":";;;cASa,mBAAW;;;;;;cAOX,qBAAoB;;;;;cAOpB,oBAAmB;;;;;;;cASnB"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAoB;AAIpD,+DAA+D;AAC/D,eAAO,MAAM,WAAW,yBAAiD,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAO,gBAAgB,CAAC,SAAS,CAAC,GAAG,SACnB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,gBAAgB,CAAC,QAAQ,CACX,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kBAGvB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- /// <reference types="@assistant-ui/core/react" />
2
- import { ConvertEveMessagesOptions, EveAuthorizationData, EveMessageContent, convertEveMessage, convertEveMessages, getEveMessageContent, toEveInputResponse } from "./convertEveMessages.js";
3
- import { EveRuntimeExtras } from "./eveExtras.js";
4
- import { useEveError, useEveEvents, useEveReset, useEveSession } from "./hooks.js";
5
- import { UseEveAgentRuntimeOptions, useEveAgentRuntime } from "./useEveAgentRuntime.js";
6
- export { type ConvertEveMessagesOptions, type EveAuthorizationData, type EveMessageContent, type EveRuntimeExtras, type UseEveAgentRuntimeOptions, convertEveMessage, convertEveMessages, getEveMessageContent, toEveInputResponse, useEveAgentRuntime, useEveError, useEveEvents, useEveReset, useEveSession };
1
+ /// <reference types="@assistant-ui/core/react" preserve="true" />
2
+ export { convertEveMessage, convertEveMessages, getEveMessageContent, toEveInputResponse, } from "./convertEveMessages.js";
3
+ export type { ConvertEveMessagesOptions, EveAuthorizationData, EveMessageContent, } from "./convertEveMessages.js";
4
+ export { useEveAgentRuntime } from "./useEveAgentRuntime.js";
5
+ export type { UseEveAgentRuntimeOptions } from "./useEveAgentRuntime.js";
6
+ export { useEveError, useEveEvents, useEveReset, useEveSession } from "./hooks.js";
7
+ export type { EveRuntimeExtras } from "./eveExtras.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,gCAA6B;AAC9B,YAAY,EACV,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,GAClB,gCAA6B;AAC9B,OAAO,EAAE,kBAAkB,EAAE,gCAA6B;AAC1D,YAAY,EAAE,yBAAyB,EAAE,gCAA6B;AACtE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAgB;AAChF,YAAY,EAAE,gBAAgB,EAAE,uBAAoB"}
@@ -1,14 +1,13 @@
1
- import { AttachmentAdapter, DictationAdapter, ExternalStoreSharedOptions, FeedbackAdapter, RealtimeVoiceAdapter, SpeechSynthesisAdapter } from "@assistant-ui/core";
2
- import { EveMessageData, UseEveAgentOptions } from "eve/react";
3
- //#region src/useEveAgentRuntime.d.ts
4
- type UseEveAgentRuntimeOptions = Omit<UseEveAgentOptions<EveMessageData>, "reducer"> & ExternalStoreSharedOptions & {
5
- readonly adapters?: {
6
- readonly attachments?: AttachmentAdapter | undefined;
7
- readonly speech?: SpeechSynthesisAdapter | undefined;
8
- readonly dictation?: DictationAdapter | undefined;
9
- readonly voice?: RealtimeVoiceAdapter | undefined;
10
- readonly feedback?: FeedbackAdapter | undefined;
11
- } | undefined;
1
+ import { type AttachmentAdapter, type DictationAdapter, type ExternalStoreSharedOptions, type FeedbackAdapter, type RealtimeVoiceAdapter, type SpeechSynthesisAdapter } from "@assistant-ui/core";
2
+ import { type EveMessageData, type UseEveAgentOptions } from "eve/react";
3
+ export type UseEveAgentRuntimeOptions = Omit<UseEveAgentOptions<EveMessageData>, "reducer"> & ExternalStoreSharedOptions & {
4
+ readonly adapters?: {
5
+ readonly attachments?: AttachmentAdapter | undefined;
6
+ readonly speech?: SpeechSynthesisAdapter | undefined;
7
+ readonly dictation?: DictationAdapter | undefined;
8
+ readonly voice?: RealtimeVoiceAdapter | undefined;
9
+ readonly feedback?: FeedbackAdapter | undefined;
10
+ } | undefined;
12
11
  };
13
12
  /**
14
13
  * Connects Eve's `useEveAgent` hook to assistant-ui's runtime contract.
@@ -17,7 +16,5 @@ type UseEveAgentRuntimeOptions = Omit<UseEveAgentOptions<EveMessageData>, "reduc
17
16
  * session, supports cancellation, and maps Eve input requests to assistant-ui
18
17
  * tool approval UI.
19
18
  */
20
- declare const useEveAgentRuntime: (options?: UseEveAgentRuntimeOptions) => import("@assistant-ui/core").AssistantRuntime;
21
- //#endregion
22
- export { UseEveAgentRuntimeOptions, useEveAgentRuntime };
19
+ export declare const useEveAgentRuntime: (options?: UseEveAgentRuntimeOptions) => import("@assistant-ui/core").AssistantRuntime;
23
20
  //# sourceMappingURL=useEveAgentRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEveAgentRuntime.d.ts","names":[],"sources":["../src/useEveAgentRuntime.ts"],"mappings":";;;KA+HY,4BAA4B,KACtC,mBAAmB,8BAGnB;WACW;aAEM,cAAc;aACd,SAAS;aACT,YAAY;aACZ,QAAQ;aACR,WAAW;;;;;;;;;;cAYjB,qBAAsB,UAAS,2DAA8B"}
1
+ {"version":3,"file":"useEveAgentRuntime.d.ts","sourceRoot":"","sources":["../src/useEveAgentRuntime.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAG5B,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AA6FnB,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,kBAAkB,CAAC,cAAc,CAAC,EAClC,SAAS,CACV,GACC,0BAA0B,GAAG;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EACd;QACE,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;QACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;QACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;QAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;QAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;KACjD,GACD,SAAS,CAAC;CACf,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAS,yBAA8B,kDA6WzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/eve",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "Eve runtime adapter for assistant-ui",
5
5
  "keywords": [
6
6
  "eve",
@@ -28,8 +28,8 @@
28
28
  ],
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@assistant-ui/core": "^0.3.18",
32
- "@assistant-ui/store": "^0.3.13"
31
+ "@assistant-ui/core": "^0.3.21",
32
+ "@assistant-ui/store": "^0.3.15"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@types/react": "*",
@@ -42,15 +42,15 @@
42
42
  }
43
43
  },
44
44
  "devDependencies": {
45
- "@assistant-ui/x-buildutils": "0.0.26",
46
- "@testing-library/dom": "^10.4.1",
45
+ "@assistant-ui/x-buildutils": "0.0.29",
46
+ "@testing-library/dom": "^10.4.2",
47
47
  "@testing-library/react": "^16.3.3",
48
- "@types/react": "^19.2.18",
49
- "eve": "^0.52.2",
48
+ "@types/react": "^19.3.0",
49
+ "eve": "^0.56.0",
50
50
  "jsdom": "^30.0.1",
51
- "react": "^19.2.8",
52
- "react-dom": "^19.2.8",
53
- "vitest": "^4.1.11"
51
+ "react": "^19.3.0",
52
+ "react-dom": "^19.3.0",
53
+ "vitest": "^5.0.1"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public",
@@ -68,6 +68,7 @@
68
68
  "scripts": {
69
69
  "build": "aui-build",
70
70
  "test": "vitest run",
71
+ "typecheck": "tsc --noEmit",
71
72
  "test:watch": "vitest"
72
73
  }
73
74
  }
@@ -1326,7 +1326,6 @@ describe("convertEveMessages", () => {
1326
1326
  stepIndex: 0,
1327
1327
  sequence: 2,
1328
1328
  messageDelta: "Let me th",
1329
- messageSoFar: "Let me th",
1330
1329
  },
1331
1330
  },
1332
1331
  ];
@@ -1519,7 +1518,6 @@ describe("convertEveMessages", () => {
1519
1518
  stepIndex: 0,
1520
1519
  sequence: 2,
1521
1520
  reasoningDelta: "Think",
1522
- reasoningSoFar: "Think",
1523
1521
  },
1524
1522
  },
1525
1523
  {
@@ -1570,7 +1568,6 @@ describe("convertEveMessages", () => {
1570
1568
  stepIndex: 0,
1571
1569
  sequence: 2,
1572
1570
  reasoningDelta: "Think",
1573
- reasoningSoFar: "Think",
1574
1571
  },
1575
1572
  },
1576
1573
  {
@@ -1633,7 +1630,6 @@ describe("convertEveMessages", () => {
1633
1630
  stepIndex: 0,
1634
1631
  sequence: 2,
1635
1632
  messageDelta: "First",
1636
- messageSoFar: "First",
1637
1633
  },
1638
1634
  },
1639
1635
  {
@@ -1675,7 +1671,6 @@ describe("convertEveMessages", () => {
1675
1671
  stepIndex: 1,
1676
1672
  sequence: 6,
1677
1673
  messageDelta: "Sec",
1678
- messageSoFar: "Sec",
1679
1674
  },
1680
1675
  },
1681
1676
  ]);
@@ -40,7 +40,6 @@ const messageAppended = (at: string, turnId = TURN) =>
40
40
  type: "message.appended",
41
41
  data: {
42
42
  messageDelta: "he",
43
- messageSoFar: "he",
44
43
  sequence: 4,
45
44
  stepIndex: 0,
46
45
  turnId,
@@ -188,3 +187,25 @@ describe("collectTurnTimestamps", () => {
188
187
  expect(timestamps.get(TURN)?.assistant).toBe(undefined);
189
188
  });
190
189
  });
190
+
191
+ describe("collectTurnTimestamps prototype-inherited event types", () => {
192
+ // `type` arrives off the wire, so a lookup on a plain object literal can
193
+ // resolve an inherited member instead of missing.
194
+ it.each(["__proto__", "constructor", "toString"])(
195
+ "ignores an event whose type is %s",
196
+ (type) => {
197
+ const cache = createTurnTimestampCache();
198
+ const events = [
199
+ {
200
+ type,
201
+ data: { sequence: 1, turnId: TURN },
202
+ meta: { at: "2026-01-01T00:00:00.000Z", id: "evt_x" },
203
+ },
204
+ ] as unknown as MessageStreamEvent[];
205
+
206
+ const timestamps = collectTurnTimestamps(events, cache);
207
+
208
+ expect(timestamps.get(TURN)).toBeUndefined();
209
+ },
210
+ );
211
+ });
@@ -72,6 +72,11 @@ export const collectTurnTimestamps = (
72
72
  }
73
73
  for (let i = resumesScan ? scanned.length : 0; i < events.length; i++) {
74
74
  const event = events[i]!;
75
+ // `type` arrives off the wire, so an inherited member such as
76
+ // `__proto__` would resolve here instead of missing, and be used as a
77
+ // timestamp key. Only the table's own entries count.
78
+ if (!Object.prototype.hasOwnProperty.call(ROLE_BY_EVENT_TYPE, event.type))
79
+ continue;
75
80
  const role = ROLE_BY_EVENT_TYPE[event.type];
76
81
  if (role === undefined) continue;
77
82
  const data: unknown = (event as { readonly data?: unknown }).data;
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="@assistant-ui/core/react" />
1
+ /// <reference types="@assistant-ui/core/react" preserve="true" />
2
2
 
3
3
  export {
4
4
  convertEveMessage,