@statelyai/agent 1.1.6 → 2.0.0-alpha.11

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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/dist/adapter.cjs +15 -0
  3. package/dist/adapter.d.cts +4 -0
  4. package/dist/adapter.d.mts +4 -0
  5. package/dist/adapter.mjs +2 -0
  6. package/dist/ai-sdk.cjs +306 -0
  7. package/dist/ai-sdk.d.cts +96 -0
  8. package/dist/ai-sdk.d.mts +96 -0
  9. package/dist/ai-sdk.mjs +304 -0
  10. package/dist/decision-C3k4ve51.mjs +227 -0
  11. package/dist/decision-D8wJrM8W.cjs +286 -0
  12. package/dist/events-CRQj3VtP.cjs +1010 -0
  13. package/dist/events-JiVPYrct.mjs +759 -0
  14. package/dist/index.cjs +2528 -0
  15. package/dist/index.d.cts +1232 -0
  16. package/dist/index.d.mts +1217 -413
  17. package/dist/index.mjs +2489 -584
  18. package/dist/openai-compat.cjs +309 -0
  19. package/dist/openai-compat.d.cts +59 -0
  20. package/dist/openai-compat.d.mts +59 -0
  21. package/dist/openai-compat.mjs +308 -0
  22. package/dist/steps-BALp1eZo.d.mts +198 -0
  23. package/dist/steps-CVe54GPP.cjs +420 -0
  24. package/dist/steps-CkyyyuHd.mjs +379 -0
  25. package/dist/steps-MjnQI4aB.d.cts +198 -0
  26. package/dist/steps.cjs +12 -0
  27. package/dist/steps.d.cts +3 -0
  28. package/dist/steps.d.mts +3 -0
  29. package/dist/steps.mjs +3 -0
  30. package/dist/text-logic-CaKqgX4Y.d.mts +710 -0
  31. package/dist/text-logic-Ckhr2kKC.d.cts +710 -0
  32. package/dist/types-C9QiMjre.d.cts +219 -0
  33. package/dist/types-qm00QF91.d.mts +219 -0
  34. package/dist/utils-BYqT_Dyv.d.cts +108 -0
  35. package/dist/utils-Do5wIJrh.d.mts +108 -0
  36. package/dist/zod.cjs +31 -0
  37. package/dist/zod.d.cts +30 -0
  38. package/dist/zod.d.mts +30 -0
  39. package/dist/zod.mjs +30 -0
  40. package/package.json +132 -28
  41. package/readme.md +153 -6
  42. package/schemas/agent-workflow.json +526 -0
  43. package/.changeset/README.md +0 -8
  44. package/.changeset/config.json +0 -11
  45. package/.env.template +0 -3
  46. package/.github/actions/ci-setup/action.yml +0 -24
  47. package/.github/workflows/release.yml +0 -46
  48. package/.vscode/launch.json +0 -28
  49. package/CHANGELOG.md +0 -222
  50. package/dist/index.d.ts +0 -428
  51. package/dist/index.js +0 -621
  52. package/examples/chatbot.ts +0 -71
  53. package/examples/cot.ts +0 -89
  54. package/examples/email.ts +0 -118
  55. package/examples/example.ts +0 -81
  56. package/examples/goal.ts +0 -94
  57. package/examples/helpers/helpers.ts +0 -17
  58. package/examples/helpers/loader.ts +0 -32
  59. package/examples/helpers/runner.ts +0 -27
  60. package/examples/joke.ts +0 -225
  61. package/examples/multi.ts +0 -103
  62. package/examples/newspaper.ts +0 -324
  63. package/examples/number.ts +0 -102
  64. package/examples/raffle.ts +0 -105
  65. package/examples/sandbox.ts +0 -28
  66. package/examples/simple.ts +0 -39
  67. package/examples/support.ts +0 -147
  68. package/examples/ticTacToe.ts +0 -224
  69. package/examples/todo.ts +0 -137
  70. package/examples/tutor.ts +0 -100
  71. package/examples/verify.ts +0 -120
  72. package/examples/weather.ts +0 -178
  73. package/examples/wiki.ts +0 -30
  74. package/examples/word.ts +0 -171
  75. package/src/adapters/vercel.ts +0 -7
  76. package/src/agent-experimental.ts +0 -221
  77. package/src/agent.test.ts +0 -506
  78. package/src/agent.ts +0 -300
  79. package/src/decision.test.ts +0 -179
  80. package/src/decision.ts +0 -84
  81. package/src/index.ts +0 -4
  82. package/src/memory.ts +0 -25
  83. package/src/planners/shortestPathPlanner.ts +0 -22
  84. package/src/planners/simplePlanner.ts +0 -139
  85. package/src/schemas.ts +0 -11
  86. package/src/strategies/chain-of-note.ts +0 -155
  87. package/src/templates/defaultText.ts +0 -18
  88. package/src/text.ts +0 -241
  89. package/src/types.ts +0 -499
  90. package/src/utils.ts +0 -72
  91. package/tsconfig.json +0 -109
  92. package/vitest.config.ts +0 -9
