@alquimia-ai/tools 2.5.0 → 2.8.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/README.md +603 -23
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/adapters/fetch.d.mts +1 -0
- package/dist/adapters/fetch.d.ts +1 -0
- package/dist/adapters/fetch.js +4 -0
- package/dist/adapters/fetch.js.map +1 -1
- package/dist/adapters/fetch.mjs +4 -0
- package/dist/adapters/fetch.mjs.map +1 -1
- package/dist/adapters/index.d.mts +1 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/next.d.mts +1 -0
- package/dist/adapters/next.d.ts +1 -0
- package/dist/adapters/next.js +4 -0
- package/dist/adapters/next.js.map +1 -1
- package/dist/adapters/next.mjs +4 -0
- package/dist/adapters/next.mjs.map +1 -1
- package/dist/approvals-CcnmqUkQ.d.ts +59 -0
- package/dist/approvals-dn4sd_Ot.d.mts +59 -0
- package/dist/hooks/index.d.mts +36 -5
- package/dist/hooks/index.d.ts +36 -5
- package/dist/hooks/index.js +269 -17
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +269 -17
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/next/index.d.mts +7 -0
- package/dist/next/index.d.ts +7 -0
- package/dist/next/index.js +56 -37
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +56 -37
- package/dist/next/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +3 -3
- package/dist/providers/index.d.ts +3 -3
- package/dist/{providers-b5_yMyMo.d.ts → providers-J_Z9rQ3Q.d.ts} +1 -1
- package/dist/{providers-DiR9cgyo.d.mts → providers-YKiEag2L.d.mts} +1 -1
- package/dist/proxy.d.mts +2 -0
- package/dist/proxy.d.ts +2 -0
- package/dist/proxy.js +47 -37
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs +47 -37
- package/dist/proxy.mjs.map +1 -1
- package/dist/sdk/index.d.mts +60 -5
- package/dist/sdk/index.d.ts +60 -5
- package/dist/sdk/index.js +115 -15
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +115 -15
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/services/index.d.mts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/{type-xksRnBUW.d.ts → type-BFtGEEb4.d.ts} +45 -1
- package/dist/{type-DqX3-9QS.d.mts → type-C_sKpIM1.d.mts} +45 -1
- package/dist/types/index.d.mts +28 -5
- package/dist/types/index.d.ts +28 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/{types-C-6fgK1_.d.mts → types-lOliroPw.d.mts} +1 -1
- package/dist/{types-C-6fgK1_.d.ts → types-lOliroPw.d.ts} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/worklog/index.d.mts +3 -2
- package/dist/worklog/index.d.ts +3 -2
- package/dist/worklog/index.js +94 -2
- package/dist/worklog/index.js.map +1 -1
- package/dist/worklog/index.mjs +94 -2
- package/dist/worklog/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -221,8 +221,52 @@ interface CommonAttributes {
|
|
|
221
221
|
channelid?: string | null;
|
|
222
222
|
depth?: string;
|
|
223
223
|
attachments?: string[];
|
|
224
|
+
/** Registry version the runtime resolved for this task (runtime v0.5.1). */
|
|
225
|
+
versiontag?: string | null;
|
|
224
226
|
}
|
|
225
227
|
type InferInitResponse = CommonAttributes;
|
|
228
|
+
/** A text block in a multimodal `query` (runtime `TextContentPart`). */
|
|
229
|
+
interface TextContentPart {
|
|
230
|
+
type: 'text';
|
|
231
|
+
text: string;
|
|
232
|
+
}
|
|
233
|
+
/** An image block in a multimodal `query` (runtime `ImageContentPart`). */
|
|
234
|
+
interface ImageContentPart {
|
|
235
|
+
type: 'image_url';
|
|
236
|
+
image_url: {
|
|
237
|
+
url: string;
|
|
238
|
+
detail?: 'auto' | 'low' | 'high';
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Catch-all for content blocks the runtime does not model explicitly. It
|
|
243
|
+
* round-trips unknown provider blocks rather than failing validation.
|
|
244
|
+
*/
|
|
245
|
+
interface NonStandardContentPart {
|
|
246
|
+
type: 'non_standard';
|
|
247
|
+
value?: Record<string, unknown>;
|
|
248
|
+
}
|
|
249
|
+
type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;
|
|
250
|
+
/**
|
|
251
|
+
* An inference `query`: either plain text, or an OpenAI-style list of content
|
|
252
|
+
* parts for multimodal input.
|
|
253
|
+
*/
|
|
254
|
+
type Content = string | ContentPart[];
|
|
255
|
+
/**
|
|
256
|
+
* A blob held in the session context. Returned by `POST /context/blob/upload`
|
|
257
|
+
* and accepted as `input_audio` on infer (runtime v0.5.1).
|
|
258
|
+
*/
|
|
259
|
+
interface RuntimeBlob {
|
|
260
|
+
blob_id: string;
|
|
261
|
+
filename: string;
|
|
262
|
+
content_size: number;
|
|
263
|
+
content_type?: string | null;
|
|
264
|
+
checksum?: string | null;
|
|
265
|
+
created_at?: number | null;
|
|
266
|
+
expires_at?: number | null;
|
|
267
|
+
/** Base64-encoded content. Populated by channel ingest, not by blob upload. */
|
|
268
|
+
data_base64?: string | null;
|
|
269
|
+
}
|
|
226
270
|
/**
|
|
227
271
|
* Native-tools evaluation strategy. Wraps the client-side tool schemas
|
|
228
272
|
* the SDK previously sent at the top level of the infer payload.
|
|
@@ -309,4 +353,4 @@ interface GenuiSurfaceItem {
|
|
|
309
353
|
dismissedWith?: string;
|
|
310
354
|
}
|
|
311
355
|
|
|
312
|
-
export { type ApmSpan as A, type BaseAPIConfig as B, type
|
|
356
|
+
export { type ApmSpan as A, type BaseAPIConfig as B, type Content as C, type DocumentSearchResult as D, type ElevenLabsRequestSpecs as E, type TokenUsage as F, type GenuiSurfaceItem as G, ToolFactory as H, type IToolSpec as I, type ToolOutput as J, type ToolSummary as K, type Tooler as L, type NativeToolsEvaluationStrategy as N, type OneShootEvaluationStrategy as O, type RatingData as R, type TTSResult as T, type UsageMetadata as U, type AlquimiaMessage as a, type ToolEvent as b, type AIMessageChunk as c, type AttachmentPayload as d, type RuntimeBlob as e, type AIMessageChunkData as f, type ActionResponse as g, type AlquimiaEventData as h, type ApiError as i, type AssistantInferenceResponse as j, type AssistantResponseData as k, type CommonAttributes as l, type ContentPart as m, type ConversationsMap as n, type ElevenLabsVoiceSettings as o, type EvaluationStrategy as p, type ExpertInferenceResponse as q, type ExtraDataContext as r, type ITooler as s, type ImageContentPart as t, type InferInitResponse as u, type NonStandardContentPart as v, type RawToolsEvaluationStrategy as w, type ResponseMetadata as x, type TextContentPart as y, type ThinkingsInferenceResponse as z };
|
|
@@ -221,8 +221,52 @@ interface CommonAttributes {
|
|
|
221
221
|
channelid?: string | null;
|
|
222
222
|
depth?: string;
|
|
223
223
|
attachments?: string[];
|
|
224
|
+
/** Registry version the runtime resolved for this task (runtime v0.5.1). */
|
|
225
|
+
versiontag?: string | null;
|
|
224
226
|
}
|
|
225
227
|
type InferInitResponse = CommonAttributes;
|
|
228
|
+
/** A text block in a multimodal `query` (runtime `TextContentPart`). */
|
|
229
|
+
interface TextContentPart {
|
|
230
|
+
type: 'text';
|
|
231
|
+
text: string;
|
|
232
|
+
}
|
|
233
|
+
/** An image block in a multimodal `query` (runtime `ImageContentPart`). */
|
|
234
|
+
interface ImageContentPart {
|
|
235
|
+
type: 'image_url';
|
|
236
|
+
image_url: {
|
|
237
|
+
url: string;
|
|
238
|
+
detail?: 'auto' | 'low' | 'high';
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Catch-all for content blocks the runtime does not model explicitly. It
|
|
243
|
+
* round-trips unknown provider blocks rather than failing validation.
|
|
244
|
+
*/
|
|
245
|
+
interface NonStandardContentPart {
|
|
246
|
+
type: 'non_standard';
|
|
247
|
+
value?: Record<string, unknown>;
|
|
248
|
+
}
|
|
249
|
+
type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;
|
|
250
|
+
/**
|
|
251
|
+
* An inference `query`: either plain text, or an OpenAI-style list of content
|
|
252
|
+
* parts for multimodal input.
|
|
253
|
+
*/
|
|
254
|
+
type Content = string | ContentPart[];
|
|
255
|
+
/**
|
|
256
|
+
* A blob held in the session context. Returned by `POST /context/blob/upload`
|
|
257
|
+
* and accepted as `input_audio` on infer (runtime v0.5.1).
|
|
258
|
+
*/
|
|
259
|
+
interface RuntimeBlob {
|
|
260
|
+
blob_id: string;
|
|
261
|
+
filename: string;
|
|
262
|
+
content_size: number;
|
|
263
|
+
content_type?: string | null;
|
|
264
|
+
checksum?: string | null;
|
|
265
|
+
created_at?: number | null;
|
|
266
|
+
expires_at?: number | null;
|
|
267
|
+
/** Base64-encoded content. Populated by channel ingest, not by blob upload. */
|
|
268
|
+
data_base64?: string | null;
|
|
269
|
+
}
|
|
226
270
|
/**
|
|
227
271
|
* Native-tools evaluation strategy. Wraps the client-side tool schemas
|
|
228
272
|
* the SDK previously sent at the top level of the infer payload.
|
|
@@ -309,4 +353,4 @@ interface GenuiSurfaceItem {
|
|
|
309
353
|
dismissedWith?: string;
|
|
310
354
|
}
|
|
311
355
|
|
|
312
|
-
export { type ApmSpan as A, type BaseAPIConfig as B, type
|
|
356
|
+
export { type ApmSpan as A, type BaseAPIConfig as B, type Content as C, type DocumentSearchResult as D, type ElevenLabsRequestSpecs as E, type TokenUsage as F, type GenuiSurfaceItem as G, ToolFactory as H, type IToolSpec as I, type ToolOutput as J, type ToolSummary as K, type Tooler as L, type NativeToolsEvaluationStrategy as N, type OneShootEvaluationStrategy as O, type RatingData as R, type TTSResult as T, type UsageMetadata as U, type AlquimiaMessage as a, type ToolEvent as b, type AIMessageChunk as c, type AttachmentPayload as d, type RuntimeBlob as e, type AIMessageChunkData as f, type ActionResponse as g, type AlquimiaEventData as h, type ApiError as i, type AssistantInferenceResponse as j, type AssistantResponseData as k, type CommonAttributes as l, type ContentPart as m, type ConversationsMap as n, type ElevenLabsVoiceSettings as o, type EvaluationStrategy as p, type ExpertInferenceResponse as q, type ExtraDataContext as r, type ITooler as s, type ImageContentPart as t, type InferInitResponse as u, type NonStandardContentPart as v, type RawToolsEvaluationStrategy as w, type ResponseMetadata as x, type TextContentPart as y, type ThinkingsInferenceResponse as z };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as AIMessageChunk, f as AIMessageChunkData, g as ActionResponse, h as AlquimiaEventData, a as AlquimiaMessage, i as ApiError, A as ApmSpan, j as AssistantInferenceResponse, k as AssistantResponseData, d as AttachmentPayload, B as BaseAPIConfig, l as CommonAttributes, C as Content, m as ContentPart, n as ConversationsMap, D as DocumentSearchResult, E as ElevenLabsRequestSpecs, o as ElevenLabsVoiceSettings, p as EvaluationStrategy, q as ExpertInferenceResponse, r as ExtraDataContext, G as GenuiSurfaceItem, I as IToolSpec, s as ITooler, t as ImageContentPart, u as InferInitResponse, N as NativeToolsEvaluationStrategy, v as NonStandardContentPart, O as OneShootEvaluationStrategy, R as RatingData, w as RawToolsEvaluationStrategy, x as ResponseMetadata, e as RuntimeBlob, T as TTSResult, y as TextContentPart, z as ThinkingsInferenceResponse, F as TokenUsage, b as ToolEvent, H as ToolFactory, J as ToolOutput, K as ToolSummary, L as Tooler, U as UsageMetadata } from '../type-C_sKpIM1.mjs';
|
|
2
2
|
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.mjs';
|
|
3
|
-
import { W as WorklogRecord } from '../types-
|
|
3
|
+
import { W as WorklogRecord } from '../types-lOliroPw.mjs';
|
|
4
4
|
import '@elastic/apm-rum';
|
|
5
5
|
import 'ai';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Runtime v0.5.
|
|
8
|
+
* Runtime v0.5.1 event payloads.
|
|
9
9
|
*
|
|
10
10
|
* These types mirror the request/response schemas exposed by the
|
|
11
11
|
* `/event/*` endpoints. Many fields are optional because the runtime accepts
|
|
@@ -21,6 +21,8 @@ interface RuntimeEventBase {
|
|
|
21
21
|
channel_id?: string;
|
|
22
22
|
control_id?: string | null;
|
|
23
23
|
timestamp?: string;
|
|
24
|
+
/** Resolved registry version tag for versioned assistant refs (runtime v0.5.1). */
|
|
25
|
+
versiontag?: string | null;
|
|
24
26
|
}
|
|
25
27
|
/** POST /event/session-start */
|
|
26
28
|
interface SessionStartEvent extends RuntimeEventBase {
|
|
@@ -60,6 +62,27 @@ interface ToolApprovalEvent extends RuntimeEventBase {
|
|
|
60
62
|
/** Optional reason or note attached to the decision. */
|
|
61
63
|
message?: string;
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* How the runtime answered a {@link ToolApprovalEvent}. `POST /event/tool-approval`
|
|
67
|
+
* answers every refusal with a 409 and only the `detail` text tells them apart,
|
|
68
|
+
* so the SDK classifies it once here instead of every caller string-matching.
|
|
69
|
+
*
|
|
70
|
+
* - `accepted` — the decision was recorded and the parked tool call resumes (or is dropped).
|
|
71
|
+
* - `already-decided` — someone else (another operator, the originating channel) answered first.
|
|
72
|
+
* - `wrong-channel` — the gate must be answered on the channel that raised it; HTTP never will.
|
|
73
|
+
* - `not-pending` — the control id is stale or already resolved.
|
|
74
|
+
* - `forbidden` — the caller lacks an approver role or is not bound to the task's agentspace.
|
|
75
|
+
* - `not-found` — the task is gone (finished or expired).
|
|
76
|
+
* - `error` — anything else: transport failure, 5xx, an unrecognized 409.
|
|
77
|
+
*/
|
|
78
|
+
type ToolApprovalOutcome = "accepted" | "already-decided" | "wrong-channel" | "not-pending" | "forbidden" | "not-found" | "error";
|
|
79
|
+
interface ToolApprovalResult {
|
|
80
|
+
outcome: ToolApprovalOutcome;
|
|
81
|
+
/** HTTP status, when a response came back at all. */
|
|
82
|
+
status?: number;
|
|
83
|
+
/** The runtime's `detail`, verbatim, for anything but `accepted`. */
|
|
84
|
+
detail?: string;
|
|
85
|
+
}
|
|
63
86
|
/** POST /event/tool-completion (client-side tool execution result). */
|
|
64
87
|
interface ToolCompletionEvent extends ToolExecutionResponse {
|
|
65
88
|
event_class: "ToolCompletionEvent";
|
|
@@ -80,7 +103,7 @@ interface BusModeEvent extends RuntimeEventBase {
|
|
|
80
103
|
interface HeartbeatEvent extends RuntimeEventBase {
|
|
81
104
|
event_class: "HeartbeatEvent";
|
|
82
105
|
}
|
|
83
|
-
/** Discriminated union of all runtime v0.5.
|
|
106
|
+
/** Discriminated union of all runtime v0.5.1 event payloads. */
|
|
84
107
|
type RuntimeEvent = SessionStartEvent | SessionEndEvent | UserMessageEvent | AgentMessageEvent | ToolApprovalEvent | ToolCompletionEvent | RuntimeErrorEvent | BusModeEvent | HeartbeatEvent;
|
|
85
108
|
|
|
86
|
-
export type { AgentMessageEvent, BusModeEvent, HeartbeatEvent, RuntimeErrorEvent, RuntimeEvent, RuntimeEventBase, SessionEndEvent, SessionStartEvent, ToolApprovalEvent, ToolCompletionEvent, UserMessageEvent };
|
|
109
|
+
export type { AgentMessageEvent, BusModeEvent, HeartbeatEvent, RuntimeErrorEvent, RuntimeEvent, RuntimeEventBase, SessionEndEvent, SessionStartEvent, ToolApprovalEvent, ToolApprovalOutcome, ToolApprovalResult, ToolCompletionEvent, UserMessageEvent };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as AIMessageChunk, f as AIMessageChunkData, g as ActionResponse, h as AlquimiaEventData, a as AlquimiaMessage, i as ApiError, A as ApmSpan, j as AssistantInferenceResponse, k as AssistantResponseData, d as AttachmentPayload, B as BaseAPIConfig, l as CommonAttributes, C as Content, m as ContentPart, n as ConversationsMap, D as DocumentSearchResult, E as ElevenLabsRequestSpecs, o as ElevenLabsVoiceSettings, p as EvaluationStrategy, q as ExpertInferenceResponse, r as ExtraDataContext, G as GenuiSurfaceItem, I as IToolSpec, s as ITooler, t as ImageContentPart, u as InferInitResponse, N as NativeToolsEvaluationStrategy, v as NonStandardContentPart, O as OneShootEvaluationStrategy, R as RatingData, w as RawToolsEvaluationStrategy, x as ResponseMetadata, e as RuntimeBlob, T as TTSResult, y as TextContentPart, z as ThinkingsInferenceResponse, F as TokenUsage, b as ToolEvent, H as ToolFactory, J as ToolOutput, K as ToolSummary, L as Tooler, U as UsageMetadata } from '../type-BFtGEEb4.js';
|
|
2
2
|
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.js';
|
|
3
|
-
import { W as WorklogRecord } from '../types-
|
|
3
|
+
import { W as WorklogRecord } from '../types-lOliroPw.js';
|
|
4
4
|
import '@elastic/apm-rum';
|
|
5
5
|
import 'ai';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Runtime v0.5.
|
|
8
|
+
* Runtime v0.5.1 event payloads.
|
|
9
9
|
*
|
|
10
10
|
* These types mirror the request/response schemas exposed by the
|
|
11
11
|
* `/event/*` endpoints. Many fields are optional because the runtime accepts
|
|
@@ -21,6 +21,8 @@ interface RuntimeEventBase {
|
|
|
21
21
|
channel_id?: string;
|
|
22
22
|
control_id?: string | null;
|
|
23
23
|
timestamp?: string;
|
|
24
|
+
/** Resolved registry version tag for versioned assistant refs (runtime v0.5.1). */
|
|
25
|
+
versiontag?: string | null;
|
|
24
26
|
}
|
|
25
27
|
/** POST /event/session-start */
|
|
26
28
|
interface SessionStartEvent extends RuntimeEventBase {
|
|
@@ -60,6 +62,27 @@ interface ToolApprovalEvent extends RuntimeEventBase {
|
|
|
60
62
|
/** Optional reason or note attached to the decision. */
|
|
61
63
|
message?: string;
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* How the runtime answered a {@link ToolApprovalEvent}. `POST /event/tool-approval`
|
|
67
|
+
* answers every refusal with a 409 and only the `detail` text tells them apart,
|
|
68
|
+
* so the SDK classifies it once here instead of every caller string-matching.
|
|
69
|
+
*
|
|
70
|
+
* - `accepted` — the decision was recorded and the parked tool call resumes (or is dropped).
|
|
71
|
+
* - `already-decided` — someone else (another operator, the originating channel) answered first.
|
|
72
|
+
* - `wrong-channel` — the gate must be answered on the channel that raised it; HTTP never will.
|
|
73
|
+
* - `not-pending` — the control id is stale or already resolved.
|
|
74
|
+
* - `forbidden` — the caller lacks an approver role or is not bound to the task's agentspace.
|
|
75
|
+
* - `not-found` — the task is gone (finished or expired).
|
|
76
|
+
* - `error` — anything else: transport failure, 5xx, an unrecognized 409.
|
|
77
|
+
*/
|
|
78
|
+
type ToolApprovalOutcome = "accepted" | "already-decided" | "wrong-channel" | "not-pending" | "forbidden" | "not-found" | "error";
|
|
79
|
+
interface ToolApprovalResult {
|
|
80
|
+
outcome: ToolApprovalOutcome;
|
|
81
|
+
/** HTTP status, when a response came back at all. */
|
|
82
|
+
status?: number;
|
|
83
|
+
/** The runtime's `detail`, verbatim, for anything but `accepted`. */
|
|
84
|
+
detail?: string;
|
|
85
|
+
}
|
|
63
86
|
/** POST /event/tool-completion (client-side tool execution result). */
|
|
64
87
|
interface ToolCompletionEvent extends ToolExecutionResponse {
|
|
65
88
|
event_class: "ToolCompletionEvent";
|
|
@@ -80,7 +103,7 @@ interface BusModeEvent extends RuntimeEventBase {
|
|
|
80
103
|
interface HeartbeatEvent extends RuntimeEventBase {
|
|
81
104
|
event_class: "HeartbeatEvent";
|
|
82
105
|
}
|
|
83
|
-
/** Discriminated union of all runtime v0.5.
|
|
106
|
+
/** Discriminated union of all runtime v0.5.1 event payloads. */
|
|
84
107
|
type RuntimeEvent = SessionStartEvent | SessionEndEvent | UserMessageEvent | AgentMessageEvent | ToolApprovalEvent | ToolCompletionEvent | RuntimeErrorEvent | BusModeEvent | HeartbeatEvent;
|
|
85
108
|
|
|
86
|
-
export type { AgentMessageEvent, BusModeEvent, HeartbeatEvent, RuntimeErrorEvent, RuntimeEvent, RuntimeEventBase, SessionEndEvent, SessionStartEvent, ToolApprovalEvent, ToolCompletionEvent, UserMessageEvent };
|
|
109
|
+
export type { AgentMessageEvent, BusModeEvent, HeartbeatEvent, RuntimeErrorEvent, RuntimeEvent, RuntimeEventBase, SessionEndEvent, SessionStartEvent, ToolApprovalEvent, ToolApprovalOutcome, ToolApprovalResult, ToolCompletionEvent, UserMessageEvent };
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts","../../src/types/type.ts"],"sourcesContent":["export * from './type';\nexport * from './runtime';\n","import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts","../../src/types/type.ts"],"sourcesContent":["export * from './type';\nexport * from './runtime';\n","import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n /** Registry version the runtime resolved for this task (runtime v0.5.1). */\n versiontag?: string | null;\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /** A text block in a multimodal `query` (runtime `TextContentPart`). */\n export interface TextContentPart {\n type: 'text';\n text: string;\n }\n\n /** An image block in a multimodal `query` (runtime `ImageContentPart`). */\n export interface ImageContentPart {\n type: 'image_url';\n image_url: {\n url: string;\n detail?: 'auto' | 'low' | 'high';\n };\n }\n\n /**\n * Catch-all for content blocks the runtime does not model explicitly. It\n * round-trips unknown provider blocks rather than failing validation.\n */\n export interface NonStandardContentPart {\n type: 'non_standard';\n value?: Record<string, unknown>;\n }\n\n export type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;\n\n /**\n * An inference `query`: either plain text, or an OpenAI-style list of content\n * parts for multimodal input.\n */\n export type Content = string | ContentPart[];\n\n /**\n * A blob held in the session context. Returned by `POST /context/blob/upload`\n * and accepted as `input_audio` on infer (runtime v0.5.1).\n */\n export interface RuntimeBlob {\n blob_id: string;\n filename: string;\n content_size: number;\n content_type?: string | null;\n checksum?: string | null;\n created_at?: number | null;\n expires_at?: number | null;\n /** Base64-encoded content. Populated by channel ingest, not by blob upload. */\n data_base64?: string | null;\n }\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
|
package/dist/types/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/type.ts"],"sourcesContent":["import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";AAeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/type.ts"],"sourcesContent":["import { Span } from \"@elastic/apm-rum\";\nimport { Message } from \"ai\";\nimport { A2uiSurface } from \"../genui\";\nexport interface ITooler {\n tooler: Array<{\n name: string;\n parameters: Record<string, any>;\n }>;\n}\n\nexport interface IToolSpec {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport abstract class ToolFactory {\n protected toolSpec: IToolSpec | null = null;\n\n constructor(toolSpec: IToolSpec) {\n this.toolSpec = toolSpec;\n }\n\n static createTool(toolSpec: IToolSpec): IToolSpec {\n return toolSpec;\n }\n\n abstract execute(): Promise<any>;\n}\n\nexport interface AIMessageChunk {\n type: string;\n data?: AIMessageChunkData;\n answer?: string;\n tooler?: ToolEvent[];\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n thinkings?: ThinkingsInferenceResponse[];\n}\n\nexport interface AIMessageChunkData {\n content: string;\n additional_kwargs?: Record<string, unknown>;\n response_metadata?: Record<string, unknown>;\n type: string;\n name?: string | null;\n id?: string | null;\n example?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n usage_metadata?: any;\n tool_call_chunks?: unknown[];\n error_code?: string;\n error_detail?: string;\n}\n\ntype ToolCall = {\n name: string;\n args: Record<string, any>;\n id?: string | null;\n};\n\ntype InvalidToolCall = {\n name: string | null;\n args: string | null;\n id: string | null;\n error: string | null;\n};\n\nexport interface BaseAPIConfig {\n baseUrl: string;\n route: string;\n token?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RatingData {\n assistantId: string;\n sessionId: string;\n topicId: number;\n score?: number;\n description?: string;\n}\n\nexport interface AttachmentPayload {\n filename: string;\n content_type: string;\n content_size: number;\n}\n\nexport type AlquimiaMessage = Message & {\n error_code?: string;\n error_detail?: string;\n taskid?: string;\n loading?: boolean;\n created_at?: string;\n additionalInfo?: string;\n tooler?: Tooler[];\n thinkings?: ThinkingsInferenceResponse[];\n attachments?: AttachmentPayload[];\n};\n\nexport interface ActionResponse<T = void> {\n success: boolean;\n data?: T;\n error?: {\n message: string;\n code?: string;\n details?: any;\n name?: string;\n cause?: string;\n status?: string;\n };\n}\n\nexport type ApmSpan = Span & {\n id?: string \n traceId?: string\n} | undefined\n\nexport type ApiError = Error & {\n message: string;\n name: string;\n cause: string;\n code?: string | number;\n status?: string | number;\n}\n\nexport type Tooler = {\n control_id: string;\n tool_summary?: ToolSummary;\n tool_output?: ToolOutput;\n}\n\nexport type ToolSummary = {\n name: string;\n parameters: Record<string, any>;\n}\n\nexport type ToolOutput = {\n result: any;\n status: string;\n}\n\nexport type ToolEvent = {\n event_class: string;\n control_id: string;\n data: any;\n status: string;\n}\n\nexport interface ConversationsMap {\n [topicId: string]: string;\n}\n\nexport interface DocumentSearchResult {\n pageContent: string;\n metadata: {\n source: string;\n _id: string;\n _collection_name: string;\n };\n score: number;\n}\n\nexport type ElevenLabsVoiceSettings = {\n stability: number;\n similarity_boost: number;\n style: number;\n};\n\nexport type ElevenLabsRequestSpecs = {\n optimize_streaming_latency: string;\n output_format: string;\n model_id: string;\n language: string;\n voice_settings: ElevenLabsVoiceSettings;\n};\n\nexport type TTSResult =\n | { type: 'blob'; data: Blob }\n | { type: 'url'; data: string }\n | { type: 'error'; message: string };\n\n /** One SSE `data:` JSON frame (`event_class` at top level). */\n export interface AlquimiaEventData {\n taskid?: string;\n event_class?: string;\n control_id?: string;\n date_submitted?: string;\n status?: string | null;\n data?: unknown;\n experts?: ExpertInferenceResponse[];\n thinkings?: ThinkingsInferenceResponse[];\n tools_output?: ToolEvent[];\n agents_output?: any[];\n tools_pending_approval?: any[];\n tools_pending_execution?: any[];\n errors?: any[];\n }\n\n export interface AssistantInferenceResponse {\n event_class: string;\n control_id: string;\n data: string;\n status: string;\n date_submitted: string;\n message?: string | null;\n extras?: Record<string, unknown> | null;\n extra_data?: ExtraDataContext | null;\n channel?: unknown | null;\n depth?: number;\n taskid?: string;\n }\n\n /**\n * Channel-scoped context returned alongside an inference response (was\n * `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel\n * the inference was triggered from.\n */\n export interface ExtraDataContext {\n whatsapp_message_id?: string;\n whatsapp_message_from?: string;\n email_message_recipient?: string;\n email_message_subject?: string;\n email_message_id?: string;\n email_message_body?: string;\n slack_team_id?: string;\n slack_user_id?: string;\n slack_channel_id?: string;\n slack_response_url?: string;\n }\n\n /**\n * JSON body returned by `POST /event/infer/{assistantId}` (and channel\n * variants). Keys match the runtime wire format (lowercase, no underscores).\n * `taskid` is the id used for the SSE stream.\n */\n export interface CommonAttributes {\n taskid?: string | null;\n parenttaskid?: string | null;\n sessionid?: string | null;\n userid?: string | null;\n assistantid?: string | null;\n agentspaceid?: string | null;\n channelid?: string | null;\n depth?: string;\n attachments?: string[];\n /** Registry version the runtime resolved for this task (runtime v0.5.1). */\n versiontag?: string | null;\n }\n\n export type InferInitResponse = CommonAttributes;\n\n /** A text block in a multimodal `query` (runtime `TextContentPart`). */\n export interface TextContentPart {\n type: 'text';\n text: string;\n }\n\n /** An image block in a multimodal `query` (runtime `ImageContentPart`). */\n export interface ImageContentPart {\n type: 'image_url';\n image_url: {\n url: string;\n detail?: 'auto' | 'low' | 'high';\n };\n }\n\n /**\n * Catch-all for content blocks the runtime does not model explicitly. It\n * round-trips unknown provider blocks rather than failing validation.\n */\n export interface NonStandardContentPart {\n type: 'non_standard';\n value?: Record<string, unknown>;\n }\n\n export type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;\n\n /**\n * An inference `query`: either plain text, or an OpenAI-style list of content\n * parts for multimodal input.\n */\n export type Content = string | ContentPart[];\n\n /**\n * A blob held in the session context. Returned by `POST /context/blob/upload`\n * and accepted as `input_audio` on infer (runtime v0.5.1).\n */\n export interface RuntimeBlob {\n blob_id: string;\n filename: string;\n content_size: number;\n content_type?: string | null;\n checksum?: string | null;\n created_at?: number | null;\n expires_at?: number | null;\n /** Base64-encoded content. Populated by channel ingest, not by blob upload. */\n data_base64?: string | null;\n }\n\n /**\n * Native-tools evaluation strategy. Wraps the client-side tool schemas\n * the SDK previously sent at the top level of the infer payload.\n */\n export interface NativeToolsEvaluationStrategy {\n evaluation_strategy_id: 'native';\n tool_schemas?: unknown[];\n max_steps?: number;\n current_step?: number;\n max_concurrent_tools?: number;\n decorators?: unknown[];\n tool_choice?: unknown;\n structured_output?: unknown;\n }\n\n export interface RawToolsEvaluationStrategy {\n evaluation_strategy_id: 'raw';\n tool_schemas?: unknown[];\n }\n\n export interface OneShootEvaluationStrategy {\n evaluation_strategy_id: 'one-shoot';\n }\n\n export type EvaluationStrategy =\n | NativeToolsEvaluationStrategy\n | RawToolsEvaluationStrategy\n | OneShootEvaluationStrategy;\n\n export interface AssistantResponseData {\n content: string;\n additional_kwargs: Record<string, any>;\n response_metadata: ResponseMetadata;\n type: string;\n id: string;\n example: boolean;\n tool_calls: any[];\n invalid_tool_calls: any[];\n usage_metadata: UsageMetadata;\n }\n\n export interface ResponseMetadata {\n token_usage: TokenUsage;\n model_name: string;\n system_fingerprint: string;\n finish_reason: string;\n logprobs: any | null;\n }\n\n export interface TokenUsage {\n completion_tokens: number;\n prompt_tokens: number;\n total_tokens: number;\n completion_time: number;\n prompt_time: number;\n queue_time: number;\n total_time: number;\n }\n\n export interface UsageMetadata {\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n }\n\n export interface ExpertInferenceResponse {\n event_class: string;\n control_id: string;\n data: {\n label: string;\n score: number;\n };\n status: string;\n date_submitted: string;\n }\n\n export interface ThinkingsInferenceResponse {\n event_class: string;\n control_id: string;\n status: string;\n date_submitted: string;\n data: {\n content: AssistantResponseData;\n is_complete: boolean;\n is_partial: boolean;\n };\n }\n\n export interface GenuiSurfaceItem {\n controlId: string;\n surface: A2uiSurface;\n /** Message-count anchor: the surface renders after this many messages (chronological ordering). */\n afterCount: number;\n /** True once the user has submitted an interactive surface (disables it + shows a submitted state). */\n submitted?: boolean;\n /** Set when the user declined the surface and typed a reply */\n dismissedWith?: string;\n }"],"mappings":";AAeO,IAAe,cAAf,MAA2B;AAAA,EAGhC,YAAY,UAAqB;AAFjC,SAAU,WAA6B;AAGrC,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,OAAO,WAAW,UAAgC;AAChD,WAAO;AAAA,EACT;AAGF;","names":[]}
|
|
@@ -65,7 +65,7 @@ interface WorklogVerificationResult {
|
|
|
65
65
|
message: string;
|
|
66
66
|
}
|
|
67
67
|
/** Semantic bucket a node belongs to. */
|
|
68
|
-
type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "answer" | "unknown";
|
|
68
|
+
type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "knowledge" | "speech" | "answer" | "unknown";
|
|
69
69
|
/** Lifecycle state of a single node. */
|
|
70
70
|
type NodeStatus = "pending" | "running" | "completed" | "failed" | "skipped";
|
|
71
71
|
/** Overall run status. */
|
|
@@ -65,7 +65,7 @@ interface WorklogVerificationResult {
|
|
|
65
65
|
message: string;
|
|
66
66
|
}
|
|
67
67
|
/** Semantic bucket a node belongs to. */
|
|
68
|
-
type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "answer" | "unknown";
|
|
68
|
+
type NodeKind = "safeguard" | "reasoning" | "tool" | "a2a" | "memory" | "knowledge" | "speech" | "answer" | "unknown";
|
|
69
69
|
/** Lifecycle state of a single node. */
|
|
70
70
|
type NodeStatus = "pending" | "running" | "completed" | "failed" | "skipped";
|
|
71
71
|
/** Overall run status. */
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseAPIConfig,
|
|
1
|
+
import { B as BaseAPIConfig, z as ThinkingsInferenceResponse, L as Tooler, b as ToolEvent, n as ConversationsMap } from '../type-C_sKpIM1.mjs';
|
|
2
2
|
import { C as CatalogManifest } from '../registry-Bcu_ZYL1.mjs';
|
|
3
3
|
import '@elastic/apm-rum';
|
|
4
4
|
import 'ai';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseAPIConfig,
|
|
1
|
+
import { B as BaseAPIConfig, z as ThinkingsInferenceResponse, L as Tooler, b as ToolEvent, n as ConversationsMap } from '../type-BFtGEEb4.js';
|
|
2
2
|
import { C as CatalogManifest } from '../registry-Bcu_ZYL1.js';
|
|
3
3
|
import '@elastic/apm-rum';
|
|
4
4
|
import 'ai';
|
package/dist/worklog/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { E as EventInterpreter, W as WorklogRecord, a as WorklogState } from '../types-
|
|
2
|
-
export { b as EventRole, N as NodeKind, c as NodeStatus, R as RunStatus, d as WorklogDetail, e as WorklogEventDetail, f as WorklogEventPage, g as WorklogNode, h as WorklogPage, i as WorklogSummary, j as WorklogVerificationResult, k as initialWorklogState } from '../types-
|
|
1
|
+
import { E as EventInterpreter, W as WorklogRecord, a as WorklogState } from '../types-lOliroPw.mjs';
|
|
2
|
+
export { b as EventRole, N as NodeKind, c as NodeStatus, R as RunStatus, d as WorklogDetail, e as WorklogEventDetail, f as WorklogEventPage, g as WorklogNode, h as WorklogPage, i as WorklogSummary, j as WorklogVerificationResult, k as initialWorklogState } from '../types-lOliroPw.mjs';
|
|
3
|
+
export { a as ApprovalDecision, A as ApprovalRequest, b as ApprovalsState, f as foldApprovals, i as initialApprovalsState, l as listApprovals, p as pendingApprovals, r as reduceApprovals } from '../approvals-dn4sd_Ot.mjs';
|
|
3
4
|
|
|
4
5
|
declare const EVENT_REGISTRY: Record<string, EventInterpreter>;
|
|
5
6
|
declare function resolveInterpreter(eventClass: string): EventInterpreter;
|
package/dist/worklog/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { E as EventInterpreter, W as WorklogRecord, a as WorklogState } from '../types-
|
|
2
|
-
export { b as EventRole, N as NodeKind, c as NodeStatus, R as RunStatus, d as WorklogDetail, e as WorklogEventDetail, f as WorklogEventPage, g as WorklogNode, h as WorklogPage, i as WorklogSummary, j as WorklogVerificationResult, k as initialWorklogState } from '../types-
|
|
1
|
+
import { E as EventInterpreter, W as WorklogRecord, a as WorklogState } from '../types-lOliroPw.js';
|
|
2
|
+
export { b as EventRole, N as NodeKind, c as NodeStatus, R as RunStatus, d as WorklogDetail, e as WorklogEventDetail, f as WorklogEventPage, g as WorklogNode, h as WorklogPage, i as WorklogSummary, j as WorklogVerificationResult, k as initialWorklogState } from '../types-lOliroPw.js';
|
|
3
|
+
export { a as ApprovalDecision, A as ApprovalRequest, b as ApprovalsState, f as foldApprovals, i as initialApprovalsState, l as listApprovals, p as pendingApprovals, r as reduceApprovals } from '../approvals-CcnmqUkQ.js';
|
|
3
4
|
|
|
4
5
|
declare const EVENT_REGISTRY: Record<string, EventInterpreter>;
|
|
5
6
|
declare function resolveInterpreter(eventClass: string): EventInterpreter;
|
package/dist/worklog/index.js
CHANGED
|
@@ -21,9 +21,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var worklog_exports = {};
|
|
22
22
|
__export(worklog_exports, {
|
|
23
23
|
EVENT_REGISTRY: () => EVENT_REGISTRY,
|
|
24
|
+
foldApprovals: () => foldApprovals,
|
|
24
25
|
foldWorklog: () => foldWorklog,
|
|
25
26
|
frameToRecord: () => frameToRecord,
|
|
27
|
+
initialApprovalsState: () => initialApprovalsState,
|
|
26
28
|
initialWorklogState: () => initialWorklogState,
|
|
29
|
+
listApprovals: () => listApprovals,
|
|
30
|
+
pendingApprovals: () => pendingApprovals,
|
|
31
|
+
reduceApprovals: () => reduceApprovals,
|
|
27
32
|
reduceWorklog: () => reduceWorklog,
|
|
28
33
|
resolveInterpreter: () => resolveInterpreter,
|
|
29
34
|
useWorklog: () => useWorklog
|
|
@@ -46,6 +51,18 @@ var agentTitle = (r) => {
|
|
|
46
51
|
return typeof name === "string" && name.length > 0 ? `Agent: ${name}` : "Agent-to-agent";
|
|
47
52
|
};
|
|
48
53
|
var constTitle = (label) => () => label;
|
|
54
|
+
var approvalTitle = (r) => {
|
|
55
|
+
const name = asRecord(asRecord(r.data).parameters).name;
|
|
56
|
+
return typeof name === "string" && name.length > 0 ? `Approval required: ${name}` : "Human approval required";
|
|
57
|
+
};
|
|
58
|
+
var shieldBlockTitle = (r) => {
|
|
59
|
+
const id = asRecord(r.data).shield_id;
|
|
60
|
+
return typeof id === "string" && id.length > 0 ? `Blocked by ${id}` : "Blocked by safeguard";
|
|
61
|
+
};
|
|
62
|
+
var knowledgeTitle = (r) => {
|
|
63
|
+
const query = asRecord(r.data).query;
|
|
64
|
+
return typeof query === "string" && query.length > 0 ? `Knowledge: ${query}` : "Knowledge retrieval";
|
|
65
|
+
};
|
|
49
66
|
var EVENT_REGISTRY = {
|
|
50
67
|
// Run envelope
|
|
51
68
|
AssistantInference: { kind: "answer", role: "run-open", title: constTitle("Inference started") },
|
|
@@ -53,6 +70,9 @@ var EVENT_REGISTRY = {
|
|
|
53
70
|
// Safeguard
|
|
54
71
|
ShieldInference: { kind: "safeguard", role: "open", title: constTitle("Safeguard") },
|
|
55
72
|
ShieldInferenceResponse: { kind: "safeguard", role: "close", title: constTitle("Safeguard") },
|
|
73
|
+
// Emitted when a shield enforcement decision blocks the request (core 0.5.x).
|
|
74
|
+
// Response-only: the reducer opens it already closed when no command matched.
|
|
75
|
+
ShieldBlockedResponse: { kind: "safeguard", role: "close", title: shieldBlockTitle },
|
|
56
76
|
// Reasoning
|
|
57
77
|
ResponseInference: { kind: "reasoning", role: "open", title: constTitle("Reasoning") },
|
|
58
78
|
ResponseInferenceResponse: { kind: "reasoning", role: "close", title: constTitle("Reasoning") },
|
|
@@ -70,6 +90,14 @@ var EVENT_REGISTRY = {
|
|
|
70
90
|
A2AInference: { kind: "a2a", role: "open", title: agentTitle },
|
|
71
91
|
AgentDiscovery: { kind: "a2a", role: "open", title: constTitle("Agent discovery") },
|
|
72
92
|
AgentDiscoveryResponse: { kind: "a2a", role: "close", title: constTitle("Agent discovery") },
|
|
93
|
+
// Knowledge retrieval (RAG) — core 0.5.x
|
|
94
|
+
KnowledgeRetrieval: { kind: "knowledge", role: "open", title: knowledgeTitle },
|
|
95
|
+
KnowledgeRetrievalResponse: { kind: "knowledge", role: "close", title: knowledgeTitle },
|
|
96
|
+
// Speech pipeline — core 0.5.x
|
|
97
|
+
SpeechTranscription: { kind: "speech", role: "open", title: constTitle("Speech-to-text") },
|
|
98
|
+
SpeechTranscriptionResponse: { kind: "speech", role: "close", title: constTitle("Speech-to-text") },
|
|
99
|
+
SpeechSynthesis: { kind: "speech", role: "open", title: constTitle("Text-to-speech") },
|
|
100
|
+
SpeechSynthesisResponse: { kind: "speech", role: "close", title: constTitle("Text-to-speech") },
|
|
73
101
|
// Memory / persistence
|
|
74
102
|
ContextPersistence: { kind: "memory", role: "open", title: constTitle("Memory persistence") },
|
|
75
103
|
ContextFlush: { kind: "memory", role: "open", title: constTitle("Memory flush") },
|
|
@@ -78,7 +106,7 @@ var EVENT_REGISTRY = {
|
|
|
78
106
|
HumanApprovalRequired: {
|
|
79
107
|
kind: "tool",
|
|
80
108
|
role: "open",
|
|
81
|
-
title:
|
|
109
|
+
title: approvalTitle,
|
|
82
110
|
pending: true
|
|
83
111
|
},
|
|
84
112
|
HumanApprovalRequiredResponse: { kind: "tool", role: "close", title: constTitle("Human approval") }
|
|
@@ -167,7 +195,12 @@ function reduceWorklog(state, record) {
|
|
|
167
195
|
const pos = Object.prototype.hasOwnProperty.call(next.index, key) ? next.index[key] : void 0;
|
|
168
196
|
if (pos != null) {
|
|
169
197
|
const existing = next.nodes[pos];
|
|
170
|
-
next.nodes[pos] = {
|
|
198
|
+
next.nodes[pos] = {
|
|
199
|
+
...existing,
|
|
200
|
+
command: existing.command ?? record.data,
|
|
201
|
+
title: existing.command === void 0 ? interp.title(record) : existing.title,
|
|
202
|
+
raw: [...existing.raw, record]
|
|
203
|
+
};
|
|
171
204
|
} else {
|
|
172
205
|
next.index[key] = next.nodes.length;
|
|
173
206
|
next.nodes.push(makeOpenNode(record, interp, key));
|
|
@@ -217,4 +250,63 @@ function frameToRecord(frame) {
|
|
|
217
250
|
previous_hash: frame.previous_hash ?? null
|
|
218
251
|
};
|
|
219
252
|
}
|
|
253
|
+
|
|
254
|
+
// src/worklog/approvals.ts
|
|
255
|
+
function initialApprovalsState() {
|
|
256
|
+
return { order: [], byId: {} };
|
|
257
|
+
}
|
|
258
|
+
var asObject = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
259
|
+
var MCP_APPROVAL_EXTENSION = "mcp_approval";
|
|
260
|
+
function describeRequest(record) {
|
|
261
|
+
const execution = asObject(asObject(record.data)?.parameters) ?? {};
|
|
262
|
+
const name = execution.name;
|
|
263
|
+
const callId = execution.control_id;
|
|
264
|
+
const args = execution.tool_call_parameters !== void 0 && execution.tool_call_parameters !== null ? execution.tool_call_parameters : execution.parameters;
|
|
265
|
+
const extensions = asObject(execution.parameters)?.runtime_extensions;
|
|
266
|
+
return {
|
|
267
|
+
toolName: typeof name === "string" && name.length > 0 ? name : null,
|
|
268
|
+
toolCallId: typeof callId === "string" ? callId : null,
|
|
269
|
+
arguments: args ?? null,
|
|
270
|
+
channelOwned: Array.isArray(extensions) && extensions.includes(MCP_APPROVAL_EXTENSION)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function describeDecision(record) {
|
|
274
|
+
const approved = record.data === true;
|
|
275
|
+
return {
|
|
276
|
+
approved,
|
|
277
|
+
reason: !approved && typeof record.data === "string" && record.data.length > 0 ? record.data : null,
|
|
278
|
+
decidedAt: record.date_submitted
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
var blank = (controlId) => ({
|
|
282
|
+
controlId,
|
|
283
|
+
toolName: null,
|
|
284
|
+
toolCallId: null,
|
|
285
|
+
arguments: null,
|
|
286
|
+
channelOwned: false,
|
|
287
|
+
requestedAt: null,
|
|
288
|
+
decision: null
|
|
289
|
+
});
|
|
290
|
+
function reduceApprovals(state, record) {
|
|
291
|
+
const isRequest = record.event_class === "HumanApprovalRequired";
|
|
292
|
+
const isResponse = record.event_class === "HumanApprovalRequiredResponse";
|
|
293
|
+
if (!isRequest && !isResponse || !record.control_id) return state;
|
|
294
|
+
const id = record.control_id;
|
|
295
|
+
const known = state.byId[id];
|
|
296
|
+
const current = known ?? blank(id);
|
|
297
|
+
const next = isRequest ? { ...current, ...describeRequest(record), requestedAt: record.date_submitted } : { ...current, decision: current.decision ?? describeDecision(record) };
|
|
298
|
+
return {
|
|
299
|
+
order: known ? state.order : [...state.order, id],
|
|
300
|
+
byId: { ...state.byId, [id]: next }
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function foldApprovals(records) {
|
|
304
|
+
return records.reduce(reduceApprovals, initialApprovalsState());
|
|
305
|
+
}
|
|
306
|
+
function listApprovals(state) {
|
|
307
|
+
return state.order.map((id) => state.byId[id]);
|
|
308
|
+
}
|
|
309
|
+
function pendingApprovals(state) {
|
|
310
|
+
return listApprovals(state).filter((a) => a.decision === null);
|
|
311
|
+
}
|
|
220
312
|
//# sourceMappingURL=index.js.map
|