@framers/agentos 0.1.69 → 0.1.71
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/api/agent.d.ts +98 -2
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +64 -9
- package/dist/api/agent.js.map +1 -1
- package/dist/api/generateImage.d.ts +109 -0
- package/dist/api/generateImage.d.ts.map +1 -0
- package/dist/api/generateImage.js +41 -0
- package/dist/api/generateImage.js.map +1 -0
- package/dist/api/generateText.d.ts +73 -3
- package/dist/api/generateText.d.ts.map +1 -1
- package/dist/api/generateText.js +29 -4
- package/dist/api/generateText.js.map +1 -1
- package/dist/api/model.d.ts +74 -4
- package/dist/api/model.d.ts.map +1 -1
- package/dist/api/model.js +79 -5
- package/dist/api/model.js.map +1 -1
- package/dist/api/streamText.d.ts +37 -1
- package/dist/api/streamText.d.ts.map +1 -1
- package/dist/api/streamText.js +188 -49
- package/dist/api/streamText.js.map +1 -1
- package/dist/api/toolAdapter.d.ts +58 -0
- package/dist/api/toolAdapter.d.ts.map +1 -0
- package/dist/api/{tool-adapter.js → toolAdapter.js} +24 -2
- package/dist/api/toolAdapter.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestration/builders/AgentGraph.d.ts +250 -0
- package/dist/orchestration/builders/AgentGraph.d.ts.map +1 -0
- package/dist/orchestration/builders/AgentGraph.js +338 -0
- package/dist/orchestration/builders/AgentGraph.js.map +1 -0
- package/dist/orchestration/builders/MissionBuilder.d.ts +231 -0
- package/dist/orchestration/builders/MissionBuilder.d.ts.map +1 -0
- package/dist/orchestration/builders/MissionBuilder.js +321 -0
- package/dist/orchestration/builders/MissionBuilder.js.map +1 -0
- package/dist/orchestration/builders/WorkflowBuilder.d.ts +265 -0
- package/dist/orchestration/builders/WorkflowBuilder.d.ts.map +1 -0
- package/dist/orchestration/builders/WorkflowBuilder.js +472 -0
- package/dist/orchestration/builders/WorkflowBuilder.js.map +1 -0
- package/dist/orchestration/builders/index.d.ts +7 -0
- package/dist/orchestration/builders/index.d.ts.map +1 -0
- package/dist/orchestration/builders/index.js +5 -0
- package/dist/orchestration/builders/index.js.map +1 -0
- package/dist/orchestration/builders/nodes.d.ts +36 -0
- package/dist/orchestration/builders/nodes.d.ts.map +1 -0
- package/dist/orchestration/builders/nodes.js +98 -0
- package/dist/orchestration/builders/nodes.js.map +1 -0
- package/dist/orchestration/checkpoint/ICheckpointStore.d.ts +152 -0
- package/dist/orchestration/checkpoint/ICheckpointStore.d.ts.map +1 -0
- package/dist/orchestration/checkpoint/ICheckpointStore.js +8 -0
- package/dist/orchestration/checkpoint/ICheckpointStore.js.map +1 -0
- package/dist/orchestration/checkpoint/InMemoryCheckpointStore.d.ts +89 -0
- package/dist/orchestration/checkpoint/InMemoryCheckpointStore.d.ts.map +1 -0
- package/dist/orchestration/checkpoint/InMemoryCheckpointStore.js +156 -0
- package/dist/orchestration/checkpoint/InMemoryCheckpointStore.js.map +1 -0
- package/dist/orchestration/checkpoint/index.d.ts +10 -0
- package/dist/orchestration/checkpoint/index.d.ts.map +1 -0
- package/dist/orchestration/checkpoint/index.js +10 -0
- package/dist/orchestration/checkpoint/index.js.map +1 -0
- package/dist/orchestration/compiler/GraphCompiler.d.ts +85 -0
- package/dist/orchestration/compiler/GraphCompiler.d.ts.map +1 -0
- package/dist/orchestration/compiler/GraphCompiler.js +71 -0
- package/dist/orchestration/compiler/GraphCompiler.js.map +1 -0
- package/dist/orchestration/compiler/MissionCompiler.d.ts +181 -0
- package/dist/orchestration/compiler/MissionCompiler.d.ts.map +1 -0
- package/dist/orchestration/compiler/MissionCompiler.js +219 -0
- package/dist/orchestration/compiler/MissionCompiler.js.map +1 -0
- package/dist/orchestration/compiler/SchemaLowering.d.ts +37 -0
- package/dist/orchestration/compiler/SchemaLowering.d.ts.map +1 -0
- package/dist/orchestration/compiler/SchemaLowering.js +93 -0
- package/dist/orchestration/compiler/SchemaLowering.js.map +1 -0
- package/dist/orchestration/compiler/Validator.d.ts +61 -0
- package/dist/orchestration/compiler/Validator.d.ts.map +1 -0
- package/dist/orchestration/compiler/Validator.js +96 -0
- package/dist/orchestration/compiler/Validator.js.map +1 -0
- package/dist/orchestration/compiler/index.d.ts +16 -0
- package/dist/orchestration/compiler/index.d.ts.map +1 -0
- package/dist/orchestration/compiler/index.js +13 -0
- package/dist/orchestration/compiler/index.js.map +1 -0
- package/dist/orchestration/events/GraphEvent.d.ts +233 -0
- package/dist/orchestration/events/GraphEvent.d.ts.map +1 -0
- package/dist/orchestration/events/GraphEvent.js +203 -0
- package/dist/orchestration/events/GraphEvent.js.map +1 -0
- package/dist/orchestration/events/index.d.ts +2 -0
- package/dist/orchestration/events/index.d.ts.map +1 -0
- package/dist/orchestration/events/index.js +2 -0
- package/dist/orchestration/events/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +20 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +26 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/ir/index.d.ts +2 -0
- package/dist/orchestration/ir/index.d.ts.map +1 -0
- package/dist/orchestration/ir/index.js +2 -0
- package/dist/orchestration/ir/index.js.map +1 -0
- package/dist/orchestration/ir/types.d.ts +540 -0
- package/dist/orchestration/ir/types.d.ts.map +1 -0
- package/dist/orchestration/ir/types.js +20 -0
- package/dist/orchestration/ir/types.js.map +1 -0
- package/dist/orchestration/runtime/GraphRuntime.d.ts +135 -0
- package/dist/orchestration/runtime/GraphRuntime.d.ts.map +1 -0
- package/dist/orchestration/runtime/GraphRuntime.js +381 -0
- package/dist/orchestration/runtime/GraphRuntime.js.map +1 -0
- package/dist/orchestration/runtime/LoopController.d.ts +173 -0
- package/dist/orchestration/runtime/LoopController.d.ts.map +1 -0
- package/dist/orchestration/runtime/LoopController.js +130 -0
- package/dist/orchestration/runtime/LoopController.js.map +1 -0
- package/dist/orchestration/runtime/NodeExecutor.d.ts +206 -0
- package/dist/orchestration/runtime/NodeExecutor.d.ts.map +1 -0
- package/dist/orchestration/runtime/NodeExecutor.js +227 -0
- package/dist/orchestration/runtime/NodeExecutor.js.map +1 -0
- package/dist/orchestration/runtime/NodeScheduler.d.ts +85 -0
- package/dist/orchestration/runtime/NodeScheduler.d.ts.map +1 -0
- package/dist/orchestration/runtime/NodeScheduler.js +180 -0
- package/dist/orchestration/runtime/NodeScheduler.js.map +1 -0
- package/dist/orchestration/runtime/StateManager.d.ts +122 -0
- package/dist/orchestration/runtime/StateManager.d.ts.map +1 -0
- package/dist/orchestration/runtime/StateManager.js +243 -0
- package/dist/orchestration/runtime/StateManager.js.map +1 -0
- package/dist/orchestration/runtime/index.d.ts +16 -0
- package/dist/orchestration/runtime/index.d.ts.map +1 -0
- package/dist/orchestration/runtime/index.js +13 -0
- package/dist/orchestration/runtime/index.js.map +1 -0
- package/package.json +10 -4
- package/dist/api/tool-adapter.d.ts +0 -12
- package/dist/api/tool-adapter.d.ts.map +0 -1
- package/dist/api/tool-adapter.js.map +0 -1
package/dist/api/agent.d.ts
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file agent.ts
|
|
3
|
+
* Lightweight stateful agent factory for the AgentOS high-level API.
|
|
4
|
+
*
|
|
5
|
+
* Wraps {@link generateText} and {@link streamText} with per-session conversation
|
|
6
|
+
* history, optional HEXACO-inspired personality shaping, and a named-agent system
|
|
7
|
+
* prompt builder. For full guardrail enforcement or production multi-agent
|
|
8
|
+
* orchestration use the AgentOS runtime (`AgentOSOrchestrator`) instead.
|
|
9
|
+
*/
|
|
1
10
|
import { type GenerateTextOptions, type GenerateTextResult, type Message } from './generateText.js';
|
|
2
11
|
import { type StreamTextResult } from './streamText.js';
|
|
3
|
-
import type { ToolDefinitionMap } from './
|
|
12
|
+
import type { ToolDefinitionMap } from './toolAdapter.js';
|
|
13
|
+
/**
|
|
14
|
+
* Configuration options for the {@link agent} factory function.
|
|
15
|
+
*/
|
|
4
16
|
export interface AgentOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Model in `provider:model` format used for every call made by this agent.
|
|
19
|
+
* @example `"openai:gpt-4o"`, `"anthropic:claude-opus-4-5"`
|
|
20
|
+
*/
|
|
5
21
|
model: string;
|
|
22
|
+
/** Display name injected into the system prompt (e.g. `"Aria"`). */
|
|
6
23
|
name?: string;
|
|
24
|
+
/** Free-form system instructions prepended before personality and name lines. */
|
|
7
25
|
instructions?: string;
|
|
26
|
+
/** Named tools available to the agent on every call. */
|
|
8
27
|
tools?: ToolDefinitionMap;
|
|
28
|
+
/**
|
|
29
|
+
* Enable in-memory conversation history for sessions.
|
|
30
|
+
* When `false`, each `send` / `stream` call is stateless. Defaults to `true`.
|
|
31
|
+
*/
|
|
9
32
|
memory?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* HEXACO-inspired personality trait overrides (0–1 scale).
|
|
35
|
+
* Encoded as a human-readable trait string appended to the system prompt.
|
|
36
|
+
*/
|
|
10
37
|
personality?: Partial<{
|
|
11
38
|
honesty: number;
|
|
12
39
|
emotionality: number;
|
|
@@ -15,26 +42,95 @@ export interface AgentOptions {
|
|
|
15
42
|
conscientiousness: number;
|
|
16
43
|
openness: number;
|
|
17
44
|
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Guardrail policy identifiers.
|
|
47
|
+
* **Not supported** in the lightweight API — passing any values throws immediately.
|
|
48
|
+
* Use `AgentOSOrchestrator` for real guardrail enforcement.
|
|
49
|
+
*/
|
|
18
50
|
guardrails?: string[];
|
|
51
|
+
/** Override the provider API key instead of reading from environment variables. */
|
|
19
52
|
apiKey?: string;
|
|
53
|
+
/** Override the provider base URL (useful for local proxies or Ollama). */
|
|
20
54
|
baseUrl?: string;
|
|
55
|
+
/** Maximum agentic steps per call. Defaults to `5`. */
|
|
21
56
|
maxSteps?: number;
|
|
22
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A named conversation session returned by {@link Agent.session}.
|
|
60
|
+
* Maintains its own message history independently of other sessions on the same agent.
|
|
61
|
+
*/
|
|
23
62
|
export interface AgentSession {
|
|
63
|
+
/** Stable session identifier supplied to or auto-generated by {@link Agent.session}. */
|
|
24
64
|
readonly id: string;
|
|
65
|
+
/**
|
|
66
|
+
* Sends a user message and returns the complete assistant reply.
|
|
67
|
+
* Appends both turns to the session history when `memory` is enabled.
|
|
68
|
+
*
|
|
69
|
+
* @param text - User message text.
|
|
70
|
+
* @returns The full generation result including text, usage, and tool calls.
|
|
71
|
+
*/
|
|
25
72
|
send(text: string): Promise<GenerateTextResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Streams a user message and returns streaming iterables.
|
|
75
|
+
* The assistant reply is appended to session history once the `text` promise resolves.
|
|
76
|
+
*
|
|
77
|
+
* @param text - User message text.
|
|
78
|
+
* @returns A {@link StreamTextResult} with async iterables and awaitable aggregates.
|
|
79
|
+
*/
|
|
26
80
|
stream(text: string): StreamTextResult;
|
|
81
|
+
/** Returns a snapshot of the current conversation history for this session. */
|
|
27
82
|
messages(): Message[];
|
|
83
|
+
/** Clears all messages from this session's history. */
|
|
28
84
|
clear(): void;
|
|
29
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* A stateful agent instance returned by {@link agent}.
|
|
88
|
+
*/
|
|
30
89
|
export interface Agent {
|
|
90
|
+
/**
|
|
91
|
+
* Generates a single reply without maintaining session history.
|
|
92
|
+
*
|
|
93
|
+
* @param prompt - User prompt text.
|
|
94
|
+
* @param opts - Optional overrides merged on top of the agent's base options.
|
|
95
|
+
* @returns The complete generation result.
|
|
96
|
+
*/
|
|
31
97
|
generate(prompt: string, opts?: Partial<GenerateTextOptions>): Promise<GenerateTextResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Streams a single reply without maintaining session history.
|
|
100
|
+
*
|
|
101
|
+
* @param prompt - User prompt text.
|
|
102
|
+
* @param opts - Optional overrides merged on top of the agent's base options.
|
|
103
|
+
* @returns A {@link StreamTextResult}.
|
|
104
|
+
*/
|
|
32
105
|
stream(prompt: string, opts?: Partial<GenerateTextOptions>): StreamTextResult;
|
|
106
|
+
/**
|
|
107
|
+
* Returns (or creates) a named {@link AgentSession} with its own conversation history.
|
|
108
|
+
*
|
|
109
|
+
* @param id - Optional session ID. A unique ID is generated when omitted.
|
|
110
|
+
* @returns The session object for this ID.
|
|
111
|
+
*/
|
|
33
112
|
session(id?: string): AgentSession;
|
|
113
|
+
/** Releases all in-memory session state held by this agent. */
|
|
34
114
|
close(): Promise<void>;
|
|
35
115
|
}
|
|
36
116
|
/**
|
|
37
|
-
* Creates a stateful agent
|
|
117
|
+
* Creates a lightweight stateful agent backed by in-memory session storage.
|
|
118
|
+
*
|
|
119
|
+
* The agent wraps {@link generateText} and {@link streamText} with a persistent
|
|
120
|
+
* system prompt built from `instructions`, `name`, and `personality` fields.
|
|
121
|
+
* Multiple independent sessions can be opened via {@link Agent.session}.
|
|
122
|
+
*
|
|
123
|
+
* @param opts - Agent configuration including model, instructions, and optional tools.
|
|
124
|
+
* @returns An {@link Agent} instance with `generate`, `stream`, `session`, and `close` methods.
|
|
125
|
+
* @throws {Error} If `opts.guardrails` contains any entries (not supported in the lightweight API).
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const myAgent = agent({ model: 'openai:gpt-4o', instructions: 'You are a helpful assistant.' });
|
|
130
|
+
* const session = myAgent.session('user-123');
|
|
131
|
+
* const reply = await session.send('Hello!');
|
|
132
|
+
* console.log(reply.text);
|
|
133
|
+
* ```
|
|
38
134
|
*/
|
|
39
135
|
export declare function agent(opts: AgentOptions): Agent;
|
|
40
136
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/api/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","s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AM,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,IAAI,OAAO,EAAE,CAAC;IACtB,uDAAuD;IACvD,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC3F;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;IAC9E;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACnC,+DAA+D;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAyBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,KAAK,CAgF/C"}
|
package/dist/api/agent.js
CHANGED
|
@@ -1,14 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file agent.ts
|
|
3
|
+
* Lightweight stateful agent factory for the AgentOS high-level API.
|
|
4
|
+
*
|
|
5
|
+
* Wraps {@link generateText} and {@link streamText} with per-session conversation
|
|
6
|
+
* history, optional HEXACO-inspired personality shaping, and a named-agent system
|
|
7
|
+
* prompt builder. For full guardrail enforcement or production multi-agent
|
|
8
|
+
* orchestration use the AgentOS runtime (`AgentOSOrchestrator`) instead.
|
|
9
|
+
*/
|
|
2
10
|
import { generateText } from './generateText.js';
|
|
3
11
|
import { streamText } from './streamText.js';
|
|
12
|
+
function buildSystemPrompt(opts) {
|
|
13
|
+
const sections = [];
|
|
14
|
+
if (opts.instructions?.trim()) {
|
|
15
|
+
sections.push(opts.instructions.trim());
|
|
16
|
+
}
|
|
17
|
+
if (opts.name?.trim()) {
|
|
18
|
+
sections.push(`Assistant name: ${opts.name.trim()}.`);
|
|
19
|
+
}
|
|
20
|
+
if (opts.personality) {
|
|
21
|
+
const traits = Object.entries(opts.personality)
|
|
22
|
+
.filter(([, value]) => typeof value === 'number' && Number.isFinite(value))
|
|
23
|
+
.map(([key, value]) => `${key}=${Number(value).toFixed(2)}`);
|
|
24
|
+
if (traits.length > 0) {
|
|
25
|
+
sections.push(`Behavior traits: ${traits.join(', ')}.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return sections.length > 0 ? sections.join('\n\n') : undefined;
|
|
29
|
+
}
|
|
4
30
|
/**
|
|
5
|
-
* Creates a stateful agent
|
|
31
|
+
* Creates a lightweight stateful agent backed by in-memory session storage.
|
|
32
|
+
*
|
|
33
|
+
* The agent wraps {@link generateText} and {@link streamText} with a persistent
|
|
34
|
+
* system prompt built from `instructions`, `name`, and `personality` fields.
|
|
35
|
+
* Multiple independent sessions can be opened via {@link Agent.session}.
|
|
36
|
+
*
|
|
37
|
+
* @param opts - Agent configuration including model, instructions, and optional tools.
|
|
38
|
+
* @returns An {@link Agent} instance with `generate`, `stream`, `session`, and `close` methods.
|
|
39
|
+
* @throws {Error} If `opts.guardrails` contains any entries (not supported in the lightweight API).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const myAgent = agent({ model: 'openai:gpt-4o', instructions: 'You are a helpful assistant.' });
|
|
44
|
+
* const session = myAgent.session('user-123');
|
|
45
|
+
* const reply = await session.send('Hello!');
|
|
46
|
+
* console.log(reply.text);
|
|
47
|
+
* ```
|
|
6
48
|
*/
|
|
7
49
|
export function agent(opts) {
|
|
50
|
+
if (opts.guardrails && opts.guardrails.length > 0) {
|
|
51
|
+
throw new Error('agent({ guardrails }) is not supported in the lightweight high-level API. Use the full AgentOS runtime for real guardrail enforcement.');
|
|
52
|
+
}
|
|
8
53
|
const sessions = new Map();
|
|
54
|
+
const useMemory = opts.memory !== false;
|
|
9
55
|
const baseOpts = {
|
|
10
56
|
model: opts.model,
|
|
11
|
-
system: opts
|
|
57
|
+
system: buildSystemPrompt(opts),
|
|
12
58
|
tools: opts.tools,
|
|
13
59
|
maxSteps: opts.maxSteps ?? 5,
|
|
14
60
|
apiKey: opts.apiKey,
|
|
@@ -29,22 +75,31 @@ export function agent(opts) {
|
|
|
29
75
|
return {
|
|
30
76
|
id: sessionId,
|
|
31
77
|
async send(text) {
|
|
32
|
-
|
|
78
|
+
const requestMessages = useMemory
|
|
79
|
+
? [...history, { role: 'user', content: text }]
|
|
80
|
+
: [{ role: 'user', content: text }];
|
|
33
81
|
const result = await generateText({
|
|
34
82
|
...baseOpts,
|
|
35
|
-
messages:
|
|
83
|
+
messages: requestMessages,
|
|
36
84
|
});
|
|
37
|
-
|
|
85
|
+
if (useMemory) {
|
|
86
|
+
history.push({ role: 'user', content: text });
|
|
87
|
+
history.push({ role: 'assistant', content: result.text });
|
|
88
|
+
}
|
|
38
89
|
return result;
|
|
39
90
|
},
|
|
40
91
|
stream(text) {
|
|
41
|
-
history.push({ role: 'user', content: text });
|
|
42
92
|
const result = streamText({
|
|
43
93
|
...baseOpts,
|
|
44
|
-
messages:
|
|
94
|
+
messages: useMemory
|
|
95
|
+
? [...history, { role: 'user', content: text }]
|
|
96
|
+
: [{ role: 'user', content: text }],
|
|
45
97
|
});
|
|
46
98
|
// Capture text for history when done
|
|
47
|
-
|
|
99
|
+
if (useMemory) {
|
|
100
|
+
history.push({ role: 'user', content: text });
|
|
101
|
+
result.text.then((replyText) => history.push({ role: 'assistant', content: replyText }));
|
|
102
|
+
}
|
|
48
103
|
return result;
|
|
49
104
|
},
|
|
50
105
|
messages() {
|
package/dist/api/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version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,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;oBAC3F,CAAC;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,QAAQ;oBACN,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;gBACtB,CAAC;gBAED,KAAK;oBACH,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;gBACrB,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,KAAK;YACT,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** A single generated image with optional URL and base64 data. */
|
|
2
|
+
export interface GeneratedImage {
|
|
3
|
+
url?: string;
|
|
4
|
+
b64_json?: string;
|
|
5
|
+
revised_prompt?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Result from an image provider. */
|
|
8
|
+
interface ImageGenerationResult {
|
|
9
|
+
modelId: string;
|
|
10
|
+
providerId: string;
|
|
11
|
+
created: number;
|
|
12
|
+
text?: string;
|
|
13
|
+
images: GeneratedImage[];
|
|
14
|
+
usage?: {
|
|
15
|
+
promptTokens?: number;
|
|
16
|
+
totalTokens?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Provider-specific option bag. */
|
|
20
|
+
type ImageProviderOptionBag = Record<string, unknown>;
|
|
21
|
+
/** Response format: URL or base64. */
|
|
22
|
+
type ImageResponseFormat = 'url' | 'b64_json';
|
|
23
|
+
/** Background style. */
|
|
24
|
+
type ImageBackground = 'transparent' | 'opaque' | 'auto';
|
|
25
|
+
/** Image modality. */
|
|
26
|
+
type ImageModality = 'image' | 'text';
|
|
27
|
+
/** Output file format. */
|
|
28
|
+
type ImageOutputFormat = 'png' | 'jpeg' | 'webp' | 'gif';
|
|
29
|
+
/**
|
|
30
|
+
* Options for a {@link generateImage} call.
|
|
31
|
+
*/
|
|
32
|
+
export interface GenerateImageOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Model in `provider:model` format.
|
|
35
|
+
* @example `"openai:dall-e-3"`, `"stability:stable-diffusion-xl-1024-v1-0"`
|
|
36
|
+
*/
|
|
37
|
+
model: string;
|
|
38
|
+
/** Text description of the desired image. */
|
|
39
|
+
prompt: string;
|
|
40
|
+
/** Output modalities requested from the provider (provider-dependent). */
|
|
41
|
+
modalities?: ImageModality[];
|
|
42
|
+
/** Number of images to generate. Defaults to `1` for most providers. */
|
|
43
|
+
n?: number;
|
|
44
|
+
/** Pixel dimensions string, e.g. `"1024x1024"`. Provider-dependent. */
|
|
45
|
+
size?: string;
|
|
46
|
+
/** Aspect ratio string, e.g. `"16:9"`. Used by some providers instead of `size`. */
|
|
47
|
+
aspectRatio?: string;
|
|
48
|
+
/** Quality hint forwarded to the provider (e.g. `"hd"` for DALL-E 3). */
|
|
49
|
+
quality?: string;
|
|
50
|
+
/** Background style for transparent-capable providers. */
|
|
51
|
+
background?: ImageBackground;
|
|
52
|
+
/** Desired output file format (e.g. `"png"`, `"jpeg"`, `"webp"`). */
|
|
53
|
+
outputFormat?: ImageOutputFormat;
|
|
54
|
+
/** Compression level (0–100) for lossy output formats. */
|
|
55
|
+
outputCompression?: number;
|
|
56
|
+
/** Whether the provider should return a URL or base64-encoded data. */
|
|
57
|
+
responseFormat?: ImageResponseFormat;
|
|
58
|
+
/** Override the provider API key instead of reading from environment variables. */
|
|
59
|
+
apiKey?: string;
|
|
60
|
+
/** Override the provider base URL. */
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
/** Optional user identifier forwarded to the provider for moderation tracking. */
|
|
63
|
+
userId?: string;
|
|
64
|
+
/** Random seed for reproducible generation (provider-dependent support). */
|
|
65
|
+
seed?: number;
|
|
66
|
+
/** Negative prompt describing content to avoid (provider-dependent support). */
|
|
67
|
+
negativePrompt?: string;
|
|
68
|
+
/** Arbitrary provider-specific options not covered by the standard fields. */
|
|
69
|
+
providerOptions?: ImageProviderOptionBag | Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The result returned by {@link generateImage}.
|
|
73
|
+
*/
|
|
74
|
+
export interface GenerateImageResult {
|
|
75
|
+
/** Model identifier reported by the provider. */
|
|
76
|
+
model: string;
|
|
77
|
+
/** Provider identifier (e.g. `"openai"`, `"stability"`). */
|
|
78
|
+
provider: string;
|
|
79
|
+
/** Unix timestamp (seconds) when the image was created. */
|
|
80
|
+
created: number;
|
|
81
|
+
/** Optional text response accompanying the images (provider-dependent). */
|
|
82
|
+
text?: string;
|
|
83
|
+
/** Array of generated image objects containing URLs or base64 data. */
|
|
84
|
+
images: GeneratedImage[];
|
|
85
|
+
/** Token / credit usage reported by the provider, when available. */
|
|
86
|
+
usage?: ImageGenerationResult['usage'];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generates one or more images using a provider-agnostic `provider:model` string.
|
|
90
|
+
*
|
|
91
|
+
* Resolves credentials via {@link resolveMediaProvider}, initialises the matching
|
|
92
|
+
* image provider, and returns a normalised {@link GenerateImageResult}.
|
|
93
|
+
*
|
|
94
|
+
* @param opts - Image generation options including model, prompt, and optional parameters.
|
|
95
|
+
* @returns A promise resolving to the generation result with image data and metadata.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const result = await generateImage({
|
|
100
|
+
* model: 'openai:dall-e-3',
|
|
101
|
+
* prompt: 'A photorealistic red panda sitting on a moonlit rooftop.',
|
|
102
|
+
* size: '1024x1024',
|
|
103
|
+
* });
|
|
104
|
+
* console.log(result.images[0].url);
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function generateImage(opts: GenerateImageOptions): Promise<GenerateImageResult>;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=generateImage.d.ts.map
|
|
@@ -0,0 +1 @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level API.
|
|
4
|
+
*
|
|
5
|
+
* Parses a `provider:model` string, resolves media-provider credentials, and
|
|
6
|
+
* dispatches the request to the appropriate image provider implementation
|
|
7
|
+
* (e.g. OpenAI DALL-E, Stability AI, Replicate).
|
|
8
|
+
*/
|
|
9
|
+
import { parseModelString, resolveMediaProvider } from './model.js';
|
|
10
|
+
/**
|
|
11
|
+
* Generates one or more images using a provider-agnostic `provider:model` string.
|
|
12
|
+
*
|
|
13
|
+
* Resolves credentials via {@link resolveMediaProvider}, initialises the matching
|
|
14
|
+
* image provider, and returns a normalised {@link GenerateImageResult}.
|
|
15
|
+
*
|
|
16
|
+
* @param opts - Image generation options including model, prompt, and optional parameters.
|
|
17
|
+
* @returns A promise resolving to the generation result with image data and metadata.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const result = await generateImage({
|
|
22
|
+
* model: 'openai:dall-e-3',
|
|
23
|
+
* prompt: 'A photorealistic red panda sitting on a moonlit rooftop.',
|
|
24
|
+
* size: '1024x1024',
|
|
25
|
+
* });
|
|
26
|
+
* console.log(result.images[0].url);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export async function generateImage(opts) {
|
|
30
|
+
const { providerId, modelId } = parseModelString(opts.model);
|
|
31
|
+
const resolved = resolveMediaProvider(providerId, modelId, {
|
|
32
|
+
apiKey: opts.apiKey,
|
|
33
|
+
baseUrl: opts.baseUrl,
|
|
34
|
+
});
|
|
35
|
+
// TODO: Wire to core/images/ module once implemented.
|
|
36
|
+
// For now, throw a descriptive error so callers know the provider layer isn't ready.
|
|
37
|
+
throw new Error(`generateImage() is not yet wired to a provider backend. ` +
|
|
38
|
+
`Resolved: ${resolved.providerId}:${resolved.modelId}. ` +
|
|
39
|
+
`The core/images/ module needs to be implemented first.`);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=generateImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateImage.js","sourceRoot":"","sources":["../../src/api/generateImage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA+EpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAA0B;IAC5D,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE;QACzD,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAC;IAEH,sDAAsD;IACtD,qFAAqF;IACrF,MAAM,IAAI,KAAK,CACb,0DAA0D;QAC1D,aAAa,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,IAAI;QACxD,wDAAwD,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -1,40 +1,110 @@
|
|
|
1
|
-
import { type ToolDefinitionMap } from './
|
|
1
|
+
import { type ToolDefinitionMap } from './toolAdapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* A single chat message in a conversation history.
|
|
4
|
+
* Mirrors the OpenAI / Anthropic message shape accepted by provider adapters.
|
|
5
|
+
*/
|
|
2
6
|
export interface Message {
|
|
7
|
+
/** Role of the message author. */
|
|
3
8
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
9
|
+
/** Plain-text or serialised-JSON content of the message. */
|
|
4
10
|
content: string;
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Record of a single tool invocation performed during a {@link generateText} call.
|
|
14
|
+
* One record is appended per tool call, regardless of whether the call succeeded.
|
|
15
|
+
*/
|
|
6
16
|
export interface ToolCallRecord {
|
|
17
|
+
/** Name of the tool as registered in the `tools` map. */
|
|
7
18
|
name: string;
|
|
19
|
+
/** Parsed arguments supplied by the model. */
|
|
8
20
|
args: unknown;
|
|
21
|
+
/** Return value from the tool's `execute` function (present on success). */
|
|
9
22
|
result?: unknown;
|
|
23
|
+
/** Error message when the tool threw or returned a failure result. */
|
|
10
24
|
error?: string;
|
|
11
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Token consumption figures reported by the provider for a single completion call.
|
|
28
|
+
* All values are approximate and provider-dependent.
|
|
29
|
+
*/
|
|
12
30
|
export interface TokenUsage {
|
|
31
|
+
/** Number of tokens in the prompt / input sent to the model. */
|
|
13
32
|
promptTokens: number;
|
|
33
|
+
/** Number of tokens in the model's response. */
|
|
14
34
|
completionTokens: number;
|
|
35
|
+
/** Sum of `promptTokens` and `completionTokens`. */
|
|
15
36
|
totalTokens: number;
|
|
16
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Options for a {@link generateText} call.
|
|
40
|
+
* Either `prompt` or `messages` (or both) must be provided.
|
|
41
|
+
*/
|
|
17
42
|
export interface GenerateTextOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Model identifier in `provider:model` format.
|
|
45
|
+
* @example `"openai:gpt-4o"`, `"anthropic:claude-opus-4-5"`, `"ollama:llama3.2"`
|
|
46
|
+
*/
|
|
18
47
|
model: string;
|
|
48
|
+
/** Single user turn to append after any `messages`. Convenience alternative to building a `messages` array. */
|
|
19
49
|
prompt?: string;
|
|
50
|
+
/** System prompt injected as the first message. */
|
|
20
51
|
system?: string;
|
|
52
|
+
/** Full conversation history. Appended before `prompt` when both are supplied. */
|
|
21
53
|
messages?: Message[];
|
|
54
|
+
/** Named tools the model may invoke. Values are {@link ToolDefinition} objects or {@link ITool} instances. */
|
|
22
55
|
tools?: ToolDefinitionMap;
|
|
56
|
+
/**
|
|
57
|
+
* Maximum number of agentic steps (LLM calls) to execute before returning.
|
|
58
|
+
* Each tool-call round trip counts as one step. Defaults to `1`.
|
|
59
|
+
*/
|
|
23
60
|
maxSteps?: number;
|
|
61
|
+
/** Sampling temperature forwarded to the provider (0–2 for most providers). */
|
|
24
62
|
temperature?: number;
|
|
63
|
+
/** Hard cap on output tokens. Provider-dependent default applies when omitted. */
|
|
25
64
|
maxTokens?: number;
|
|
65
|
+
/** Override the API key instead of reading from environment variables. */
|
|
26
66
|
apiKey?: string;
|
|
67
|
+
/** Override the provider base URL (useful for local proxies or Ollama). */
|
|
27
68
|
baseUrl?: string;
|
|
28
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The completed result returned by {@link generateText}.
|
|
72
|
+
*/
|
|
29
73
|
export interface GenerateTextResult {
|
|
74
|
+
/** Final assistant text after all agentic steps have completed. */
|
|
30
75
|
text: string;
|
|
76
|
+
/** Aggregated token usage across all steps. */
|
|
31
77
|
usage: TokenUsage;
|
|
78
|
+
/** Ordered list of every tool call made during the run. */
|
|
32
79
|
toolCalls: ToolCallRecord[];
|
|
80
|
+
/**
|
|
81
|
+
* Reason the model stopped generating.
|
|
82
|
+
* - `"stop"` — natural end of response.
|
|
83
|
+
* - `"length"` — `maxTokens` limit reached.
|
|
84
|
+
* - `"tool-calls"` — loop exhausted `maxSteps` while still calling tools.
|
|
85
|
+
* - `"error"` — provider returned an error.
|
|
86
|
+
*/
|
|
33
87
|
finishReason: 'stop' | 'length' | 'tool-calls' | 'error';
|
|
34
88
|
}
|
|
35
89
|
/**
|
|
36
|
-
* Stateless text generation
|
|
37
|
-
*
|
|
90
|
+
* Stateless text generation with optional multi-step tool calling.
|
|
91
|
+
*
|
|
92
|
+
* Creates a temporary provider manager, executes one or more LLM completion
|
|
93
|
+
* steps (each tool-call round trip counts as one step), and returns the final
|
|
94
|
+
* assembled result. Provider credentials are resolved from environment
|
|
95
|
+
* variables unless overridden in `opts`.
|
|
96
|
+
*
|
|
97
|
+
* @param opts - Generation options including model, prompt/messages, and optional tools.
|
|
98
|
+
* @returns A promise that resolves to the final text, token usage, tool call log, and finish reason.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const result = await generateText({
|
|
103
|
+
* model: 'openai:gpt-4o',
|
|
104
|
+
* prompt: 'Summarise the history of the Roman Empire in two sentences.',
|
|
105
|
+
* });
|
|
106
|
+
* console.log(result.text);
|
|
107
|
+
* ```
|
|
38
108
|
*/
|
|
39
109
|
export declare function generateText(opts: GenerateTextOptions): Promise<GenerateTextResult>;
|
|
40
110
|
//# sourceMappingURL=generateText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateText.d.ts","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateText.d.ts","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAUA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGtE;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,kCAAkC;IAClC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,8GAA8G;IAC9G,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,UAAU,CAAC;IAClB,2DAA2D;IAC3D,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyHzF"}
|
package/dist/api/generateText.js
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file generateText.ts
|
|
3
|
+
* Stateless, single-call text generation for the AgentOS high-level API.
|
|
4
|
+
*
|
|
5
|
+
* Parses a `provider:model` string, resolves credentials from environment
|
|
6
|
+
* variables or caller-supplied overrides, and invokes the provider's completion
|
|
7
|
+
* endpoint. Multi-step tool calling is supported: the loop continues until the
|
|
8
|
+
* model produces a plain-text reply or `maxSteps` is exhausted.
|
|
9
|
+
*/
|
|
1
10
|
import { parseModelString, resolveProvider, createProviderManager } from './model.js';
|
|
2
|
-
import { adaptTools } from './
|
|
11
|
+
import { adaptTools } from './toolAdapter.js';
|
|
3
12
|
/**
|
|
4
|
-
* Stateless text generation
|
|
5
|
-
*
|
|
13
|
+
* Stateless text generation with optional multi-step tool calling.
|
|
14
|
+
*
|
|
15
|
+
* Creates a temporary provider manager, executes one or more LLM completion
|
|
16
|
+
* steps (each tool-call round trip counts as one step), and returns the final
|
|
17
|
+
* assembled result. Provider credentials are resolved from environment
|
|
18
|
+
* variables unless overridden in `opts`.
|
|
19
|
+
*
|
|
20
|
+
* @param opts - Generation options including model, prompt/messages, and optional tools.
|
|
21
|
+
* @returns A promise that resolves to the final text, token usage, tool call log, and finish reason.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const result = await generateText({
|
|
26
|
+
* model: 'openai:gpt-4o',
|
|
27
|
+
* prompt: 'Summarise the history of the Roman Empire in two sentences.',
|
|
28
|
+
* });
|
|
29
|
+
* console.log(result.text);
|
|
30
|
+
* ```
|
|
6
31
|
*/
|
|
7
32
|
export async function generateText(opts) {
|
|
8
33
|
const { providerId, modelId } = parseModelString(opts.model);
|
|
@@ -32,7 +57,7 @@ export async function generateText(opts) {
|
|
|
32
57
|
}))
|
|
33
58
|
: undefined;
|
|
34
59
|
const allToolCalls = [];
|
|
35
|
-
|
|
60
|
+
const totalUsage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
36
61
|
const maxSteps = opts.maxSteps ?? 1;
|
|
37
62
|
for (let step = 0; step < maxSteps; step++) {
|
|
38
63
|
const response = await provider.generateCompletion(resolved.modelId, messages, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateText.js","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,UAAU,EAA0B,MAAM,
|
|
1
|
+
{"version":3,"file":"generateText.js","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAAA;;;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