package/src/types.ts DELETED
@@ -1,499 +0,0 @@
1
- import {
2
- ActorLogic,
3
- ActorRefFrom,
4
- AnyActorRef,
5
- AnyEventObject,
6
- AnyStateMachine,
7
- EventFrom,
8
- EventObject,
9
- PromiseActorLogic,
10
- SnapshotFrom,
11
- StateValue,
12
- Subscription,
13
- TransitionSnapshot,
14
- Values,
15
- } from 'xstate';
16
- import {
17
- CoreMessage,
18
- CoreTool,
19
- generateText,
20
- GenerateTextResult,
21
- LanguageModel,
22
- streamText,
23
- StreamTextResult,
24
- } from 'ai';
25
- import { ZodContextMapping, ZodEventMapping } from './schemas';
26
- import { TypeOf } from 'zod';
27
-
28
- export type GenerateTextOptions = Parameters<typeof generateText>[0];
29
-
30
- export type StreamTextOptions = Parameters<typeof streamText>[0];
31
-
32
- export type AgentPlanInput<TEvent extends EventObject> = Omit<
33
- GenerateTextOptions,
34
- 'prompt' | 'messages' | 'tools'
35
- > & {
36
- /**
37
- * The currently observed state.
38
- */
39
- state: ObservedState;
40
- /**
41
- * The goal for the agent to accomplish.
42
- * The agent will create a plan based on this goal.
43
- */
44
- goal: string;
45
- /**
46
- * The events that the agent can trigger. This is a mapping of
47
- * event types to Zod event schemas.
48
- */
49
- events: ZodEventMapping;
50
- /**
51
- * The state machine that represents the environment the agent
52
- * is interacting with.
53
- */
54
- machine?: AnyStateMachine;
55
- /**
56
- * The previous plan.
57
- */
58
- previousPlan?: AgentPlan<TEvent>;
59
- };
60
-
61
- export type AgentPlan<TEvent extends EventObject> = {
62
- goal: string;
63
- state: ObservedState;
64
- content?: string;
65
- /**
66
- * Executes the plan based on the given `state` and resolves with
67
- * a potential next `event` to trigger to achieve the `goal`.
68
- */
69
- execute: (state: ObservedState) => Promise<TEvent | undefined>;
70
- nextEvent: TEvent | undefined;
71
- sessionId: string;
72
- timestamp: number;
73
- };
74
-
75
- export interface TransitionData {
76
- eventType: string;
77
- description?: string;
78
- guard?: { type: string };
79
- target?: any;
80
- }
81
-
82
- export type PromptTemplate<TEvents extends EventObject> = (data: {
83
- goal: string;
84
- /**
85
- * The observed state
86
- */
87
- state?: ObservedState;
88
- /**
89
- * The context to provide.
90
- * This overrides the observed state.context, if provided.
91
- */
92
- context?: any;
93
- /**
94
- * The state machine model of the observed environment
95
- */
96
- machine?: unknown;
97
- /**
98
- * The potential next transitions that can be taken
99
- * in the state machine
100
- */
101
- transitions?: TransitionData[];
102
- /**
103
- * Past observations
104
- */
105
- observations?: AgentObservation<any>[]; // TODO
106
- feedback?: AgentFeedback[];
107
- messages?: AgentMessage[];
108
- plans?: AgentPlan<TEvents>[];
109
- }) => string;
110
-
111
- export type AgentPlanner<T extends AnyAgent> = (
112
- agent: T,
113
- input: AgentPlanInput<T['types']['events']>
114
- ) => Promise<AgentPlan<T['types']['events']> | undefined>;
115
-
116
- export type AgentDecideOptions = {
117
- goal: string;
118
- model?: LanguageModel;
119
- context?: any;
120
- state: ObservedState;
121
- machine: AnyStateMachine;
122
- execute?: (event: AnyEventObject) => Promise<void>;
123
- planner?: AgentPlanner<any>;
124
- events?: ZodEventMapping;
125
- } & Omit<
126
- Parameters<typeof generateText>[0],
127
- 'model' | 'tools' | 'prompt' | 'messages'
128
- >;
129
-
130
- export interface AgentFeedback {
131
- goal?: string;
132
- observationId?: string;
133
- /**
134
- * The message correlation that the feedback is relevant for
135
- */
136
- correlationId?: string;
137
- attributes: Record<string, any>;
138
- reward: number;
139
- timestamp: number;
140
- sessionId: string;
141
- }
142
-
143
- export interface AgentFeedbackInput {
144
- goal?: string;
145
- observationId?: string;
146
- correlationId?: string;
147
- attributes?: Record<string, any>;
148
- timestamp?: number;
149
- reward?: number;
150
- }
151
-
152
- export type AgentMessage = CoreMessage & {
153
- timestamp: number;
154
- id: string;
155
- /**
156
- * The response ID of the message, which references
157
- * which message this message is responding to, if any.
158
- */
159
- responseId?: string;
160
- result?: GenerateTextResult<any>;
161
- sessionId: string;
162
- correlationId: string;
163
- parentCorrelationId?: string;
164
- };
165
-
166
- export type AgentMessageInput = CoreMessage & {
167
- timestamp?: number;
168
- id?: string;
169
- /**
170
- * The response ID of the message, which references
171
- * which message this message is responding to, if any.
172
- */
173
- responseId?: string;
174
- correlationId?: string;
175
- parentCorrelationId?: string;
176
- result?: GenerateTextResult<any>;
177
- };
178
-
179
- export interface AgentObservation<TActor extends AnyActorRef> {
180
- id: string;
181
- prevState: SnapshotFrom<TActor> | undefined;
182
- event: EventFrom<TActor>;
183
- state: SnapshotFrom<TActor>;
184
- machineHash: string | undefined;
185
- sessionId: string;
186
- timestamp: number;
187
- }
188
-
189
- export interface AgentObservationInput {
190
- id?: string;
191
- prevState: ObservedState | undefined;
192
- event: AnyEventObject;
193
- state: ObservedState;
194
- machine?: AnyStateMachine;
195
- timestamp?: number;
196
- }
197
-
198
- export type AgentDecisionInput = {
199
- goal: string;
200
- model?: LanguageModel;
201
- context?: any;
202
- } & Omit<Parameters<typeof generateText>[0], 'model' | 'tools' | 'prompt'>;
203
-
204
- export type AgentDecisionLogic<TEvents extends EventObject> = PromiseActorLogic<
205
- AgentPlan<TEvents> | undefined,
206
- AgentDecisionInput | string
207
- >;
208
-
209
- export type AgentEmitted<TEvents extends EventObject> =
210
- | {
211
- type: 'feedback';
212
- feedback: AgentFeedback;
213
- }
214
- | {
215
- type: 'observation';
216
- observation: AgentObservation<any>; // TODO
217
- }
218
- | {
219
- type: 'message';
220
- message: AgentMessage;
221
- }
222
- | {
223
- type: 'plan';
224
- plan: AgentPlan<TEvents>;
225
- };
226
-
227
- export type AgentLogic<TEvents extends EventObject> = ActorLogic<
228
- TransitionSnapshot<AgentMemoryContext>,
229
- | {
230
- type: 'agent.feedback';
231
- feedback: AgentFeedback;
232
- }
233
- | {
234
- type: 'agent.observe';
235
- observation: AgentObservation<any>; // TODO
236
- }
237
- | {
238
- type: 'agent.message';
239
- message: AgentMessage;
240
- }
241
- | {
242
- type: 'agent.plan';
243
- plan: AgentPlan<TEvents>;
244
- },
245
- any, // TODO: input
246
- any,
247
- AgentEmitted<TEvents>
248
- >;
249
-
250
- export type EventsFromZodEventMapping<TEventSchemas extends ZodEventMapping> =
251
- Values<{
252
- [K in keyof TEventSchemas & string]: {
253
- type: K;
254
- } & TypeOf<TEventSchemas[K]>;
255
- }>;
256
-
257
- export type ContextFromZodContextMapping<
258
- TContextSchema extends ZodContextMapping
259
- > = {
260
- [K in keyof TContextSchema & string]: TypeOf<TContextSchema[K]>;
261
- };
262
-
263
- export type Agent<TContext, TEvents extends EventObject> = ActorRefFrom<
264
- AgentLogic<TEvents>
265
- > & {
266
- /**
267
- * The name of the agent. All agents with the same name are related and
268
- * able to share experiences (observations, feedback) with each other.
269
- */
270
- name?: string;
271
- /**
272
- * The unique identifier for the agent.
273
- */
274
- id?: string;
275
- description?: string;
276
- events: ZodEventMapping;
277
- types: {
278
- events: TEvents;
279
- context: Compute<TContext>;
280
- };
281
- model: LanguageModel;
282
- defaultOptions: GenerateTextOptions;
283
- memory: AgentLongTermMemory | undefined;
284
- /**
285
- * The adapter used to perform LLM actions such as
286
- * `.generateText(…)` and `.streamText(…)`.
287
- *
288
- * Defaults to the Vercel AI SDK.
289
- */
290
- adapter: AIAdapter;
291
-
292
- /**
293
- * Resolves with an `AgentPlan` based on the information provided in the `options`, including:
294
- *
295
- * - The `goal` for the agent to achieve
296
- * - The observed current `state`
297
- * - The `machine` (e.g. a state machine) that specifies what can happen next
298
- * - Additional `context`
299
- */
300
- decide: (
301
- options: AgentDecideOptions
302
- ) => Promise<AgentPlan<TEvents> | undefined>;
303
-
304
- // Generate text
305
- generateText: (
306
- options: AgentGenerateTextOptions
307
- ) => Promise<AgentGenerateTextResult>;
308
-
309
- // Stream text
310
- streamText: (
311
- options: AgentStreamTextOptions
312
- ) => Promise<AgentStreamTextResult>;
313
-
314
- addObservation: (
315
- observationInput: AgentObservationInput
316
- ) => AgentObservation<any>; // TODO
317
- addMessage: (messageInput: AgentMessageInput) => AgentMessage;
318
- addFeedback: (feedbackInput: AgentFeedbackInput) => AgentFeedback;
319
- addPlan: (plan: AgentPlan<TEvents>) => void;
320
- /**
321
- * Called whenever the agent (LLM assistant) receives or sends a message.
322
- */
323
- onMessage: (callback: (message: AgentMessage) => void) => void;
324
- /**
325
- * Selects agent data from its context.
326
- *
327
- * @deprecated Select from `agent.getSnapshot().context` directly or:
328
- * - `agent.getMessages()`
329
- * - `agent.getObservations()`
330
- * - `agent.getFeedback()`
331
- * - `agent.getPlans()`
332
- */
333
- select: <T>(selector: (context: AgentMemoryContext) => T) => T;
334
-
335
- /**
336
- * Retrieves messages from the agent's short-term (local) memory.
337
- */
338
- getMessages: () => AgentMessage[];
339
-
340
- /**
341
- * Retrieves observations from the agent's short-term (local) memory.
342
- */
343
- getObservations: () => AgentObservation<Agent<TContext, TEvents>>[];
344
-
345
- /**
346
- * Retrieves feedback from the agent's short-term (local) memory.
347
- */
348
- getFeedback: () => AgentFeedback[];
349
-
350
- /**
351
- * Retrieves strategies from the agent's short-term (local) memory.
352
- */
353
- getPlans: () => AgentPlan<TEvents>[];
354
-
355
- /**
356
- * Interacts with this state machine actor by inspecting state transitions and storing them as observations.
357
- *
358
- * Observations contain the `prevState`, `event`, and current `state` of this
359
- * actor, as well as other properties that are useful when recalled.
360
- * These observations are stored in the `agent`'s short-term (local) memory
361
- * and can be retrieved via `agent.getObservations()`.
362
- *
363
- * @example
364
- * ```ts
365
- * // Only observes the actor's state transitions
366
- * agent.interact(actor);
367
- *
368
- * actor.start();
369
- * ```
370
- */
371
- interact<TActor extends AnyActorRef>(actorRef: TActor): Subscription;
372
- /**
373
- * Interacts with this state machine actor by:
374
- * 1. Inspecting state transitions and storing them as observations
375
- * 2. Deciding what to do next (which event to send the actor) based on
376
- * the agent input returned from `getInput(observation)`, if `getInput(…)` is provided as the 2nd argument.
377
- *
378
- * Observations contain the `prevState`, `event`, and current `state` of this
379
- * actor, as well as other properties that are useful when recalled.
380
- * These observations are stored in the `agent`'s short-term (local) memory
381
- * and can be retrieved via `agent.getObservations()`.
382
- *
383
- * @example
384
- * ```ts
385
- * // Observes the actor's state transitions and
386
- * // makes a decision if on the "summarize" state
387
- * agent.interact(actor, observed => {
388
- * if (observed.state.matches('summarize')) {
389
- * return {
390
- * context: observed.state.context,
391
- * goal: 'Summarize the message'
392
- * }
393
- * }
394
- * });
395
- *
396
- * actor.start();
397
- * ```
398
- */
399
- interact<TActor extends AnyActorRef>(
400
- actorRef: TActor,
401
- getInput: (
402
- observation: AgentObservation<TActor>
403
- ) => AgentDecisionInput | undefined
404
- ): Subscription;
405
- };
406
-
407
- export type AnyAgent = Agent<any, any>;
408
-
409
- export type FromAgent<T> = T | ((agent: AnyAgent) => T | Promise<T>);
410
-
411
- export type CommonTextOptions = {
412
- prompt: FromAgent<string>;
413
- model?: LanguageModel;
414
- context?: Record<string, any>;
415
- messages?: FromAgent<CoreMessage[]>;
416
- template?: PromptTemplate<any>;
417
- correlationId?: string;
418
- parentCorrelationId?: string;
419
- };
420
-
421
- export type TextResultMeta = {
422
- correlationId: string;
423
- parentCorrelationId?: string;
424
- };
425
-
426
- export type AgentGenerateTextOptions = Omit<
427
- GenerateTextOptions,
428
- 'model' | 'prompt' | 'messages'
429
- > &
430
- CommonTextOptions;
431
-
432
- export type AgentGenerateTextResult = GenerateTextResult<any> & TextResultMeta;
433
-
434
- export type AgentStreamTextOptions = Omit<
435
- StreamTextOptions,
436
- 'model' | 'prompt' | 'messages'
437
- > &
438
- CommonTextOptions;
439
-
440
- export type AgentStreamTextResult = StreamTextResult<any> & TextResultMeta;
441
-
442
- export interface ObservedState {
443
- /**
444
- * The current state value of the state machine, e.g.
445
- * `"loading"` or `"processing"` or `"ready"`
446
- */
447
- value: StateValue;
448
- /**
449
- * Additional contextual data related to the current state
450
- */
451
- context: Record<string, unknown>;
452
- }
453
-
454
- export type ObservedStateFrom<TActor extends AnyActorRef> = Pick<
455
- SnapshotFrom<TActor>,
456
- 'value' | 'context'
457
- >;
458
-
459
- export type AgentMemoryContext = {
460
- observations: AgentObservation<any>[]; // TODO
461
- messages: AgentMessage[];
462
- plans: AgentPlan<any>[];
463
- feedback: AgentFeedback[];
464
- };
465
-
466
- export type AgentMemory = AppendOnlyStorage<AgentMemoryContext>;
467
-
468
- export interface AppendOnlyStorage<T extends Record<string, any[]>> {
469
- append<K extends keyof T>(
470
- sessionId: string,
471
- key: K,
472
- item: T[K][0]
473
- ): Promise<void>;
474
- getAll<K extends keyof T>(
475
- sessionId: string,
476
- key: K
477
- ): Promise<T[K] | undefined>;
478
- }
479
-
480
- export interface AgentLongTermMemory {
481
- get<K extends keyof AgentMemoryContext>(
482
- key: K
483
- ): Promise<AgentMemoryContext[K]>;
484
- append<K extends keyof AgentMemoryContext>(
485
- key: K,
486
- item: AgentMemoryContext[K][0]
487
- ): Promise<void>;
488
- set<K extends keyof AgentMemoryContext>(
489
- key: K,
490
- items: AgentMemoryContext[K]
491
- ): Promise<void>;
492
- }
493
-
494
- export interface AIAdapter {
495
- generateText: typeof generateText;
496
- streamText: typeof streamText;
497
- }
498
-
499
- export type Compute<A extends any> = { [K in keyof A]: A[K] } & unknown;
package/src/utils.ts DELETED
@@ -1,72 +0,0 @@
1
- import { AnyMachineSnapshot, AnyStateMachine, AnyStateNode } from 'xstate';
2
- import hash from 'object-hash';
3
- import { TransitionData } from './types';
4
-
5
- export function getAllTransitions(state: AnyMachineSnapshot): TransitionData[] {
6
- const nodes = state._nodes;
7
- const transitions = (nodes as AnyStateNode[])
8
- .map((node) => [...(node as AnyStateNode).transitions.values()])
9
- .map((nodeTransitions) => {
10
- return nodeTransitions.map((nodeEventTransitions) => {
11
- return nodeEventTransitions.map((transition) => {
12
- return {
13
- ...transition,
14
- guard:
15
- typeof transition.guard === 'string'
16
- ? { type: transition.guard }
17
- : (transition.guard as any), // TODO: fix
18
- };
19
- });
20
- });
21
- })
22
- .flat(2);
23
-
24
- return transitions;
25
- }
26
-
27
- export function getAllMachineTransitions(
28
- stateNode: AnyStateNode
29
- ): TransitionData[] {
30
- const transitions: TransitionData[] = [...stateNode.transitions.values()]
31
- .map((nodeTransitions) => {
32
- return nodeTransitions.map((transition) => {
33
- return {
34
- ...transition,
35
- guard:
36
- typeof transition.guard === 'string'
37
- ? { type: transition.guard }
38
- : (transition.guard as any), // TODO: fix
39
- };
40
- });
41
- })
42
- .flat(2);
43
-
44
- for (const s of Object.values(stateNode.states)) {
45
- const stateTransitions = getAllMachineTransitions(s);
46
- transitions.push(...stateTransitions);
47
- }
48
-
49
- return transitions;
50
- }
51
-
52
- export function wrapInXml(tagName: string, content: string): string {
53
- return `<${tagName}>${content}</${tagName}>`;
54
- }
55
-
56
- export function randomId() {
57
- const timestamp = Date.now().toString(36);
58
- const random = Math.random().toString(36).substring(2, 9);
59
- return timestamp + random;
60
- }
61
-
62
- const machineHashes: WeakMap<AnyStateMachine, string> = new WeakMap();
63
- /**
64
- * Returns a string hash representing only the transitions in the state machine.
65
- */
66
- export function getMachineHash(machine: AnyStateMachine): string {
67
- if (machineHashes.has(machine)) return machineHashes.get(machine)!;
68
- const transitions = getAllMachineTransitions(machine.root);
69
- const machineHash = hash(transitions);
70
- machineHashes.set(machine, machineHash);
71
- return machineHash;
72
- }
package/tsconfig.json DELETED
@@ -1,109 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "es2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
- /* Modules */
28
- "module": "commonjs" /* Specify what module code is generated. */,
29
- // "rootDir": "./", /* Specify the root folder within your source files. */
30
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
- // "resolveJsonModule": true, /* Enable importing .json files. */
43
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
-
46
- /* JavaScript Support */
47
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
-
51
- /* Emit */
52
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
- "sourceMap": true /* Create source map files for emitted JavaScript files. */,
56
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
- // "outDir": "./", /* Specify an output folder for all emitted files. */
59
- // "removeComments": true, /* Disable emitting comments. */
60
- "noEmit": true /* Disable emitting files from a compilation. */,
61
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68
- // "newLine": "crlf", /* Set the newline character for emitting files. */
69
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
-
76
- /* Interop Constraints */
77
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
81
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
83
-
84
- /* Type Checking */
85
- "strict": true /* Enable all strict type-checking options. */,
86
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99
- "noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */,
100
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
-
105
- /* Completeness */
106
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
- }
109
- }
package/vitest.config.ts DELETED
@@ -1,9 +0,0 @@
1
- // vitest.config.ts
2
- import dotenv from 'dotenv';
3
- dotenv.config();
4
-
5
- export default {
6
- test: {
7
- testTimeout: 10000, // Global timeout of 10000ms for all tests
8
- },
9
- };