@zmeel/server 0.3.2 → 2026.404.0-canary.0
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/app.d.ts +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +1 -0
- package/dist/app.js.map +1 -1
- package/dist/auth/better-auth.d.ts +1 -1
- package/dist/auth/better-auth.d.ts.map +1 -1
- package/dist/auth/better-auth.js +13 -1
- package/dist/auth/better-auth.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -2
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/routes/authz.d.ts +5 -5
- package/dist/routes/health.d.ts +1 -0
- package/dist/routes/health.d.ts.map +1 -1
- package/dist/routes/health.js +6 -1
- package/dist/routes/health.js.map +1 -1
- package/dist/services/activity.d.ts +3 -3
- package/dist/services/agents.d.ts +3 -3
- package/dist/services/approvals.d.ts +2 -2
- package/dist/services/costs.d.ts +2 -2
- package/dist/services/feedback.d.ts +2 -2
- package/dist/services/finance.d.ts +2 -2
- package/dist/services/goals.d.ts +6 -6
- package/dist/services/heartbeat.d.ts +17 -17
- package/dist/services/issues.d.ts +3 -3
- package/dist/services/plugin-registry.d.ts +73 -73
- package/dist/services/routines.d.ts +15 -15
- package/dist/services/saas-provisioning.d.ts +17 -0
- package/dist/services/saas-provisioning.d.ts.map +1 -0
- package/dist/services/saas-provisioning.js +55 -0
- package/dist/services/saas-provisioning.js.map +1 -0
- package/dist/services/workspace-runtime.d.ts +2 -2
- package/package.json +13 -13
- package/skills/para-memory-files/SKILL.md +104 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/skills/zmeel/SKILL.md +390 -0
- package/skills/zmeel/references/api-reference.md +721 -0
- package/skills/zmeel/references/company-skills.md +193 -0
- package/skills/zmeel/references/routines.md +187 -0
- package/skills/zmeel-create-agent/SKILL.md +142 -0
- package/skills/zmeel-create-agent/references/api-reference.md +105 -0
- package/skills/zmeel-create-plugin/SKILL.md +101 -0
|
@@ -106,7 +106,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
106
106
|
tableName: "plugins";
|
|
107
107
|
dataType: "json";
|
|
108
108
|
columnType: "PgJsonb";
|
|
109
|
-
data: ("
|
|
109
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
110
110
|
driverParam: unknown;
|
|
111
111
|
notNull: true;
|
|
112
112
|
hasDefault: true;
|
|
@@ -118,7 +118,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
118
118
|
identity: undefined;
|
|
119
119
|
generated: undefined;
|
|
120
120
|
}, {}, {
|
|
121
|
-
$type: ("
|
|
121
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
122
122
|
}>;
|
|
123
123
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
124
124
|
name: "manifest_json";
|
|
@@ -244,18 +244,18 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
244
244
|
generated: undefined;
|
|
245
245
|
}, {}, {}>;
|
|
246
246
|
}, "single", Record<"plugins", "not-null">, false, "orderBy", {
|
|
247
|
+
version: string;
|
|
247
248
|
id: string;
|
|
248
249
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
249
250
|
updatedAt: Date;
|
|
250
251
|
lastError: string | null;
|
|
251
|
-
version: string;
|
|
252
|
-
apiVersion: number;
|
|
253
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
254
|
-
packageName: string;
|
|
255
|
-
packagePath: string | null;
|
|
256
252
|
pluginKey: string;
|
|
253
|
+
packageName: string;
|
|
254
|
+
apiVersion: number;
|
|
255
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
257
256
|
manifestJson: zmeelPluginManifestV1;
|
|
258
257
|
installOrder: number | null;
|
|
258
|
+
packagePath: string | null;
|
|
259
259
|
installedAt: Date;
|
|
260
260
|
}[], {
|
|
261
261
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -348,7 +348,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
348
348
|
tableName: "plugins";
|
|
349
349
|
dataType: "json";
|
|
350
350
|
columnType: "PgJsonb";
|
|
351
|
-
data: ("
|
|
351
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
352
352
|
driverParam: unknown;
|
|
353
353
|
notNull: true;
|
|
354
354
|
hasDefault: true;
|
|
@@ -360,7 +360,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
360
360
|
identity: undefined;
|
|
361
361
|
generated: undefined;
|
|
362
362
|
}, {}, {
|
|
363
|
-
$type: ("
|
|
363
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
364
364
|
}>;
|
|
365
365
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
366
366
|
name: "manifest_json";
|
|
@@ -581,7 +581,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
581
581
|
tableName: "plugins";
|
|
582
582
|
dataType: "json";
|
|
583
583
|
columnType: "PgJsonb";
|
|
584
|
-
data: ("
|
|
584
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
585
585
|
driverParam: unknown;
|
|
586
586
|
notNull: true;
|
|
587
587
|
hasDefault: true;
|
|
@@ -593,7 +593,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
593
593
|
identity: undefined;
|
|
594
594
|
generated: undefined;
|
|
595
595
|
}, {}, {
|
|
596
|
-
$type: ("
|
|
596
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
597
597
|
}>;
|
|
598
598
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
599
599
|
name: "manifest_json";
|
|
@@ -719,18 +719,18 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
719
719
|
generated: undefined;
|
|
720
720
|
}, {}, {}>;
|
|
721
721
|
}, "single", Record<"plugins", "not-null">, false, "where" | "orderBy", {
|
|
722
|
+
version: string;
|
|
722
723
|
id: string;
|
|
723
724
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
724
725
|
updatedAt: Date;
|
|
725
726
|
lastError: string | null;
|
|
726
|
-
version: string;
|
|
727
|
-
apiVersion: number;
|
|
728
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
729
|
-
packageName: string;
|
|
730
|
-
packagePath: string | null;
|
|
731
727
|
pluginKey: string;
|
|
728
|
+
packageName: string;
|
|
729
|
+
apiVersion: number;
|
|
730
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
732
731
|
manifestJson: zmeelPluginManifestV1;
|
|
733
732
|
installOrder: number | null;
|
|
733
|
+
packagePath: string | null;
|
|
734
734
|
installedAt: Date;
|
|
735
735
|
}[], {
|
|
736
736
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -823,7 +823,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
823
823
|
tableName: "plugins";
|
|
824
824
|
dataType: "json";
|
|
825
825
|
columnType: "PgJsonb";
|
|
826
|
-
data: ("
|
|
826
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
827
827
|
driverParam: unknown;
|
|
828
828
|
notNull: true;
|
|
829
829
|
hasDefault: true;
|
|
@@ -835,7 +835,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
835
835
|
identity: undefined;
|
|
836
836
|
generated: undefined;
|
|
837
837
|
}, {}, {
|
|
838
|
-
$type: ("
|
|
838
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
839
839
|
}>;
|
|
840
840
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
841
841
|
name: "manifest_json";
|
|
@@ -1053,7 +1053,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1053
1053
|
tableName: "plugins";
|
|
1054
1054
|
dataType: "json";
|
|
1055
1055
|
columnType: "PgJsonb";
|
|
1056
|
-
data: ("
|
|
1056
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1057
1057
|
driverParam: unknown;
|
|
1058
1058
|
notNull: true;
|
|
1059
1059
|
hasDefault: true;
|
|
@@ -1065,7 +1065,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1065
1065
|
identity: undefined;
|
|
1066
1066
|
generated: undefined;
|
|
1067
1067
|
}, {}, {
|
|
1068
|
-
$type: ("
|
|
1068
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1069
1069
|
}>;
|
|
1070
1070
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
1071
1071
|
name: "manifest_json";
|
|
@@ -1191,18 +1191,18 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1191
1191
|
generated: undefined;
|
|
1192
1192
|
}, {}, {}>;
|
|
1193
1193
|
}, "single", Record<"plugins", "not-null">, false, "where" | "orderBy", {
|
|
1194
|
+
version: string;
|
|
1194
1195
|
id: string;
|
|
1195
1196
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1196
1197
|
updatedAt: Date;
|
|
1197
1198
|
lastError: string | null;
|
|
1198
|
-
version: string;
|
|
1199
|
-
apiVersion: number;
|
|
1200
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
1201
|
-
packageName: string;
|
|
1202
|
-
packagePath: string | null;
|
|
1203
1199
|
pluginKey: string;
|
|
1200
|
+
packageName: string;
|
|
1201
|
+
apiVersion: number;
|
|
1202
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1204
1203
|
manifestJson: zmeelPluginManifestV1;
|
|
1205
1204
|
installOrder: number | null;
|
|
1205
|
+
packagePath: string | null;
|
|
1206
1206
|
installedAt: Date;
|
|
1207
1207
|
}[], {
|
|
1208
1208
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -1295,7 +1295,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1295
1295
|
tableName: "plugins";
|
|
1296
1296
|
dataType: "json";
|
|
1297
1297
|
columnType: "PgJsonb";
|
|
1298
|
-
data: ("
|
|
1298
|
+
data: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1299
1299
|
driverParam: unknown;
|
|
1300
1300
|
notNull: true;
|
|
1301
1301
|
hasDefault: true;
|
|
@@ -1307,7 +1307,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1307
1307
|
identity: undefined;
|
|
1308
1308
|
generated: undefined;
|
|
1309
1309
|
}, {}, {
|
|
1310
|
-
$type: ("
|
|
1310
|
+
$type: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1311
1311
|
}>;
|
|
1312
1312
|
manifestJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
1313
1313
|
name: "manifest_json";
|
|
@@ -1435,34 +1435,34 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1435
1435
|
}>, "where" | "orderBy">;
|
|
1436
1436
|
/** Get a single plugin by primary key. */
|
|
1437
1437
|
getById: (id: string) => Promise<{
|
|
1438
|
+
version: string;
|
|
1438
1439
|
id: string;
|
|
1439
1440
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1440
1441
|
updatedAt: Date;
|
|
1441
1442
|
lastError: string | null;
|
|
1442
|
-
version: string;
|
|
1443
|
-
apiVersion: number;
|
|
1444
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
1445
|
-
packageName: string;
|
|
1446
|
-
packagePath: string | null;
|
|
1447
1443
|
pluginKey: string;
|
|
1444
|
+
packageName: string;
|
|
1445
|
+
apiVersion: number;
|
|
1446
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1448
1447
|
manifestJson: zmeelPluginManifestV1;
|
|
1449
1448
|
installOrder: number | null;
|
|
1449
|
+
packagePath: string | null;
|
|
1450
1450
|
installedAt: Date;
|
|
1451
1451
|
}>;
|
|
1452
1452
|
/** Get a single plugin by its unique `pluginKey`. */
|
|
1453
1453
|
getByKey: (pluginKey: string) => Promise<{
|
|
1454
|
+
version: string;
|
|
1454
1455
|
id: string;
|
|
1455
1456
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1456
1457
|
updatedAt: Date;
|
|
1457
1458
|
lastError: string | null;
|
|
1458
|
-
version: string;
|
|
1459
|
-
apiVersion: number;
|
|
1460
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
1461
|
-
packageName: string;
|
|
1462
|
-
packagePath: string | null;
|
|
1463
1459
|
pluginKey: string;
|
|
1460
|
+
packageName: string;
|
|
1461
|
+
apiVersion: number;
|
|
1462
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1464
1463
|
manifestJson: zmeelPluginManifestV1;
|
|
1465
1464
|
installOrder: number | null;
|
|
1465
|
+
packagePath: string | null;
|
|
1466
1466
|
installedAt: Date;
|
|
1467
1467
|
}>;
|
|
1468
1468
|
/**
|
|
@@ -1473,18 +1473,18 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1473
1473
|
* assigns the next install order.
|
|
1474
1474
|
*/
|
|
1475
1475
|
install: (input: InstallPlugin, manifest: zmeelPluginManifestV1) => Promise<{
|
|
1476
|
+
version: string;
|
|
1476
1477
|
id: string;
|
|
1477
1478
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1478
1479
|
updatedAt: Date;
|
|
1479
1480
|
lastError: string | null;
|
|
1480
|
-
version: string;
|
|
1481
|
-
apiVersion: number;
|
|
1482
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
1483
|
-
packageName: string;
|
|
1484
|
-
packagePath: string | null;
|
|
1485
1481
|
pluginKey: string;
|
|
1482
|
+
packageName: string;
|
|
1483
|
+
apiVersion: number;
|
|
1484
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1486
1485
|
manifestJson: zmeelPluginManifestV1;
|
|
1487
1486
|
installOrder: number | null;
|
|
1487
|
+
packagePath: string | null;
|
|
1488
1488
|
installedAt: Date;
|
|
1489
1489
|
}>;
|
|
1490
1490
|
/**
|
|
@@ -1501,7 +1501,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1501
1501
|
packageName: string;
|
|
1502
1502
|
version: string;
|
|
1503
1503
|
apiVersion: number;
|
|
1504
|
-
categories: ("
|
|
1504
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1505
1505
|
manifestJson: zmeelPluginManifestV1;
|
|
1506
1506
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1507
1507
|
installOrder: number | null;
|
|
@@ -1517,7 +1517,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1517
1517
|
packageName: string;
|
|
1518
1518
|
version: string;
|
|
1519
1519
|
apiVersion: number;
|
|
1520
|
-
categories: ("
|
|
1520
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1521
1521
|
manifestJson: zmeelPluginManifestV1;
|
|
1522
1522
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1523
1523
|
installOrder: number | null;
|
|
@@ -1534,18 +1534,18 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1534
1534
|
* a soft-delete that preserves the record.
|
|
1535
1535
|
*/
|
|
1536
1536
|
uninstall: (id: string, removeData?: boolean) => Promise<{
|
|
1537
|
+
version: string;
|
|
1537
1538
|
id: string;
|
|
1538
1539
|
status: "error" | "installed" | "ready" | "disabled" | "upgrade_pending" | "uninstalled";
|
|
1539
1540
|
updatedAt: Date;
|
|
1540
1541
|
lastError: string | null;
|
|
1541
|
-
version: string;
|
|
1542
|
-
apiVersion: number;
|
|
1543
|
-
categories: ("automation" | "connector" | "workspace" | "ui")[];
|
|
1544
|
-
packageName: string;
|
|
1545
|
-
packagePath: string | null;
|
|
1546
1542
|
pluginKey: string;
|
|
1543
|
+
packageName: string;
|
|
1544
|
+
apiVersion: number;
|
|
1545
|
+
categories: ("connector" | "workspace" | "automation" | "ui")[];
|
|
1547
1546
|
manifestJson: zmeelPluginManifestV1;
|
|
1548
1547
|
installOrder: number | null;
|
|
1548
|
+
packagePath: string | null;
|
|
1549
1549
|
installedAt: Date;
|
|
1550
1550
|
}>;
|
|
1551
1551
|
/** Retrieve a plugin's instance configuration. */
|
|
@@ -1554,8 +1554,8 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1554
1554
|
createdAt: Date;
|
|
1555
1555
|
updatedAt: Date;
|
|
1556
1556
|
lastError: string | null;
|
|
1557
|
-
configJson: Record<string, unknown>;
|
|
1558
1557
|
pluginId: string;
|
|
1558
|
+
configJson: Record<string, unknown>;
|
|
1559
1559
|
}>;
|
|
1560
1560
|
/**
|
|
1561
1561
|
* Create or fully replace a plugin's instance configuration.
|
|
@@ -1567,8 +1567,8 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1567
1567
|
createdAt: Date;
|
|
1568
1568
|
updatedAt: Date;
|
|
1569
1569
|
lastError: string | null;
|
|
1570
|
-
configJson: Record<string, unknown>;
|
|
1571
1570
|
pluginId: string;
|
|
1571
|
+
configJson: Record<string, unknown>;
|
|
1572
1572
|
}>;
|
|
1573
1573
|
/**
|
|
1574
1574
|
* Partially update a plugin's instance configuration via shallow merge.
|
|
@@ -1579,8 +1579,8 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1579
1579
|
createdAt: Date;
|
|
1580
1580
|
updatedAt: Date;
|
|
1581
1581
|
lastError: string | null;
|
|
1582
|
-
configJson: Record<string, unknown>;
|
|
1583
1582
|
pluginId: string;
|
|
1583
|
+
configJson: Record<string, unknown>;
|
|
1584
1584
|
}>;
|
|
1585
1585
|
/**
|
|
1586
1586
|
* Record an error against a plugin's config (e.g. validation failure
|
|
@@ -1600,8 +1600,8 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1600
1600
|
createdAt: Date;
|
|
1601
1601
|
updatedAt: Date;
|
|
1602
1602
|
lastError: string | null;
|
|
1603
|
-
configJson: Record<string, unknown>;
|
|
1604
1603
|
pluginId: string;
|
|
1604
|
+
configJson: Record<string, unknown>;
|
|
1605
1605
|
}>;
|
|
1606
1606
|
/**
|
|
1607
1607
|
* List persistent entity mappings owned by a specific plugin, with filtering and pagination.
|
|
@@ -1667,7 +1667,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1667
1667
|
tableName: "plugin_entities";
|
|
1668
1668
|
dataType: "string";
|
|
1669
1669
|
columnType: "PgText";
|
|
1670
|
-
data: "
|
|
1670
|
+
data: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
1671
1671
|
driverParam: string;
|
|
1672
1672
|
notNull: true;
|
|
1673
1673
|
hasDefault: false;
|
|
@@ -1679,7 +1679,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1679
1679
|
identity: undefined;
|
|
1680
1680
|
generated: undefined;
|
|
1681
1681
|
}, {}, {
|
|
1682
|
-
$type: "
|
|
1682
|
+
$type: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
1683
1683
|
}>;
|
|
1684
1684
|
scopeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1685
1685
|
name: "scope_id";
|
|
@@ -1811,9 +1811,9 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1811
1811
|
title: string | null;
|
|
1812
1812
|
scopeId: string | null;
|
|
1813
1813
|
externalId: string | null;
|
|
1814
|
-
scopeKind: "company" | "agent" | "project" | "issue" | "goal" | "run" | "instance" | "project_workspace";
|
|
1815
1814
|
entityType: string;
|
|
1816
1815
|
pluginId: string;
|
|
1816
|
+
scopeKind: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
1817
1817
|
}[], {
|
|
1818
1818
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
1819
1819
|
name: "id";
|
|
@@ -1871,7 +1871,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1871
1871
|
tableName: "plugin_entities";
|
|
1872
1872
|
dataType: "string";
|
|
1873
1873
|
columnType: "PgText";
|
|
1874
|
-
data: "
|
|
1874
|
+
data: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
1875
1875
|
driverParam: string;
|
|
1876
1876
|
notNull: true;
|
|
1877
1877
|
hasDefault: false;
|
|
@@ -1883,7 +1883,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
1883
1883
|
identity: undefined;
|
|
1884
1884
|
generated: undefined;
|
|
1885
1885
|
}, {}, {
|
|
1886
|
-
$type: "
|
|
1886
|
+
$type: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
1887
1887
|
}>;
|
|
1888
1888
|
scopeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1889
1889
|
name: "scope_id";
|
|
@@ -2024,9 +2024,9 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2024
2024
|
title: string | null;
|
|
2025
2025
|
scopeId: string | null;
|
|
2026
2026
|
externalId: string | null;
|
|
2027
|
-
scopeKind: "company" | "agent" | "project" | "issue" | "goal" | "run" | "instance" | "project_workspace";
|
|
2028
2027
|
entityType: string;
|
|
2029
2028
|
pluginId: string;
|
|
2029
|
+
scopeKind: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
2030
2030
|
}>;
|
|
2031
2031
|
/**
|
|
2032
2032
|
* Create or update a persistent mapping between a zmeel object and an
|
|
@@ -2045,9 +2045,9 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2045
2045
|
title: string | null;
|
|
2046
2046
|
scopeId: string | null;
|
|
2047
2047
|
externalId: string | null;
|
|
2048
|
-
scopeKind: "company" | "agent" | "project" | "issue" | "goal" | "run" | "instance" | "project_workspace";
|
|
2049
2048
|
entityType: string;
|
|
2050
2049
|
pluginId: string;
|
|
2050
|
+
scopeKind: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
2051
2051
|
}>;
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Delete a specific plugin-owned entity mapping by its internal UUID.
|
|
@@ -2064,9 +2064,9 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2064
2064
|
title: string | null;
|
|
2065
2065
|
scopeId: string | null;
|
|
2066
2066
|
externalId: string | null;
|
|
2067
|
-
scopeKind: "company" | "agent" | "project" | "issue" | "goal" | "run" | "instance" | "project_workspace";
|
|
2068
2067
|
entityType: string;
|
|
2069
2068
|
pluginId: string;
|
|
2069
|
+
scopeKind: "instance" | "company" | "project" | "project_workspace" | "agent" | "issue" | "goal" | "run";
|
|
2070
2070
|
}>;
|
|
2071
2071
|
/**
|
|
2072
2072
|
* List all scheduled jobs registered for a specific plugin.
|
|
@@ -2235,10 +2235,10 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2235
2235
|
status: "active" | "paused" | "failed";
|
|
2236
2236
|
createdAt: Date;
|
|
2237
2237
|
updatedAt: Date;
|
|
2238
|
-
schedule: string;
|
|
2239
2238
|
nextRunAt: Date | null;
|
|
2240
|
-
jobKey: string;
|
|
2241
2239
|
pluginId: string;
|
|
2240
|
+
jobKey: string;
|
|
2241
|
+
schedule: string;
|
|
2242
2242
|
lastRunAt: Date | null;
|
|
2243
2243
|
}[], {
|
|
2244
2244
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
@@ -2409,10 +2409,10 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2409
2409
|
status: "active" | "paused" | "failed";
|
|
2410
2410
|
createdAt: Date;
|
|
2411
2411
|
updatedAt: Date;
|
|
2412
|
-
schedule: string;
|
|
2413
2412
|
nextRunAt: Date | null;
|
|
2414
|
-
jobKey: string;
|
|
2415
2413
|
pluginId: string;
|
|
2414
|
+
jobKey: string;
|
|
2415
|
+
schedule: string;
|
|
2416
2416
|
lastRunAt: Date | null;
|
|
2417
2417
|
}>;
|
|
2418
2418
|
/**
|
|
@@ -2431,10 +2431,10 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2431
2431
|
status: "active" | "paused" | "failed";
|
|
2432
2432
|
createdAt: Date;
|
|
2433
2433
|
updatedAt: Date;
|
|
2434
|
-
schedule: string;
|
|
2435
2434
|
nextRunAt: Date | null;
|
|
2436
|
-
jobKey: string;
|
|
2437
2435
|
pluginId: string;
|
|
2436
|
+
jobKey: string;
|
|
2437
|
+
schedule: string;
|
|
2438
2438
|
lastRunAt: Date | null;
|
|
2439
2439
|
}>;
|
|
2440
2440
|
/**
|
|
@@ -2446,12 +2446,12 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2446
2446
|
* @returns The newly created `PluginJobRunRecord` in 'pending' status.
|
|
2447
2447
|
*/
|
|
2448
2448
|
createJobRun: (pluginId: string, jobId: string, trigger: PluginJobRunTrigger) => Promise<{
|
|
2449
|
+
error: string | null;
|
|
2449
2450
|
id: string;
|
|
2450
|
-
status: "pending" | "queued" | "running" | "
|
|
2451
|
+
status: "pending" | "queued" | "running" | "failed" | "succeeded" | "cancelled";
|
|
2451
2452
|
createdAt: Date;
|
|
2452
|
-
finishedAt: Date | null;
|
|
2453
|
-
error: string | null;
|
|
2454
2453
|
startedAt: Date | null;
|
|
2454
|
+
finishedAt: Date | null;
|
|
2455
2455
|
pluginId: string;
|
|
2456
2456
|
jobId: string;
|
|
2457
2457
|
trigger: "manual" | "schedule" | "retry";
|
|
@@ -2477,7 +2477,7 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2477
2477
|
jobId: string;
|
|
2478
2478
|
pluginId: string;
|
|
2479
2479
|
trigger: "manual" | "schedule" | "retry";
|
|
2480
|
-
status: "pending" | "queued" | "running" | "
|
|
2480
|
+
status: "pending" | "queued" | "running" | "failed" | "succeeded" | "cancelled";
|
|
2481
2481
|
durationMs: number | null;
|
|
2482
2482
|
error: string | null;
|
|
2483
2483
|
logs: string[];
|
|
@@ -2498,13 +2498,13 @@ export declare function pluginRegistryService(db: Db): {
|
|
|
2498
2498
|
payload: Record<string, unknown>;
|
|
2499
2499
|
headers?: Record<string, string>;
|
|
2500
2500
|
}) => Promise<{
|
|
2501
|
+
error: string | null;
|
|
2501
2502
|
id: string;
|
|
2502
2503
|
status: "pending" | "failed" | "success";
|
|
2503
2504
|
createdAt: Date;
|
|
2504
2505
|
payload: Record<string, unknown>;
|
|
2505
|
-
finishedAt: Date | null;
|
|
2506
|
-
error: string | null;
|
|
2507
2506
|
startedAt: Date | null;
|
|
2507
|
+
finishedAt: Date | null;
|
|
2508
2508
|
externalId: string | null;
|
|
2509
2509
|
pluginId: string;
|
|
2510
2510
|
durationMs: number | null;
|
|
@@ -23,11 +23,11 @@ export declare function routineService(db: Db, deps?: {
|
|
|
23
23
|
projectId: string;
|
|
24
24
|
priority: string;
|
|
25
25
|
assigneeAgentId: string;
|
|
26
|
-
updatedByAgentId: string | null;
|
|
27
26
|
parentIssueId: string | null;
|
|
28
27
|
concurrencyPolicy: string;
|
|
29
28
|
catchUpPolicy: string;
|
|
30
29
|
variables: RoutineVariable[];
|
|
30
|
+
updatedByAgentId: string | null;
|
|
31
31
|
lastTriggeredAt: Date | null;
|
|
32
32
|
lastEnqueuedAt: Date | null;
|
|
33
33
|
}>;
|
|
@@ -39,9 +39,10 @@ export declare function routineService(db: Db, deps?: {
|
|
|
39
39
|
createdByAgentId: string | null;
|
|
40
40
|
createdByUserId: string | null;
|
|
41
41
|
updatedByUserId: string | null;
|
|
42
|
+
updatedByAgentId: string | null;
|
|
43
|
+
routineId: string;
|
|
42
44
|
kind: string;
|
|
43
45
|
label: string | null;
|
|
44
|
-
routineId: string;
|
|
45
46
|
enabled: boolean;
|
|
46
47
|
cronExpression: string | null;
|
|
47
48
|
timezone: string | null;
|
|
@@ -53,7 +54,6 @@ export declare function routineService(db: Db, deps?: {
|
|
|
53
54
|
replayWindowSec: number | null;
|
|
54
55
|
lastRotatedAt: Date | null;
|
|
55
56
|
lastResult: string | null;
|
|
56
|
-
updatedByAgentId: string | null;
|
|
57
57
|
}>;
|
|
58
58
|
list: (companyId: string) => Promise<RoutineListItem[]>;
|
|
59
59
|
getDetail: (id: string) => Promise<RoutineDetail | null>;
|
|
@@ -71,20 +71,20 @@ export declare function routineService(db: Db, deps?: {
|
|
|
71
71
|
}>;
|
|
72
72
|
runRoutine: (id: string, input: RunRoutine) => Promise<{
|
|
73
73
|
id: string;
|
|
74
|
+
status: string;
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
updatedAt: Date;
|
|
74
77
|
companyId: string;
|
|
78
|
+
source: string;
|
|
79
|
+
idempotencyKey: string | null;
|
|
80
|
+
completedAt: Date | null;
|
|
75
81
|
routineId: string;
|
|
76
82
|
triggerId: string | null;
|
|
77
|
-
source: string;
|
|
78
|
-
status: string;
|
|
79
83
|
triggeredAt: Date;
|
|
80
|
-
idempotencyKey: string | null;
|
|
81
84
|
triggerPayload: Record<string, unknown> | null;
|
|
82
85
|
linkedIssueId: string | null;
|
|
83
86
|
coalescedIntoRunId: string | null;
|
|
84
87
|
failureReason: string | null;
|
|
85
|
-
completedAt: Date | null;
|
|
86
|
-
createdAt: Date;
|
|
87
|
-
updatedAt: Date;
|
|
88
88
|
}>;
|
|
89
89
|
firePublicTrigger: (publicId: string, input: {
|
|
90
90
|
authorizationHeader?: string | null;
|
|
@@ -95,20 +95,20 @@ export declare function routineService(db: Db, deps?: {
|
|
|
95
95
|
payload?: Record<string, unknown> | null;
|
|
96
96
|
}) => Promise<{
|
|
97
97
|
id: string;
|
|
98
|
+
status: string;
|
|
99
|
+
createdAt: Date;
|
|
100
|
+
updatedAt: Date;
|
|
98
101
|
companyId: string;
|
|
102
|
+
source: string;
|
|
103
|
+
idempotencyKey: string | null;
|
|
104
|
+
completedAt: Date | null;
|
|
99
105
|
routineId: string;
|
|
100
106
|
triggerId: string | null;
|
|
101
|
-
source: string;
|
|
102
|
-
status: string;
|
|
103
107
|
triggeredAt: Date;
|
|
104
|
-
idempotencyKey: string | null;
|
|
105
108
|
triggerPayload: Record<string, unknown> | null;
|
|
106
109
|
linkedIssueId: string | null;
|
|
107
110
|
coalescedIntoRunId: string | null;
|
|
108
111
|
failureReason: string | null;
|
|
109
|
-
completedAt: Date | null;
|
|
110
|
-
createdAt: Date;
|
|
111
|
-
updatedAt: Date;
|
|
112
112
|
}>;
|
|
113
113
|
listRuns: (routineId: string, limit?: number) => Promise<RoutineRunSummary[]>;
|
|
114
114
|
tickScheduledTriggers: (now?: Date) => Promise<{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Db } from "@zmeel/db";
|
|
2
|
+
export interface AutoProvisionResult {
|
|
3
|
+
companyId: string;
|
|
4
|
+
companyName: string;
|
|
5
|
+
issuePrefix: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Auto-provision a new SaaS user:
|
|
9
|
+
* 1. Grant instance_admin role
|
|
10
|
+
* 2. Create a default company
|
|
11
|
+
* 3. Add the user as owner of that company
|
|
12
|
+
*/
|
|
13
|
+
export declare function autoProvisionSaasUser(db: Db, opts: {
|
|
14
|
+
userId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}): Promise<AutoProvisionResult>;
|
|
17
|
+
//# sourceMappingURL=saas-provisioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saas-provisioning.d.ts","sourceRoot":"","sources":["../../src/services/saas-provisioning.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAcpC,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,EAAE,EACN,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAuC9B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { randomBytes, randomUUID } from "node:crypto";
|
|
2
|
+
import { companies, companyMemberships, instanceUserRoles } from "@zmeel/db";
|
|
3
|
+
/**
|
|
4
|
+
* Derive a unique issue prefix from a company name.
|
|
5
|
+
* Takes the first 3 alpha characters uppercased, then appends a random hex suffix
|
|
6
|
+
* to avoid collisions with the unique index on `companies.issuePrefix`.
|
|
7
|
+
*/
|
|
8
|
+
function deriveIssuePrefix(name) {
|
|
9
|
+
const alpha = name.replace(/[^a-zA-Z]/g, "");
|
|
10
|
+
const prefix = (alpha.length >= 3 ? alpha.slice(0, 3) : alpha.padEnd(3, "X")).toUpperCase();
|
|
11
|
+
return `${prefix}-${randomBytes(3).toString("hex")}`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Auto-provision a new SaaS user:
|
|
15
|
+
* 1. Grant instance_admin role
|
|
16
|
+
* 2. Create a default company
|
|
17
|
+
* 3. Add the user as owner of that company
|
|
18
|
+
*/
|
|
19
|
+
export async function autoProvisionSaasUser(db, opts) {
|
|
20
|
+
const { userId, name } = opts;
|
|
21
|
+
const companyId = randomUUID();
|
|
22
|
+
const companyName = `${name}'s Company`;
|
|
23
|
+
const issuePrefix = deriveIssuePrefix(companyName);
|
|
24
|
+
const now = new Date();
|
|
25
|
+
await db.transaction(async (tx) => {
|
|
26
|
+
// 1. Make the user an instance admin
|
|
27
|
+
await tx.insert(instanceUserRoles).values({
|
|
28
|
+
userId,
|
|
29
|
+
role: "instance_admin",
|
|
30
|
+
createdAt: now,
|
|
31
|
+
updatedAt: now,
|
|
32
|
+
});
|
|
33
|
+
// 2. Create the default company
|
|
34
|
+
await tx.insert(companies).values({
|
|
35
|
+
id: companyId,
|
|
36
|
+
name: companyName,
|
|
37
|
+
issuePrefix,
|
|
38
|
+
status: "active",
|
|
39
|
+
createdAt: now,
|
|
40
|
+
updatedAt: now,
|
|
41
|
+
});
|
|
42
|
+
// 3. Add the user as owner
|
|
43
|
+
await tx.insert(companyMemberships).values({
|
|
44
|
+
companyId,
|
|
45
|
+
principalType: "user",
|
|
46
|
+
principalId: userId,
|
|
47
|
+
status: "active",
|
|
48
|
+
membershipRole: "owner",
|
|
49
|
+
createdAt: now,
|
|
50
|
+
updatedAt: now,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return { companyId, companyName, issuePrefix };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=saas-provisioning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saas-provisioning.js","sourceRoot":"","sources":["../../src/services/saas-provisioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE7E;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5F,OAAO,GAAG,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACvD,CAAC;AAQD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,EAAM,EACN,IAAsC;IAEtC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC9B,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,GAAG,IAAI,YAAY,CAAC;IACxC,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,MAAM,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QAChC,qCAAqC;QACrC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC;YACxC,MAAM;YACN,IAAI,EAAE,gBAAgB;YACtB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QAEH,gCAAgC;QAChC,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;YAChC,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,WAAW;YACjB,WAAW;YACX,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QAEH,2BAA2B;QAC3B,MAAM,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;YACzC,SAAS;YACT,aAAa,EAAE,MAAM;YACrB,WAAW,EAAE,MAAM;YACnB,MAAM,EAAE,QAAQ;YAChB,cAAc,EAAE,OAAO;YACvB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -134,6 +134,7 @@ export declare function stopRuntimeServicesForProjectWorkspace(input: {
|
|
|
134
134
|
projectWorkspaceId: string;
|
|
135
135
|
}): Promise<void>;
|
|
136
136
|
export declare function listWorkspaceRuntimeServicesForProjectWorkspaces(db: Db, companyId: string, projectWorkspaceIds: string[]): Promise<Map<string, {
|
|
137
|
+
port: number | null;
|
|
137
138
|
id: string;
|
|
138
139
|
status: string;
|
|
139
140
|
createdAt: Date;
|
|
@@ -149,13 +150,12 @@ export declare function listWorkspaceRuntimeServicesForProjectWorkspaces(db: Db,
|
|
|
149
150
|
projectId: string | null;
|
|
150
151
|
cwd: string | null;
|
|
151
152
|
projectWorkspaceId: string | null;
|
|
152
|
-
executionWorkspaceId: string | null;
|
|
153
153
|
providerRef: string | null;
|
|
154
|
+
executionWorkspaceId: string | null;
|
|
154
155
|
issueId: string | null;
|
|
155
156
|
serviceName: string;
|
|
156
157
|
lifecycle: string;
|
|
157
158
|
reuseKey: string | null;
|
|
158
|
-
port: number | null;
|
|
159
159
|
url: string | null;
|
|
160
160
|
startedByRunId: string | null;
|
|
161
161
|
stoppedAt: Date | null;
|