@agentfield/sdk 0.1.110 → 0.1.111-rc.1
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/dist/index.d.ts +288 -93
- package/dist/index.js +206 -27
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/triggers/fixtures/cron.json +4 -0
- package/src/triggers/fixtures/generic_bearer.json +11 -0
- package/src/triggers/fixtures/generic_hmac.json +14 -0
- package/src/triggers/fixtures/github.json +42 -0
- package/src/triggers/fixtures/slack.json +17 -0
- package/src/triggers/fixtures/stripe.json +28 -0
package/dist/index.d.ts
CHANGED
|
@@ -843,98 +843,6 @@ declare function executeToolCallLoop(agent: Agent, prompt: string, toolMap: Tool
|
|
|
843
843
|
trace: ToolCallTrace;
|
|
844
844
|
}>;
|
|
845
845
|
|
|
846
|
-
declare class ReasonerContext<TInput = any> {
|
|
847
|
-
readonly input: TInput;
|
|
848
|
-
readonly executionId: string;
|
|
849
|
-
readonly runId?: string;
|
|
850
|
-
readonly sessionId?: string;
|
|
851
|
-
readonly actorId?: string;
|
|
852
|
-
readonly workflowId?: string;
|
|
853
|
-
readonly rootWorkflowId?: string;
|
|
854
|
-
readonly parentExecutionId?: string;
|
|
855
|
-
readonly reasonerId?: string;
|
|
856
|
-
readonly callerDid?: string;
|
|
857
|
-
readonly targetDid?: string;
|
|
858
|
-
readonly agentNodeDid?: string;
|
|
859
|
-
readonly req: express.Request;
|
|
860
|
-
readonly res: express.Response;
|
|
861
|
-
readonly agent: Agent;
|
|
862
|
-
readonly logger: ExecutionLogger;
|
|
863
|
-
readonly aiClient: AIClient;
|
|
864
|
-
readonly memory: MemoryInterface;
|
|
865
|
-
readonly workflow: WorkflowReporter;
|
|
866
|
-
readonly did: DidInterface;
|
|
867
|
-
/**
|
|
868
|
-
* AbortSignal that fires when the control plane cancels this execution
|
|
869
|
-
* (per-execution cancel, the bottom-up cancel-tree endpoint, or any
|
|
870
|
-
* future source that flips the bus). Pass it through to `fetch`, the
|
|
871
|
-
* @anthropic-ai/sdk, the openai SDK, or anywhere that accepts
|
|
872
|
-
* `{ signal }` to short-circuit in-flight work mid-call. For pure-JS
|
|
873
|
-
* CPU loops, check `ctx.signal.aborted` periodically and throw.
|
|
874
|
-
*/
|
|
875
|
-
readonly signal: AbortSignal;
|
|
876
|
-
constructor(params: {
|
|
877
|
-
input: TInput;
|
|
878
|
-
executionId: string;
|
|
879
|
-
runId?: string;
|
|
880
|
-
sessionId?: string;
|
|
881
|
-
actorId?: string;
|
|
882
|
-
workflowId?: string;
|
|
883
|
-
rootWorkflowId?: string;
|
|
884
|
-
parentExecutionId?: string;
|
|
885
|
-
reasonerId?: string;
|
|
886
|
-
callerDid?: string;
|
|
887
|
-
targetDid?: string;
|
|
888
|
-
agentNodeDid?: string;
|
|
889
|
-
req: express.Request;
|
|
890
|
-
res: express.Response;
|
|
891
|
-
agent: Agent;
|
|
892
|
-
logger: ExecutionLogger;
|
|
893
|
-
aiClient: AIClient;
|
|
894
|
-
memory: MemoryInterface;
|
|
895
|
-
workflow: WorkflowReporter;
|
|
896
|
-
did: DidInterface;
|
|
897
|
-
signal?: AbortSignal;
|
|
898
|
-
});
|
|
899
|
-
ai<T>(prompt: string, options: AIRequestOptions & {
|
|
900
|
-
schema: ZodSchema<T>;
|
|
901
|
-
}): Promise<T>;
|
|
902
|
-
ai(prompt: string, options?: AIToolRequestOptions): Promise<string>;
|
|
903
|
-
/**
|
|
904
|
-
* AI call with automatic tool calling via discover -> ai -> call loop.
|
|
905
|
-
*
|
|
906
|
-
* Discovers available capabilities, presents them as tools to the LLM,
|
|
907
|
-
* dispatches tool calls via agent.call(), and iterates until a final response.
|
|
908
|
-
*
|
|
909
|
-
* @returns Object with `text` (final response) and `trace` (observability data).
|
|
910
|
-
*/
|
|
911
|
-
aiWithTools(prompt: string, options?: AIToolRequestOptions): Promise<{
|
|
912
|
-
text: string;
|
|
913
|
-
trace: ToolCallTrace;
|
|
914
|
-
}>;
|
|
915
|
-
aiStream(prompt: string, options?: AIRequestOptions): Promise<AIStream>;
|
|
916
|
-
call(target: string, input: any): Promise<any>;
|
|
917
|
-
/**
|
|
918
|
-
* Pause this execution for external approval / resumption.
|
|
919
|
-
*
|
|
920
|
-
* Transitions the execution to `waiting` on the control plane and blocks
|
|
921
|
-
* until a decision arrives via the agent's approval webhook, or the timeout
|
|
922
|
-
* elapses (returning `{ decision: 'expired' }`). The caller creates the
|
|
923
|
-
* approval request on an external service first and passes its
|
|
924
|
-
* `approvalRequestId`. Delegates to {@link Agent.pause}. See its docs for the
|
|
925
|
-
* async-execution requirement that lets a pause outlive the dispatch ceiling.
|
|
926
|
-
*/
|
|
927
|
-
pause(opts: {
|
|
928
|
-
approvalRequestId: string;
|
|
929
|
-
approvalRequestUrl?: string;
|
|
930
|
-
expiresInHours?: number;
|
|
931
|
-
timeoutMs?: number;
|
|
932
|
-
}): Promise<ApprovalResult>;
|
|
933
|
-
discover(options?: DiscoveryOptions): Promise<DiscoveryResult>;
|
|
934
|
-
note(message: string, tags?: string[]): void;
|
|
935
|
-
}
|
|
936
|
-
declare function getCurrentContext<TInput = any>(): ReasonerContext<TInput> | undefined;
|
|
937
|
-
|
|
938
846
|
/**
|
|
939
847
|
* Trigger binding types for AgentField TypeScript SDK.
|
|
940
848
|
*
|
|
@@ -1039,6 +947,105 @@ interface ScheduleTriggerBinding {
|
|
|
1039
947
|
spec: ScheduleTriggerSpec;
|
|
1040
948
|
}
|
|
1041
949
|
|
|
950
|
+
declare class ReasonerContext<TInput = any> {
|
|
951
|
+
readonly input: TInput;
|
|
952
|
+
readonly executionId: string;
|
|
953
|
+
readonly runId?: string;
|
|
954
|
+
readonly sessionId?: string;
|
|
955
|
+
readonly actorId?: string;
|
|
956
|
+
readonly workflowId?: string;
|
|
957
|
+
readonly rootWorkflowId?: string;
|
|
958
|
+
readonly parentExecutionId?: string;
|
|
959
|
+
readonly reasonerId?: string;
|
|
960
|
+
readonly callerDid?: string;
|
|
961
|
+
readonly targetDid?: string;
|
|
962
|
+
readonly agentNodeDid?: string;
|
|
963
|
+
readonly req: express.Request;
|
|
964
|
+
readonly res: express.Response;
|
|
965
|
+
readonly agent: Agent;
|
|
966
|
+
readonly logger: ExecutionLogger;
|
|
967
|
+
readonly aiClient: AIClient;
|
|
968
|
+
readonly memory: MemoryInterface;
|
|
969
|
+
readonly workflow: WorkflowReporter;
|
|
970
|
+
readonly did: DidInterface;
|
|
971
|
+
/**
|
|
972
|
+
* AbortSignal that fires when the control plane cancels this execution
|
|
973
|
+
* (per-execution cancel, the bottom-up cancel-tree endpoint, or any
|
|
974
|
+
* future source that flips the bus). Pass it through to `fetch`, the
|
|
975
|
+
* @anthropic-ai/sdk, the openai SDK, or anywhere that accepts
|
|
976
|
+
* `{ signal }` to short-circuit in-flight work mid-call. For pure-JS
|
|
977
|
+
* CPU loops, check `ctx.signal.aborted` periodically and throw.
|
|
978
|
+
*/
|
|
979
|
+
readonly signal: AbortSignal;
|
|
980
|
+
/**
|
|
981
|
+
* Trigger context populated when the reasoner was invoked by an inbound
|
|
982
|
+
* webhook event or cron schedule. `undefined` for direct calls via
|
|
983
|
+
* `app.call(...)` or HTTP POST without a dispatcher envelope.
|
|
984
|
+
*/
|
|
985
|
+
readonly trigger?: TriggerContext;
|
|
986
|
+
constructor(params: {
|
|
987
|
+
input: TInput;
|
|
988
|
+
executionId: string;
|
|
989
|
+
runId?: string;
|
|
990
|
+
sessionId?: string;
|
|
991
|
+
actorId?: string;
|
|
992
|
+
workflowId?: string;
|
|
993
|
+
rootWorkflowId?: string;
|
|
994
|
+
parentExecutionId?: string;
|
|
995
|
+
reasonerId?: string;
|
|
996
|
+
callerDid?: string;
|
|
997
|
+
targetDid?: string;
|
|
998
|
+
agentNodeDid?: string;
|
|
999
|
+
req: express.Request;
|
|
1000
|
+
res: express.Response;
|
|
1001
|
+
agent: Agent;
|
|
1002
|
+
logger: ExecutionLogger;
|
|
1003
|
+
aiClient: AIClient;
|
|
1004
|
+
memory: MemoryInterface;
|
|
1005
|
+
workflow: WorkflowReporter;
|
|
1006
|
+
did: DidInterface;
|
|
1007
|
+
signal?: AbortSignal;
|
|
1008
|
+
trigger?: TriggerContext;
|
|
1009
|
+
});
|
|
1010
|
+
ai<T>(prompt: string, options: AIRequestOptions & {
|
|
1011
|
+
schema: ZodSchema<T>;
|
|
1012
|
+
}): Promise<T>;
|
|
1013
|
+
ai(prompt: string, options?: AIToolRequestOptions): Promise<string>;
|
|
1014
|
+
/**
|
|
1015
|
+
* AI call with automatic tool calling via discover -> ai -> call loop.
|
|
1016
|
+
*
|
|
1017
|
+
* Discovers available capabilities, presents them as tools to the LLM,
|
|
1018
|
+
* dispatches tool calls via agent.call(), and iterates until a final response.
|
|
1019
|
+
*
|
|
1020
|
+
* @returns Object with `text` (final response) and `trace` (observability data).
|
|
1021
|
+
*/
|
|
1022
|
+
aiWithTools(prompt: string, options?: AIToolRequestOptions): Promise<{
|
|
1023
|
+
text: string;
|
|
1024
|
+
trace: ToolCallTrace;
|
|
1025
|
+
}>;
|
|
1026
|
+
aiStream(prompt: string, options?: AIRequestOptions): Promise<AIStream>;
|
|
1027
|
+
call(target: string, input: any): Promise<any>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Pause this execution for external approval / resumption.
|
|
1030
|
+
*
|
|
1031
|
+
* Transitions the execution to `waiting` on the control plane and blocks
|
|
1032
|
+
* until a decision arrives via the agent's approval webhook, or the timeout
|
|
1033
|
+
* elapses (returning `{ decision: 'expired' }`). The caller creates the
|
|
1034
|
+
* approval request on an external service first and passes its
|
|
1035
|
+
* `approvalRequestId`. Delegates to {@link Agent.pause}. See its docs for the
|
|
1036
|
+
* async-execution requirement that lets a pause outlive the dispatch ceiling.
|
|
1037
|
+
*/
|
|
1038
|
+
pause(opts: {
|
|
1039
|
+
approvalRequestId: string;
|
|
1040
|
+
approvalRequestUrl?: string;
|
|
1041
|
+
expiresInHours?: number;
|
|
1042
|
+
timeoutMs?: number;
|
|
1043
|
+
}): Promise<ApprovalResult>;
|
|
1044
|
+
discover(options?: DiscoveryOptions): Promise<DiscoveryResult>;
|
|
1045
|
+
note(message: string, tags?: string[]): void;
|
|
1046
|
+
}
|
|
1047
|
+
declare function getCurrentContext<TInput = any>(): ReasonerContext<TInput> | undefined;
|
|
1048
|
+
|
|
1042
1049
|
interface ReasonerDefinition<TInput = any, TOutput = any> {
|
|
1043
1050
|
name: string;
|
|
1044
1051
|
handler: ReasonerHandler<TInput, TOutput>;
|
|
@@ -1552,6 +1559,33 @@ declare class Agent {
|
|
|
1552
1559
|
*/
|
|
1553
1560
|
private resolvePublicUrl;
|
|
1554
1561
|
reasoner<TInput = any, TOutput = any>(name: string, handler: ReasonerHandler<TInput, TOutput>, options?: ReasonerOptions): this;
|
|
1562
|
+
/**
|
|
1563
|
+
* Sugar for registering an event-triggered reasoner.
|
|
1564
|
+
*
|
|
1565
|
+
* Equivalent to:
|
|
1566
|
+
* ```ts
|
|
1567
|
+
* app.reasoner(name, handler, { triggers: [eventTrigger(spec)] });
|
|
1568
|
+
* ```
|
|
1569
|
+
*
|
|
1570
|
+
* The reasoner name defaults to `handler.name` when not provided.
|
|
1571
|
+
*/
|
|
1572
|
+
onEvent<TInput = any, TOutput = any>(spec: Omit<EventTriggerSpec, 'codeOrigin'> & {
|
|
1573
|
+
name?: string;
|
|
1574
|
+
}, handler: ReasonerHandler<TInput, TOutput>, options?: Omit<ReasonerOptions, 'triggers'>): this;
|
|
1575
|
+
/**
|
|
1576
|
+
* Sugar for registering a schedule-triggered (cron) reasoner.
|
|
1577
|
+
*
|
|
1578
|
+
* Equivalent to:
|
|
1579
|
+
* ```ts
|
|
1580
|
+
* app.reasoner(name, handler, { triggers: [scheduleTrigger({ cron })] });
|
|
1581
|
+
* ```
|
|
1582
|
+
*
|
|
1583
|
+
* The reasoner name defaults to `handler.name` when not provided.
|
|
1584
|
+
*/
|
|
1585
|
+
onSchedule<TInput = any, TOutput = any>(cron: string, handler: ReasonerHandler<TInput, TOutput>, options?: Omit<ReasonerOptions, 'triggers'> & {
|
|
1586
|
+
name?: string;
|
|
1587
|
+
timezone?: string;
|
|
1588
|
+
}): this;
|
|
1555
1589
|
skill<TInput = any, TOutput = any>(name: string, handler: SkillHandler<TInput, TOutput>, options?: SkillOptions): this;
|
|
1556
1590
|
includeRouter(router: AgentRouter): void;
|
|
1557
1591
|
session(name: string, options: SessionOptions, handler: (session: RealtimeSession) => Promise<unknown> | unknown): this;
|
|
@@ -2574,4 +2608,165 @@ declare function scheduleTrigger(spec: ScheduleTriggerSpec): ScheduleTriggerBind
|
|
|
2574
2608
|
*/
|
|
2575
2609
|
declare function triggerToPayload(trigger: TriggerBinding): Record<string, unknown>;
|
|
2576
2610
|
|
|
2577
|
-
|
|
2611
|
+
/**
|
|
2612
|
+
* Trigger dispatch envelope detection and TriggerContext construction.
|
|
2613
|
+
*
|
|
2614
|
+
* When the control plane dispatches a webhook event to a reasoner, it wraps
|
|
2615
|
+
* the payload in an envelope: `{ event: <payload>, _meta: <trigger metadata> }`.
|
|
2616
|
+
* This module detects that shape, unwraps the event, constructs a TriggerContext,
|
|
2617
|
+
* and applies the binding's `transform` if one is declared.
|
|
2618
|
+
*
|
|
2619
|
+
* Direct calls (no envelope) pass through unchanged — the handler receives
|
|
2620
|
+
* its input as before.
|
|
2621
|
+
*
|
|
2622
|
+
* @module triggers/dispatch
|
|
2623
|
+
*/
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* Shape of the dispatcher's envelope sent by the control plane for
|
|
2627
|
+
* webhook-triggered executions.
|
|
2628
|
+
*/
|
|
2629
|
+
interface TriggerEnvelope {
|
|
2630
|
+
event: Record<string, unknown>;
|
|
2631
|
+
_meta: {
|
|
2632
|
+
trigger_id: string;
|
|
2633
|
+
source: string;
|
|
2634
|
+
event_type: string;
|
|
2635
|
+
event_id: string;
|
|
2636
|
+
idempotency_key: string;
|
|
2637
|
+
received_at: string;
|
|
2638
|
+
vc_id?: string;
|
|
2639
|
+
};
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Result of envelope detection and unwrap.
|
|
2643
|
+
*/
|
|
2644
|
+
interface UnwrapResult {
|
|
2645
|
+
/** The unwrapped input (event payload or original input for direct calls). */
|
|
2646
|
+
input: unknown;
|
|
2647
|
+
/** TriggerContext if this was a trigger dispatch; undefined for direct calls. */
|
|
2648
|
+
triggerContext?: TriggerContext;
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Detect whether a request body is a dispatcher trigger envelope.
|
|
2652
|
+
*
|
|
2653
|
+
* The envelope shape is `{ event: ..., _meta: { trigger_id, source, ... } }`.
|
|
2654
|
+
* Only objects with both `event` and `_meta` keys (where `_meta` contains
|
|
2655
|
+
* `trigger_id`) are considered envelopes.
|
|
2656
|
+
*/
|
|
2657
|
+
declare function isTriggerEnvelope(body: unknown): body is TriggerEnvelope;
|
|
2658
|
+
/**
|
|
2659
|
+
* Unwrap a trigger envelope (if present) and construct TriggerContext.
|
|
2660
|
+
*
|
|
2661
|
+
* For trigger dispatches: extracts the event payload and builds a typed
|
|
2662
|
+
* TriggerContext from `_meta`. For direct calls: returns the body unchanged
|
|
2663
|
+
* with `triggerContext: undefined`.
|
|
2664
|
+
*/
|
|
2665
|
+
declare function unwrapEnvelope(body: unknown): UnwrapResult;
|
|
2666
|
+
/**
|
|
2667
|
+
* Apply the matching binding's `transform` function to the unwrapped event.
|
|
2668
|
+
*
|
|
2669
|
+
* Matching logic (mirrors Python SDK's `_apply_trigger_transform`):
|
|
2670
|
+
* 1. Find bindings where `binding.spec.source === triggerContext.source`
|
|
2671
|
+
* 2. For event bindings with non-empty `types`, check prefix match against
|
|
2672
|
+
* `triggerContext.eventType`
|
|
2673
|
+
* 3. Most specific match (non-empty types) wins over catch-all (empty types)
|
|
2674
|
+
* 4. Apply `transform` if the matched binding declares one
|
|
2675
|
+
*
|
|
2676
|
+
* Returns the (possibly transformed) input.
|
|
2677
|
+
*/
|
|
2678
|
+
declare function applyTriggerTransform(triggerContext: TriggerContext, bindings: TriggerBinding[], input: unknown): unknown;
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* Testing helpers for reasoners that handle webhook triggers.
|
|
2682
|
+
*
|
|
2683
|
+
* The standard SDK runtime delivers trigger events via the agent's HTTP
|
|
2684
|
+
* endpoint — your reasoner sees `ctx.trigger` populated and (when `transform`
|
|
2685
|
+
* is set) the unwrapped, transformed input. For unit tests you want the same
|
|
2686
|
+
* shape without spinning up a control plane, an HTTP server, or a real
|
|
2687
|
+
* provider. `simulateTrigger` gives you that: it crafts the `TriggerContext`
|
|
2688
|
+
* the agent runtime would have produced, applies any matching `transform`
|
|
2689
|
+
* from the reasoner's declared bindings, and invokes the handler directly
|
|
2690
|
+
* with a minimal ReasonerContext-like object. No HTTP, no workflow
|
|
2691
|
+
* registration, no VC mint.
|
|
2692
|
+
*
|
|
2693
|
+
* @module triggers/testing
|
|
2694
|
+
*/
|
|
2695
|
+
|
|
2696
|
+
/**
|
|
2697
|
+
* Options for `simulateTrigger`.
|
|
2698
|
+
*/
|
|
2699
|
+
interface SimulateTriggerOptions {
|
|
2700
|
+
/** Provider source name (e.g. "stripe", "github", "cron"). */
|
|
2701
|
+
source: string;
|
|
2702
|
+
/** Inbound event body. Defaults to `{}`. */
|
|
2703
|
+
body?: Record<string, unknown>;
|
|
2704
|
+
/** Provider's event type (e.g. "payment_intent.succeeded"). Defaults to "". */
|
|
2705
|
+
eventType?: string;
|
|
2706
|
+
/** Override the generated event ID. */
|
|
2707
|
+
eventId?: string;
|
|
2708
|
+
/** Override the generated idempotency key. */
|
|
2709
|
+
idempotencyKey?: string;
|
|
2710
|
+
/** Override the generated trigger ID. */
|
|
2711
|
+
triggerId?: string;
|
|
2712
|
+
/** Override the received-at timestamp. Defaults to `new Date()`. */
|
|
2713
|
+
receivedAt?: Date;
|
|
2714
|
+
/** Optional VC ID. */
|
|
2715
|
+
vcId?: string;
|
|
2716
|
+
/**
|
|
2717
|
+
* Trigger bindings for the handler. Used to find the matching binding's
|
|
2718
|
+
* `transform`. If not provided, the body is passed through as-is.
|
|
2719
|
+
*/
|
|
2720
|
+
bindings?: TriggerBinding[];
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Options for `simulateSchedule`.
|
|
2724
|
+
*/
|
|
2725
|
+
interface SimulateScheduleOptions {
|
|
2726
|
+
/** Cron expression (for test introspection). */
|
|
2727
|
+
cron?: string;
|
|
2728
|
+
/** Override the received-at timestamp. Defaults to `new Date()`. */
|
|
2729
|
+
receivedAt?: Date;
|
|
2730
|
+
/** Trigger bindings for the handler. */
|
|
2731
|
+
bindings?: TriggerBinding[];
|
|
2732
|
+
}
|
|
2733
|
+
/**
|
|
2734
|
+
* Minimal execution context surface exposed as `ctx` in simulate tests.
|
|
2735
|
+
* Only carries the bits a webhook reasoner is likely to read.
|
|
2736
|
+
*/
|
|
2737
|
+
interface SimulatedContext<TInput = unknown> {
|
|
2738
|
+
input: TInput;
|
|
2739
|
+
trigger: TriggerContext;
|
|
2740
|
+
executionId: string;
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Simulate a trigger dispatch and invoke the handler.
|
|
2744
|
+
*
|
|
2745
|
+
* Builds a synthetic `TriggerContext`, optionally applies the matched
|
|
2746
|
+
* binding's `transform`, and calls the handler with a minimal context
|
|
2747
|
+
* object that mirrors what the real dispatch path produces.
|
|
2748
|
+
*
|
|
2749
|
+
* @param handler - Function accepting `(ctx: { input, trigger, executionId })`.
|
|
2750
|
+
* The same shape a `ReasonerHandler` receives, but trimmed to the fields
|
|
2751
|
+
* relevant for trigger-driven logic.
|
|
2752
|
+
* @param options - Trigger simulation options.
|
|
2753
|
+
* @returns Whatever the handler returns (awaits async handlers transparently).
|
|
2754
|
+
*/
|
|
2755
|
+
declare function simulateTrigger<R>(handler: (ctx: SimulatedContext) => R | Promise<R>, options: SimulateTriggerOptions): Promise<R>;
|
|
2756
|
+
/**
|
|
2757
|
+
* Simulate a schedule (cron) trigger dispatch.
|
|
2758
|
+
*
|
|
2759
|
+
* Convenience wrapper around `simulateTrigger` for cron-triggered reasoners.
|
|
2760
|
+
* Passes an empty body and `source: 'cron'`, `eventType: 'tick'`.
|
|
2761
|
+
*/
|
|
2762
|
+
declare function simulateSchedule<R>(handler: (ctx: SimulatedContext) => R | Promise<R>, options?: SimulateScheduleOptions): Promise<R>;
|
|
2763
|
+
/**
|
|
2764
|
+
* Load a captured provider payload from the SDK fixture library.
|
|
2765
|
+
*
|
|
2766
|
+
* Fixtures live at `src/triggers/fixtures/<source>.json` relative to the
|
|
2767
|
+
* package root. Returns a parsed object — each call re-reads from disk so
|
|
2768
|
+
* tests can mutate freely.
|
|
2769
|
+
*/
|
|
2770
|
+
declare function loadFixture(source: string): Record<string, unknown>;
|
|
2771
|
+
|
|
2772
|
+
export { ACTIVE_STATUSES, AIClient, type AIConfig, type AIEmbeddingOptions, type AIRequestOptions, type AIStream, type AIToolRequestOptions, Agent, type AgentCapability, type AgentConfig, type AgentHandler, AgentRouter, type AgentRouterOptions, type AgentState, ApprovalClient, type ApprovalDecision, type ApprovalRequestResponse, ApprovalResult, type ApprovalStatusResponse, Audio, type AudioOutput, type AudioRequest, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DidResolver, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, type EventTriggerBinding, type EventTriggerSpec, ExecutionContext, type ExecutionCredential, type ExecutionLogAttributes, type ExecutionLogBatchPayload, type ExecutionLogContext, type ExecutionLogEmitOptions, type ExecutionLogEntry, type ExecutionLogLevel, type ExecutionLogTransport, type ExecutionLogTransportPayload, type ExecutionLogWireEntry, ExecutionLogger, type ExecutionLoggerOptions, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, File, type FileOutput, type GenerateCredentialOptions, type GenerateCredentialParams, HEADER_CALLER_DID, HEADER_DID_NONCE, HEADER_DID_SIGNATURE, HEADER_DID_TIMESTAMP, type HarnessConfig, type HarnessOptions, type HarnessProvider, type HarnessResult, HarnessRunner, type HealthStatus, Image, type ImageOutput, type ImageRequest, JWE_ALG, JWE_ENC, KEY_AGREEMENT_TYPE, type MediaProvider, MediaProviderError, type MediaResponse, MediaRouter, type MemoryChangeEvent, MemoryClient, MemoryClientBase, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, type MemoryEventHistoryOptions, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, type MultimodalContent, MultimodalResponse, OpenRouterMediaProvider, type OpenRouterMediaProviderOptions, PauseClock, PauseManager, type Payload, PayloadEncryptionError, RateLimitError, type RateLimiterOptions, type RawExecutionContext, type RawResult, RealtimeSession, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, SUPPORTED_SESSION_TRANSPORTS, type ScheduleTriggerBinding, type ScheduleTriggerSpec, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SessionDefinition, type SessionOptions, type SessionProvider, type SessionTransport, type SessionTransportCapability, SessionTransportError, type SessionTurn, type SimulateScheduleOptions, type SimulateTriggerOptions, type SimulatedContext, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, Text, type ToolCallConfig, type ToolCallRecord, type ToolCallTrace, type ToolsOption, type TriggerBinding, type TriggerContext, type TriggerEnvelope, type UnwrapResult, type VectorSearchOptions, type VectorSearchResult, Video, type VideoFrameImage, type VideoInputReference, type VideoRequest, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, applyTriggerTransform, audioFromBase64, audioFromBuffer, audioFromFile, audioFromUrl, buildProvider, buildSessionDefinition, buildToolConfig, capabilitiesToTools, capabilityToMetadataTool, capabilityToTool, createExecutionLogger, createHarnessResult, createMetrics, createMultimodalResponse, createRawResult, decrypt, decryptToString, encryptForDid, encryptToJwk, eventTrigger, executeToolCallLoop, extractKeyAgreementJwk, fileFromBase64, fileFromBuffer, fileFromPath, fileFromUrl, generateX25519KeyPair, getCurrentContext, getCurrentSkillContext, imageFromBase64, imageFromBuffer, imageFromFile, imageFromUrl, installApprovalWebhookRoute, isActive, isExecutionLogBatchPayload, isTerminal, isTriggerEnvelope, loadFixture, normalizeExecutionLogEntry, normalizeSessionTransportValue, normalizeStatus, scheduleTrigger, serializeExecutionLogEntry, simulateSchedule, simulateTrigger, text, triggerToPayload, unwrapEnvelope, validateSessionTransport, videoFromBase64, videoFromBuffer, videoFromFile, videoFromUrl };
|