@agent-native/core 0.136.3 → 0.136.4

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 (37) hide show
  1. package/dist/client/agent-page/AgentJobsTab.js +19 -4
  2. package/dist/client/agent-page/use-jobs.d.ts +10 -0
  3. package/dist/client/agent-page/use-jobs.js +21 -0
  4. package/dist/collab/awareness.d.ts +2 -2
  5. package/dist/jobs/actions/run-automation-now.d.ts +6 -0
  6. package/dist/jobs/actions/run-automation-now.js +22 -0
  7. package/dist/jobs/background-automation-runner.d.ts +2 -0
  8. package/dist/jobs/background-automation-runner.js +22 -16
  9. package/dist/jobs/run-history.d.ts +17 -3
  10. package/dist/jobs/run-history.js +73 -7
  11. package/dist/jobs/run-now.d.ts +20 -0
  12. package/dist/jobs/run-now.js +99 -0
  13. package/dist/jobs/scheduler.d.ts +15 -0
  14. package/dist/jobs/scheduler.js +76 -12
  15. package/dist/localization/default-messages.d.ts +3 -0
  16. package/dist/localization/default-messages.js +3 -0
  17. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  18. package/dist/notifications/routes.d.ts +3 -3
  19. package/dist/observability/routes.d.ts +3 -3
  20. package/dist/provider-api/actions/custom-provider-registration.d.ts +12 -12
  21. package/dist/provider-api/actions/provider-api.d.ts +4 -4
  22. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  23. package/dist/resources/handlers.d.ts +1 -1
  24. package/dist/secrets/routes.d.ts +3 -3
  25. package/dist/server/action-discovery.js +4 -0
  26. package/dist/server/agent-chat-plugin.js +135 -68
  27. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  28. package/dist/server/email-actions.d.ts +6 -3
  29. package/dist/server/email-actions.js +17 -83
  30. package/dist/server/email-markdown.d.ts +4 -0
  31. package/dist/server/email-markdown.js +174 -0
  32. package/dist/server/transcribe-voice.d.ts +1 -1
  33. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -0
  34. package/dist/triggers/actions.d.ts +1 -1
  35. package/dist/triggers/actions.js +27 -5
  36. package/package.json +1 -1
  37. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -0
@@ -5,12 +5,13 @@
5
5
  * available in every template. The agent uses them to create, list, and
6
6
  * manage automations from chat.
7
7
  *
8
- * All six operations are consolidated into a single `manage-automations` tool
8
+ * All seven operations are consolidated into a single `manage-automations` tool
9
9
  * with an `action` discriminator to keep the tool registry compact.
10
10
  */
11
11
  import { defineAutomation, deleteAutomation, listAutomationDefinitions, updateAutomation, } from "../automations/service.js";
12
12
  import { listEvents } from "../event-bus/index.js";
13
13
  import { describeCron, effectiveTimezone } from "../jobs/cron.js";
14
+ import { queueAutomationRunNow } from "../jobs/run-now.js";
14
15
  import { getIntegrationRequestContext, getRequestOrgId, } from "../server/request-context.js";
15
16
  import { refreshEventSubscriptions } from "./dispatcher.js";
16
17
  /* ------------------------------------------------------------------ */
@@ -235,6 +236,23 @@ async function handleFireTest(args, getCurrentUser) {
235
236
  emit("test.event.fired", { data }, { owner });
236
237
  return `Test event fired with payload: ${JSON.stringify({ data })}. Any automations subscribed to "test.event.fired" will be evaluated.`;
237
238
  }
239
+ async function handleRunNow(args, getCurrentUser, context) {
240
+ if (context?.caller === "automation") {
241
+ return "Error: an automation cannot run another automation.";
242
+ }
243
+ try {
244
+ const result = await queueAutomationRunNow({
245
+ userEmail: getCurrentUser(),
246
+ orgId: getRequestOrgId(),
247
+ scope: automationScope(args.scope),
248
+ name: typeof args.name === "string" ? args.name : "",
249
+ });
250
+ return JSON.stringify(result);
251
+ }
252
+ catch (error) {
253
+ return `Error: ${error.message}`;
254
+ }
255
+ }
238
256
  /* ------------------------------------------------------------------ */
