@nuxtagentic/automations 0.0.0-stage → 0.1.1
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/LICENSE.md +9 -0
- package/README.md +173 -2
- package/client.ts +24 -0
- package/module.ts +55 -0
- package/package.json +59 -3
- package/runtime/components/AutomationCanvas.vue +488 -0
- package/runtime/components/AutomationInspector.vue +436 -0
- package/runtime/components/AutomationNodeIcon.vue +27 -0
- package/runtime/components/AutomationRunsPanel.vue +475 -0
- package/runtime/components/AutomationSidebar.vue +253 -0
- package/runtime/components/AutomationStatusIcon.vue +44 -0
- package/runtime/pages/automations.vue +1181 -0
- package/runtime/server/api/automations/[id]/endpoint.get.ts +12 -0
- package/runtime/server/api/automations/[id]/run.post.ts +30 -0
- package/runtime/server/api/automations/events.post.ts +37 -0
- package/runtime/server/api/automations/runs/[id]/resume.post.ts +23 -0
- package/runtime/server/handlers/automation-hook.post.ts +51 -0
- package/runtime/server/handlers/connect-hook.post.ts +54 -0
- package/runtime/server/handlers/integration-hook.post.ts +86 -0
- package/runtime/server/plugins/events.ts +79 -0
- package/runtime/server/plugins/maintenance.ts +20 -0
- package/runtime/server/utils/agent-runner.ts +15 -0
- package/runtime/server/utils/automation-context.ts +77 -0
- package/runtime/server/utils/automation-engine.ts +697 -0
- package/runtime/server/utils/automation-launch.ts +205 -0
- package/runtime/server/utils/automation-schedule.ts +31 -0
- package/runtime/server/utils/connection-events.ts +114 -0
- package/runtime/server/utils/maintenance.ts +255 -0
- package/runtime/server/utils/schedule-sync.ts +32 -0
- package/runtime/server/utils/transient-retry.ts +34 -0
- package/runtime/server/workflows/runner.ts +39 -0
- package/runtime/shared/agent.ts +5 -0
- package/runtime/shared/automation-run.ts +61 -0
- package/runtime/shared/automation.ts +202 -0
- package/runtime/workspace.ts +56 -0
- package/schema.ts +222 -0
- package/server.ts +2 -0
- package/workflow.ts +2 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Proprietary software. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Use of Nuxt Agentic packages and starter materials is governed by the applicable
|
|
4
|
+
commercial agreement supplied with a purchase. This repository does not grant
|
|
5
|
+
an open-source license or permission to redistribute the packages as a competing
|
|
6
|
+
template or module library.
|
|
7
|
+
|
|
8
|
+
Third-party dependencies retain their respective licenses. This notice does not
|
|
9
|
+
replace or modify those licenses.
|
package/README.md
CHANGED
|
@@ -1,3 +1,174 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Automations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Schedules use five-field cron and an IANA time zone (for example,
|
|
4
|
+
`0 9 * * 1-5` in `Europe/Amsterdam`). Saving an active scheduled automation
|
|
5
|
+
sets its durable alarm. Editing, pausing or deleting reschedules or cancels it
|
|
6
|
+
through the CloudConfig model hook, including writes from MCP and server SDKs.
|
|
7
|
+
The callback reloads the automation and deduplicates the scheduled timestamp
|
|
8
|
+
before starting a run. Schedules go through CloudConfig's agent platform:
|
|
9
|
+
durable alarms on Cloudflare, and in-process timers that end with the server
|
|
10
|
+
in Node development.
|
|
11
|
+
|
|
12
|
+
Provider rounds and individual tools checkpoint separately. Integration tools
|
|
13
|
+
recheck current permissions at dispatch. Approval-required tools and outcomes
|
|
14
|
+
pause the run until the owner approves or rejects in Integrations. Cloudflare
|
|
15
|
+
Workflows wake on an approval event and read the stored approval result; local
|
|
16
|
+
runs resume through the authenticated resume endpoint. Results are only marked
|
|
17
|
+
successful after approval and the actual action finish. Completed tools replay
|
|
18
|
+
from receipts. Interrupted external calls stop for review to avoid duplicate
|
|
19
|
+
writes. A waiting approval expires after 30 days in Cloudflare.
|
|
20
|
+
|
|
21
|
+
**Automations** is a core feature, always available from the dashboard sidebar at
|
|
22
|
+
`/dashboard/automations`.
|
|
23
|
+
Integrations and Agents are also always available. Configure a saved agent in **Agents**.
|
|
24
|
+
Name the automation draft, select a trigger and agent,
|
|
25
|
+
then configure the success and error nodes. Changes save automatically after a
|
|
26
|
+
short pause, including names and node positions. **Save automation** in the Test run
|
|
27
|
+
menu (⌘/Ctrl Enter) saves
|
|
28
|
+
immediately. **Active** enables event delivery. New drafts start paused. The inner sidebar
|
|
29
|
+
organizes automations into searchable, collapsible folders, with a **+** menu for
|
|
30
|
+
new automations and folders. The sidebar header closes the folder list; the button
|
|
31
|
+
over the canvas reopens it. Edit the automation name beside Automations in the navbar. Open the menu beside **Test run**
|
|
32
|
+
and choose **Delete automation** to remove the current automation. Right-click a
|
|
33
|
+
folder to delete it; its automations remain
|
|
34
|
+
available outside folders. Switching automations or leaving the page saves pending
|
|
35
|
+
edits first. Save failures keep the draft visible so you can correct it and retry.
|
|
36
|
+
Activation, Runs, zoom and test controls sit on the right of the dashboard navbar.
|
|
37
|
+
|
|
38
|
+
Dragging a node changes its saved position. Alignment guides appear near other
|
|
39
|
+
nodes' centers and edges, snapping the dragged node into exact alignment. Drag the
|
|
40
|
+
background to pan; use the zoom controls or Ctrl/Cmd + wheel to zoom. Arrow keys
|
|
41
|
+
move a focused node. Selection,
|
|
42
|
+
pan, zoom, the current folder and the current run live in the URL. Pointer movement
|
|
43
|
+
is batched into animation frames locally; node positions commit when a drag ends,
|
|
44
|
+
and the view syncs to the URL after the interaction. Escape closes the inspector.
|
|
45
|
+
The prompt supports Save automation, Test run, Trigger on a webhook, Retry 3 times
|
|
46
|
+
on error, and Post errors to Slack.
|
|
47
|
+
|
|
48
|
+
## First run
|
|
49
|
+
|
|
50
|
+
Create a saved agent in Agents and choose its provider/model. Configure only the
|
|
51
|
+
key for the provider you use:
|
|
52
|
+
|
|
53
|
+
| Provider | Server environment variable |
|
|
54
|
+
| --------- | --------------------------- |
|
|
55
|
+
| OpenAI | `NUXT_OPENAI_API_KEY` |
|
|
56
|
+
| Anthropic | `NUXT_ANTHROPIC_API_KEY` |
|
|
57
|
+
| Google AI | `NUXT_GOOGLE_AI_API_KEY` |
|
|
58
|
+
|
|
59
|
+
The module also accepts `NUXT_AUTOMATIONS_OPENAI_API_KEY`,
|
|
60
|
+
`NUXT_AUTOMATIONS_ANTHROPIC_API_KEY` and `NUXT_AUTOMATIONS_GOOGLE_AI_API_KEY` as
|
|
61
|
+
dedicated overrides. Add the selected variable to `deploy.secrets` when deploying
|
|
62
|
+
through CloudConfig. Match the agent's model ID to its provider account. Draft
|
|
63
|
+
agents can be tested; automatic event delivery requires an active agent.
|
|
64
|
+
|
|
65
|
+
The agent's [runtime picker](../agents/README.md) also supports local Codex CLI
|
|
66
|
+
and Claude Code execution during localhost development, using their saved login
|
|
67
|
+
and selected local model. The same agent retains a separate production API
|
|
68
|
+
provider/model. Deployed runs always use that API configuration. The
|
|
69
|
+
`NUXT_AGENTS_*` keys are supported alongside the existing variables above.
|
|
70
|
+
|
|
71
|
+
Start with **Keep result** and **Stop silently**: no third-party connection is
|
|
72
|
+
needed for a useful agent run. Connect services when you need actions. Add allowed
|
|
73
|
+
integration tools in the agent's Tools drawer. Test runs execute the real agent
|
|
74
|
+
and configured actions; the split-button menu edits the sample payload, tests the
|
|
75
|
+
error path and saves the draft. **Runs** opens the right-hand history panel.
|
|
76
|
+
Select a run to see its input, response or error, source, timing and expandable step logs. New runs retain the agent model, instructions, attempts and actions used at execution time. Re-run with this input starts another test. Escape returns to the run list, then closes the panel. History and run selection live in the URL. Results, failures, attempts and node outcomes are stored in CloudConfig. No success result is simulated.
|
|
77
|
+
|
|
78
|
+
## Outcomes and retries
|
|
79
|
+
|
|
80
|
+
- **Send email / Notify owner:** connect Gmail and allow Send email. Use a recipient
|
|
81
|
+
address, `user.email`, or a template such as `{{ customer.email }}`.
|
|
82
|
+
- **Post to Slack:** connect Slack, allow Post messages and enter the channel ID.
|
|
83
|
+
- **Update record:** enter a writable field name. Event payloads identify the
|
|
84
|
+
record with `{ "record": { "model": "kanbanCard", "id": 42 } }`. The canonical
|
|
85
|
+
CloudConfig client enforces ownership, validation and hooks. Private fields,
|
|
86
|
+
relations and automation/security records cannot be changed by this outcome.
|
|
87
|
+
- **Call webhook:** enter an HTTPS URL and allow its exact origin in the comma-
|
|
88
|
+
separated `NUXT_INTEGRATIONS_WEBHOOK_ORIGINS` server setting. `pnpm deploy` pushes
|
|
89
|
+
it from `.env` when set (it is an optional deploy secret). Requests contain the
|
|
90
|
+
payload, output, error, run ID and name, plus an Idempotency-Key header.
|
|
91
|
+
|
|
92
|
+
Agent retries are bounded to 0–5, with a fresh configured timeout for each model
|
|
93
|
+
or integration tool call. Approval waits do not consume this timeout.
|
|
94
|
+
After starting an integration tool call, a failed agent attempt goes to the error
|
|
95
|
+
branch instead of repeating provider writes. Outcome actions are not automatically
|
|
96
|
+
retried. Receivers should honor idempotency keys where available; external APIs
|
|
97
|
+
cannot universally guarantee exactly-once delivery.
|
|
98
|
+
|
|
99
|
+
Each model and tool call is journaled as its own `automationRunReceipt` row, so a
|
|
100
|
+
long run never outgrows D1's 2 MB row limit. Integration results larger than
|
|
101
|
+
256 KB reach the agent as a truncated preview with a hint to narrow the request,
|
|
102
|
+
which also keeps every Workflow step under its 1 MiB limit.
|
|
103
|
+
|
|
104
|
+
## Maintenance
|
|
105
|
+
|
|
106
|
+
On Cloudflare, the Worker's cron trigger (`*/15 * * * *` in `wrangler.jsonc`) runs a
|
|
107
|
+
bounded, idempotent maintenance job:
|
|
108
|
+
|
|
109
|
+
- **Lost schedules.** When an active scheduled automation has no run for its last
|
|
110
|
+
due time (ten minutes of grace), its alarm is re-armed. An occurrence missed
|
|
111
|
+
within the last hour also runs late, under the event ID the alarm would have used.
|
|
112
|
+
- **Orphaned runs.** A run left queued, running or waiting for fifteen minutes is
|
|
113
|
+
checked against its Workflow instance. If the instance errored, was terminated
|
|
114
|
+
or no longer exists, the run is closed as failed with the reason.
|
|
115
|
+
- **Retention.** Replay receipts are removed a day after their run finishes. Set
|
|
116
|
+
`NUXT_AUTOMATIONS_RUN_RETENTION_DAYS` to also delete finished runs older than
|
|
117
|
+
that many days; it is unset by default, which keeps all history.
|
|
118
|
+
|
|
119
|
+
## Webhooks and agent hosts
|
|
120
|
+
|
|
121
|
+
Choose Webhook, save, then copy the generated endpoint. Activate the automation
|
|
122
|
+
and its agent before sending events. POST JSON with a unique `Idempotency-Key`
|
|
123
|
+
header; repeated keys return the existing run. The endpoint is a secret capability,
|
|
124
|
+
scoped to its owner and automation. Request bodies are limited to 100 KB.
|
|
125
|
+
|
|
126
|
+
Authenticated CloudConfig REST/MCP tools manage `automation` records and read
|
|
127
|
+
`automationRun` history. Runtime commands use an authenticated request transport:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { createAutomationCommands } from '@nuxtagentic/automations/client'
|
|
131
|
+
|
|
132
|
+
const automations = createAutomationCommands(useRequestFetch())
|
|
133
|
+
const run = await automations.run(automationId, { user: { email: 'you@company.com' } })
|
|
134
|
+
await automations.emit(
|
|
135
|
+
'task.moved',
|
|
136
|
+
{
|
|
137
|
+
record: { model: 'kanbanCard', id: cardId },
|
|
138
|
+
data: { status: 'done' },
|
|
139
|
+
},
|
|
140
|
+
crypto.randomUUID(),
|
|
141
|
+
)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
CloudConfig remains the source of truth for records; helpers only call custom
|
|
145
|
+
execution commands. A connected service's Event endpoint accepts normalized
|
|
146
|
+
provider events without browser cookies. Local HTTP account creation/deactivation,
|
|
147
|
+
file uploads and board status changes dispatch workspace events after a successful
|
|
148
|
+
response. Imports, direct server SDK writes, MCP mutations and other application
|
|
149
|
+
code should explicitly call `emit` after their mutation succeeds. User-created
|
|
150
|
+
events refer to administrator-created accounts; social sign-up needs an auth hook
|
|
151
|
+
or explicit event emitter in the host.
|
|
152
|
+
|
|
153
|
+
For a process-local MCP agent, embed `createMcpServer` with an explicit `principal`
|
|
154
|
+
whose numeric ID matches the owning account; network MCP needs per-request
|
|
155
|
+
authentication. The default anonymous `cloudconfig mcp` process cannot access
|
|
156
|
+
these private records. Runtime commands also require that account's authenticated
|
|
157
|
+
transport, or the saved automation's secret webhook endpoint.
|
|
158
|
+
|
|
159
|
+
## Deployment and core registration
|
|
160
|
+
|
|
161
|
+
Nuxt development runs asynchronously through Nitro's `waitUntil`. Cloudflare
|
|
162
|
+
deployments use the `AUTOMATION_RUNNER` Workflows binding and the exported
|
|
163
|
+
`AutomationRunner` class, so executions survive the HTTP request. Declare its
|
|
164
|
+
entry, class, binding and name in `deploy.workflows` in `cloud.config.ts`.
|
|
165
|
+
The CloudConfig Nuxt module exports the class and the CLI reconciles the root
|
|
166
|
+
Wrangler binding. Scheduled triggers also require the agent host declared in
|
|
167
|
+
`deploy.agents`, whose `scheduled` callback launches the automation. Deploy with
|
|
168
|
+
`pnpm deploy`.
|
|
169
|
+
|
|
170
|
+
Provision `automationsModels` and `integrationsModels` in the host's
|
|
171
|
+
`cloud.config.ts`, generate/review migrations, then migrate. Agents, Integrations and
|
|
172
|
+
Automations register without catalog entries and stay active for every workspace,
|
|
173
|
+
including existing saved installation choices. Removing the Automations Nuxt
|
|
174
|
+
package from a host also requires removing its root Workflow binding.
|
package/client.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CommandRequest } from '@nuxtagentic/integrations/client'
|
|
2
|
+
export interface AutomationLaunch {
|
|
3
|
+
runId: number
|
|
4
|
+
status: string
|
|
5
|
+
duplicate: boolean
|
|
6
|
+
}
|
|
7
|
+
/** Runtime commands complement, rather than replace, generated CloudConfig CRUD. */
|
|
8
|
+
export function createAutomationCommands(request: CommandRequest) {
|
|
9
|
+
return {
|
|
10
|
+
run: (id: number, payload: unknown, options: { errorPath?: boolean; eventId?: string } = {}) =>
|
|
11
|
+
request<AutomationLaunch>(`/api/automations/${id}/run`, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: { payload, ...options },
|
|
14
|
+
}),
|
|
15
|
+
endpoint: (id: number) => request<{ url: string }>(`/api/automations/${id}/endpoint`),
|
|
16
|
+
integrationEndpoint: (provider: string) =>
|
|
17
|
+
request<{ url: string }>(`/api/automations/integration-hook/${encodeURIComponent(provider)}`),
|
|
18
|
+
emit: (event: string, payload: unknown, id: string) =>
|
|
19
|
+
request<{ runs: AutomationLaunch[] }>('/api/automations/events', {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
body: { event, payload, id },
|
|
22
|
+
}),
|
|
23
|
+
}
|
|
24
|
+
}
|
package/module.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { addServerHandler, createResolver, defineNuxtModule } from '@nuxt/kit'
|
|
2
|
+
import { registerWorkspaceModule } from '@nuxtagentic/kit'
|
|
3
|
+
|
|
4
|
+
export default defineNuxtModule({
|
|
5
|
+
meta: { name: '@nuxtagentic/automations' },
|
|
6
|
+
moduleDependencies: {
|
|
7
|
+
'@nuxtagentic/workspace': {},
|
|
8
|
+
'@nuxtagentic/agents': {},
|
|
9
|
+
'@nuxtagentic/integrations': {},
|
|
10
|
+
},
|
|
11
|
+
setup(_options, nuxt) {
|
|
12
|
+
const resolver = createResolver(import.meta.url)
|
|
13
|
+
nuxt.options.runtimeConfig.automations = {
|
|
14
|
+
openaiApiKey: '',
|
|
15
|
+
anthropicApiKey: '',
|
|
16
|
+
googleAiApiKey: '',
|
|
17
|
+
}
|
|
18
|
+
registerWorkspaceModule(
|
|
19
|
+
{
|
|
20
|
+
id: 'automations',
|
|
21
|
+
runtime: resolver.resolve('./runtime'),
|
|
22
|
+
feature: {
|
|
23
|
+
from: resolver.resolve('./runtime/workspace.ts'),
|
|
24
|
+
name: 'automationsContribution',
|
|
25
|
+
},
|
|
26
|
+
metadata: resolver.resolve('./runtime/shared/agent.ts'),
|
|
27
|
+
},
|
|
28
|
+
nuxt,
|
|
29
|
+
)
|
|
30
|
+
nuxt.hook('pages:extend', (pages) => {
|
|
31
|
+
pages.push({
|
|
32
|
+
name: 'dashboard-automations',
|
|
33
|
+
path: '/dashboard/automations',
|
|
34
|
+
file: resolver.resolve('./runtime/pages/automations.vue'),
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
addServerHandler({
|
|
38
|
+
route: '/api/automation-hooks/:owner/:id/:token/:slug',
|
|
39
|
+
method: 'post',
|
|
40
|
+
handler: resolver.resolve('./runtime/server/handlers/automation-hook.post.ts'),
|
|
41
|
+
})
|
|
42
|
+
addServerHandler({
|
|
43
|
+
route: '/api/integration-hooks/:uid',
|
|
44
|
+
method: 'post',
|
|
45
|
+
handler: resolver.resolve('./runtime/server/handlers/integration-hook.post.ts'),
|
|
46
|
+
})
|
|
47
|
+
// Takes precedence over CloudConfig's own `/api/**` mount for this path, so
|
|
48
|
+
// verified vendor webhooks start automations with the request's context.
|
|
49
|
+
addServerHandler({
|
|
50
|
+
route: '/api/connect/hooks/:provider',
|
|
51
|
+
method: 'post',
|
|
52
|
+
handler: resolver.resolve('./runtime/server/handlers/connect-hook.post.ts'),
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtagentic/automations",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"module.ts",
|
|
7
|
+
"runtime",
|
|
8
|
+
"schema.ts",
|
|
9
|
+
"client.ts",
|
|
10
|
+
"README.md",
|
|
11
|
+
"server.ts",
|
|
12
|
+
"workflow.ts",
|
|
13
|
+
"LICENSE.md"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./module.ts",
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./schema": "./schema.ts",
|
|
19
|
+
"./client": "./client.ts",
|
|
20
|
+
"./server": "./server.ts",
|
|
21
|
+
"./workflow": "./workflow.ts",
|
|
22
|
+
"./runtime/*.vue": "./runtime/*.vue",
|
|
23
|
+
"./runtime/*.css": "./runtime/*.css",
|
|
24
|
+
"./runtime/*.json": "./runtime/*.json",
|
|
25
|
+
"./runtime/*.svg": "./runtime/*.svg",
|
|
26
|
+
"./runtime/*": "./runtime/*.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@cloudconfig/core": "0.2.0-beta.2",
|
|
30
|
+
"@nuxt/kit": "4.6.1",
|
|
31
|
+
"@nuxt/ui": "^4.11.1",
|
|
32
|
+
"@cloudflare/workers-types": "5.20261015.1",
|
|
33
|
+
"@vueuse/core": "^14.4.0",
|
|
34
|
+
"cron-parser": "^5.10.1",
|
|
35
|
+
"h3": "1.15.11",
|
|
36
|
+
"vue-router": "^5.4.0",
|
|
37
|
+
"@nuxtagentic/agents": "0.1.1",
|
|
38
|
+
"@nuxtagentic/workspace": "0.1.1",
|
|
39
|
+
"@nuxtagentic/kit": "0.1.1",
|
|
40
|
+
"@nuxtagentic/prompt": "0.1.1",
|
|
41
|
+
"@nuxtagentic/integrations": "0.1.1",
|
|
42
|
+
"@nuxtagentic/identity": "0.1.1",
|
|
43
|
+
"@nuxtagentic/google": "0.1.1"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"nuxt": "^4.6.1",
|
|
47
|
+
"vue": "^3.5.43",
|
|
48
|
+
"nitropack": "^2.13.4"
|
|
49
|
+
},
|
|
50
|
+
"cloudconfig": {
|
|
51
|
+
"models": "automationsModels"
|
|
52
|
+
},
|
|
53
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
54
|
+
"description": "Durable agent workflows, triggers and approvals for Nuxt Agentic.",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"registry": "https://registry.npmjs.org/"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": "^22.22.3 || ^24.15.0 || >=26.0.0"
|
|
61
|
+
}
|
|
6
62
|
}
|