4runr-os 2.10.2 → 2.10.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.
- package/apps/gateway/package-lock.json +18 -18
- package/apps/gateway/src/health/index.ts +11 -2
- package/dist/gateway-observability.js +1 -1
- package/dist/gateway-observability.js.map +1 -1
- package/dist/tui-handlers.js +86 -6
- package/dist/tui-handlers.js.map +1 -1
- package/mk3-tui/src/app.rs +6 -0
- package/mk3-tui/src/main.rs +27 -1
- package/mk3-tui/src/ui/portal_monitoring.rs +6 -1
- package/package.json +3 -2
- package/prisma/migrations/20250806234307_add_agent_model/migration.sql +23 -0
- package/prisma/migrations/20250806234618_add_token_model/migration.sql +24 -0
- package/prisma/migrations/20250807002545_add_request_log_model/migration.sql +12 -0
- package/prisma/migrations/20250811200143_init/migration.sql +75 -0
- package/prisma/migrations/20250820014813_add_agent_runtime_models/migration.sql +44 -0
- package/prisma/migrations/20250820024550_task003_monitoring/migration.sql +49 -0
- package/prisma/migrations/20250820160424_task005_demo_tags/migration.sql +26 -0
- package/prisma/migrations/20250820162446_task006_trigger_tracking/migration.sql +24 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +469 -0
- package/scripts/postinstall-gateway.js +26 -1
package/mk3-tui/src/main.rs
CHANGED
|
@@ -424,6 +424,32 @@ fn main() -> Result<()> {
|
|
|
424
424
|
format!("Fetched: {}", if snapshot.is_empty() { "—" } else { snapshot.as_str() }),
|
|
425
425
|
String::new(),
|
|
426
426
|
];
|
|
427
|
+
if let Some(tot) = obj.get("totals").and_then(|v| v.get("httpRequests")) {
|
|
428
|
+
let current = tot
|
|
429
|
+
.as_u64()
|
|
430
|
+
.or_else(|| tot.as_f64().map(|f| f as u64));
|
|
431
|
+
if let Some(c) = current {
|
|
432
|
+
if let (Some(prev), Some(last_t)) = (
|
|
433
|
+
app.state.portal_monitoring.last_http_for_delta,
|
|
434
|
+
app.state.portal_monitoring.last_instant_for_delta,
|
|
435
|
+
) {
|
|
436
|
+
let d = c.saturating_sub(prev);
|
|
437
|
+
let el = last_t.elapsed().as_secs_f32().max(0.1);
|
|
438
|
+
let per_min = (d as f32 / el) * 60.0;
|
|
439
|
+
let pulse = if d > 0 { " *" } else { " --" };
|
|
440
|
+
lines.push(format!(
|
|
441
|
+
"LIVE: +{} HTTP since last screen refresh (~{:.0}/min){}",
|
|
442
|
+
d, per_min, pulse
|
|
443
|
+
));
|
|
444
|
+
} else {
|
|
445
|
+
lines.push("LIVE: first sample — next refresh shows HTTP request rate (poll interval).".to_string());
|
|
446
|
+
}
|
|
447
|
+
app.state.portal_monitoring.last_http_for_delta = Some(c);
|
|
448
|
+
app.state.portal_monitoring.last_instant_for_delta =
|
|
449
|
+
Some(std::time::Instant::now());
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
lines.push(String::new());
|
|
427
453
|
if let Some(arr) = obj.get("healthLines").and_then(|a| a.as_array()) {
|
|
428
454
|
for v in arr {
|
|
429
455
|
if let Some(s) = v.as_str() {
|
|
@@ -433,7 +459,7 @@ fn main() -> Result<()> {
|
|
|
433
459
|
lines.push(String::new());
|
|
434
460
|
}
|
|
435
461
|
lines.push(
|
|
436
|
-
"Prometheus /metrics (HTTP
|
|
462
|
+
"Prometheus /metrics (HTTP total includes this screen’s /health, /ready, and /metrics polls; add API/agent traffic for runs/queue/SSE)."
|
|
437
463
|
.to_string(),
|
|
438
464
|
);
|
|
439
465
|
lines.push(String::new());
|
|
@@ -118,7 +118,12 @@ pub fn render(f: &mut Frame, state: &mut AppState) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// Special formatting for different line types
|
|
121
|
-
if line_text.starts_with("
|
|
121
|
+
if line_text.starts_with("LIVE:") {
|
|
122
|
+
body_lines.push(Line::from(Span::styled(
|
|
123
|
+
line_text,
|
|
124
|
+
Style::default().fg(NEON_GREEN).bold(),
|
|
125
|
+
)));
|
|
126
|
+
} else if line_text.starts_with("✓") || line_text.starts_with("/health OK") {
|
|
122
127
|
body_lines.push(Line::from(Span::styled(
|
|
123
128
|
line_text,
|
|
124
129
|
Style::default().fg(NEON_GREEN),
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "4runr-os",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.4",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "4Runr AI Agent OS - Secure terminal interface for AI agents. v2.10.
|
|
5
|
+
"description": "4Runr AI Agent OS - Secure terminal interface for AI agents. v2.10.4: TUI autostart local Redis (Docker) by default for Gateway; FOURRUNR_NO_AUTO_REDIS=1 to opt out; Portal Monitoring LIVE request-rate line; /ready messages for Redis. v2.10.3: prisma/ in package + postinstall generate. v2.10.2+ monitoring. See docs/4RUNR-DB-IMPLEMENTATION-PLAN.md, docs/MONITORING-IMPROVEMENTS-V1.md",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"4runr": "dist/index.js",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"mk3-tui/bin/**/*",
|
|
85
85
|
"mk3-tui/binaries/**/*",
|
|
86
86
|
"apps/gateway/**/*",
|
|
87
|
+
"prisma/**/*",
|
|
87
88
|
"packages/shared/package.json",
|
|
88
89
|
"packages/shared/dist/**/*",
|
|
89
90
|
"packages/sentinel/package.json",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "Agent" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"name" TEXT NOT NULL,
|
|
5
|
+
"role" TEXT NOT NULL,
|
|
6
|
+
"createdBy" TEXT NOT NULL,
|
|
7
|
+
"publicKey" TEXT NOT NULL,
|
|
8
|
+
"status" TEXT NOT NULL DEFAULT 'active',
|
|
9
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- CreateTable
|
|
13
|
+
CREATE TABLE "Token" (
|
|
14
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
15
|
+
"agentId" TEXT NOT NULL,
|
|
16
|
+
"token" TEXT NOT NULL,
|
|
17
|
+
"expiresAt" DATETIME NOT NULL,
|
|
18
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
19
|
+
CONSTRAINT "Token_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
-- CreateIndex
|
|
23
|
+
CREATE UNIQUE INDEX "Token_token_key" ON "Token"("token");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `token` on the `Token` table. All the data in the column will be lost.
|
|
5
|
+
- Added the required column `encrypted` to the `Token` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- RedefineTables
|
|
9
|
+
PRAGMA defer_foreign_keys=ON;
|
|
10
|
+
PRAGMA foreign_keys=OFF;
|
|
11
|
+
CREATE TABLE "new_Token" (
|
|
12
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
13
|
+
"agentId" TEXT NOT NULL,
|
|
14
|
+
"encrypted" TEXT NOT NULL,
|
|
15
|
+
"expiresAt" DATETIME NOT NULL,
|
|
16
|
+
"revoked" BOOLEAN NOT NULL DEFAULT false,
|
|
17
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
18
|
+
CONSTRAINT "Token_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
19
|
+
);
|
|
20
|
+
INSERT INTO "new_Token" ("agentId", "createdAt", "expiresAt", "id") SELECT "agentId", "createdAt", "expiresAt", "id" FROM "Token";
|
|
21
|
+
DROP TABLE "Token";
|
|
22
|
+
ALTER TABLE "new_Token" RENAME TO "Token";
|
|
23
|
+
PRAGMA foreign_keys=ON;
|
|
24
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "RequestLog" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"agentId" TEXT NOT NULL,
|
|
5
|
+
"tool" TEXT NOT NULL,
|
|
6
|
+
"action" TEXT NOT NULL,
|
|
7
|
+
"responseTime" INTEGER NOT NULL,
|
|
8
|
+
"statusCode" INTEGER NOT NULL,
|
|
9
|
+
"success" BOOLEAN NOT NULL,
|
|
10
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
CONSTRAINT "RequestLog_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
12
|
+
);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "Policy" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"name" TEXT NOT NULL,
|
|
5
|
+
"description" TEXT,
|
|
6
|
+
"agentId" TEXT,
|
|
7
|
+
"role" TEXT,
|
|
8
|
+
"spec" TEXT NOT NULL,
|
|
9
|
+
"specHash" TEXT NOT NULL,
|
|
10
|
+
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
11
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
12
|
+
"updatedAt" DATETIME NOT NULL,
|
|
13
|
+
CONSTRAINT "Policy_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- CreateTable
|
|
17
|
+
CREATE TABLE "PolicyLog" (
|
|
18
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
19
|
+
"policyId" TEXT NOT NULL,
|
|
20
|
+
"agentId" TEXT NOT NULL,
|
|
21
|
+
"tool" TEXT NOT NULL,
|
|
22
|
+
"action" TEXT NOT NULL,
|
|
23
|
+
"decision" TEXT NOT NULL,
|
|
24
|
+
"reason" TEXT,
|
|
25
|
+
"requestData" TEXT,
|
|
26
|
+
"responseData" TEXT,
|
|
27
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
28
|
+
CONSTRAINT "PolicyLog_policyId_fkey" FOREIGN KEY ("policyId") REFERENCES "Policy" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
29
|
+
CONSTRAINT "PolicyLog_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
-- CreateTable
|
|
33
|
+
CREATE TABLE "QuotaCounter" (
|
|
34
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
35
|
+
"policyId" TEXT NOT NULL,
|
|
36
|
+
"quotaKey" TEXT NOT NULL,
|
|
37
|
+
"current" INTEGER NOT NULL DEFAULT 0,
|
|
38
|
+
"resetAt" DATETIME NOT NULL,
|
|
39
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
40
|
+
"updatedAt" DATETIME NOT NULL,
|
|
41
|
+
CONSTRAINT "QuotaCounter_policyId_fkey" FOREIGN KEY ("policyId") REFERENCES "Policy" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
-- CreateTable
|
|
45
|
+
CREATE TABLE "ToolCredential" (
|
|
46
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
47
|
+
"tool" TEXT NOT NULL,
|
|
48
|
+
"version" TEXT NOT NULL,
|
|
49
|
+
"isActive" BOOLEAN NOT NULL DEFAULT false,
|
|
50
|
+
"encryptedCredential" TEXT NOT NULL,
|
|
51
|
+
"metadata" TEXT,
|
|
52
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
53
|
+
"updatedAt" DATETIME NOT NULL,
|
|
54
|
+
"activatedAt" DATETIME,
|
|
55
|
+
"deactivatedAt" DATETIME
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
-- CreateTable
|
|
59
|
+
CREATE TABLE "TokenRegistry" (
|
|
60
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
61
|
+
"tokenId" TEXT NOT NULL,
|
|
62
|
+
"agentId" TEXT NOT NULL,
|
|
63
|
+
"payloadHash" TEXT NOT NULL,
|
|
64
|
+
"issuedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
65
|
+
"expiresAt" DATETIME NOT NULL,
|
|
66
|
+
"isRevoked" BOOLEAN NOT NULL DEFAULT false,
|
|
67
|
+
"revokedAt" DATETIME,
|
|
68
|
+
CONSTRAINT "TokenRegistry_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
-- CreateIndex
|
|
72
|
+
CREATE UNIQUE INDEX "ToolCredential_tool_version_key" ON "ToolCredential"("tool", "version");
|
|
73
|
+
|
|
74
|
+
-- CreateIndex
|
|
75
|
+
CREATE UNIQUE INDEX "TokenRegistry_tokenId_key" ON "TokenRegistry"("tokenId");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "runtime_agents" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"name" TEXT NOT NULL,
|
|
5
|
+
"language" TEXT NOT NULL,
|
|
6
|
+
"sourceType" TEXT NOT NULL DEFAULT 'ZIP',
|
|
7
|
+
"sourceUri" TEXT,
|
|
8
|
+
"entrypoint" TEXT NOT NULL,
|
|
9
|
+
"env" JSONB NOT NULL,
|
|
10
|
+
"limitsCpu" REAL,
|
|
11
|
+
"limitsMemMb" INTEGER,
|
|
12
|
+
"networkMode" TEXT NOT NULL DEFAULT 'NONE',
|
|
13
|
+
"status" TEXT NOT NULL DEFAULT 'READY',
|
|
14
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
15
|
+
"updatedAt" DATETIME NOT NULL
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- CreateTable
|
|
19
|
+
CREATE TABLE "runtime_runs" (
|
|
20
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
21
|
+
"agentId" TEXT NOT NULL,
|
|
22
|
+
"status" TEXT NOT NULL DEFAULT 'QUEUED',
|
|
23
|
+
"startedAt" DATETIME,
|
|
24
|
+
"endedAt" DATETIME,
|
|
25
|
+
"exitCode" INTEGER,
|
|
26
|
+
"reason" TEXT,
|
|
27
|
+
"cpuSeconds" REAL,
|
|
28
|
+
"maxMemMb" INTEGER,
|
|
29
|
+
"logsPtr" TEXT,
|
|
30
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
31
|
+
CONSTRAINT "runtime_runs_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "runtime_agents" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
-- CreateTable
|
|
35
|
+
CREATE TABLE "runtime_schedules" (
|
|
36
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
37
|
+
"agentId" TEXT NOT NULL,
|
|
38
|
+
"cronExpr" TEXT NOT NULL,
|
|
39
|
+
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
|
40
|
+
"lastRunAt" DATETIME,
|
|
41
|
+
"nextRunAt" DATETIME,
|
|
42
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
43
|
+
CONSTRAINT "runtime_schedules_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "runtime_agents" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
44
|
+
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `logsPtr` on the `runtime_runs` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- RedefineTables
|
|
8
|
+
PRAGMA defer_foreign_keys=ON;
|
|
9
|
+
PRAGMA foreign_keys=OFF;
|
|
10
|
+
CREATE TABLE "new_runtime_agents" (
|
|
11
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
12
|
+
"name" TEXT NOT NULL,
|
|
13
|
+
"language" TEXT NOT NULL,
|
|
14
|
+
"sourceType" TEXT NOT NULL DEFAULT 'ZIP',
|
|
15
|
+
"sourceUri" TEXT,
|
|
16
|
+
"entrypoint" TEXT NOT NULL,
|
|
17
|
+
"env" JSONB NOT NULL,
|
|
18
|
+
"limitsCpu" REAL,
|
|
19
|
+
"limitsMemMb" INTEGER,
|
|
20
|
+
"networkMode" TEXT NOT NULL DEFAULT 'NONE',
|
|
21
|
+
"status" TEXT NOT NULL DEFAULT 'READY',
|
|
22
|
+
"maxRestarts" INTEGER NOT NULL DEFAULT 2,
|
|
23
|
+
"restartBackoffMs" INTEGER NOT NULL DEFAULT 5000,
|
|
24
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
25
|
+
"updatedAt" DATETIME NOT NULL
|
|
26
|
+
);
|
|
27
|
+
INSERT INTO "new_runtime_agents" ("createdAt", "entrypoint", "env", "id", "language", "limitsCpu", "limitsMemMb", "name", "networkMode", "sourceType", "sourceUri", "status", "updatedAt") SELECT "createdAt", "entrypoint", "env", "id", "language", "limitsCpu", "limitsMemMb", "name", "networkMode", "sourceType", "sourceUri", "status", "updatedAt" FROM "runtime_agents";
|
|
28
|
+
DROP TABLE "runtime_agents";
|
|
29
|
+
ALTER TABLE "new_runtime_agents" RENAME TO "runtime_agents";
|
|
30
|
+
CREATE TABLE "new_runtime_runs" (
|
|
31
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
32
|
+
"agentId" TEXT NOT NULL,
|
|
33
|
+
"status" TEXT NOT NULL DEFAULT 'QUEUED',
|
|
34
|
+
"startedAt" DATETIME,
|
|
35
|
+
"endedAt" DATETIME,
|
|
36
|
+
"exitCode" INTEGER,
|
|
37
|
+
"reason" TEXT,
|
|
38
|
+
"cpuSeconds" REAL,
|
|
39
|
+
"maxMemMb" INTEGER,
|
|
40
|
+
"restarts" INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
"lastSampleAt" DATETIME,
|
|
42
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
43
|
+
CONSTRAINT "runtime_runs_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "runtime_agents" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
44
|
+
);
|
|
45
|
+
INSERT INTO "new_runtime_runs" ("agentId", "cpuSeconds", "createdAt", "endedAt", "exitCode", "id", "maxMemMb", "reason", "startedAt", "status") SELECT "agentId", "cpuSeconds", "createdAt", "endedAt", "exitCode", "id", "maxMemMb", "reason", "startedAt", "status" FROM "runtime_runs";
|
|
46
|
+
DROP TABLE "runtime_runs";
|
|
47
|
+
ALTER TABLE "new_runtime_runs" RENAME TO "runtime_runs";
|
|
48
|
+
PRAGMA foreign_keys=ON;
|
|
49
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_runtime_agents" (
|
|
5
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"name" TEXT NOT NULL,
|
|
7
|
+
"language" TEXT NOT NULL,
|
|
8
|
+
"sourceType" TEXT NOT NULL DEFAULT 'ZIP',
|
|
9
|
+
"sourceUri" TEXT,
|
|
10
|
+
"entrypoint" TEXT NOT NULL,
|
|
11
|
+
"env" JSONB NOT NULL,
|
|
12
|
+
"limitsCpu" REAL,
|
|
13
|
+
"limitsMemMb" INTEGER,
|
|
14
|
+
"networkMode" TEXT NOT NULL DEFAULT 'NONE',
|
|
15
|
+
"status" TEXT NOT NULL DEFAULT 'READY',
|
|
16
|
+
"maxRestarts" INTEGER NOT NULL DEFAULT 2,
|
|
17
|
+
"restartBackoffMs" INTEGER NOT NULL DEFAULT 5000,
|
|
18
|
+
"tags" JSONB NOT NULL DEFAULT [],
|
|
19
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
+
"updatedAt" DATETIME NOT NULL
|
|
21
|
+
);
|
|
22
|
+
INSERT INTO "new_runtime_agents" ("createdAt", "entrypoint", "env", "id", "language", "limitsCpu", "limitsMemMb", "maxRestarts", "name", "networkMode", "restartBackoffMs", "sourceType", "sourceUri", "status", "updatedAt") SELECT "createdAt", "entrypoint", "env", "id", "language", "limitsCpu", "limitsMemMb", "maxRestarts", "name", "networkMode", "restartBackoffMs", "sourceType", "sourceUri", "status", "updatedAt" FROM "runtime_agents";
|
|
23
|
+
DROP TABLE "runtime_agents";
|
|
24
|
+
ALTER TABLE "new_runtime_agents" RENAME TO "runtime_agents";
|
|
25
|
+
PRAGMA foreign_keys=ON;
|
|
26
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_runtime_runs" (
|
|
5
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"agentId" TEXT NOT NULL,
|
|
7
|
+
"status" TEXT NOT NULL DEFAULT 'QUEUED',
|
|
8
|
+
"startedAt" DATETIME,
|
|
9
|
+
"endedAt" DATETIME,
|
|
10
|
+
"exitCode" INTEGER,
|
|
11
|
+
"reason" TEXT,
|
|
12
|
+
"cpuSeconds" REAL,
|
|
13
|
+
"maxMemMb" INTEGER,
|
|
14
|
+
"restarts" INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
"lastSampleAt" DATETIME,
|
|
16
|
+
"triggeredBy" TEXT NOT NULL DEFAULT 'MANUAL',
|
|
17
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
18
|
+
CONSTRAINT "runtime_runs_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "runtime_agents" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
19
|
+
);
|
|
20
|
+
INSERT INTO "new_runtime_runs" ("agentId", "cpuSeconds", "createdAt", "endedAt", "exitCode", "id", "lastSampleAt", "maxMemMb", "reason", "restarts", "startedAt", "status") SELECT "agentId", "cpuSeconds", "createdAt", "endedAt", "exitCode", "id", "lastSampleAt", "maxMemMb", "reason", "restarts", "startedAt", "status" FROM "runtime_runs";
|
|
21
|
+
DROP TABLE "runtime_runs";
|
|
22
|
+
ALTER TABLE "new_runtime_runs" RENAME TO "runtime_runs";
|
|
23
|
+
PRAGMA foreign_keys=ON;
|
|
24
|
+
PRAGMA defer_foreign_keys=OFF;
|