@revisium/orchestrator 0.1.0-alpha.5 → 0.1.0-alpha.6
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 +149 -1
- package/dist/api/graphql-api/filters/agent-observability-exception.filter.js +24 -0
- package/dist/api/graphql-api/filters/agent-observability-exception.filter.js.map +1 -0
- package/dist/api/graphql-api/graphql-api.module.js +2 -0
- package/dist/api/graphql-api/graphql-api.module.js.map +1 -1
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js +296 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js +64 -0
- package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.js.map +1 -0
- package/dist/api/graphql-api/graphql-ws/constants.js +2 -0
- package/dist/api/graphql-api/graphql-ws/constants.js.map +1 -1
- package/dist/api/graphql-api/graphql-ws/pubsub.module.js +5 -2
- package/dist/api/graphql-api/graphql-ws/pubsub.module.js.map +1 -1
- package/dist/api/graphql-api/registerGraphqlEnums.js +6 -1
- package/dist/api/graphql-api/registerGraphqlEnums.js.map +1 -1
- package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js +48 -0
- package/dist/api/graphql-api/runs/inputs/get-agent-log.input.js.map +1 -0
- package/dist/api/graphql-api/runs/model/agent-activity.model.js +367 -0
- package/dist/api/graphql-api/runs/model/agent-activity.model.js.map +1 -0
- package/dist/api/graphql-api/runs/runs-subscription.resolver.js +35 -4
- package/dist/api/graphql-api/runs/runs-subscription.resolver.js.map +1 -1
- package/dist/api/graphql-api/runs/runs.resolver.js +35 -0
- package/dist/api/graphql-api/runs/runs.resolver.js.map +1 -1
- package/dist/cli/commands/doctor-report.js +39 -0
- package/dist/cli/commands/doctor-report.js.map +1 -0
- package/dist/cli/commands/lifecycle.js +237 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/mcp.js +46 -8
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/revisium-helpers.js +2 -2
- package/dist/cli/index.js +5 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/program.js +7 -23
- package/dist/cli/program.js.map +1 -1
- package/dist/config.js +42 -5
- package/dist/config.js.map +1 -1
- package/dist/control-plane/bootstrap.js +93 -0
- package/dist/control-plane/bootstrap.js.map +1 -0
- package/dist/control-plane/schema-migration.js +7 -11
- package/dist/control-plane/schema-migration.js.map +1 -1
- package/dist/control-plane/seed-default-playbook.js +23 -0
- package/dist/control-plane/seed-default-playbook.js.map +1 -1
- package/dist/e2e/kit/agents.js +17 -5
- package/dist/e2e/kit/agents.js.map +1 -1
- package/dist/e2e/kit/assertions.js +20 -0
- package/dist/e2e/kit/assertions.js.map +1 -1
- package/dist/e2e/kit/harness.js +12 -1
- package/dist/e2e/kit/harness.js.map +1 -1
- package/dist/e2e/kit/scenarios.js +1 -1
- package/dist/e2e/recovery-dd-crash-child.js +3 -2
- package/dist/e2e/recovery-dd-crash-child.js.map +1 -1
- package/dist/engine/dbos.service.js +20 -0
- package/dist/engine/dbos.service.js.map +1 -1
- package/dist/engine/ensure-postgres.js +11 -9
- package/dist/engine/ensure-postgres.js.map +1 -1
- package/dist/features/runs/queries/handlers/runs-query.handlers.js +135 -0
- package/dist/features/runs/queries/handlers/runs-query.handlers.js.map +1 -1
- package/dist/features/runs/queries/impl/get-agent-activity.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-activity.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-agent-attempts.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-attempts.query.js.map +1 -0
- package/dist/features/runs/queries/impl/get-agent-log.query.js +7 -0
- package/dist/features/runs/queries/impl/get-agent-log.query.js.map +1 -0
- package/dist/features/runs/queries/index.js +4 -1
- package/dist/features/runs/queries/index.js.map +1 -1
- package/dist/features/runs/runs-api.service.js +12 -0
- package/dist/features/runs/runs-api.service.js.map +1 -1
- package/dist/host/daemon.js +68 -0
- package/dist/host/daemon.js.map +1 -0
- package/dist/host/ensure-host.js +109 -0
- package/dist/host/ensure-host.js.map +1 -0
- package/dist/host/host-runtime.js +52 -0
- package/dist/host/host-runtime.js.map +1 -0
- package/dist/http/graphql-host.js +8 -2
- package/dist/http/graphql-host.js.map +1 -1
- package/dist/http/graphql-host.module.js +3 -0
- package/dist/http/graphql-host.module.js.map +1 -1
- package/dist/mcp/mcp-capabilities.js +6 -1
- package/dist/mcp/mcp-capabilities.js.map +1 -1
- package/dist/mcp/mcp-facade.service.js +24 -0
- package/dist/mcp/mcp-facade.service.js.map +1 -1
- package/dist/mcp/mcp-http.service.js +95 -0
- package/dist/mcp/mcp-http.service.js.map +1 -0
- package/dist/mcp/mcp-tools.js +58 -0
- package/dist/mcp/mcp-tools.js.map +1 -1
- package/dist/observability/agent-activity-reporter.js +185 -0
- package/dist/observability/agent-activity-reporter.js.map +1 -0
- package/dist/observability/agent-observability.service.js +1142 -0
- package/dist/observability/agent-observability.service.js.map +1 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/types.js +11 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/pipeline/data-driven-task.workflow.js +37 -75
- package/dist/pipeline/data-driven-task.workflow.js.map +1 -1
- package/dist/pipeline/pipeline.service.js +54 -15
- package/dist/pipeline/pipeline.service.js.map +1 -1
- package/dist/pipeline-core/validate-capability.js +23 -0
- package/dist/pipeline-core/validate-capability.js.map +1 -0
- package/dist/pipeline-core/validate-conflicts.js +37 -0
- package/dist/pipeline-core/validate-conflicts.js.map +1 -0
- package/dist/pipeline-core/validate-dataflow.js +180 -0
- package/dist/pipeline-core/validate-dataflow.js.map +1 -0
- package/dist/pipeline-core/validate-diff.js +158 -0
- package/dist/pipeline-core/validate-diff.js.map +1 -0
- package/dist/pipeline-core/validate-edges.js +44 -0
- package/dist/pipeline-core/validate-edges.js.map +1 -0
- package/dist/pipeline-core/validate-graph.js +123 -0
- package/dist/pipeline-core/validate-graph.js.map +1 -0
- package/dist/pipeline-core/validate-loops.js +226 -0
- package/dist/pipeline-core/validate-loops.js.map +1 -0
- package/dist/pipeline-core/validate-parallel.js +132 -0
- package/dist/pipeline-core/validate-parallel.js.map +1 -0
- package/dist/pipeline-core/validate-sink.js +27 -0
- package/dist/pipeline-core/validate-sink.js.map +1 -0
- package/dist/pipeline-core/validate-topology.js +140 -0
- package/dist/pipeline-core/validate-topology.js.map +1 -0
- package/dist/pipeline-core/validate-verdict.js +72 -0
- package/dist/pipeline-core/validate-verdict.js.map +1 -0
- package/dist/pipeline-core/validate.js +34 -1107
- package/dist/pipeline-core/validate.js.map +1 -1
- package/dist/revisium/run.service.js +15 -1
- package/dist/revisium/run.service.js.map +1 -1
- package/dist/runners/codex.service.js +51 -0
- package/dist/runners/codex.service.js.map +1 -0
- package/dist/runners/integrator-branch-naming.js +24 -0
- package/dist/runners/integrator-branch-naming.js.map +1 -0
- package/dist/runners/integrator-git.js +84 -0
- package/dist/runners/integrator-git.js.map +1 -0
- package/dist/runners/integrator-remote.js +34 -0
- package/dist/runners/integrator-remote.js.map +1 -0
- package/dist/runners/integrator-types.js +9 -0
- package/dist/runners/integrator-types.js.map +1 -0
- package/dist/runners/integrator.js +12 -132
- package/dist/runners/integrator.js.map +1 -1
- package/dist/runners/runner.module.js +4 -2
- package/dist/runners/runner.module.js.map +1 -1
- package/dist/smoke/cli.js +47 -0
- package/dist/smoke/cli.js.map +1 -0
- package/dist/smoke/isolation.js +113 -0
- package/dist/smoke/isolation.js.map +1 -0
- package/dist/task-control-plane/task-control-plane-api.service.js +24 -1
- package/dist/task-control-plane/task-control-plane-api.service.js.map +1 -1
- package/dist/task-control-plane/task-control-plane.module.js +21 -1
- package/dist/task-control-plane/task-control-plane.module.js.map +1 -1
- package/dist/worker/artifact-store.js +6 -1
- package/dist/worker/artifact-store.js.map +1 -1
- package/dist/worker/build-context.js +135 -1
- package/dist/worker/build-context.js.map +1 -1
- package/dist/worker/claude-code-runner.js +75 -76
- package/dist/worker/claude-code-runner.js.map +1 -1
- package/dist/worker/codex-runner.js +474 -0
- package/dist/worker/codex-runner.js.map +1 -0
- package/dist/worker/result-envelope.js +51 -79
- package/dist/worker/result-envelope.js.map +1 -1
- package/dist/worker/runner-common.js +106 -0
- package/dist/worker/runner-common.js.map +1 -0
- package/dist/worker/runner-dispatch.js +3 -1
- package/dist/worker/runner-dispatch.js.map +1 -1
- package/dist/worker/runner.js.map +1 -1
- package/dist/worker/stub-runner.js +3 -3
- package/dist/worker/stub-runner.js.map +1 -1
- package/package.json +1 -1
- package/dist/app.module.js +0 -28
- package/dist/app.module.js.map +0 -1
- package/dist/cli/commands/bootstrap.js +0 -100
- package/dist/cli/commands/bootstrap.js.map +0 -1
- package/dist/cli/commands/dev.js +0 -143
- package/dist/cli/commands/dev.js.map +0 -1
- package/dist/cli/commands/inbox.js +0 -288
- package/dist/cli/commands/inbox.js.map +0 -1
- package/dist/cli/commands/playbook.js +0 -74
- package/dist/cli/commands/playbook.js.map +0 -1
- package/dist/cli/commands/poll-workflow-state.js +0 -144
- package/dist/cli/commands/poll-workflow-state.js.map +0 -1
- package/dist/cli/commands/revisium-context.js +0 -23
- package/dist/cli/commands/revisium-context.js.map +0 -1
- package/dist/cli/commands/revisium.js +0 -89
- package/dist/cli/commands/revisium.js.map +0 -1
- package/dist/cli/commands/run.js +0 -451
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/serve.js +0 -26
- package/dist/cli/commands/serve.js.map +0 -1
- package/dist/cli/live-guard.js +0 -49
- package/dist/cli/live-guard.js.map +0 -1
- package/dist/cli/needs-host.js +0 -77
- package/dist/cli/needs-host.js.map +0 -1
- package/dist/mcp/mcp-stdio.service.js +0 -48
- package/dist/mcp/mcp-stdio.service.js.map +0 -1
- package/dist/mcp/mcp.module.js +0 -21
- package/dist/mcp/mcp.module.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ reviewer → integrator), hosted in **NestJS**. **DBOS** owns durable progress
|
|
|
5
5
|
from the first unfinished step — while **Revisium** owns meaning: roles, policy, inbox, events. Workflow-as-data is
|
|
6
6
|
a post-MVP goal; see [`docs/architecture-overview.md`](./docs/architecture-overview.md).
|
|
7
7
|
|
|
8
|
-
> 🚧 **Early alpha.** The end-to-end MVP works —
|
|
8
|
+
> 🚧 **Early alpha.** The end-to-end MVP works — create a run → plan gate → implement → review → PR → merge
|
|
9
9
|
> gate — see [`docs/roadmap.md`](./docs/roadmap.md).
|
|
10
10
|
|
|
11
11
|
## Start here
|
|
@@ -15,6 +15,154 @@ a post-MVP goal; see [`docs/architecture-overview.md`](./docs/architecture-overv
|
|
|
15
15
|
- Architecture & invariants: [`docs/architecture-overview.md`](./docs/architecture-overview.md)
|
|
16
16
|
- Docs index & roadmap: [`docs/README.md`](./docs/README.md) · [`docs/roadmap.md`](./docs/roadmap.md)
|
|
17
17
|
|
|
18
|
+
## Local Development
|
|
19
|
+
|
|
20
|
+
`revo` is one daemonized product. **`revo start`** brings up the whole stack — the standalone
|
|
21
|
+
Revisium daemon plus the Revo host daemon that owns DBOS and serves the GraphQL + MCP front doors —
|
|
22
|
+
and bootstraps the control-plane so it is ready to use. The CLI is lifecycle-only
|
|
23
|
+
(`start` / `stop` / `status` / `restart` / `doctor` / `logs`); orchestration (runs, inbox, …) is
|
|
24
|
+
reached over **MCP** (agents) or **GraphQL** (UI/scripts), both served by the daemon.
|
|
25
|
+
|
|
26
|
+
Run a source checkout alongside an installed package without collisions via a named **profile**
|
|
27
|
+
(`--profile dev`, or `REVO_PROFILE=dev`): the `dev` profile shifts the whole port band off the
|
|
28
|
+
`default` profile, so the two never share a port, data dir, or `dbos` database.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pnpm install
|
|
32
|
+
pnpm run revo -- start --profile dev # standalone + host daemon, bootstrapped & ready
|
|
33
|
+
pnpm run revo -- status --profile dev # stack health summary
|
|
34
|
+
pnpm run revo -- doctor --profile dev # diagnose process / port / profile issues
|
|
35
|
+
pnpm run revo -- logs --profile dev # tail host + standalone logs; add -f to follow
|
|
36
|
+
pnpm run revo -- restart --profile dev # stop, then start
|
|
37
|
+
pnpm run revo -- stop --profile dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Knob | `default` (installed package) | `dev` (source checkout) |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| data dir | `~/.revisium-orchestrator` | `~/.revisium-orchestrator-dev` |
|
|
43
|
+
| standalone HTTP / Postgres | `19222` / `15440` | `19622` / `15840` |
|
|
44
|
+
| Revo GraphQL | `19223` | `19623` |
|
|
45
|
+
| DBOS database | `dbos` | `dbos_dev` |
|
|
46
|
+
|
|
47
|
+
Any single knob can be overridden explicitly — `REVO_DATA_DIR` / `REVO_PORT` / `REVO_PG_PORT` /
|
|
48
|
+
`REVO_GRAPHQL_PORT` / `REVO_DBOS_DB` — and an explicit env var always wins over the profile band.
|
|
49
|
+
|
|
50
|
+
Connect an agent over MCP (a thin stdio bridge that forwards to the running daemon):
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
claude mcp add revo -- pnpm --dir "$PWD" run revo -- mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run the local verification gates:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
pnpm run typecheck
|
|
60
|
+
pnpm run lint:ci
|
|
61
|
+
pnpm run test:cov
|
|
62
|
+
pnpm run verify
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The smoke scripts are guarded: they require a non-default `REVO_DATA_DIR`,
|
|
66
|
+
`REVO_PORT`, `REVO_PG_PORT`, and `REVO_DBOS_DB`; GraphQL smoke paths also require
|
|
67
|
+
`REVO_GRAPHQL_PORT`.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
pnpm run smoke:control-plane
|
|
71
|
+
pnpm run smoke:create-run
|
|
72
|
+
pnpm run smoke:inspect-run
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Live Run Observability Smoke
|
|
76
|
+
|
|
77
|
+
This smoke runs a real agent. It can call provider CLIs and incur cost. Use it
|
|
78
|
+
only when that is intentional.
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
export REVO_SMOKE_REPO=/path/to/local/sandbox-repo
|
|
82
|
+
pnpm run revo -- start --profile dev # standalone + host daemon (serves GraphQL + MCP), ready
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Drive and observe a run through the daemon's front doors — there are no `run`/`serve` CLI commands.
|
|
86
|
+
From an agent, use the MCP tools (`create_run`, `start_run`, then `get_agent_activity` /
|
|
87
|
+
`get_agent_log`). From a UI or script, use the GraphQL front door the daemon already serves at
|
|
88
|
+
`http://127.0.0.1:$REVO_GRAPHQL_PORT/graphql` — create a run:
|
|
89
|
+
|
|
90
|
+
```graphql
|
|
91
|
+
mutation Create($data: CreateRunInput!) {
|
|
92
|
+
createRun(data: $data) {
|
|
93
|
+
runId
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then observe it over the same endpoint:
|
|
99
|
+
|
|
100
|
+
```graphql
|
|
101
|
+
query Activity($runId: ID!) {
|
|
102
|
+
runAgentActivity(runId: $runId) {
|
|
103
|
+
runId
|
|
104
|
+
aggregateStatus
|
|
105
|
+
latestOutputAt
|
|
106
|
+
attempts {
|
|
107
|
+
attemptId
|
|
108
|
+
runner
|
|
109
|
+
status
|
|
110
|
+
stdoutBytes
|
|
111
|
+
stderrBytes
|
|
112
|
+
artifactRef
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
query Log($data: GetAgentLogInput!) {
|
|
118
|
+
runAgentLog(data: $data) {
|
|
119
|
+
runId
|
|
120
|
+
attemptId
|
|
121
|
+
stream
|
|
122
|
+
offsetBytes
|
|
123
|
+
nextOffsetBytes
|
|
124
|
+
totalBytes
|
|
125
|
+
truncated
|
|
126
|
+
content
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For MCP, configure the MCP client to launch this checkout's local binary with the
|
|
132
|
+
same environment. The MCP tools do not accept per-call profile arguments; the
|
|
133
|
+
profile comes from the process environment.
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"revo-dev": {
|
|
139
|
+
"command": "/path/to/agent-orchestrator/bin/revo.js",
|
|
140
|
+
"args": ["mcp"],
|
|
141
|
+
"env": {
|
|
142
|
+
"REVO_DATA_DIR": "/path/to/.revisium-orchestrator-dev",
|
|
143
|
+
"REVO_PORT": "19622",
|
|
144
|
+
"REVO_PG_PORT": "15840",
|
|
145
|
+
"REVO_GRAPHQL_PORT": "19623",
|
|
146
|
+
"REVO_DBOS_DB": "dbos_dev"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Useful MCP observability tools for the same run:
|
|
154
|
+
|
|
155
|
+
- `get_agent_activity`
|
|
156
|
+
- `get_agent_attempts`
|
|
157
|
+
- `get_agent_log`
|
|
158
|
+
- `read_agent_output_events`
|
|
159
|
+
- `tail_agent_log`
|
|
160
|
+
|
|
161
|
+
If running from a sandboxed automation environment, local server checks may fail
|
|
162
|
+
with `listen EPERM` or a misleading `No free port found from <port>`. Re-run the
|
|
163
|
+
daemon, GraphQL, and MCP smoke commands from a normal terminal or an approved
|
|
164
|
+
unsandboxed execution context.
|
|
165
|
+
|
|
18
166
|
## License
|
|
19
167
|
|
|
20
168
|
See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Catch } from '@nestjs/common';
|
|
8
|
+
import { GraphQLError } from 'graphql';
|
|
9
|
+
import { AgentObservabilityError } from '../../../observability/types.js';
|
|
10
|
+
let AgentObservabilityExceptionFilter = class AgentObservabilityExceptionFilter {
|
|
11
|
+
catch(exception, host) {
|
|
12
|
+
if (host.getType() !== 'graphql') {
|
|
13
|
+
throw exception;
|
|
14
|
+
}
|
|
15
|
+
throw new GraphQLError(exception.message, {
|
|
16
|
+
extensions: { code: exception.code },
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
AgentObservabilityExceptionFilter = __decorate([
|
|
21
|
+
Catch(AgentObservabilityError)
|
|
22
|
+
], AgentObservabilityExceptionFilter);
|
|
23
|
+
export { AgentObservabilityExceptionFilter };
|
|
24
|
+
//# sourceMappingURL=agent-observability-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-observability-exception.filter.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/filters/agent-observability-exception.filter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAC5C,KAAK,CAAC,SAAkC,EAAE,IAAmB;QAC3D,IAAI,IAAI,CAAC,OAAO,EAAkB,KAAK,SAAS,EAAE,CAAC;YACjD,MAAM,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,IAAI,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE;YACxC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE;SACrC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAVY,iCAAiC;IAD7C,KAAK,CAAC,uBAAuB,CAAC;GAClB,iCAAiC,CAU7C"}
|
|
@@ -15,6 +15,7 @@ import { PrApiModule } from '../../features/pr/pr-api.module.js';
|
|
|
15
15
|
import { RunsApiModule } from '../../features/runs/runs-api.module.js';
|
|
16
16
|
import { SystemApiModule } from '../../features/system/system-api.module.js';
|
|
17
17
|
import { createGraphqlMetricsPlugin } from '../../infrastructure/metrics/graphql/graphql-metrics.js';
|
|
18
|
+
import { AgentObservabilityExceptionFilter } from './filters/agent-observability-exception.filter.js';
|
|
18
19
|
import { GraphQLValidationExceptionFilter } from './filters/graphql-validation-exception.filter.js';
|
|
19
20
|
import { PubSubModule } from './graphql-ws/pubsub.module.js';
|
|
20
21
|
import { InboxResolver } from './inbox/inbox.resolver.js';
|
|
@@ -56,6 +57,7 @@ GraphqlApiModule = __decorate([
|
|
|
56
57
|
}),
|
|
57
58
|
],
|
|
58
59
|
providers: [
|
|
60
|
+
{ provide: APP_FILTER, useClass: AgentObservabilityExceptionFilter },
|
|
59
61
|
{ provide: APP_FILTER, useClass: GraphQLValidationExceptionFilter },
|
|
60
62
|
InboxResolver,
|
|
61
63
|
InboxSubscriptionResolver,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-api.module.js","sourceRoot":"","sources":["../../../src/api/graphql-api/graphql-api.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAg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B,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAvC5B,MAAM,CAAC;QACN,OAAO,EAAE;YACP,cAAc;YACd,eAAe;YACf,WAAW;YACX,YAAY;YACZ,aAAa;YACb,eAAe;YACf,aAAa,CAAC,YAAY,CAAmB;gBAC3C,MAAM,EAAE,UAAU;gBAClB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;oBACjB,IAAI,EAAE,UAAU;oBAChB,cAAc,EAAE,IAAI;oBACpB,UAAU,EAAE,IAAI;oBAChB,aAAa,EAAE,IAAI;oBACnB,SAAS,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE;oBAC7D,yBAAyB,EAAE;wBACzB,6BAA6B,EAAE,QAAQ;qBACxC;oBACD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;oBACpD,OAAO,EAAE,CAAC,0BAA0B,EAAE,CAAC;iBACxC,CAAC;aACH,CAAC;SACH;QACD,SAAS,EAAE;YACT,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,iCAAiC,EAAE;YACpE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,gCAAgC,EAAE;YACnE,aAAa;YACb,yBAAyB;YACzB,cAAc;YACd,UAAU;YACV,iBAAiB;YACjB,iBAAiB;YACjB,mBAAmB;YACnB,YAAY;YACZ,wBAAwB;YACxB,cAAc;SACf;KACF,CAAC;GACW,gBAAgB,CAAG;;AAEhC,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var AgentObservabilitySubscriptionBridge_1;
|
|
14
|
+
import { Inject, Injectable, Logger } from '@nestjs/common';
|
|
15
|
+
import { TaskControlPlaneApiService } from '../../../task-control-plane/task-control-plane-api.service.js';
|
|
16
|
+
import { RUN_AGENT_ACTIVITY_UPDATED_TOPIC, RUN_AGENT_OUTPUT_APPENDED_TOPIC, } from './constants.js';
|
|
17
|
+
import { mapAgentOutputEventForSubscription, mapAgentRunActivityForSubscription, } from './agent-observability-subscription-mappers.js';
|
|
18
|
+
const LIVE_TAIL_WARMUP_IDLE_MS = 25;
|
|
19
|
+
const LIVE_TAIL_WARMUP_MAX_EVENTS = 1_000;
|
|
20
|
+
const SUBSCRIPTION_QUEUE_MAX_VALUES = 1_000;
|
|
21
|
+
const SUBSCRIPTION_REFETCH_CODE = 'AGENT_OBSERVABILITY_REFETCH_REQUIRED';
|
|
22
|
+
const SUBSCRIPTION_REFETCH_MESSAGE = 'agent observability subscription is no longer current; refetch current agent observability state before resubscribing';
|
|
23
|
+
export class AgentObservabilitySubscriptionError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.name = 'AgentObservabilitySubscriptionError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let AgentObservabilitySubscriptionBridge = AgentObservabilitySubscriptionBridge_1 = class AgentObservabilitySubscriptionBridge {
|
|
32
|
+
api;
|
|
33
|
+
logger = new Logger(AgentObservabilitySubscriptionBridge_1.name);
|
|
34
|
+
watchers = new Map();
|
|
35
|
+
constructor(api) {
|
|
36
|
+
this.api = api;
|
|
37
|
+
}
|
|
38
|
+
onModuleDestroy() {
|
|
39
|
+
for (const state of this.watchers.values()) {
|
|
40
|
+
state.abort.abort();
|
|
41
|
+
for (const subscriber of state.subscribers)
|
|
42
|
+
subscriber.close();
|
|
43
|
+
}
|
|
44
|
+
this.watchers.clear();
|
|
45
|
+
}
|
|
46
|
+
subscribeToActivity(runId) {
|
|
47
|
+
return this.retain(runId, RUN_AGENT_ACTIVITY_UPDATED_TOPIC, (signal) => this.watchActivity(runId, signal));
|
|
48
|
+
}
|
|
49
|
+
subscribeToOutput(runId) {
|
|
50
|
+
return this.retain(runId, RUN_AGENT_OUTPUT_APPENDED_TOPIC, (signal) => this.watchOutput(runId, signal));
|
|
51
|
+
}
|
|
52
|
+
retain(runId, topic, start) {
|
|
53
|
+
const key = watcherKey(topic, runId);
|
|
54
|
+
const current = this.watchers.get(key);
|
|
55
|
+
const subscriber = new SubscriptionQueue(() => this.release(runId, topic, subscriber));
|
|
56
|
+
if (current) {
|
|
57
|
+
current.subscribers.add(subscriber);
|
|
58
|
+
return subscriber;
|
|
59
|
+
}
|
|
60
|
+
const abort = new AbortController();
|
|
61
|
+
const state = { abort, subscribers: new Set([subscriber]) };
|
|
62
|
+
this.watchers.set(key, state);
|
|
63
|
+
void start(abort.signal)
|
|
64
|
+
.catch((error) => {
|
|
65
|
+
if (abort.signal.aborted)
|
|
66
|
+
return;
|
|
67
|
+
const subscriptionError = toSubscriptionError(error);
|
|
68
|
+
this.logger.warn(`${topic} watch stopped for ${runId}: ${subscriptionError.code}; ${diagnosticMessage(error)}`);
|
|
69
|
+
for (const item of state.subscribers)
|
|
70
|
+
item.fail(subscriptionError);
|
|
71
|
+
})
|
|
72
|
+
.finally(() => {
|
|
73
|
+
const latest = this.watchers.get(key);
|
|
74
|
+
if (latest !== state)
|
|
75
|
+
return;
|
|
76
|
+
for (const item of state.subscribers)
|
|
77
|
+
item.close();
|
|
78
|
+
this.watchers.delete(key);
|
|
79
|
+
});
|
|
80
|
+
return subscriber;
|
|
81
|
+
}
|
|
82
|
+
release(runId, topic, subscriber) {
|
|
83
|
+
const key = watcherKey(topic, runId);
|
|
84
|
+
const state = this.watchers.get(key);
|
|
85
|
+
if (!state)
|
|
86
|
+
return;
|
|
87
|
+
state.subscribers.delete(subscriber);
|
|
88
|
+
if (state.subscribers.size > 0)
|
|
89
|
+
return;
|
|
90
|
+
state.abort.abort();
|
|
91
|
+
this.watchers.delete(key);
|
|
92
|
+
}
|
|
93
|
+
async watchActivity(runId, signal) {
|
|
94
|
+
await consumeLiveTail(this.api.watchAgentActivity({ runId }), signal, (activity) => this.publishActivity(runId, activity));
|
|
95
|
+
}
|
|
96
|
+
async watchOutput(runId, signal) {
|
|
97
|
+
await consumeLiveTail(this.api.watchAgentOutput({ runId }), signal, (event) => this.publishOutput(runId, event));
|
|
98
|
+
}
|
|
99
|
+
publishActivity(runId, activity) {
|
|
100
|
+
if (activity.runId !== runId)
|
|
101
|
+
return;
|
|
102
|
+
this.publish(RUN_AGENT_ACTIVITY_UPDATED_TOPIC, runId, {
|
|
103
|
+
runAgentActivityUpdated: mapAgentRunActivityForSubscription(activity),
|
|
104
|
+
runId,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
publishOutput(runId, event) {
|
|
108
|
+
if (event.runId !== runId)
|
|
109
|
+
return;
|
|
110
|
+
this.publish(RUN_AGENT_OUTPUT_APPENDED_TOPIC, runId, {
|
|
111
|
+
runAgentOutputAppended: mapAgentOutputEventForSubscription(event),
|
|
112
|
+
runId,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
publish(topic, runId, payload) {
|
|
116
|
+
const state = this.watchers.get(watcherKey(topic, runId));
|
|
117
|
+
if (!state)
|
|
118
|
+
return;
|
|
119
|
+
for (const subscriber of state.subscribers) {
|
|
120
|
+
const result = subscriber.push(payload);
|
|
121
|
+
if (result === 'overflow') {
|
|
122
|
+
this.logger.warn(`${topic} subscriber queue overflow for ${runId}: ${SUBSCRIPTION_REFETCH_CODE}; queued values exceeded ${SUBSCRIPTION_QUEUE_MAX_VALUES}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
AgentObservabilitySubscriptionBridge = AgentObservabilitySubscriptionBridge_1 = __decorate([
|
|
128
|
+
Injectable(),
|
|
129
|
+
__param(0, Inject(TaskControlPlaneApiService)),
|
|
130
|
+
__metadata("design:paramtypes", [TaskControlPlaneApiService])
|
|
131
|
+
], AgentObservabilitySubscriptionBridge);
|
|
132
|
+
export { AgentObservabilitySubscriptionBridge };
|
|
133
|
+
function watcherKey(topic, runId) {
|
|
134
|
+
return `${topic}:${runId}`;
|
|
135
|
+
}
|
|
136
|
+
function diagnosticMessage(error) {
|
|
137
|
+
return stringifyReason(error);
|
|
138
|
+
}
|
|
139
|
+
function toError(error, fallbackMessage) {
|
|
140
|
+
if (error instanceof Error)
|
|
141
|
+
return error;
|
|
142
|
+
return new Error(error === undefined ? fallbackMessage : stringifyReason(error));
|
|
143
|
+
}
|
|
144
|
+
function stringifyReason(reason) {
|
|
145
|
+
if (reason instanceof Error)
|
|
146
|
+
return reason.message;
|
|
147
|
+
if (typeof reason === 'string')
|
|
148
|
+
return reason;
|
|
149
|
+
if (reason === undefined)
|
|
150
|
+
return 'undefined';
|
|
151
|
+
if (reason === null)
|
|
152
|
+
return 'null';
|
|
153
|
+
if (typeof reason === 'number' || typeof reason === 'boolean' || typeof reason === 'bigint')
|
|
154
|
+
return `${reason}`;
|
|
155
|
+
if (typeof reason === 'symbol')
|
|
156
|
+
return reason.description ? `Symbol(${reason.description})` : 'Symbol()';
|
|
157
|
+
if (typeof reason === 'function')
|
|
158
|
+
return reason.name ? `[function ${reason.name}]` : '[function]';
|
|
159
|
+
try {
|
|
160
|
+
return JSON.stringify(reason) ?? 'unserializable object';
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return 'unserializable object';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function toSubscriptionError(_error) {
|
|
167
|
+
return refetchRequiredSubscriptionError();
|
|
168
|
+
}
|
|
169
|
+
function refetchRequiredSubscriptionError() {
|
|
170
|
+
return new AgentObservabilitySubscriptionError(SUBSCRIPTION_REFETCH_CODE, SUBSCRIPTION_REFETCH_MESSAGE);
|
|
171
|
+
}
|
|
172
|
+
async function consumeLiveTail(source, signal, publish) {
|
|
173
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
174
|
+
let pending = iterator.next();
|
|
175
|
+
let live = false;
|
|
176
|
+
let skipped = 0;
|
|
177
|
+
const abort = () => {
|
|
178
|
+
void iterator.return?.(undefined).catch(() => undefined);
|
|
179
|
+
};
|
|
180
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
181
|
+
try {
|
|
182
|
+
while (!signal.aborted) {
|
|
183
|
+
const next = live ? await pending : await nextWithTimeout(pending, LIVE_TAIL_WARMUP_IDLE_MS);
|
|
184
|
+
if (next === 'timeout') {
|
|
185
|
+
live = true;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
pending = iterator.next();
|
|
189
|
+
if (next.done || signal.aborted)
|
|
190
|
+
break;
|
|
191
|
+
if (!live) {
|
|
192
|
+
skipped += 1;
|
|
193
|
+
if (skipped > LIVE_TAIL_WARMUP_MAX_EVENTS)
|
|
194
|
+
throw liveTailOverflowError();
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
publish(next.value);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
finally {
|
|
201
|
+
signal.removeEventListener('abort', abort);
|
|
202
|
+
await iterator.return?.(undefined).catch(() => undefined);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function liveTailOverflowError() {
|
|
206
|
+
return refetchRequiredSubscriptionError();
|
|
207
|
+
}
|
|
208
|
+
async function nextWithTimeout(pending, timeoutMs) {
|
|
209
|
+
let timer;
|
|
210
|
+
try {
|
|
211
|
+
return await Promise.race([
|
|
212
|
+
pending,
|
|
213
|
+
new Promise((resolve) => {
|
|
214
|
+
timer = setTimeout(() => resolve('timeout'), timeoutMs);
|
|
215
|
+
}),
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
if (timer)
|
|
220
|
+
clearTimeout(timer);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
class SubscriptionQueue {
|
|
224
|
+
onReturn;
|
|
225
|
+
maxValues;
|
|
226
|
+
values = [];
|
|
227
|
+
waiters = [];
|
|
228
|
+
closed = false;
|
|
229
|
+
error;
|
|
230
|
+
released = false;
|
|
231
|
+
constructor(onReturn, maxValues = SUBSCRIPTION_QUEUE_MAX_VALUES) {
|
|
232
|
+
this.onReturn = onReturn;
|
|
233
|
+
this.maxValues = maxValues;
|
|
234
|
+
}
|
|
235
|
+
[Symbol.asyncIterator]() {
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
next() {
|
|
239
|
+
if (this.error)
|
|
240
|
+
return Promise.reject(this.error);
|
|
241
|
+
if (this.values.length > 0) {
|
|
242
|
+
return Promise.resolve({ done: false, value: this.values.shift() });
|
|
243
|
+
}
|
|
244
|
+
if (this.closed)
|
|
245
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
246
|
+
return new Promise((resolve, reject) => this.waiters.push({ resolve, reject }));
|
|
247
|
+
}
|
|
248
|
+
async return() {
|
|
249
|
+
this.close();
|
|
250
|
+
this.release();
|
|
251
|
+
return { done: true, value: undefined };
|
|
252
|
+
}
|
|
253
|
+
async throw(error) {
|
|
254
|
+
this.close();
|
|
255
|
+
this.release();
|
|
256
|
+
throw toError(error, 'subscription iterator thrown');
|
|
257
|
+
}
|
|
258
|
+
push(value) {
|
|
259
|
+
if (this.closed || this.error)
|
|
260
|
+
return 'closed';
|
|
261
|
+
const waiter = this.waiters.shift();
|
|
262
|
+
if (waiter) {
|
|
263
|
+
waiter.resolve({ done: false, value });
|
|
264
|
+
return 'accepted';
|
|
265
|
+
}
|
|
266
|
+
if (this.values.length >= this.maxValues) {
|
|
267
|
+
this.fail(refetchRequiredSubscriptionError());
|
|
268
|
+
this.release();
|
|
269
|
+
return 'overflow';
|
|
270
|
+
}
|
|
271
|
+
this.values.push(value);
|
|
272
|
+
return 'accepted';
|
|
273
|
+
}
|
|
274
|
+
fail(error) {
|
|
275
|
+
if (this.closed || this.error)
|
|
276
|
+
return;
|
|
277
|
+
this.error = toError(error, 'subscription queue failed');
|
|
278
|
+
this.values.splice(0);
|
|
279
|
+
for (const waiter of this.waiters.splice(0))
|
|
280
|
+
waiter.reject(this.error);
|
|
281
|
+
}
|
|
282
|
+
close() {
|
|
283
|
+
if (this.closed)
|
|
284
|
+
return;
|
|
285
|
+
this.closed = true;
|
|
286
|
+
for (const waiter of this.waiters.splice(0))
|
|
287
|
+
waiter.resolve({ done: true, value: undefined });
|
|
288
|
+
}
|
|
289
|
+
release() {
|
|
290
|
+
if (this.released)
|
|
291
|
+
return;
|
|
292
|
+
this.released = true;
|
|
293
|
+
this.onReturn();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=agent-observability-subscription-bridge.service.js.map
|
package/dist/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-observability-subscription-bridge.service.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/agent-observability-subscription-bridge.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAE3G,OAAO,EACL,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,gBAAgB,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AAQ,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AgentOutputStream, } from '../runs/model/agent-activity.model.js';
|
|
2
|
+
function toDate(value) {
|
|
3
|
+
const parsed = new Date(value);
|
|
4
|
+
return Number.isNaN(parsed.getTime()) ? new Date(0) : parsed;
|
|
5
|
+
}
|
|
6
|
+
function mapOutputStream(stream) {
|
|
7
|
+
if (stream === 'stdout')
|
|
8
|
+
return AgentOutputStream.stdout;
|
|
9
|
+
if (stream === 'stderr')
|
|
10
|
+
return AgentOutputStream.stderr;
|
|
11
|
+
if (stream === 'agent-jsonl')
|
|
12
|
+
return AgentOutputStream.agent_jsonl;
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
function mapActivitySnapshot(snapshot) {
|
|
16
|
+
return {
|
|
17
|
+
runId: snapshot.runId,
|
|
18
|
+
attemptId: snapshot.attemptId,
|
|
19
|
+
stepId: snapshot.stepId,
|
|
20
|
+
stepKey: snapshot.stepKey,
|
|
21
|
+
role: snapshot.role,
|
|
22
|
+
runner: snapshot.runner,
|
|
23
|
+
pid: snapshot.pid,
|
|
24
|
+
status: snapshot.status,
|
|
25
|
+
startedAt: toDate(snapshot.startedAt),
|
|
26
|
+
lastEventAt: toDate(snapshot.lastEventAt),
|
|
27
|
+
lastOutputAt: snapshot.lastOutputAt ? toDate(snapshot.lastOutputAt) : undefined,
|
|
28
|
+
lastStream: mapOutputStream(snapshot.lastStream),
|
|
29
|
+
stdoutBytes: snapshot.stdoutBytes,
|
|
30
|
+
stderrBytes: snapshot.stderrBytes,
|
|
31
|
+
eventCount: snapshot.eventCount,
|
|
32
|
+
artifactRef: snapshot.artifactRef,
|
|
33
|
+
exitCode: snapshot.exitCode ?? null,
|
|
34
|
+
timedOut: snapshot.timedOut,
|
|
35
|
+
error: snapshot.error,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function mapAgentRunActivityForSubscription(activity) {
|
|
39
|
+
return {
|
|
40
|
+
runId: activity.runId,
|
|
41
|
+
aggregateStatus: activity.aggregateStatus,
|
|
42
|
+
latestActivityAt: toDate(activity.latestActivityAt),
|
|
43
|
+
latestOutputAt: activity.latestOutputAt ? toDate(activity.latestOutputAt) : undefined,
|
|
44
|
+
attempts: activity.attempts.map(mapActivitySnapshot),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function mapAgentOutputEventForSubscription(event) {
|
|
48
|
+
return {
|
|
49
|
+
cursor: event.cursor,
|
|
50
|
+
runId: event.runId,
|
|
51
|
+
attemptId: event.attemptId,
|
|
52
|
+
attemptSeq: event.attemptSeq,
|
|
53
|
+
stepId: event.stepId,
|
|
54
|
+
stepKey: event.stepKey,
|
|
55
|
+
at: toDate(event.at),
|
|
56
|
+
kind: event.kind,
|
|
57
|
+
stream: mapOutputStream(event.stream),
|
|
58
|
+
bytes: event.bytes,
|
|
59
|
+
preview: event.preview,
|
|
60
|
+
parsedType: event.parsedType,
|
|
61
|
+
statusHint: event.statusHint,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=agent-observability-subscription-mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-observability-subscription-mappers.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/agent-observability-subscription-mappers.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,iBAAiB,GAGlB,MAAM,uCAAuC,CAAC;AAE/C,SAAS,MAAM,CAAC,KAAa;IAC3B,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/D,CAAC;AAED,SAAS,eAAe,CAAC,MAA2C;IAClE,IAAI,MAAM,KAAK,QAAQ;QAAE,O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B,eAAe,EAAE,QAAQ,CAAC,eAAsC;QAChE,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACnD,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS;QACrF,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,CAAC;KACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,KAAuB;IACxE,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,IAAI,EAAE,KAAK,CAAC,IAA4B;QACxC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC;QACrC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,UAAU,EAAE,KAAK,CAAC,UAA6C;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,8 @@ export const RUN_UPDATED_TOPIC = 'runUpdated';
|
|
|
3
3
|
export const RUN_WORKFLOW_UPDATED_TOPIC = 'runWorkflowUpdated';
|
|
4
4
|
export const RUN_EVENT_APPENDED_TOPIC = 'runEventAppended';
|
|
5
5
|
export const RUN_PROGRESS_UPDATED_TOPIC = 'runProgressUpdated';
|
|
6
|
+
export const RUN_AGENT_ACTIVITY_UPDATED_TOPIC = 'runAgentActivityUpdated';
|
|
7
|
+
export const RUN_AGENT_OUTPUT_APPENDED_TOPIC = 'runAgentOutputAppended';
|
|
6
8
|
export const INBOX_ITEM_ADDED_TOPIC = 'inboxItemAdded';
|
|
7
9
|
export const INBOX_ITEM_RESOLVED_TOPIC = 'inboxItemResolved';
|
|
8
10
|
export const RUN_COST_RECORDED_TOPIC = 'runCostRecorded';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACxE,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC"}
|
|
@@ -7,6 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Global, Module } from '@nestjs/common';
|
|
8
8
|
import { PubSub } from 'graphql-subscriptions';
|
|
9
9
|
import { RunsApiModule } from '../../../features/runs/runs-api.module.js';
|
|
10
|
+
import { TaskControlPlaneModule } from '../../../task-control-plane/task-control-plane.module.js';
|
|
11
|
+
import { AgentObservabilitySubscriptionBridge } from './agent-observability-subscription-bridge.service.js';
|
|
10
12
|
import { APP_PUB_SUB } from './constants.js';
|
|
11
13
|
import { ControlPlaneSubscriptionBridge } from './subscription-bridge.service.js';
|
|
12
14
|
import { RunProgressSubscriptionPoller } from './run-progress-subscription-poller.service.js';
|
|
@@ -15,14 +17,15 @@ let PubSubModule = class PubSubModule {
|
|
|
15
17
|
PubSubModule = __decorate([
|
|
16
18
|
Global(),
|
|
17
19
|
Module({
|
|
18
|
-
imports: [RunsApiModule],
|
|
20
|
+
imports: [RunsApiModule, TaskControlPlaneModule],
|
|
19
21
|
providers: [
|
|
20
22
|
// Local-first production choice. Swap this provider to graphql-redis-subscriptions for multi-instance hosts.
|
|
21
23
|
{ provide: APP_PUB_SUB, useFactory: () => new PubSub() },
|
|
24
|
+
AgentObservabilitySubscriptionBridge,
|
|
22
25
|
ControlPlaneSubscriptionBridge,
|
|
23
26
|
RunProgressSubscriptionPoller,
|
|
24
27
|
],
|
|
25
|
-
exports: [APP_PUB_SUB],
|
|
28
|
+
exports: [APP_PUB_SUB, AgentObservabilitySubscriptionBridge],
|
|
26
29
|
})
|
|
27
30
|
], PubSubModule);
|
|
28
31
|
export { PubSubModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubsub.module.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/pubsub.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"pubsub.module.js","sourceRoot":"","sources":["../../../../src/api/graphql-api/graphql-ws/pubsub.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,oCAAoC,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAcvF,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IAZxB,MAAM,EAAE;IACR,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC;QAChD,SAAS,EAAE;YACT,6GAA6G;YAC7G,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,EAAE;YACxD,oCAAoC;YACpC,8BAA8B;YAC9B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