239
257
  /* Consolidated tool entry */
240
258
  /* ------------------------------------------------------------------ */
@@ -245,6 +263,7 @@ const VALID_ACTIONS = [
245
263
  "update",
246
264
  "delete",
247
265
  "fire-test",
266
+ "run-now",
248
267
  ];
249
268
  export function createAutomationToolEntries(getCurrentUser) {
250
269
  return {
@@ -257,18 +276,19 @@ export function createAutomationToolEntries(getCurrentUser) {
257
276
  - **define**: Create a new automation. IMPORTANT: Always confirm with the user before calling — show them a summary of what will be created. Required params: name, trigger_type, body. Optional: scope, event, schedule, timezone, condition, mode, domain, delegated_policy_id, model, mcpTools.
258
277
  - **update**: Update an existing automation's settings without changing its creator (enabled, schedule, timezone, condition, body, policy, model, MCP allowlist). Required param: name. Use the same scope it was created in.
259
278
  - **delete**: Delete an automation. Always confirm with the user first. Required param: name.
260
- - **fire-test**: Fire a test event to validate automations. Emits a test.event.fired event. Optional param: data (JSON string).`,
279
+ - **fire-test**: Fire a test event to validate automations. Emits a test.event.fired event. Optional param: data (JSON string).
280
+ - **run-now**: Run one automation immediately using its real actions and side effects. This is an explicit user-authorized run and returns a durable run id; it does not change the automation's next scheduled run. Required params: name; optional scope.`,
261
281
  parameters: {
262
282
  type: "object",
263
283
  properties: {
264
284
  action: {
265
285
  type: "string",
266
- description: "The operation to perform: list-events, list, define, update, delete, or fire-test.",
286
+ description: "The operation to perform: list-events, list, define, update, delete, fire-test, or run-now.",
267
287
  enum: [...VALID_ACTIONS],
268
288
  },
269
289
  name: {
270
290
  type: "string",
271
- description: "Slug name for the automation (lowercase, hyphens). Used by define, update, and delete.",
291
+ description: "Slug name for the automation (lowercase, hyphens). Used by define, update, delete, and run-now.",
272
292
  },
273
293
  scope: {
274
294
  type: "string",
@@ -345,7 +365,7 @@ export function createAutomationToolEntries(getCurrentUser) {
345
365
  allowedValues: { action: ["list-events", "list"] },
346
366
  description: "Plan mode allows listing automations and event types.",
347
367
  },
348
- run: async (args) => {
368
+ run: async (args, context) => {
349
369
  const action = args.action;
350
370
  switch (action) {
351
371
  case "list-events":
@@ -360,6 +380,8 @@ export function createAutomationToolEntries(getCurrentUser) {
360
380
  return handleDelete(args, getCurrentUser);
361
381
  case "fire-test":
362
382
  return handleFireTest(args, getCurrentUser);
383
+ case "run-now":
384
+ return handleRunNow(args, getCurrentUser, context);
363
385
  default:
364
386
  return `Error: unknown action "${action}". Valid actions: ${VALID_ACTIONS.join(", ")}.`;
365
387
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.136.3",
3
+ "version": "0.136.4",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -103,6 +103,7 @@ All automation operations are accessed through a single `manage-automations` too
103
103
  | `update` | Update an existing automation (enabled, condition, body) |
104
104
  | `delete` | Delete an automation (always confirm with user first) |
105
105
  | `fire-test` | Emit a `test.event.fired` event to validate automations |
106
+ | `run-now` | Run one automation immediately with its real actions and side effects |
106
107
 
107
108
  Additional tool: `web-request` — outbound HTTP with `${keys.NAME}` substitution.
108
109