@alfe.ai/gateway 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -161,3 +161,8 @@ See `src/protocol.ts` for full type definitions.
161
161
 
162
162
  - Dashboard integration management (backend wired, UI in progress)
163
163
  - Voice migration to integration model (`packages/openclaw-voice/` exists, not yet full integration)
164
+
165
+ ## Links
166
+
167
+ - 🌐 Website: <https://alfe.ai>
168
+ - 📚 Docs: <https://docs.alfe.ai>
package/dist/health.js CHANGED
@@ -495,6 +495,15 @@ var AuthService = class {
495
495
  getSubscriptionStatus() {
496
496
  return this.client.request(`${this.prefix}/subscription`);
497
497
  }
498
+ /**
499
+ * Mint a short-lived, single-use Clerk sign-in token for the calling user so
500
+ * a native client can hand its logged-in session to the web dashboard
501
+ * (`${dashboard}/handoff?__clerk_ticket=<token>`). Server mints only for the
502
+ * authenticated user — never a caller-supplied id.
503
+ */
504
+ createHandoffToken() {
505
+ return this.client.request(`${this.prefix}/handoff-token`, { method: "POST" });
506
+ }
498
507
  applyForStartup(input) {
499
508
  return this.client.request(`${this.prefix}/subscription/apply-startup`, {
500
509
  method: "POST",
@@ -566,10 +575,8 @@ var AuthService = class {
566
575
  //#region ../../packages-internal/api-client/dist/services/integrations.js
567
576
  var IntegrationsService = class {
568
577
  client;
569
- voiceClient;
570
- constructor(client, voiceClient) {
578
+ constructor(client) {
571
579
  this.client = client;
572
- this.voiceClient = voiceClient;
573
580
  }
574
581
  listScopedInstalls(scope, scopeId) {
575
582
  const params = new URLSearchParams({
@@ -618,8 +625,11 @@ var IntegrationsService = class {
618
625
  });
619
626
  }
620
627
  listIntegrations(agentId, options) {
621
- const qs = options?.includeInherited ? "?includeInherited=true" : "";
622
- return this.client.request(`/integrations/agents/${agentId}${qs}`);
628
+ const params = new URLSearchParams();
629
+ if (options?.includeInherited) params.set("includeInherited", "true");
630
+ if (options?.effective) params.set("effective", "true");
631
+ const qs = params.toString();
632
+ return this.client.request(`/integrations/agents/${agentId}${qs ? `?${qs}` : ""}`);
623
633
  }
624
634
  installIntegration(agentId, data) {
625
635
  return this.client.request(`/integrations/agents/${agentId}`, {
@@ -651,10 +661,6 @@ var IntegrationsService = class {
651
661
  body: JSON.stringify({ agentId })
652
662
  });
653
663
  }
654
- listVoices() {
655
- if (this.voiceClient) return this.voiceClient.request("/api/voices");
656
- return this.client.request("/integrations/voices");
657
- }
658
664
  getDiscordGuildChannels(guildId) {
659
665
  return this.client.request(`/discord/guilds/${encodeURIComponent(guildId)}/channels`);
660
666
  }
@@ -4483,6 +4489,15 @@ enumValues({
4483
4489
  NanoClaw: "nanoclaw",
4484
4490
  Hermes: "hermes"
4485
4491
  });
4492
+ const TTS_MODELS = enumValues({
4493
+ ElevenLabsTurbo: "elevenlabs-turbo",
4494
+ ElevenLabsStandard: "elevenlabs-standard"
4495
+ });
4496
+ object({
4497
+ voiceId: string().regex(/^[A-Za-z0-9]{8,64}$/).optional(),
4498
+ ttsModel: _enum(TTS_MODELS).optional(),
4499
+ enabled: boolean().optional()
4500
+ });
4486
4501
  enumValues({
4487
4502
  Org: "org",
4488
4503
  Team: "team",
@@ -4769,10 +4784,12 @@ const NotificationType = {
4769
4784
  SubscriptionCancelled: "subscription.cancelled",
4770
4785
  SubscriptionPastDue: "subscription.past_due",
4771
4786
  BalanceThresholdWarning: "balance.threshold.warning",
4787
+ PlatformTierPriceIncrease: "platform.tier_price_increase",
4772
4788
  AgentCreated: "agent.created",
4773
4789
  AgentProvisionFailed: "agent.provision.failed",
4774
4790
  AgentBillingSuspended: "agent.billing.suspended",
4775
4791
  AgentDisconnectedExtended: "agent.disconnected.extended",
4792
+ BrowserTakeoverRequested: "browser_takeover_requested",
4776
4793
  InviteCreated: "onboarding.invite.created",
4777
4794
  OrgClaimed: "onboarding.org.claimed",
4778
4795
  TeamMemberAdded: "team.member.added",
@@ -4789,7 +4806,7 @@ const RecipientStrategy = {
4789
4806
  TenantAdmins: "tenant_admins",
4790
4807
  SpecificUser: "specific_user"
4791
4808
  };
4792
- 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;
4809
+ 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.PlatformTierPriceIncrease, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, 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.BrowserTakeoverRequested, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, 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;
4793
4810
  //#endregion
4794
4811
  //#region src/config.ts
4795
4812
  /**
@@ -5047,6 +5064,7 @@ async function fetchAgentConfig(apiKey, apiEndpoint) {
5047
5064
  const wsResult = await wsResponse.json();
5048
5065
  const templateKey = wsResult.data?.templateKey;
5049
5066
  const defaultModel = wsResult.data?.defaultModel ?? void 0;
5067
+ const installedFrom = wsResult.data?.installedFrom;
5050
5068
  if (!templateKey) {
5051
5069
  logger$1.debug("No templateKey in workspace response");
5052
5070
  return defaultModel ? {
@@ -5054,8 +5072,14 @@ async function fetchAgentConfig(apiKey, apiEndpoint) {
5054
5072
  files: {}
5055
5073
  } : null;
5056
5074
  }
5057
- logger$1.debug({ templateKey }, "Fetching template files...");
5058
- const filesResponse = await fetch(`${apiEndpoint}/templates/${encodeURIComponent(templateKey)}/files`, {
5075
+ const pinnedVersion = installedFrom?.templateKey === templateKey ? installedFrom.version : void 0;
5076
+ const filesUrl = new URL(`${apiEndpoint}/templates/${encodeURIComponent(templateKey)}/files`);
5077
+ if (pinnedVersion !== void 0) filesUrl.searchParams.set("version", String(pinnedVersion));
5078
+ logger$1.debug({
5079
+ templateKey,
5080
+ version: pinnedVersion
5081
+ }, "Fetching template files...");
5082
+ const filesResponse = await fetch(filesUrl.toString(), {
5059
5083
  method: "GET",
5060
5084
  headers: { "Authorization": `Bearer ${apiKey}` }
5061
5085
  });
@@ -5067,16 +5091,18 @@ async function fetchAgentConfig(apiKey, apiEndpoint) {
5067
5091
  files: {}
5068
5092
  };
5069
5093
  }
5070
- const filesResult = await filesResponse.json();
5071
- const fileCount = Object.keys(filesResult.data?.files ?? {}).length;
5094
+ const files = (await filesResponse.json()).data?.files ?? {};
5095
+ const fileCount = Object.keys(files).length;
5072
5096
  logger$1.debug({
5073
5097
  templateKey,
5098
+ version: pinnedVersion,
5074
5099
  fileCount
5075
5100
  }, "Template files fetched");
5076
5101
  return {
5077
5102
  templateKey,
5078
5103
  defaultModel,
5079
- files: filesResult.data?.files ?? {}
5104
+ files,
5105
+ personaFiles: Object.keys(files)
5080
5106
  };
5081
5107
  } catch (err) {
5082
5108
  logger$1.debug({ err: err instanceof Error ? err.message : String(err) }, "fetchAgentConfig failed");
@@ -60,6 +60,18 @@ interface AgentWorkspaceConfig {
60
60
  templateKey?: string;
61
61
  defaultModel?: string;
62
62
  files: Record<string, string>;
63
+ /**
64
+ * Filenames within `files` that are agent-owned persona files (SOUL.md,
65
+ * IDENTITY.md, AGENTS.md, USER.md, BOOTSTRAP.md, …). The consumer
66
+ * (`writeWorkspaceFiles`) seeds these ONLY IF ABSENT so an agent's own edits
67
+ * — restored by the openclaw-sync backup on a fresh VM — are never clobbered
68
+ * by a setup-time re-seed. Filenames NOT in this set keep overwrite-on-write
69
+ * semantics. The templates `/files` endpoint returns persona files
70
+ * exclusively today, so `fetchAgentConfig` populates this with every key; the
71
+ * field is threaded explicitly rather than assumed so a future workspace-file
72
+ * source can mix persona (seed-if-missing) and non-persona (overwrite) files.
73
+ */
74
+ personaFiles?: string[];
63
75
  }
64
76
  declare const ALFE_DIR: string;
65
77
  declare const SOCKET_PATH: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/gateway",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Alfe local gateway daemon — persistent control plane for agent integrations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,14 +22,22 @@
22
22
  "pino-roll": "^1.2.0",
23
23
  "smol-toml": ">=1.6.1",
24
24
  "ws": "^8.18.0",
25
- "@alfe.ai/agent-api-client": "^0.3.0",
26
- "@alfe.ai/ai-proxy-local": "^0.0.11",
27
- "@alfe.ai/config": "^0.1.0",
28
- "@alfe.ai/integration-manifest": "^0.3.0",
29
- "@alfe.ai/integrations": "^0.2.0",
30
- "@alfe.ai/mcp-bundler": "^0.2.1"
25
+ "@alfe.ai/agent-api-client": "^0.4.0",
26
+ "@alfe.ai/ai-proxy-local": "^0.0.12",
27
+ "@alfe.ai/config": "^0.2.0",
28
+ "@alfe.ai/integration-manifest": "^0.3.1",
29
+ "@alfe.ai/integrations": "^0.2.4",
30
+ "@alfe.ai/mcp-bundler": "^0.2.2"
31
31
  },
32
32
  "license": "UNLICENSED",
33
+ "homepage": "https://alfe.ai",
34
+ "author": "Alfe (https://alfe.ai)",
35
+ "keywords": [
36
+ "alfe",
37
+ "ai-agents",
38
+ "agent",
39
+ "llm"
40
+ ],
33
41
  "scripts": {
34
42
  "build": "tsdown",
35
43
  "dev": "tsdown --watch",