@fevex/core 0.1.0-alpha.1 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +424 -6
  2. package/dist/agents/index.d.mts +1 -1
  3. package/dist/agents/index.mjs +1 -1
  4. package/dist/channels/index.d.mts +2 -0
  5. package/dist/channels/index.mjs +150 -0
  6. package/dist/evals/index.d.mts +19 -11
  7. package/dist/evals/index.mjs +125 -122
  8. package/dist/fevex-Ddyi6z6L.d.mts +60 -0
  9. package/dist/http/index.d.mts +90 -0
  10. package/dist/http/index.mjs +470 -0
  11. package/dist/{index-ojCY3lwm.d.mts → index-B4PIkqOU.d.mts} +5 -4
  12. package/dist/index-Bg9rr8Qe.d.mts +50 -0
  13. package/dist/index-Bgcxgy66.d.mts +82 -0
  14. package/dist/index-CTIwrVf9.d.mts +51 -0
  15. package/dist/index-CqOjvtQ9.d.mts +132 -0
  16. package/dist/index-CrOId2px.d.mts +66 -0
  17. package/dist/index-DeXUtyd9.d.mts +70 -0
  18. package/dist/index-DviHtsLo.d.mts +58 -0
  19. package/dist/index-Dx_LotWZ.d.mts +425 -0
  20. package/dist/{index-QTkd6a7C.d.mts → index-dkFyTNh4.d.mts} +4 -3
  21. package/dist/index.d.mts +22 -10
  22. package/dist/index.mjs +2784 -720
  23. package/dist/knowledge/index.d.mts +2 -0
  24. package/dist/knowledge/index.mjs +89 -0
  25. package/dist/models/index.d.mts +2 -46
  26. package/dist/observability/index.d.mts +1 -1
  27. package/dist/policies/index.d.mts +1 -1
  28. package/dist/policies/index.mjs +1 -1
  29. package/dist/run-error-Cr17wPGH.mjs +23 -0
  30. package/dist/runtime/index.d.mts +2 -2
  31. package/dist/runtime/index.mjs +58 -9
  32. package/dist/sandbox/index.d.mts +2 -0
  33. package/dist/sandbox/index.mjs +122 -0
  34. package/dist/teams/index.d.mts +2 -0
  35. package/dist/teams/index.mjs +2 -0
  36. package/dist/teams-Ctz676G4.mjs +82 -0
  37. package/dist/testing/index.d.mts +33 -9
  38. package/dist/testing/index.mjs +415 -27
  39. package/dist/tools/index.d.mts +3 -3
  40. package/dist/tools/index.mjs +222 -2
  41. package/dist/types-CuoRx12Q.d.mts +333 -0
  42. package/dist/workflows/index.d.mts +2 -0
  43. package/dist/workflows/index.mjs +6 -0
  44. package/package.json +27 -3
  45. package/dist/fevex-Dz6GBz9o.d.mts +0 -32
  46. package/dist/index-BzxHfyYV.d.mts +0 -23
  47. package/dist/index-CZGyhNIQ.d.mts +0 -47
  48. package/dist/index-C_Zpr13f.d.mts +0 -124
  49. package/dist/index-DGWOGXzc.d.mts +0 -181
