@standardagents/builder 0.11.0-next.99fb790 → 0.11.0-next.a433660
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/built-in-routes.js +5708 -6
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -240,6 +240,10 @@ interface ThreadInstance {
|
|
|
240
240
|
}>;
|
|
241
241
|
getLogs(limit?: number, offset?: number, order?: "asc" | "desc"): Promise<LogData[]>;
|
|
242
242
|
getThreadMeta(threadId: string): Promise<ThreadMetadata | null>;
|
|
243
|
+
deleteMessage(messageId: string): Promise<{
|
|
244
|
+
success: boolean;
|
|
245
|
+
error?: string;
|
|
246
|
+
}>;
|
|
243
247
|
shouldStop(): Promise<boolean>;
|
|
244
248
|
tools(): Record<string, () => Promise<NativeToolModule>>;
|
|
245
249
|
hooks(): HookRegistry;
|
|
@@ -264,6 +268,7 @@ interface ThreadInstance {
|
|
|
264
268
|
data?: string;
|
|
265
269
|
error?: string;
|
|
266
270
|
}>;
|
|
271
|
+
runAgent(threadId: string, agentName: string): Promise<void>;
|
|
267
272
|
scheduleEffect(threadId: string, effectName: string, effectArgs: Record<string, unknown>, delayMs?: number): Promise<string>;
|
|
268
273
|
getScheduledEffects(name?: string): Promise<Array<{
|
|
269
274
|
id: string;
|
|
@@ -1066,6 +1071,16 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
1066
1071
|
* Used for creating ThreadState outside of flow execution.
|
|
1067
1072
|
*/
|
|
1068
1073
|
getThreadMetadata(threadId: string): Promise<ThreadMetadata>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Trigger an agent to run on this thread.
|
|
1076
|
+
*
|
|
1077
|
+
* Queues an agent execution via the alarm queue. The execution
|
|
1078
|
+
* runs asynchronously in the background.
|
|
1079
|
+
*
|
|
1080
|
+
* @param threadId - Thread ID for the execution
|
|
1081
|
+
* @param agentName - Name of the agent to run
|
|
1082
|
+
*/
|
|
1083
|
+
runAgent(threadId: string, agentName: string): Promise<void>;
|
|
1069
1084
|
/**
|
|
1070
1085
|
* Schedule an effect for future execution.
|
|
1071
1086
|
*
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import { sip } from '@standardagents/sip';
|
|
|
2
2
|
import fs2 from 'fs';
|
|
3
3
|
import path3 from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
-
import { createRequire } from 'module';
|
|
6
5
|
export { defineAgent, defineHook, defineModel, definePrompt, defineThreadEndpoint, defineTool } from '@standardagents/spec';
|
|
7
6
|
import { DurableObject } from 'cloudflare:workers';
|
|
8
7
|
|
|
@@ -2312,6 +2311,10 @@ var init_ThreadStateImpl = __esm({
|
|
|
2312
2311
|
async updateMessage(messageId, updates) {
|
|
2313
2312
|
throw new Error("updateMessage not yet implemented");
|
|
2314
2313
|
}
|
|
2314
|
+
async deleteMessage(messageId) {
|
|
2315
|
+
const result = await this._threadInstance.deleteMessage(messageId);
|
|
2316
|
+
return result.success;
|
|
2317
|
+
}
|
|
2315
2318
|
// ─────────────────────────────────────────────────────────────────────────
|
|
2316
2319
|
// Logs
|
|
2317
2320
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -2496,6 +2499,12 @@ var init_ThreadStateImpl = __esm({
|
|
|
2496
2499
|
return this._executionState;
|
|
2497
2500
|
}
|
|
2498
2501
|
// ─────────────────────────────────────────────────────────────────────────
|
|
2502
|
+
// Agent Execution
|
|
2503
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
2504
|
+
async runAgent(agentName) {
|
|
2505
|
+
await this._threadInstance.runAgent(this._metadata.id, agentName);
|
|
2506
|
+
}
|
|
2507
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
2499
2508
|
// Effect Scheduling
|
|
2500
2509
|
// ─────────────────────────────────────────────────────────────────────────
|
|
2501
2510
|
async scheduleEffect(name, args, delay = 0) {
|
|
@@ -7688,7 +7697,6 @@ function validateAgentData(data) {
|
|
|
7688
7697
|
}
|
|
7689
7698
|
|
|
7690
7699
|
// src/plugin.ts
|
|
7691
|
-
createRequire(import.meta.url);
|
|
7692
7700
|
var VIRTUAL_TOOLS_ID = "virtual:@standardagents-tools";
|
|
7693
7701
|
var RESOLVED_VIRTUAL_TOOLS_ID = "\0" + VIRTUAL_TOOLS_ID;
|
|
7694
7702
|
var VIRTUAL_ROUTES_ID = "virtual:@standardagents-routes";
|
|
@@ -10659,6 +10667,33 @@ var DurableThread = class extends DurableObject {
|
|
|
10659
10667
|
};
|
|
10660
10668
|
}
|
|
10661
10669
|
// ============================================================
|
|
10670
|
+
// Agent Execution Methods (for use by ThreadStateImpl)
|
|
10671
|
+
// ============================================================
|
|
10672
|
+
/**
|
|
10673
|
+
* Trigger an agent to run on this thread.
|
|
10674
|
+
*
|
|
10675
|
+
* Queues an agent execution via the alarm queue. The execution
|
|
10676
|
+
* runs asynchronously in the background.
|
|
10677
|
+
*
|
|
10678
|
+
* @param threadId - Thread ID for the execution
|
|
10679
|
+
* @param agentName - Name of the agent to run
|
|
10680
|
+
*/
|
|
10681
|
+
async runAgent(threadId, agentName) {
|
|
10682
|
+
const agents = this.agents();
|
|
10683
|
+
if (!agents[agentName]) {
|
|
10684
|
+
throw new Error(`Agent not found: ${agentName}`);
|
|
10685
|
+
}
|
|
10686
|
+
await this.alarmQueue.enqueue(
|
|
10687
|
+
"executeFlow",
|
|
10688
|
+
{
|
|
10689
|
+
threadId,
|
|
10690
|
+
agentId: agentName
|
|
10691
|
+
},
|
|
10692
|
+
0
|
|
10693
|
+
// Execute immediately
|
|
10694
|
+
);
|
|
10695
|
+
}
|
|
10696
|
+
// ============================================================
|
|
10662
10697
|
// Effect Scheduling Methods (for use by ThreadStateImpl)
|
|
10663
10698
|
// ============================================================
|
|
10664
10699
|
/**
|