@simulacra-ai/core 0.0.8 → 0.0.9
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/README.md +19 -3
- package/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -180,6 +180,12 @@ declare class WorkflowManager {
|
|
|
180
180
|
* This is typically not needed as workflows are started automatically when messages are sent.
|
|
181
181
|
*/
|
|
182
182
|
start_workflow(): void;
|
|
183
|
+
/**
|
|
184
|
+
* Sends a prompt and returns a promise that resolves when the full workflow
|
|
185
|
+
* completes, including all tool execution rounds.
|
|
186
|
+
*/
|
|
187
|
+
run(prompt: string): Promise<WorkflowEndEvent>;
|
|
188
|
+
run(contents: UserContent[]): Promise<WorkflowEndEvent>;
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,12 @@ declare class WorkflowManager {
|
|
|
180
180
|
* This is typically not needed as workflows are started automatically when messages are sent.
|
|
181
181
|
*/
|
|
182
182
|
start_workflow(): void;
|
|
183
|
+
/**
|
|
184
|
+
* Sends a prompt and returns a promise that resolves when the full workflow
|
|
185
|
+
* completes, including all tool execution rounds.
|
|
186
|
+
*/
|
|
187
|
+
run(prompt: string): Promise<WorkflowEndEvent>;
|
|
188
|
+
run(contents: UserContent[]): Promise<WorkflowEndEvent>;
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2105,6 +2105,26 @@ var WorkflowManager = class {
|
|
|
2105
2105
|
throw new Error("invalid state");
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
|
+
async run(input) {
|
|
2109
|
+
if (this.#state !== "idle") {
|
|
2110
|
+
throw new Error("invalid state");
|
|
2111
|
+
}
|
|
2112
|
+
const workflow_end = new Promise((resolve) => {
|
|
2113
|
+
const handler = (event) => {
|
|
2114
|
+
if (event.event_name === "workflow_end") {
|
|
2115
|
+
this.off("workflow_event", handler);
|
|
2116
|
+
resolve(event.event_args[0]);
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
this.on("workflow_event", handler);
|
|
2120
|
+
});
|
|
2121
|
+
if (typeof input === "string") {
|
|
2122
|
+
await this.#conversation.prompt(input);
|
|
2123
|
+
} else {
|
|
2124
|
+
await this.#conversation.send_message(input);
|
|
2125
|
+
}
|
|
2126
|
+
return workflow_end;
|
|
2127
|
+
}
|
|
2108
2128
|
#on_prompt_send = ({ message }) => {
|
|
2109
2129
|
if (this.#current_workflow) {
|
|
2110
2130
|
return;
|