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

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
@@ -0,0 +1,132 @@
1
+ import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
2
+ import { f as RunId, g as ToolSpec, h as ToolEventSource, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CuoRx12Q.mjs";
3
+ import { i as SandboxCapabilities, r as Sandbox } from "./index-CrOId2px.mjs";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+ //#region src/tools/tool.d.ts
6
+ interface ToolExecutionContext {
7
+ runId: RunId;
8
+ toolCallId: string;
9
+ attempt: number;
10
+ idempotencyKey: string;
11
+ getCredential(name: string): Promise<string>;
12
+ sandbox?: Sandbox;
13
+ context?: ExecutionContext;
14
+ signal?: AbortSignal;
15
+ }
16
+ type ToolRisk = 'read' | 'write' | 'sensitive' | 'destructive';
17
+ type ToolApproval = 'never' | 'required';
18
+ type ToolIdempotency = 'none' | 'keyed';
19
+ interface ToolRetryPolicy {
20
+ maxAttempts: number;
21
+ backoffMs: number;
22
+ maxBackoffMs?: number;
23
+ }
24
+ interface ToolDefinition<TInput = unknown, TOutput = unknown> {
25
+ name: string;
26
+ label?: string;
27
+ description?: string;
28
+ inputSchema?: StandardSchemaV1<unknown, TInput>;
29
+ outputSchema?: StandardSchemaV1<unknown, TOutput>;
30
+ inputJsonSchema?: JsonObject;
31
+ outputJsonSchema?: JsonObject;
32
+ risk?: ToolRisk;
33
+ approval?: ToolApproval;
34
+ idempotency?: ToolIdempotency;
35
+ retry?: ToolRetryPolicy;
36
+ credentials?: string[];
37
+ sandbox?: SandboxCapabilities;
38
+ source?: ToolEventSource;
39
+ resolve?: (context?: ToolProviderContext) => Promise<ToolProviderTool | undefined>;
40
+ execute(input: TInput, context: ToolExecutionContext): TOutput | Promise<TOutput>;
41
+ }
42
+ type ToolWithSchemas<TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1> = Omit<ToolDefinition<StandardSchemaV1.InferOutput<TInputSchema>, StandardSchemaV1.InferOutput<TOutputSchema>>, 'inputSchema' | 'outputSchema'> & {
43
+ inputSchema: TInputSchema;
44
+ outputSchema: TOutputSchema;
45
+ };
46
+ type ToolWithInputSchema<TInputSchema extends StandardSchemaV1> = Omit<ToolDefinition<StandardSchemaV1.InferOutput<TInputSchema>, unknown>, 'inputSchema'> & {
47
+ inputSchema: TInputSchema;
48
+ };
49
+ declare function defineTool<TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TDefinition extends ToolWithSchemas<TInputSchema, TOutputSchema>>(tool: ToolWithSchemas<TInputSchema, TOutputSchema> & ExactDefinition<TDefinition, ToolWithSchemas<TInputSchema, TOutputSchema>>): TDefinition;
50
+ declare function defineTool<TInputSchema extends StandardSchemaV1, TDefinition extends ToolWithInputSchema<TInputSchema>>(tool: ToolWithInputSchema<TInputSchema> & ExactDefinition<TDefinition, ToolWithInputSchema<TInputSchema>>): TDefinition;
51
+ declare function defineTool<TDefinition extends ToolDefinition>(tool: ToolDefinition & ExactDefinition<TDefinition, ToolDefinition>): TDefinition;
52
+ declare function toToolSpec(tool: ToolDefinition, inputSchema?: JsonObject): ToolSpec;
53
+ type ToolResult = JsonValue;
54
+ //#endregion
55
+ //#region src/tools/connection.d.ts
56
+ interface ToolProviderContext {
57
+ runId?: RunId;
58
+ toolCallId?: string;
59
+ attempt?: number;
60
+ idempotencyKey?: string;
61
+ context?: ExecutionContext;
62
+ signal?: AbortSignal;
63
+ }
64
+ interface ToolProviderTool {
65
+ name: string;
66
+ label?: string;
67
+ description?: string;
68
+ inputSchema?: JsonObject;
69
+ outputSchema?: JsonObject;
70
+ }
71
+ interface ToolProvider {
72
+ kind?: string;
73
+ listTools(context?: ToolProviderContext): Promise<ToolProviderTool[]>;
74
+ callTool(name: string, input: JsonValue, context: ToolProviderContext): JsonValue | Promise<JsonValue>;
75
+ close?(): Promise<void>;
76
+ }
77
+ type IntegrationErrorCategory = 'auth' | 'validation' | 'network' | 'remote' | 'timeout';
78
+ /** Safe, provider-neutral error surfaced by connection adapters. */
79
+ declare class IntegrationError extends Error {
80
+ readonly code: string;
81
+ readonly category: IntegrationErrorCategory;
82
+ readonly retryable: boolean;
83
+ readonly safeMessage: string;
84
+ readonly name = "IntegrationError";
85
+ constructor(code: string, category: IntegrationErrorCategory, retryable: boolean, safeMessage: string, options?: ErrorOptions & {
86
+ source?: ToolEventSource;
87
+ });
88
+ readonly source?: ToolEventSource;
89
+ }
90
+ interface ConnectionToolPolicy {
91
+ label?: string;
92
+ description?: string;
93
+ inputSchema?: JsonObject;
94
+ outputSchema?: JsonObject;
95
+ risk?: ToolRisk;
96
+ approval?: ToolApproval;
97
+ idempotency?: ToolIdempotency;
98
+ retry?: ToolRetryPolicy;
99
+ credentials?: string[];
100
+ }
101
+ interface ConnectionDefinition {
102
+ name: string;
103
+ provider: ToolProvider;
104
+ allowlist?: readonly string[];
105
+ tools?: {
106
+ allow: readonly string[];
107
+ } | Record<string, ConnectionToolPolicy>;
108
+ timeoutMs?: number;
109
+ }
110
+ declare function defineConnection<TDefinition extends ConnectionDefinition>(connection: TDefinition): TDefinition;
111
+ //#endregion
112
+ //#region src/tools/json-schema-profile.d.ts
113
+ declare const FEVEX_JSON_SCHEMA_PROFILE_VERSION = "1";
114
+ interface FevexJsonSchemaProfileLimits {
115
+ maxBytes?: number;
116
+ maxDepth?: number;
117
+ maxNodes?: number;
118
+ maxProperties?: number;
119
+ }
120
+ interface FevexJsonSchemaProfileOptions {
121
+ rootDocument?: JsonObject;
122
+ requireRootObject?: boolean;
123
+ limits?: FevexJsonSchemaProfileLimits;
124
+ }
125
+ interface FevexJsonSchemaValidator {
126
+ schema: JsonObject;
127
+ validate(value: unknown, path?: string): JsonValue;
128
+ }
129
+ declare function validateFevexJsonSchemaProfile(schema: JsonObject, options?: FevexJsonSchemaProfileOptions): JsonObject;
130
+ declare function compileFevexJsonSchema(schema: JsonObject, options?: FevexJsonSchemaProfileOptions): FevexJsonSchemaValidator;
131
+ //#endregion
132
+ export { toToolSpec as C, defineTool as S, ToolExecutionContext as _, compileFevexJsonSchema as a, ToolRetryPolicy as b, ConnectionToolPolicy as c, ToolProvider as d, ToolProviderContext as f, ToolDefinition as g, ToolApproval as h, FevexJsonSchemaValidator as i, IntegrationError as l, defineConnection as m, FevexJsonSchemaProfileLimits as n, validateFevexJsonSchemaProfile as o, ToolProviderTool as p, FevexJsonSchemaProfileOptions as r, ConnectionDefinition as s, FEVEX_JSON_SCHEMA_PROFILE_VERSION as t, IntegrationErrorCategory as u, ToolIdempotency as v, ToolRisk as x, ToolResult as y };
@@ -0,0 +1,66 @@
1
+ import { f as RunId, l as JsonValue, o as ExecutionContext } from "./types-CuoRx12Q.mjs";
2
+ //#region src/sandbox/sandbox.d.ts
3
+ interface SandboxCapabilities {
4
+ process?: {
5
+ commands?: readonly string[];
6
+ timeoutMs?: number;
7
+ };
8
+ filesystem?: {
9
+ cwd?: string;
10
+ read?: readonly string[];
11
+ write?: readonly string[];
12
+ };
13
+ network?: false | {
14
+ allow?: readonly string[];
15
+ };
16
+ resources?: {
17
+ timeoutMs?: number;
18
+ maxOutputBytes?: number;
19
+ };
20
+ }
21
+ interface SandboxRunRequest {
22
+ command: string;
23
+ args?: readonly string[];
24
+ cwd?: string;
25
+ env?: Record<string, string>;
26
+ input?: string;
27
+ timeoutMs?: number;
28
+ maxOutputBytes?: number;
29
+ capabilities?: SandboxCapabilities;
30
+ runId?: RunId;
31
+ toolCallId?: string;
32
+ attempt?: number;
33
+ idempotencyKey?: string;
34
+ context?: ExecutionContext;
35
+ signal?: AbortSignal;
36
+ }
37
+ interface SandboxRunResult {
38
+ exitCode: number | null;
39
+ stdout: string;
40
+ stderr: string;
41
+ durationMs: number;
42
+ timedOut: boolean;
43
+ }
44
+ interface Sandbox {
45
+ run(request: SandboxRunRequest): Promise<SandboxRunResult>;
46
+ }
47
+ declare class SandboxError extends Error {
48
+ readonly code: string;
49
+ readonly safeMessage: string;
50
+ readonly name = "SandboxError";
51
+ constructor(code: string, safeMessage: string, options?: ErrorOptions);
52
+ }
53
+ declare function sandboxResultToJson(result: SandboxRunResult): JsonValue;
54
+ //#endregion
55
+ //#region src/sandbox/local-sandbox.d.ts
56
+ interface LocalSandboxOptions {
57
+ rootDir: string;
58
+ commands: readonly string[];
59
+ defaultTimeoutMs?: number;
60
+ maxOutputBytes?: number;
61
+ env?: Record<string, string>;
62
+ }
63
+ /** Creates a subprocess sandbox restricted to a root directory and command allowlist. */
64
+ declare function createLocalSandbox(options: LocalSandboxOptions): Sandbox;
65
+ //#endregion
66
+ export { SandboxError as a, sandboxResultToJson as c, SandboxCapabilities as i, createLocalSandbox as n, SandboxRunRequest as o, Sandbox as r, SandboxRunResult as s, LocalSandboxOptions as t };
@@ -0,0 +1,70 @@
1
+ import { l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CuoRx12Q.mjs";
2
+ import { M as SessionId } from "./index-Dx_LotWZ.mjs";
3
+ //#region src/knowledge/knowledge.d.ts
4
+ /** Runtime context supplied to knowledge providers and memory stores. */
5
+ interface KnowledgeContext {
6
+ agentName: string;
7
+ input: string;
8
+ sessionId: SessionId;
9
+ context?: ExecutionContext;
10
+ signal?: AbortSignal;
11
+ }
12
+ interface ContextBlock {
13
+ id: string;
14
+ content: string;
15
+ metadata?: JsonObject;
16
+ }
17
+ interface ContextProvider {
18
+ name: string;
19
+ read(context: KnowledgeContext): Promise<ContextBlock[]>;
20
+ }
21
+ interface MemoryQuery {
22
+ query: string;
23
+ limit?: number;
24
+ agentName?: string;
25
+ sessionId?: SessionId;
26
+ namespace?: string;
27
+ actor?: ExecutionContext['actor'];
28
+ }
29
+ interface MemoryWrite {
30
+ content: string;
31
+ agentName?: string;
32
+ sessionId?: SessionId;
33
+ namespace?: string;
34
+ actor?: ExecutionContext['actor'];
35
+ metadata?: JsonObject;
36
+ }
37
+ interface MemoryRecord extends MemoryWrite {
38
+ id: string;
39
+ createdAt: string;
40
+ }
41
+ interface MemoryStore {
42
+ search(query: MemoryQuery, context: KnowledgeContext): Promise<MemoryRecord[]>;
43
+ write(record: MemoryWrite, context: KnowledgeContext): Promise<MemoryRecord>;
44
+ }
45
+ interface SkillDefinition {
46
+ name: string;
47
+ instructions: string;
48
+ resources?: Array<string | JsonValue | {
49
+ id?: string;
50
+ content: string | JsonValue;
51
+ metadata?: JsonObject;
52
+ }>;
53
+ }
54
+ declare function defineContextProvider<T extends ContextProvider>(provider: T): T;
55
+ declare function defineSkill(skill: SkillDefinition): ContextProvider;
56
+ declare function createMemoryContextProvider(options: {
57
+ name?: string;
58
+ store: MemoryStore;
59
+ limit?: number;
60
+ }): ContextProvider;
61
+ //#endregion
62
+ //#region src/knowledge/in-memory-memory-store.d.ts
63
+ /** Volatile keyword-search memory store for tests and local development. */
64
+ declare class InMemoryMemoryStore implements MemoryStore {
65
+ #private;
66
+ search(query: MemoryQuery, context: KnowledgeContext): Promise<MemoryRecord[]>;
67
+ write(record: MemoryWrite, context: KnowledgeContext): Promise<MemoryRecord>;
68
+ }
69
+ //#endregion
70
+ export { MemoryQuery as a, MemoryWrite as c, defineContextProvider as d, defineSkill as f, KnowledgeContext as i, SkillDefinition as l, ContextBlock as n, MemoryRecord as o, ContextProvider as r, MemoryStore as s, InMemoryMemoryStore as t, createMemoryContextProvider as u };
@@ -0,0 +1,58 @@
1
+ import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
2
+ import { f as RunId, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CuoRx12Q.mjs";
3
+ import { D as RunRequest, M as SessionId, O as RunResult, n as AgentLimits } from "./index-Dx_LotWZ.mjs";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+ //#region src/workflows/workflow.d.ts
6
+ /** Context shared with workflow steps and compensation handlers. */
7
+ interface WorkflowStepContext {
8
+ runId: RunId;
9
+ sessionId: SessionId;
10
+ stepId: string;
11
+ context?: ExecutionContext;
12
+ signal: AbortSignal;
13
+ }
14
+ interface WorkflowStepOptions<TResult = unknown> {
15
+ compensate?(result: TResult, context: WorkflowStepContext): void | Promise<void>;
16
+ /** Metadata persisted with the step and its lifecycle events. */
17
+ metadata?: JsonObject;
18
+ }
19
+ type WorkflowAgentResult<TOutput = unknown> = Omit<RunResult<TOutput>, 'events'>;
20
+ interface WorkflowEventResult<TPayload extends JsonValue = JsonValue> {
21
+ payload?: TPayload;
22
+ actor?: NonNullable<ExecutionContext['actor']>;
23
+ receivedAt: string;
24
+ }
25
+ interface WorkflowEventDefinition<TPayload extends JsonValue = JsonValue> {
26
+ payloadSchema?: StandardSchemaV1<unknown, TPayload>;
27
+ requireActor?: boolean;
28
+ }
29
+ interface WorkflowStep {
30
+ agent<TInput = unknown, TOutput = unknown>(stepId: string, agentName: string, request: RunRequest<TInput, TOutput>, options?: WorkflowStepOptions<WorkflowAgentResult<TOutput>>): Promise<WorkflowAgentResult<TOutput>>;
31
+ parallel<TTasks extends Record<string, () => Promise<unknown>>>(stepId: string, tasks: TTasks, options?: WorkflowStepOptions<{ [TKey in keyof TTasks]: Awaited<ReturnType<TTasks[TKey]>>; }>): Promise<{ [TKey in keyof TTasks]: Awaited<ReturnType<TTasks[TKey]>>; }>;
32
+ waitUntil(stepId: string, resumeAt: string | Date): Promise<void>;
33
+ waitForEvent<TPayload extends JsonValue = JsonValue>(stepId: string, eventName: string): Promise<WorkflowEventResult<TPayload>>;
34
+ }
35
+ interface WorkflowDefinition<TInput = unknown, TOutput = unknown> {
36
+ name: string;
37
+ inputSchema?: StandardSchemaV1<unknown, TInput>;
38
+ outputSchema?: StandardSchemaV1<unknown, TOutput>;
39
+ events?: Record<string, WorkflowEventDefinition>;
40
+ limits?: AgentLimits;
41
+ /**
42
+ * Semantic version of `run`, defaults to `"1"`.
43
+ *
44
+ * A paused run only resumes against the same version. Bump it whenever a
45
+ * change to `run` — or to anything `run` calls — would make replaying an
46
+ * in-flight run incorrect: reordered steps, a reused `stepId` that now means
47
+ * something else, or a changed business rule.
48
+ *
49
+ * The runtime cannot infer this. Hashing the source of `run` would break on
50
+ * every minified redeploy while still missing changes in the functions `run`
51
+ * closes over, so the decision belongs to the author.
52
+ */
53
+ version?: string;
54
+ run(step: WorkflowStep, input: TInput): TOutput | Promise<TOutput>;
55
+ }
56
+ declare function defineWorkflow<T extends WorkflowDefinition>(workflow: ExactDefinition<T, WorkflowDefinition>): T;
57
+ //#endregion
58
+ export { WorkflowStep as a, defineWorkflow as c, WorkflowEventResult as i, WorkflowDefinition as n, WorkflowStepContext as o, WorkflowEventDefinition as r, WorkflowStepOptions as s, WorkflowAgentResult as t };