@@ -1,23 +0,0 @@
1
- import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
2
- import { ModelRef, ReasoningEffort } from "./models/index.mjs";
3
- import { StandardSchemaV1 } from "@standard-schema/spec";
4
- //#region src/agents/index.d.ts
5
- interface AgentLimits {
6
- maxSteps?: number;
7
- maxToolCalls?: number;
8
- maxInputTokens?: number | false;
9
- maxOutputTokens?: number | false;
10
- }
11
- interface AgentDefinition<TOutput = unknown> {
12
- name: string;
13
- instructions: string;
14
- model?: ModelRef;
15
- tools?: string[];
16
- reasoning?: ReasoningEffort;
17
- modelOptions?: Record<string, unknown>;
18
- outputSchema?: StandardSchemaV1<unknown, TOutput>;
19
- limits?: AgentLimits;
20
- }
21
- declare function defineAgent<T extends AgentDefinition>(agent: ExactDefinition<T, AgentDefinition>): T;
22
- //#endregion
23
- export { AgentLimits as n, defineAgent as r, AgentDefinition as t };
@@ -1,47 +0,0 @@
1
- import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
2
- import { f as RunId, h as ToolSpec, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./index-C_Zpr13f.mjs";
3
- import { StandardSchemaV1 } from "@standard-schema/spec";
4
- //#region src/tools/index.d.ts
5
- interface ToolExecutionContext {
6
- runId: RunId;
7
- toolCallId: string;
8
- attempt: number;
9
- idempotencyKey: string;
10
- getCredential(name: string): Promise<string>;
11
- context?: ExecutionContext;
12
- signal?: AbortSignal;
13
- }
14
- type ToolRisk = 'read' | 'write' | 'sensitive' | 'destructive';
15
- type ToolApproval = 'never' | 'required';
16
- type ToolIdempotency = 'none' | 'keyed';
17
- interface ToolRetryPolicy {
18
- maxAttempts: number;
19
- backoffMs: number;
20
- maxBackoffMs?: number;
21
- }
22
- interface ToolDefinition<TInput = unknown, TOutput = unknown> {
23
- name: string;
24
- description?: string;
25
- inputSchema?: StandardSchemaV1<unknown, TInput>;
26
- outputSchema?: StandardSchemaV1<unknown, TOutput>;
27
- risk?: ToolRisk;
28
- approval?: ToolApproval;
29
- idempotency?: ToolIdempotency;
30
- retry?: ToolRetryPolicy;
31
- credentials?: string[];
32
- execute(input: TInput, context: ToolExecutionContext): TOutput | Promise<TOutput>;
33
- }
34
- type ToolWithSchemas<TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1> = Omit<ToolDefinition<StandardSchemaV1.InferOutput<TInputSchema>, StandardSchemaV1.InferOutput<TOutputSchema>>, 'inputSchema' | 'outputSchema'> & {
35
- inputSchema: TInputSchema;
36
- outputSchema: TOutputSchema;
37
- };
38
- type ToolWithInputSchema<TInputSchema extends StandardSchemaV1> = Omit<ToolDefinition<StandardSchemaV1.InferOutput<TInputSchema>, unknown>, 'inputSchema'> & {
39
- inputSchema: TInputSchema;
40
- };
41
- declare function defineTool<TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TDefinition extends ToolWithSchemas<TInputSchema, TOutputSchema>>(tool: ToolWithSchemas<TInputSchema, TOutputSchema> & ExactDefinition<TDefinition, ToolWithSchemas<TInputSchema, TOutputSchema>>): TDefinition;
42
- declare function defineTool<TInputSchema extends StandardSchemaV1, TDefinition extends ToolWithInputSchema<TInputSchema>>(tool: ToolWithInputSchema<TInputSchema> & ExactDefinition<TDefinition, ToolWithInputSchema<TInputSchema>>): TDefinition;
43
- declare function defineTool<TDefinition extends ToolDefinition>(tool: ToolDefinition & ExactDefinition<TDefinition, ToolDefinition>): TDefinition;
44
- declare function toToolSpec(tool: ToolDefinition, inputSchema?: JsonObject): ToolSpec;
45
- type ToolResult = JsonValue;
46
- //#endregion
47
- export { ToolResult as a, defineTool as c, ToolIdempotency as i, toToolSpec as l, ToolDefinition as n, ToolRetryPolicy as o, ToolExecutionContext as r, ToolRisk as s, ToolApproval as t };
@@ -1,124 +0,0 @@
1
- //#region src/core/index.d.ts
2
- type JsonPrimitive = string | number | boolean | null;
3
- type JsonObject = {
4
- [key: string]: JsonValue;
5
- };
6
- type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
7
- type RunId = string;
8
- declare const SCHEMA_NOT_TRANSPORTABLE = "SCHEMA_NOT_TRANSPORTABLE";
9
- declare const PROVIDER_SCHEMA_UNSUPPORTED = "PROVIDER_SCHEMA_UNSUPPORTED";
10
- declare const PROVIDER_REASONING_UNSUPPORTED = "PROVIDER_REASONING_UNSUPPORTED";
11
- interface ExecutionContext {
12
- namespace?: string;
13
- actor?: {
14
- id: string;
15
- type?: string;
16
- };
17
- attributes?: JsonObject;
18
- prompt?: JsonObject;
19
- }
20
- type AgentMessageRole = 'system' | 'user' | 'assistant' | 'tool';
21
- interface AgentMessage {
22
- role: AgentMessageRole;
23
- content: string;
24
- name?: string;
25
- toolCallId?: string;
26
- toolCalls?: ToolCall[];
27
- }
28
- interface ToolSpec {
29
- name: string;
30
- description?: string;
31
- inputSchema?: JsonObject;
32
- }
33
- interface ToolCall {
34
- id: string;
35
- name: string;
36
- input: JsonValue;
37
- }
38
- type AgentEventType = 'run.started' | 'run.paused' | 'run.resumed' | 'model.started' | 'model.output.delta' | 'model.completed' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.retrying' | 'tool.execution_unknown' | 'approval.requested' | 'approval.resolved' | 'run.completed' | 'run.failed' | 'run.cancelled';
39
- interface AgentEventPayloads {
40
- 'run.started': undefined;
41
- 'run.paused': {
42
- reason: 'approval' | 'tool_execution_unknown';
43
- toolCallId: string;
44
- };
45
- 'run.resumed': undefined;
46
- 'model.started': {
47
- step: number;
48
- };
49
- 'model.output.delta': {
50
- step: number;
51
- delta: string;
52
- };
53
- 'model.completed': {
54
- step: number;
55
- usage?: JsonObject;
56
- };
57
- 'tool.started': {
58
- step: number;
59
- toolCallId: string;
60
- toolName: string;
61
- attempt?: number;
62
- };
63
- 'tool.completed': {
64
- step: number;
65
- toolCallId: string;
66
- toolName: string;
67
- attempt?: number;
68
- };
69
- 'tool.failed': {
70
- step: number;
71
- toolCallId: string;
72
- toolName: string;
73
- error: string;
74
- };
75
- 'tool.retrying': {
76
- step: number;
77
- toolCallId: string;
78
- toolName: string;
79
- attempt: number;
80
- delayMs: number;
81
- error: string;
82
- };
83
- 'tool.execution_unknown': {
84
- step: number;
85
- toolCallId: string;
86
- toolName: string;
87
- };
88
- 'approval.requested': {
89
- approvalId: string;
90
- toolCallId: string;
91
- toolName: string;
92
- };
93
- 'approval.resolved': {
94
- approvalId: string;
95
- toolCallId: string;
96
- decision: 'approve' | 'reject';
97
- actorId: string;
98
- };
99
- 'run.completed': {
100
- output: JsonValue;
101
- usage?: JsonObject;
102
- };
103
- 'run.failed': {
104
- error: string;
105
- };
106
- 'run.cancelled': {
107
- reason: 'aborted' | 'timeout' | 'approval_rejected';
108
- };
109
- }
110
- interface AgentEventBase {
111
- id: string;
112
- sequence: number;
113
- runId: RunId;
114
- timestamp: string;
115
- }
116
- type AgentEvent<TType extends AgentEventType = AgentEventType> = { [TCurrent in TType]: AgentEventBase & {
117
- type: TCurrent;
118
- } & (AgentEventPayloads[TCurrent] extends undefined ? {
119
- payload?: never;
120
- } : {
121
- payload: AgentEventPayloads[TCurrent];
122
- }); }[TType];
123
- //#endregion
124
- export { AgentMessageRole as a, JsonPrimitive as c, PROVIDER_SCHEMA_UNSUPPORTED as d, RunId as f, ToolSpec as h, AgentMessage as i, JsonValue as l, ToolCall as m, AgentEventPayloads as n, ExecutionContext as o, SCHEMA_NOT_TRANSPORTABLE as p, AgentEventType as r, JsonObject as s, AgentEvent as t, PROVIDER_REASONING_UNSUPPORTED as u };
@@ -1,181 +0,0 @@
1
- import { f as RunId, i as AgentMessage, l as JsonValue, o as ExecutionContext, t as AgentEvent } from "./index-C_Zpr13f.mjs";
2
- import { ModelUsage } from "./models/index.mjs";
3
- import { StandardSchemaV1 } from "@standard-schema/spec";
4
- //#region src/runtime/index.d.ts
5
- type SessionId = string;
6
- type RunStatus = 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
7
- interface ApprovalRequest {
8
- id: string;
9
- toolCallId: string;
10
- toolName: string;
11
- input: JsonValue;
12
- risk: 'read' | 'write' | 'sensitive' | 'destructive';
13
- requestedAt: string;
14
- }
15
- type RunPause = {
16
- type: 'approval';
17
- approval: ApprovalRequest;
18
- } | {
19
- type: 'tool_execution_unknown';
20
- toolCallId: string;
21
- toolName: string;
22
- input: JsonValue;
23
- };
24
- interface ApprovalResolution {
25
- type: 'approval';
26
- approvalId: string;
27
- decision: 'approve' | 'reject';
28
- actor: {
29
- id: string;
30
- type?: string;
31
- };
32
- }
33
- type ToolExecutionResolution = {
34
- type: 'tool_execution';
35
- toolCallId: string;
36
- decision: 'use_output';
37
- output: JsonValue;
38
- actor: {
39
- id: string;
40
- type?: string;
41
- };
42
- } | {
43
- type: 'tool_execution';
44
- toolCallId: string;
45
- decision: 'retry';
46
- actor: {
47
- id: string;
48
- type?: string;
49
- };
50
- };
51
- type ResumeRunResolution = ApprovalResolution | ToolExecutionResolution;
52
- interface AgentRun<TOutput = JsonValue> {
53
- id: RunId;
54
- sessionId: SessionId;
55
- agentName: string;
56
- status: RunStatus;
57
- revision: number;
58
- pause?: RunPause;
59
- createdAt: string;
60
- updatedAt: string;
61
- output?: TOutput;
62
- error?: string;
63
- usage?: ModelUsage;
64
- }
65
- interface Session {
66
- id: SessionId;
67
- history: AgentMessage[];
68
- createdAt: string;
69
- updatedAt: string;
70
- }
71
- interface ListEventsOptions {
72
- after?: AgentEvent['id'];
73
- }
74
- interface RunStore {
75
- getRun(runId: RunId): Promise<AgentRun | undefined>;
76
- saveRun(run: AgentRun): Promise<void>;
77
- getSession(sessionId: SessionId): Promise<Session | undefined>;
78
- saveSession(session: Session): Promise<void>;
79
- appendEvent(event: AgentEvent): Promise<void>;
80
- listEvents(runId: RunId, options?: ListEventsOptions): Promise<AgentEvent[]>;
81
- }
82
- interface CredentialStore {
83
- resolve(input: {
84
- name: string;
85
- namespace?: string;
86
- actor?: {
87
- id: string;
88
- type?: string;
89
- };
90
- }): Promise<string | undefined>;
91
- }
92
- interface PendingToolExecution {
93
- call: {
94
- id: string;
95
- name: string;
96
- input: JsonValue;
97
- };
98
- input: JsonValue;
99
- idempotencyKey: string;
100
- attempt: number;
101
- }
102
- interface RunCheckpoint {
103
- runId: RunId;
104
- definitionHash: string;
105
- messages: AgentMessage[];
106
- inputContent: string;
107
- context?: ExecutionContext;
108
- usage?: ModelUsage;
109
- providerState?: JsonValue;
110
- step: number;
111
- toolCallCount: number;
112
- seenToolCallIds: string[];
113
- pendingTools: PendingToolExecution[];
114
- pendingIndex: number;
115
- }
116
- type ToolExecutionStatus = 'started' | 'completed' | 'failed' | 'unknown';
117
- interface ToolExecutionRecord {
118
- runId: RunId;
119
- toolCallId: string;
120
- toolName: string;
121
- input: JsonValue;
122
- status: ToolExecutionStatus;
123
- attempt: number;
124
- idempotencyKey: string;
125
- output?: JsonValue;
126
- error?: string;
127
- updatedAt: string;
128
- }
129
- interface RunLease {
130
- runId: RunId;
131
- ownerId: string;
132
- expiresAt: string;
133
- }
134
- interface ExecutionCommit {
135
- expectedRevision: number;
136
- run: AgentRun;
137
- checkpoint?: RunCheckpoint | null;
138
- session?: Session;
139
- toolExecution?: ToolExecutionRecord;
140
- events?: AgentEvent[];
141
- }
142
- interface DurableRunStore extends RunStore {
143
- getCheckpoint(runId: RunId): Promise<RunCheckpoint | undefined>;
144
- getToolExecution(runId: RunId, toolCallId: string): Promise<ToolExecutionRecord | undefined>;
145
- commitExecution(commit: ExecutionCommit): Promise<boolean>;
146
- acquireLease(lease: RunLease): Promise<boolean>;
147
- renewLease(lease: RunLease): Promise<boolean>;
148
- releaseLease(runId: RunId, ownerId: string): Promise<void>;
149
- }
150
- declare function isDurableRunStore(store: RunStore): store is DurableRunStore;
151
- declare class InMemoryRunStore implements DurableRunStore {
152
- #private;
153
- getRun(runId: RunId): Promise<AgentRun | undefined>;
154
- saveRun(run: AgentRun): Promise<void>;
155
- getSession(sessionId: SessionId): Promise<Session | undefined>;
156
- saveSession(session: Session): Promise<void>;
157
- appendEvent(event: AgentEvent): Promise<void>;
158
- listEvents(runId: RunId, options?: ListEventsOptions): Promise<AgentEvent[]>;
159
- getCheckpoint(runId: RunId): Promise<RunCheckpoint | undefined>;
160
- getToolExecution(runId: RunId, toolCallId: string): Promise<ToolExecutionRecord | undefined>;
161
- commitExecution(commit: ExecutionCommit): Promise<boolean>;
162
- acquireLease(lease: RunLease): Promise<boolean>;
163
- renewLease(lease: RunLease): Promise<boolean>;
164
- releaseLease(runId: RunId, ownerId: string): Promise<void>;
165
- }
166
- interface RunRequest<TInput = unknown, TOutput = unknown> {
167
- input: TInput;
168
- context?: ExecutionContext;
169
- outputSchema?: StandardSchemaV1<unknown, TOutput>;
170
- sessionId?: SessionId;
171
- signal?: AbortSignal;
172
- }
173
- interface RunResult<TOutput = unknown> {
174
- runId: RunId;
175
- sessionId: SessionId;
176
- output: TOutput;
177
- events?: AgentEvent[];
178
- usage?: ModelUsage;
179
- }
180
- //#endregion
181
- export { isDurableRunStore as C, ToolExecutionStatus as S, RunStore as _, DurableRunStore as a, ToolExecutionRecord as b, ListEventsOptions as c, RunCheckpoint as d, RunLease as f, RunStatus as g, RunResult as h, CredentialStore as i, PendingToolExecution as l, RunRequest as m, ApprovalRequest as n, ExecutionCommit as o, RunPause as p, ApprovalResolution as r, InMemoryRunStore as s, AgentRun as t, ResumeRunResolution as u, Session as v, ToolExecutionResolution as x, SessionId as y };