@alfe.ai/gateway 0.0.36 → 0.0.37
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/health.js +73 -6
- package/package.json +1 -1
package/dist/health.js
CHANGED
|
@@ -83,6 +83,7 @@ const ID_PREFIXES = {
|
|
|
83
83
|
knowledgeTriple: "kgt",
|
|
84
84
|
accessCode: "acc",
|
|
85
85
|
pendingInject: "pij",
|
|
86
|
+
attachment: "att",
|
|
86
87
|
run: "run",
|
|
87
88
|
request: "req",
|
|
88
89
|
connection: "conn",
|
|
@@ -519,6 +520,15 @@ var IntegrationsService = class {
|
|
|
519
520
|
disconnectGoogle(agentId) {
|
|
520
521
|
return this.client.request(`/google/agents/${encodeURIComponent(agentId)}/account`, { method: "DELETE" });
|
|
521
522
|
}
|
|
523
|
+
getAtlassianSites(agentId) {
|
|
524
|
+
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`);
|
|
525
|
+
}
|
|
526
|
+
selectAtlassianSite(agentId, cloudId) {
|
|
527
|
+
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`, {
|
|
528
|
+
method: "PUT",
|
|
529
|
+
body: JSON.stringify({ cloudId })
|
|
530
|
+
});
|
|
531
|
+
}
|
|
522
532
|
listSlackChannels(agentId) {
|
|
523
533
|
return this.client.request(`/slack/agents/${encodeURIComponent(agentId)}/channels`);
|
|
524
534
|
}
|
|
@@ -3526,6 +3536,46 @@ enumValues({
|
|
|
3526
3536
|
Error: "error"
|
|
3527
3537
|
});
|
|
3528
3538
|
//#endregion
|
|
3539
|
+
//#region ../../packages-internal/types/dist/notification-events.js
|
|
3540
|
+
const NotificationCategory = {
|
|
3541
|
+
Billing: "billing",
|
|
3542
|
+
Agents: "agents",
|
|
3543
|
+
Team: "team",
|
|
3544
|
+
Integrations: "integrations",
|
|
3545
|
+
System: "system"
|
|
3546
|
+
};
|
|
3547
|
+
const NotificationType = {
|
|
3548
|
+
PaymentSucceeded: "payment.succeeded",
|
|
3549
|
+
PaymentFailed: "payment.failed",
|
|
3550
|
+
TopUpCompleted: "top-up.completed",
|
|
3551
|
+
AutoRechargeCompleted: "auto-recharge.completed",
|
|
3552
|
+
AutoRechargeFailed: "auto-recharge.failed",
|
|
3553
|
+
SubscriptionCreated: "subscription.created",
|
|
3554
|
+
SubscriptionCancelled: "subscription.cancelled",
|
|
3555
|
+
SubscriptionPastDue: "subscription.past_due",
|
|
3556
|
+
BalanceThresholdWarning: "balance.threshold.warning",
|
|
3557
|
+
AgentCreated: "agent.created",
|
|
3558
|
+
AgentProvisionFailed: "agent.provision.failed",
|
|
3559
|
+
AgentBillingSuspended: "agent.billing.suspended",
|
|
3560
|
+
AgentDisconnectedExtended: "agent.disconnected.extended",
|
|
3561
|
+
InviteCreated: "onboarding.invite.created",
|
|
3562
|
+
OrgClaimed: "onboarding.org.claimed",
|
|
3563
|
+
TeamMemberAdded: "team.member.added",
|
|
3564
|
+
ProjectMemberAdded: "project.member.added",
|
|
3565
|
+
IntegrationInstalled: "integration.installed",
|
|
3566
|
+
IntegrationRemoved: "integration.removed"
|
|
3567
|
+
};
|
|
3568
|
+
const NotificationChannel = {
|
|
3569
|
+
Email: "email",
|
|
3570
|
+
Push: "push",
|
|
3571
|
+
Sms: "sms"
|
|
3572
|
+
};
|
|
3573
|
+
const RecipientStrategy = {
|
|
3574
|
+
TenantAdmins: "tenant_admins",
|
|
3575
|
+
SpecificUser: "specific_user"
|
|
3576
|
+
};
|
|
3577
|
+
NotificationType.PaymentSucceeded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PaymentFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.TopUpCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AutoRechargeCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.AutoRechargeFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.SubscriptionCreated, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.SubscriptionCancelled, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.SubscriptionPastDue, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.BalanceThresholdWarning, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentCreated, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentProvisionFailed, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentBillingSuspended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentDisconnectedExtended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.InviteCreated, NotificationCategory.System, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationType.OrgClaimed, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.TeamMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ProjectMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.IntegrationInstalled, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.IntegrationRemoved, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push;
|
|
3578
|
+
//#endregion
|
|
3529
3579
|
//#region src/config.ts
|
|
3530
3580
|
/**
|
|
3531
3581
|
* Daemon configuration — reads ~/.alfe/config.toml and resolves agent identity.
|
|
@@ -4977,20 +5027,38 @@ async function uninstallService() {
|
|
|
4977
5027
|
if (platform === "linux") return uninstallSystemd();
|
|
4978
5028
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
4979
5029
|
}
|
|
5030
|
+
function getLaunchdUid() {
|
|
5031
|
+
return execSync("id -u", { encoding: "utf-8" }).trim();
|
|
5032
|
+
}
|
|
4980
5033
|
async function installLaunchd() {
|
|
4981
5034
|
const plistPath = getLaunchdPlistPath();
|
|
4982
|
-
|
|
5035
|
+
const dir = join(homedir(), "Library", "LaunchAgents");
|
|
5036
|
+
const logsDir = join(homedir(), ".alfe", "logs");
|
|
5037
|
+
await mkdir(dir, { recursive: true });
|
|
5038
|
+
await mkdir(logsDir, { recursive: true });
|
|
4983
5039
|
await writeFile(plistPath, generateLaunchdPlist(), "utf-8");
|
|
4984
5040
|
logger$1.info({ path: plistPath }, "Wrote launchd plist");
|
|
5041
|
+
const uid = getLaunchdUid();
|
|
4985
5042
|
try {
|
|
4986
|
-
execSync(`launchctl
|
|
5043
|
+
execSync(`launchctl bootout gui/${uid}/${LAUNCHD_LABEL}`, { stdio: "pipe" });
|
|
4987
5044
|
} catch {}
|
|
5045
|
+
try {
|
|
5046
|
+
execSync(`launchctl bootstrap gui/${uid} ${plistPath}`, { stdio: "pipe" });
|
|
5047
|
+
} catch (err) {
|
|
5048
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
5049
|
+
logger$1.error({
|
|
5050
|
+
err: msg,
|
|
5051
|
+
plistPath
|
|
5052
|
+
}, "launchctl bootstrap failed");
|
|
5053
|
+
return `Installed plist at ${plistPath}, but failed to bootstrap service: ${msg}`;
|
|
5054
|
+
}
|
|
4988
5055
|
return `Installed: ${plistPath}\nService will start on boot and restart on crash.`;
|
|
4989
5056
|
}
|
|
4990
5057
|
async function uninstallLaunchd() {
|
|
4991
5058
|
const plistPath = getLaunchdPlistPath();
|
|
5059
|
+
const uid = getLaunchdUid();
|
|
4992
5060
|
try {
|
|
4993
|
-
execSync(`launchctl
|
|
5061
|
+
execSync(`launchctl bootout gui/${uid}/${LAUNCHD_LABEL}`, { stdio: "pipe" });
|
|
4994
5062
|
} catch {}
|
|
4995
5063
|
try {
|
|
4996
5064
|
await unlink(plistPath);
|
|
@@ -5036,9 +5104,8 @@ async function uninstallSystemd() {
|
|
|
5036
5104
|
function startService() {
|
|
5037
5105
|
const platform = process.platform;
|
|
5038
5106
|
if (platform === "darwin") {
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
logger$1.info({ path: plistPath }, "Started launchd service");
|
|
5107
|
+
execSync(`launchctl kickstart -k gui/${getLaunchdUid()}/${LAUNCHD_LABEL}`, { stdio: "pipe" });
|
|
5108
|
+
logger$1.info("Started launchd service");
|
|
5042
5109
|
return;
|
|
5043
5110
|
}
|
|
5044
5111
|
if (platform === "linux") {
|