@alfe.ai/gateway 0.9.0 → 0.9.2
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 +439 -404
- package/dist/src/index.d.ts +8 -1
- package/package.json +4 -4
package/dist/health.js
CHANGED
|
@@ -94,7 +94,7 @@ const PINNED_OPENCLAW_VERSION = "2026.6.11";
|
|
|
94
94
|
* `PINNED_OPENCLAW_VERSION` — there is no `services/compute/Dockerfile` mirror to
|
|
95
95
|
* keep in sync.
|
|
96
96
|
*/
|
|
97
|
-
const PINNED_CLAUDE_CODE_HOST_VERSION = "0.1.
|
|
97
|
+
const PINNED_CLAUDE_CODE_HOST_VERSION = "0.1.3";
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region ../../packages-internal/ids/dist/prefixes.js
|
|
100
100
|
const ID_PREFIXES = {
|
|
@@ -414,399 +414,6 @@ var AlfeApiClient = class {
|
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
416
|
//#endregion
|
|
417
|
-
//#region ../../packages-internal/api-client/dist/services/auth.js
|
|
418
|
-
var AuthService = class {
|
|
419
|
-
client;
|
|
420
|
-
constructor(client) {
|
|
421
|
-
this.client = client;
|
|
422
|
-
}
|
|
423
|
-
prefix = "/auth";
|
|
424
|
-
validate(token) {
|
|
425
|
-
return this.client.request(`${this.prefix}/validate`, {
|
|
426
|
-
method: "POST",
|
|
427
|
-
body: JSON.stringify({ token })
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
listTokens() {
|
|
431
|
-
return this.client.request(`${this.prefix}/tokens`);
|
|
432
|
-
}
|
|
433
|
-
createToken(data) {
|
|
434
|
-
return this.client.request(`${this.prefix}/tokens`, {
|
|
435
|
-
method: "POST",
|
|
436
|
-
body: JSON.stringify(data)
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
deleteToken(tokenId) {
|
|
440
|
-
return this.client.request(`${this.prefix}/tokens/${tokenId}`, { method: "DELETE" });
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Start a device-code flow. Called by the CLI when the user runs
|
|
444
|
-
* `alfe login` and picks the browser path. The returned `device_code`
|
|
445
|
-
* is the CLI's bearer secret for polling /auth/device-token; the
|
|
446
|
-
* `user_code` is what the user types/sees on the dashboard.
|
|
447
|
-
*
|
|
448
|
-
* Uses `publicRequest` because the CLI has no token yet — the standard
|
|
449
|
-
* `request` path would short-circuit with a synthetic 401.
|
|
450
|
-
*/
|
|
451
|
-
startDeviceCode(input) {
|
|
452
|
-
return this.client.publicRequest(`${this.prefix}/device-code`, {
|
|
453
|
-
method: "POST",
|
|
454
|
-
body: JSON.stringify(input)
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Poll for the minted API key. Public endpoint. Returns:
|
|
459
|
-
* 200 → { api_key, tenantId, tokenExpiresAt } (success — write to config)
|
|
460
|
-
* 428 → still pending (caller should sleep `interval` and retry)
|
|
461
|
-
* 429 → polling too fast; caller should back off
|
|
462
|
-
* 410 → device-code expired; user must run `alfe login` again
|
|
463
|
-
* 400 → already redeemed (security: do not retry)
|
|
464
|
-
*
|
|
465
|
-
* Surface the HTTP-status code via the standard ApiResult error shape
|
|
466
|
-
* so callers can branch.
|
|
467
|
-
*/
|
|
468
|
-
pollDeviceToken(deviceCode) {
|
|
469
|
-
return this.client.publicRequest(`${this.prefix}/device-token`, {
|
|
470
|
-
method: "POST",
|
|
471
|
-
body: JSON.stringify({ device_code: deviceCode })
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
/** Dashboard-side. Fetch the device fingerprint for an approval card. */
|
|
475
|
-
lookupDeviceCode(userCode) {
|
|
476
|
-
return this.client.request(`${this.prefix}/device-code/lookup`, {
|
|
477
|
-
method: "POST",
|
|
478
|
-
body: JSON.stringify({ user_code: userCode })
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
/** Dashboard-side. Approve the pending device-code; CLI's next poll gets the key. */
|
|
482
|
-
approveDeviceCode(input) {
|
|
483
|
-
return this.client.request(`${this.prefix}/device-code/approve`, {
|
|
484
|
-
method: "POST",
|
|
485
|
-
body: JSON.stringify({
|
|
486
|
-
user_code: input.userCode,
|
|
487
|
-
expiresIn: input.expiresIn
|
|
488
|
-
})
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
getOnboardingStatus() {
|
|
492
|
-
return this.client.request(`${this.prefix}/onboarding/status`);
|
|
493
|
-
}
|
|
494
|
-
completeOnboarding(input) {
|
|
495
|
-
return this.client.request(`${this.prefix}/onboarding/complete`, {
|
|
496
|
-
method: "POST",
|
|
497
|
-
body: JSON.stringify(input)
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
getAccessStatus() {
|
|
501
|
-
return this.client.request(`${this.prefix}/access/status`);
|
|
502
|
-
}
|
|
503
|
-
redeemAccessCode(code) {
|
|
504
|
-
return this.client.request(`${this.prefix}/access/redeem`, {
|
|
505
|
-
method: "POST",
|
|
506
|
-
body: JSON.stringify({ code })
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Fetch the caller's current permission list as enforced by the gateway.
|
|
511
|
-
* UI permission providers should call this on mount and refetch on
|
|
512
|
-
* Clerk org switch to stay in sync with sub-tenant permission changes.
|
|
513
|
-
*/
|
|
514
|
-
getMyPermissions() {
|
|
515
|
-
return this.client.request(`${this.prefix}/me/permissions`);
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Preview what deleting the caller's own account will do. Drives the Danger
|
|
519
|
-
* Zone copy so the user sees an honest, kind-appropriate warning before the
|
|
520
|
-
* irreversible action (a last-admin cascade wipes the whole workspace).
|
|
521
|
-
*/
|
|
522
|
-
getDeletionPreview() {
|
|
523
|
-
return this.client.request(`${this.prefix}/me/deletion-preview`);
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* Permanently delete the caller's own account. Returns `{ status: "deleting" }`
|
|
527
|
-
* and tears the account down asynchronously — the Clerk user is deleted shortly
|
|
528
|
-
* after, so the caller's session dies. On success, sign out and route the user
|
|
529
|
-
* to a terminal "account is being deleted" state; do NOT retry.
|
|
530
|
-
*
|
|
531
|
-
* Pass `confirmKind` (the accountKind the user actually confirmed, from the
|
|
532
|
-
* deletion preview): if membership changed between preview and execute, the
|
|
533
|
-
* server answers 409 `account_kind_changed` instead of cascading a scope the
|
|
534
|
-
* user never agreed to.
|
|
535
|
-
*/
|
|
536
|
-
deleteAccount(confirmKind) {
|
|
537
|
-
return this.client.request(`${this.prefix}/me`, {
|
|
538
|
-
method: "DELETE",
|
|
539
|
-
...confirmKind ? { body: JSON.stringify({ confirmKind }) } : {}
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
getSubscriptionStatus() {
|
|
543
|
-
return this.client.request(`${this.prefix}/subscription`);
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Mint a short-lived, single-use Clerk sign-in token for the calling user so
|
|
547
|
-
* a native client can hand its logged-in session to the web dashboard
|
|
548
|
-
* (`${dashboard}/handoff?__clerk_ticket=<token>`). Server mints only for the
|
|
549
|
-
* authenticated user — never a caller-supplied id.
|
|
550
|
-
*/
|
|
551
|
-
createHandoffToken() {
|
|
552
|
-
return this.client.request(`${this.prefix}/handoff-token`, { method: "POST" });
|
|
553
|
-
}
|
|
554
|
-
applyForStartup(input) {
|
|
555
|
-
return this.client.request(`${this.prefix}/subscription/apply-startup`, {
|
|
556
|
-
method: "POST",
|
|
557
|
-
body: JSON.stringify(input)
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Accept an approved Startup Program invite. Call after the applicant has a
|
|
562
|
-
* card on file (confirmed or freshly added) — this mints the Professional
|
|
563
|
-
* grant subscription. Idempotent: a repeat call on an already-accepted
|
|
564
|
-
* application returns `{ status: "accepted" }` without re-charging.
|
|
565
|
-
*/
|
|
566
|
-
acceptStartup() {
|
|
567
|
-
return this.client.request(`${this.prefix}/subscription/accept-startup`, { method: "POST" });
|
|
568
|
-
}
|
|
569
|
-
createCheckoutSession(input) {
|
|
570
|
-
return this.client.request(`${this.prefix}/subscription/checkout`, {
|
|
571
|
-
method: "POST",
|
|
572
|
-
body: JSON.stringify(input)
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Change a personal (individual-tier) subscriber's platform plan in place on
|
|
577
|
-
* their existing Stripe subscription — no second Checkout, no duplicate sub,
|
|
578
|
-
* no double charge. Upgrades prorate immediately; downgrades apply with no
|
|
579
|
-
* immediate charge/refund. Returns the updated subscription.
|
|
580
|
-
*/
|
|
581
|
-
changePlatformPlan(input) {
|
|
582
|
-
return this.client.request(`${this.prefix}/subscription/change`, {
|
|
583
|
-
method: "POST",
|
|
584
|
-
body: JSON.stringify(input)
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Preview the proration cost for changing a personal (individual-tier)
|
|
589
|
-
* subscriber's platform plan — read-only companion to `changePlatformPlan`.
|
|
590
|
-
* Nothing is charged.
|
|
591
|
-
*/
|
|
592
|
-
previewPlatformPlanChange(input) {
|
|
593
|
-
return this.client.request(`${this.prefix}/subscription/change/preview`, {
|
|
594
|
-
method: "POST",
|
|
595
|
-
body: JSON.stringify(input)
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
updateSeats(seats) {
|
|
599
|
-
return this.client.request(`${this.prefix}/subscription/seats`, {
|
|
600
|
-
method: "POST",
|
|
601
|
-
body: JSON.stringify({ seats })
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
previewSeatChange(seats) {
|
|
605
|
-
return this.client.request(`${this.prefix}/subscription/seats/preview`, {
|
|
606
|
-
method: "POST",
|
|
607
|
-
body: JSON.stringify({ seats })
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
listOrgMembers() {
|
|
611
|
-
return this.client.request(`${this.prefix}/org/members`);
|
|
612
|
-
}
|
|
613
|
-
patchOrgMember(userId, body) {
|
|
614
|
-
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, {
|
|
615
|
-
method: "PATCH",
|
|
616
|
-
body: JSON.stringify(body)
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
removeOrgMember(userId) {
|
|
620
|
-
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, { method: "DELETE" });
|
|
621
|
-
}
|
|
622
|
-
listOrgInvitations() {
|
|
623
|
-
return this.client.request(`${this.prefix}/org/invitations`);
|
|
624
|
-
}
|
|
625
|
-
createOrgInvitation(input) {
|
|
626
|
-
return this.client.request(`${this.prefix}/org/invitations`, {
|
|
627
|
-
method: "POST",
|
|
628
|
-
body: JSON.stringify(input)
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
revokeOrgInvitation(invitationId) {
|
|
632
|
-
return this.client.request(`${this.prefix}/org/invitations/${encodeURIComponent(invitationId)}`, { method: "DELETE" });
|
|
633
|
-
}
|
|
634
|
-
listOrgDomains() {
|
|
635
|
-
return this.client.request(`${this.prefix}/org/domains`);
|
|
636
|
-
}
|
|
637
|
-
createOrgDomain(input) {
|
|
638
|
-
return this.client.request(`${this.prefix}/org/domains`, {
|
|
639
|
-
method: "POST",
|
|
640
|
-
body: JSON.stringify(input)
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
deleteOrgDomain(domainId) {
|
|
644
|
-
return this.client.request(`${this.prefix}/org/domains/${encodeURIComponent(domainId)}`, { method: "DELETE" });
|
|
645
|
-
}
|
|
646
|
-
updateOrgSettings(input) {
|
|
647
|
-
return this.client.request(`${this.prefix}/org/settings`, {
|
|
648
|
-
method: "PATCH",
|
|
649
|
-
body: JSON.stringify(input)
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
//#endregion
|
|
654
|
-
//#region ../../packages-internal/api-client/dist/services/integrations.js
|
|
655
|
-
var IntegrationsService = class {
|
|
656
|
-
client;
|
|
657
|
-
constructor(client) {
|
|
658
|
-
this.client = client;
|
|
659
|
-
}
|
|
660
|
-
listScopedInstalls(scope, scopeId) {
|
|
661
|
-
const params = new URLSearchParams({
|
|
662
|
-
scope,
|
|
663
|
-
scopeId
|
|
664
|
-
});
|
|
665
|
-
return this.client.request(`/integrations/scoped?${params}`);
|
|
666
|
-
}
|
|
667
|
-
installScoped(data) {
|
|
668
|
-
return this.client.request("/integrations/scoped", {
|
|
669
|
-
method: "POST",
|
|
670
|
-
body: JSON.stringify(data)
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
getScopedInstall(integrationId, scope, scopeId) {
|
|
674
|
-
const params = new URLSearchParams({
|
|
675
|
-
scope,
|
|
676
|
-
scopeId
|
|
677
|
-
});
|
|
678
|
-
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}?${params}`);
|
|
679
|
-
}
|
|
680
|
-
updateScopedInstall(integrationId, data) {
|
|
681
|
-
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}`, {
|
|
682
|
-
method: "PATCH",
|
|
683
|
-
body: JSON.stringify(data)
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
removeScopedInstall(integrationId, scope, scopeId) {
|
|
687
|
-
const params = new URLSearchParams({
|
|
688
|
-
scope,
|
|
689
|
-
scopeId
|
|
690
|
-
});
|
|
691
|
-
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}?${params}`, { method: "DELETE" });
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Reinstall (re-apply latest) a scope-level install. Agent scope is rejected
|
|
695
|
-
* by the route — use {@link reinstallIntegration} for agent-scoped reinstall.
|
|
696
|
-
*/
|
|
697
|
-
reinstallScoped(integrationId, scope, scopeId) {
|
|
698
|
-
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}/reinstall`, {
|
|
699
|
-
method: "POST",
|
|
700
|
-
body: JSON.stringify({
|
|
701
|
-
scope,
|
|
702
|
-
scopeId
|
|
703
|
-
})
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
listIntegrations(agentId, options) {
|
|
707
|
-
const params = new URLSearchParams();
|
|
708
|
-
if (options?.includeInherited) params.set("includeInherited", "true");
|
|
709
|
-
if (options?.effective) params.set("effective", "true");
|
|
710
|
-
const qs = params.toString();
|
|
711
|
-
return this.client.request(`/integrations/agents/${agentId}${qs ? `?${qs}` : ""}`);
|
|
712
|
-
}
|
|
713
|
-
installIntegration(agentId, data) {
|
|
714
|
-
return this.client.request(`/integrations/agents/${agentId}`, {
|
|
715
|
-
method: "POST",
|
|
716
|
-
body: JSON.stringify(data)
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
getIntegrationConfig(agentId, integrationId) {
|
|
720
|
-
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/config`);
|
|
721
|
-
}
|
|
722
|
-
updateIntegration(agentId, integrationId, data) {
|
|
723
|
-
return this.client.request(`/integrations/agents/${agentId}/${integrationId}`, {
|
|
724
|
-
method: "PATCH",
|
|
725
|
-
body: JSON.stringify(data)
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
removeIntegration(agentId, integrationId) {
|
|
729
|
-
return this.client.request(`/integrations/agents/${agentId}/${integrationId}`, { method: "DELETE" });
|
|
730
|
-
}
|
|
731
|
-
reinstallIntegration(agentId, integrationId) {
|
|
732
|
-
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/reinstall`, { method: "POST" });
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Upgrade an integration to the registry's latest version via the fast,
|
|
736
|
-
* diff-based daemon path (bumps `version` without `reinstallRequestedAt`).
|
|
737
|
-
* The agent stays online — no destructive teardown. Distinct from
|
|
738
|
-
* {@link reinstallIntegration}, which is the destructive repair path.
|
|
739
|
-
*/
|
|
740
|
-
upgradeIntegration(agentId, integrationId) {
|
|
741
|
-
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/upgrade`, { method: "POST" });
|
|
742
|
-
}
|
|
743
|
-
getRegistry() {
|
|
744
|
-
return this.client.request("/integrations/registry");
|
|
745
|
-
}
|
|
746
|
-
triggerSync(agentId) {
|
|
747
|
-
return this.client.request("/integrations/sync/trigger", {
|
|
748
|
-
method: "POST",
|
|
749
|
-
body: JSON.stringify({ agentId })
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
getDiscordGuildChannels(guildId) {
|
|
753
|
-
return this.client.request(`/discord/guilds/${encodeURIComponent(guildId)}/channels`);
|
|
754
|
-
}
|
|
755
|
-
listMobileNumbers() {
|
|
756
|
-
return this.client.request("/mobile/numbers");
|
|
757
|
-
}
|
|
758
|
-
searchMobileNumbers(country, query) {
|
|
759
|
-
const params = new URLSearchParams();
|
|
760
|
-
if (country) params.set("country", country);
|
|
761
|
-
if (query) params.set("query", query);
|
|
762
|
-
return this.client.request(`/mobile/numbers/search?${params}`);
|
|
763
|
-
}
|
|
764
|
-
assignMobileNumber(agentId, phoneNumber, countryCode) {
|
|
765
|
-
return this.client.request("/mobile/numbers/assign", {
|
|
766
|
-
method: "POST",
|
|
767
|
-
body: JSON.stringify({
|
|
768
|
-
agentId,
|
|
769
|
-
phoneNumber,
|
|
770
|
-
countryCode
|
|
771
|
-
})
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
releaseMobileNumber(agentId) {
|
|
775
|
-
return this.client.request("/mobile/numbers/release", {
|
|
776
|
-
method: "POST",
|
|
777
|
-
body: JSON.stringify({ agentId })
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
getMobileNumber(agentId) {
|
|
781
|
-
return this.client.request(`/mobile/numbers?agentId=${encodeURIComponent(agentId)}`);
|
|
782
|
-
}
|
|
783
|
-
disconnectGoogle(agentId, email) {
|
|
784
|
-
const query = email ? `?email=${encodeURIComponent(email)}` : "";
|
|
785
|
-
return this.client.request(`/google/agents/${encodeURIComponent(agentId)}/account${query}`, { method: "DELETE" });
|
|
786
|
-
}
|
|
787
|
-
getAtlassianSites(agentId) {
|
|
788
|
-
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`);
|
|
789
|
-
}
|
|
790
|
-
selectAtlassianSite(agentId, cloudId) {
|
|
791
|
-
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`, {
|
|
792
|
-
method: "PUT",
|
|
793
|
-
body: JSON.stringify({ cloudId })
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
listSlackChannels(agentId) {
|
|
797
|
-
return this.client.request(`/slack/agents/${encodeURIComponent(agentId)}/channels`);
|
|
798
|
-
}
|
|
799
|
-
sendSlackMessage(agentId, channel, text) {
|
|
800
|
-
return this.client.request(`/slack/agents/${encodeURIComponent(agentId)}/send`, {
|
|
801
|
-
method: "POST",
|
|
802
|
-
body: JSON.stringify({
|
|
803
|
-
channel,
|
|
804
|
-
text
|
|
805
|
-
})
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
//#endregion
|
|
810
417
|
//#region ../../packages-internal/types/dist/lib/enum-values.js
|
|
811
418
|
/**
|
|
812
419
|
* Converts a const enum object into a non-empty readonly tuple.
|
|
@@ -4513,6 +4120,8 @@ enumValues({
|
|
|
4513
4120
|
Mistral: "mistral",
|
|
4514
4121
|
XAI: "xai",
|
|
4515
4122
|
Zhipu: "zhipu",
|
|
4123
|
+
Moonshot: "moonshot",
|
|
4124
|
+
Qwen: "qwen",
|
|
4516
4125
|
OpenRouter: "openrouter",
|
|
4517
4126
|
ElevenLabs: "elevenlabs",
|
|
4518
4127
|
Twilio: "twilio",
|
|
@@ -4535,6 +4144,7 @@ enumValues({
|
|
|
4535
4144
|
Other: "other"
|
|
4536
4145
|
});
|
|
4537
4146
|
enumValues({
|
|
4147
|
+
IndividualPayg: "individual_payg",
|
|
4538
4148
|
IndividualLite: "individual_lite",
|
|
4539
4149
|
IndividualNormal: "individual_normal",
|
|
4540
4150
|
IndividualPro: "individual_pro",
|
|
@@ -4800,6 +4410,21 @@ const ZhipuModel = {
|
|
|
4800
4410
|
GLM45Air: "glm-4.5-air"
|
|
4801
4411
|
};
|
|
4802
4412
|
const ZHIPU_MODELS = enumValues(ZhipuModel);
|
|
4413
|
+
const MoonshotModel = {
|
|
4414
|
+
K3: "kimi-k3",
|
|
4415
|
+
K26: "kimi-k2.6",
|
|
4416
|
+
K27Code: "kimi-k2.7-code",
|
|
4417
|
+
K27CodeHighSpeed: "kimi-k2.7-code-highspeed",
|
|
4418
|
+
K25: "kimi-k2.5"
|
|
4419
|
+
};
|
|
4420
|
+
const MOONSHOT_MODELS = enumValues(MoonshotModel);
|
|
4421
|
+
const QwenModel = {
|
|
4422
|
+
Qwen37Max: "qwen3.7-max",
|
|
4423
|
+
Qwen37Plus: "qwen3.7-plus",
|
|
4424
|
+
Qwen36Flash: "qwen3.6-flash",
|
|
4425
|
+
Qwen35Flash: "qwen3.5-flash"
|
|
4426
|
+
};
|
|
4427
|
+
const QWEN_MODELS = enumValues(QwenModel);
|
|
4803
4428
|
AnthropicModel.Sonnet5;
|
|
4804
4429
|
[
|
|
4805
4430
|
...ANTHROPIC_MODELS,
|
|
@@ -4809,7 +4434,9 @@ AnthropicModel.Sonnet5;
|
|
|
4809
4434
|
...MINIMAX_MODELS,
|
|
4810
4435
|
...MISTRAL_MODELS,
|
|
4811
4436
|
...XAI_MODELS,
|
|
4812
|
-
...ZHIPU_MODELS
|
|
4437
|
+
...ZHIPU_MODELS,
|
|
4438
|
+
...MOONSHOT_MODELS,
|
|
4439
|
+
...QWEN_MODELS
|
|
4813
4440
|
];
|
|
4814
4441
|
_enum(ANTHROPIC_MODELS);
|
|
4815
4442
|
_enum(OPENAI_MODELS);
|
|
@@ -4819,9 +4446,11 @@ _enum(MINIMAX_MODELS);
|
|
|
4819
4446
|
_enum(MISTRAL_MODELS);
|
|
4820
4447
|
_enum(XAI_MODELS);
|
|
4821
4448
|
_enum(ZHIPU_MODELS);
|
|
4449
|
+
_enum(MOONSHOT_MODELS);
|
|
4450
|
+
_enum(QWEN_MODELS);
|
|
4822
4451
|
string().min(1);
|
|
4823
|
-
AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air;
|
|
4824
|
-
AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air;
|
|
4452
|
+
AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air, MoonshotModel.K3, MoonshotModel.K26, MoonshotModel.K27Code, MoonshotModel.K27CodeHighSpeed, MoonshotModel.K25, QwenModel.Qwen37Max, QwenModel.Qwen37Plus, QwenModel.Qwen36Flash, QwenModel.Qwen35Flash;
|
|
4453
|
+
AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air, MoonshotModel.K3, MoonshotModel.K26, MoonshotModel.K27Code, MoonshotModel.K27CodeHighSpeed, MoonshotModel.K25, QwenModel.Qwen37Max, QwenModel.Qwen37Plus, QwenModel.Qwen36Flash, QwenModel.Qwen35Flash;
|
|
4825
4454
|
enumValues({
|
|
4826
4455
|
PendingChallenge: "pending_challenge",
|
|
4827
4456
|
Creating: "creating",
|
|
@@ -4898,6 +4527,7 @@ const NotificationType = {
|
|
|
4898
4527
|
SubscriptionCreated: "subscription.created",
|
|
4899
4528
|
SubscriptionCancelled: "subscription.cancelled",
|
|
4900
4529
|
StartupGrantEnded: "startup.grant_ended",
|
|
4530
|
+
GrantEnded: "subscription.grant_ended",
|
|
4901
4531
|
SubscriptionPastDue: "subscription.past_due",
|
|
4902
4532
|
BalanceThresholdWarning: "balance.threshold.warning",
|
|
4903
4533
|
PlatformTierPriceIncrease: "platform.tier_price_increase",
|
|
@@ -4918,11 +4548,404 @@ const NotificationChannel = {
|
|
|
4918
4548
|
Push: "push",
|
|
4919
4549
|
Sms: "sms"
|
|
4920
4550
|
};
|
|
4921
|
-
const RecipientStrategy = {
|
|
4922
|
-
TenantAdmins: "tenant_admins",
|
|
4923
|
-
SpecificUser: "specific_user"
|
|
4551
|
+
const RecipientStrategy = {
|
|
4552
|
+
TenantAdmins: "tenant_admins",
|
|
4553
|
+
SpecificUser: "specific_user"
|
|
4554
|
+
};
|
|
4555
|
+
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.StartupGrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.GrantEnded, 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;
|
|
4556
|
+
//#endregion
|
|
4557
|
+
//#region ../../packages-internal/api-client/dist/services/auth.js
|
|
4558
|
+
var AuthService = class {
|
|
4559
|
+
client;
|
|
4560
|
+
constructor(client) {
|
|
4561
|
+
this.client = client;
|
|
4562
|
+
}
|
|
4563
|
+
prefix = "/auth";
|
|
4564
|
+
validate(token) {
|
|
4565
|
+
return this.client.request(`${this.prefix}/validate`, {
|
|
4566
|
+
method: "POST",
|
|
4567
|
+
body: JSON.stringify({ token })
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4570
|
+
listTokens() {
|
|
4571
|
+
return this.client.request(`${this.prefix}/tokens`);
|
|
4572
|
+
}
|
|
4573
|
+
createToken(data) {
|
|
4574
|
+
return this.client.request(`${this.prefix}/tokens`, {
|
|
4575
|
+
method: "POST",
|
|
4576
|
+
body: JSON.stringify(data)
|
|
4577
|
+
});
|
|
4578
|
+
}
|
|
4579
|
+
deleteToken(tokenId) {
|
|
4580
|
+
return this.client.request(`${this.prefix}/tokens/${tokenId}`, { method: "DELETE" });
|
|
4581
|
+
}
|
|
4582
|
+
/**
|
|
4583
|
+
* Start a device-code flow. Called by the CLI when the user runs
|
|
4584
|
+
* `alfe login` and picks the browser path. The returned `device_code`
|
|
4585
|
+
* is the CLI's bearer secret for polling /auth/device-token; the
|
|
4586
|
+
* `user_code` is what the user types/sees on the dashboard.
|
|
4587
|
+
*
|
|
4588
|
+
* Uses `publicRequest` because the CLI has no token yet — the standard
|
|
4589
|
+
* `request` path would short-circuit with a synthetic 401.
|
|
4590
|
+
*/
|
|
4591
|
+
startDeviceCode(input) {
|
|
4592
|
+
return this.client.publicRequest(`${this.prefix}/device-code`, {
|
|
4593
|
+
method: "POST",
|
|
4594
|
+
body: JSON.stringify(input)
|
|
4595
|
+
});
|
|
4596
|
+
}
|
|
4597
|
+
/**
|
|
4598
|
+
* Poll for the minted API key. Public endpoint. Returns:
|
|
4599
|
+
* 200 → { api_key, tenantId, tokenExpiresAt } (success — write to config)
|
|
4600
|
+
* 428 → still pending (caller should sleep `interval` and retry)
|
|
4601
|
+
* 429 → polling too fast; caller should back off
|
|
4602
|
+
* 410 → device-code expired; user must run `alfe login` again
|
|
4603
|
+
* 400 → already redeemed (security: do not retry)
|
|
4604
|
+
*
|
|
4605
|
+
* Surface the HTTP-status code via the standard ApiResult error shape
|
|
4606
|
+
* so callers can branch.
|
|
4607
|
+
*/
|
|
4608
|
+
pollDeviceToken(deviceCode) {
|
|
4609
|
+
return this.client.publicRequest(`${this.prefix}/device-token`, {
|
|
4610
|
+
method: "POST",
|
|
4611
|
+
body: JSON.stringify({ device_code: deviceCode })
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
/** Dashboard-side. Fetch the device fingerprint for an approval card. */
|
|
4615
|
+
lookupDeviceCode(userCode) {
|
|
4616
|
+
return this.client.request(`${this.prefix}/device-code/lookup`, {
|
|
4617
|
+
method: "POST",
|
|
4618
|
+
body: JSON.stringify({ user_code: userCode })
|
|
4619
|
+
});
|
|
4620
|
+
}
|
|
4621
|
+
/** Dashboard-side. Approve the pending device-code; CLI's next poll gets the key. */
|
|
4622
|
+
approveDeviceCode(input) {
|
|
4623
|
+
return this.client.request(`${this.prefix}/device-code/approve`, {
|
|
4624
|
+
method: "POST",
|
|
4625
|
+
body: JSON.stringify({
|
|
4626
|
+
user_code: input.userCode,
|
|
4627
|
+
expiresIn: input.expiresIn
|
|
4628
|
+
})
|
|
4629
|
+
});
|
|
4630
|
+
}
|
|
4631
|
+
getOnboardingStatus() {
|
|
4632
|
+
return this.client.request(`${this.prefix}/onboarding/status`);
|
|
4633
|
+
}
|
|
4634
|
+
completeOnboarding(input) {
|
|
4635
|
+
return this.client.request(`${this.prefix}/onboarding/complete`, {
|
|
4636
|
+
method: "POST",
|
|
4637
|
+
body: JSON.stringify(input)
|
|
4638
|
+
});
|
|
4639
|
+
}
|
|
4640
|
+
getAccessStatus() {
|
|
4641
|
+
return this.client.request(`${this.prefix}/access/status`);
|
|
4642
|
+
}
|
|
4643
|
+
redeemAccessCode(code) {
|
|
4644
|
+
return this.client.request(`${this.prefix}/access/redeem`, {
|
|
4645
|
+
method: "POST",
|
|
4646
|
+
body: JSON.stringify({ code })
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4649
|
+
/**
|
|
4650
|
+
* Fetch the caller's current permission list as enforced by the gateway.
|
|
4651
|
+
* UI permission providers should call this on mount and refetch on
|
|
4652
|
+
* Clerk org switch to stay in sync with sub-tenant permission changes.
|
|
4653
|
+
*/
|
|
4654
|
+
getMyPermissions() {
|
|
4655
|
+
return this.client.request(`${this.prefix}/me/permissions`);
|
|
4656
|
+
}
|
|
4657
|
+
/**
|
|
4658
|
+
* Preview what deleting the caller's own account will do. Drives the Danger
|
|
4659
|
+
* Zone copy so the user sees an honest, kind-appropriate warning before the
|
|
4660
|
+
* irreversible action (a last-admin cascade wipes the whole workspace).
|
|
4661
|
+
*/
|
|
4662
|
+
getDeletionPreview() {
|
|
4663
|
+
return this.client.request(`${this.prefix}/me/deletion-preview`);
|
|
4664
|
+
}
|
|
4665
|
+
/**
|
|
4666
|
+
* Permanently delete the caller's own account. Returns `{ status: "deleting" }`
|
|
4667
|
+
* and tears the account down asynchronously — the Clerk user is deleted shortly
|
|
4668
|
+
* after, so the caller's session dies. On success, sign out and route the user
|
|
4669
|
+
* to a terminal "account is being deleted" state; do NOT retry.
|
|
4670
|
+
*
|
|
4671
|
+
* Pass `confirmKind` (the accountKind the user actually confirmed, from the
|
|
4672
|
+
* deletion preview): if membership changed between preview and execute, the
|
|
4673
|
+
* server answers 409 `account_kind_changed` instead of cascading a scope the
|
|
4674
|
+
* user never agreed to.
|
|
4675
|
+
*/
|
|
4676
|
+
deleteAccount(confirmKind) {
|
|
4677
|
+
return this.client.request(`${this.prefix}/me`, {
|
|
4678
|
+
method: "DELETE",
|
|
4679
|
+
...confirmKind ? { body: JSON.stringify({ confirmKind }) } : {}
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4682
|
+
getSubscriptionStatus() {
|
|
4683
|
+
return this.client.request(`${this.prefix}/subscription`);
|
|
4684
|
+
}
|
|
4685
|
+
/**
|
|
4686
|
+
* Mint a short-lived, single-use Clerk sign-in token for the calling user so
|
|
4687
|
+
* a native client can hand its logged-in session to the web dashboard
|
|
4688
|
+
* (`${dashboard}/handoff?__clerk_ticket=<token>`). Server mints only for the
|
|
4689
|
+
* authenticated user — never a caller-supplied id.
|
|
4690
|
+
*/
|
|
4691
|
+
createHandoffToken() {
|
|
4692
|
+
return this.client.request(`${this.prefix}/handoff-token`, { method: "POST" });
|
|
4693
|
+
}
|
|
4694
|
+
applyForStartup(input) {
|
|
4695
|
+
return this.client.request(`${this.prefix}/subscription/apply-startup`, {
|
|
4696
|
+
method: "POST",
|
|
4697
|
+
body: JSON.stringify(input)
|
|
4698
|
+
});
|
|
4699
|
+
}
|
|
4700
|
+
/**
|
|
4701
|
+
* Accept an approved Startup Program invite. Call after the applicant has a
|
|
4702
|
+
* card on file (confirmed or freshly added) — this mints the Professional
|
|
4703
|
+
* grant subscription. Idempotent: a repeat call on an already-accepted
|
|
4704
|
+
* application returns `{ status: "accepted" }` without re-charging.
|
|
4705
|
+
*/
|
|
4706
|
+
acceptStartup() {
|
|
4707
|
+
return this.client.request(`${this.prefix}/subscription/accept-startup`, { method: "POST" });
|
|
4708
|
+
}
|
|
4709
|
+
createCheckoutSession(input) {
|
|
4710
|
+
return this.client.request(`${this.prefix}/subscription/checkout`, {
|
|
4711
|
+
method: "POST",
|
|
4712
|
+
body: JSON.stringify(input)
|
|
4713
|
+
});
|
|
4714
|
+
}
|
|
4715
|
+
/**
|
|
4716
|
+
* Change a personal (individual-tier) subscriber's platform plan in place on
|
|
4717
|
+
* their existing Stripe subscription — no second Checkout, no duplicate sub,
|
|
4718
|
+
* no double charge. Upgrades prorate immediately; downgrades apply with no
|
|
4719
|
+
* immediate charge/refund. Returns the updated subscription.
|
|
4720
|
+
*/
|
|
4721
|
+
changePlatformPlan(input) {
|
|
4722
|
+
return this.client.request(`${this.prefix}/subscription/change`, {
|
|
4723
|
+
method: "POST",
|
|
4724
|
+
body: JSON.stringify(input)
|
|
4725
|
+
});
|
|
4726
|
+
}
|
|
4727
|
+
/**
|
|
4728
|
+
* Preview the proration cost for changing a personal (individual-tier)
|
|
4729
|
+
* subscriber's platform plan — read-only companion to `changePlatformPlan`.
|
|
4730
|
+
* Nothing is charged.
|
|
4731
|
+
*/
|
|
4732
|
+
previewPlatformPlanChange(input) {
|
|
4733
|
+
return this.client.request(`${this.prefix}/subscription/change/preview`, {
|
|
4734
|
+
method: "POST",
|
|
4735
|
+
body: JSON.stringify(input)
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
updateSeats(seats) {
|
|
4739
|
+
return this.client.request(`${this.prefix}/subscription/seats`, {
|
|
4740
|
+
method: "POST",
|
|
4741
|
+
body: JSON.stringify({ seats })
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
previewSeatChange(seats) {
|
|
4745
|
+
return this.client.request(`${this.prefix}/subscription/seats/preview`, {
|
|
4746
|
+
method: "POST",
|
|
4747
|
+
body: JSON.stringify({ seats })
|
|
4748
|
+
});
|
|
4749
|
+
}
|
|
4750
|
+
listOrgMembers() {
|
|
4751
|
+
return this.client.request(`${this.prefix}/org/members`);
|
|
4752
|
+
}
|
|
4753
|
+
patchOrgMember(userId, body) {
|
|
4754
|
+
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, {
|
|
4755
|
+
method: "PATCH",
|
|
4756
|
+
body: JSON.stringify(body)
|
|
4757
|
+
});
|
|
4758
|
+
}
|
|
4759
|
+
removeOrgMember(userId) {
|
|
4760
|
+
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, { method: "DELETE" });
|
|
4761
|
+
}
|
|
4762
|
+
listOrgInvitations() {
|
|
4763
|
+
return this.client.request(`${this.prefix}/org/invitations`);
|
|
4764
|
+
}
|
|
4765
|
+
createOrgInvitation(input) {
|
|
4766
|
+
return this.client.request(`${this.prefix}/org/invitations`, {
|
|
4767
|
+
method: "POST",
|
|
4768
|
+
body: JSON.stringify(input)
|
|
4769
|
+
});
|
|
4770
|
+
}
|
|
4771
|
+
revokeOrgInvitation(invitationId) {
|
|
4772
|
+
return this.client.request(`${this.prefix}/org/invitations/${encodeURIComponent(invitationId)}`, { method: "DELETE" });
|
|
4773
|
+
}
|
|
4774
|
+
listOrgDomains() {
|
|
4775
|
+
return this.client.request(`${this.prefix}/org/domains`);
|
|
4776
|
+
}
|
|
4777
|
+
createOrgDomain(input) {
|
|
4778
|
+
return this.client.request(`${this.prefix}/org/domains`, {
|
|
4779
|
+
method: "POST",
|
|
4780
|
+
body: JSON.stringify(input)
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
deleteOrgDomain(domainId) {
|
|
4784
|
+
return this.client.request(`${this.prefix}/org/domains/${encodeURIComponent(domainId)}`, { method: "DELETE" });
|
|
4785
|
+
}
|
|
4786
|
+
updateOrgSettings(input) {
|
|
4787
|
+
return this.client.request(`${this.prefix}/org/settings`, {
|
|
4788
|
+
method: "PATCH",
|
|
4789
|
+
body: JSON.stringify(input)
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
};
|
|
4793
|
+
//#endregion
|
|
4794
|
+
//#region ../../packages-internal/api-client/dist/services/integrations.js
|
|
4795
|
+
var IntegrationsService = class {
|
|
4796
|
+
client;
|
|
4797
|
+
constructor(client) {
|
|
4798
|
+
this.client = client;
|
|
4799
|
+
}
|
|
4800
|
+
listScopedInstalls(scope, scopeId) {
|
|
4801
|
+
const params = new URLSearchParams({
|
|
4802
|
+
scope,
|
|
4803
|
+
scopeId
|
|
4804
|
+
});
|
|
4805
|
+
return this.client.request(`/integrations/scoped?${params}`);
|
|
4806
|
+
}
|
|
4807
|
+
installScoped(data) {
|
|
4808
|
+
return this.client.request("/integrations/scoped", {
|
|
4809
|
+
method: "POST",
|
|
4810
|
+
body: JSON.stringify(data)
|
|
4811
|
+
});
|
|
4812
|
+
}
|
|
4813
|
+
getScopedInstall(integrationId, scope, scopeId) {
|
|
4814
|
+
const params = new URLSearchParams({
|
|
4815
|
+
scope,
|
|
4816
|
+
scopeId
|
|
4817
|
+
});
|
|
4818
|
+
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}?${params}`);
|
|
4819
|
+
}
|
|
4820
|
+
updateScopedInstall(integrationId, data) {
|
|
4821
|
+
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}`, {
|
|
4822
|
+
method: "PATCH",
|
|
4823
|
+
body: JSON.stringify(data)
|
|
4824
|
+
});
|
|
4825
|
+
}
|
|
4826
|
+
removeScopedInstall(integrationId, scope, scopeId) {
|
|
4827
|
+
const params = new URLSearchParams({
|
|
4828
|
+
scope,
|
|
4829
|
+
scopeId
|
|
4830
|
+
});
|
|
4831
|
+
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}?${params}`, { method: "DELETE" });
|
|
4832
|
+
}
|
|
4833
|
+
/**
|
|
4834
|
+
* Reinstall (re-apply latest) a scope-level install. Agent scope is rejected
|
|
4835
|
+
* by the route — use {@link reinstallIntegration} for agent-scoped reinstall.
|
|
4836
|
+
*/
|
|
4837
|
+
reinstallScoped(integrationId, scope, scopeId) {
|
|
4838
|
+
return this.client.request(`/integrations/scoped/${encodeURIComponent(integrationId)}/reinstall`, {
|
|
4839
|
+
method: "POST",
|
|
4840
|
+
body: JSON.stringify({
|
|
4841
|
+
scope,
|
|
4842
|
+
scopeId
|
|
4843
|
+
})
|
|
4844
|
+
});
|
|
4845
|
+
}
|
|
4846
|
+
listIntegrations(agentId, options) {
|
|
4847
|
+
const params = new URLSearchParams();
|
|
4848
|
+
if (options?.includeInherited) params.set("includeInherited", "true");
|
|
4849
|
+
if (options?.effective) params.set("effective", "true");
|
|
4850
|
+
const qs = params.toString();
|
|
4851
|
+
return this.client.request(`/integrations/agents/${agentId}${qs ? `?${qs}` : ""}`);
|
|
4852
|
+
}
|
|
4853
|
+
installIntegration(agentId, data) {
|
|
4854
|
+
return this.client.request(`/integrations/agents/${agentId}`, {
|
|
4855
|
+
method: "POST",
|
|
4856
|
+
body: JSON.stringify(data)
|
|
4857
|
+
});
|
|
4858
|
+
}
|
|
4859
|
+
getIntegrationConfig(agentId, integrationId) {
|
|
4860
|
+
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/config`);
|
|
4861
|
+
}
|
|
4862
|
+
updateIntegration(agentId, integrationId, data) {
|
|
4863
|
+
return this.client.request(`/integrations/agents/${agentId}/${integrationId}`, {
|
|
4864
|
+
method: "PATCH",
|
|
4865
|
+
body: JSON.stringify(data)
|
|
4866
|
+
});
|
|
4867
|
+
}
|
|
4868
|
+
removeIntegration(agentId, integrationId) {
|
|
4869
|
+
return this.client.request(`/integrations/agents/${agentId}/${integrationId}`, { method: "DELETE" });
|
|
4870
|
+
}
|
|
4871
|
+
reinstallIntegration(agentId, integrationId) {
|
|
4872
|
+
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/reinstall`, { method: "POST" });
|
|
4873
|
+
}
|
|
4874
|
+
/**
|
|
4875
|
+
* Upgrade an integration to the registry's latest version via the fast,
|
|
4876
|
+
* diff-based daemon path (bumps `version` without `reinstallRequestedAt`).
|
|
4877
|
+
* The agent stays online — no destructive teardown. Distinct from
|
|
4878
|
+
* {@link reinstallIntegration}, which is the destructive repair path.
|
|
4879
|
+
*/
|
|
4880
|
+
upgradeIntegration(agentId, integrationId) {
|
|
4881
|
+
return this.client.request(`/integrations/agents/${agentId}/${integrationId}/upgrade`, { method: "POST" });
|
|
4882
|
+
}
|
|
4883
|
+
getRegistry() {
|
|
4884
|
+
return this.client.request("/integrations/registry");
|
|
4885
|
+
}
|
|
4886
|
+
triggerSync(agentId) {
|
|
4887
|
+
return this.client.request("/integrations/sync/trigger", {
|
|
4888
|
+
method: "POST",
|
|
4889
|
+
body: JSON.stringify({ agentId })
|
|
4890
|
+
});
|
|
4891
|
+
}
|
|
4892
|
+
getDiscordGuildChannels(guildId) {
|
|
4893
|
+
return this.client.request(`/discord/guilds/${encodeURIComponent(guildId)}/channels`);
|
|
4894
|
+
}
|
|
4895
|
+
listMobileNumbers() {
|
|
4896
|
+
return this.client.request("/mobile/numbers");
|
|
4897
|
+
}
|
|
4898
|
+
searchMobileNumbers(country, query) {
|
|
4899
|
+
const params = new URLSearchParams();
|
|
4900
|
+
if (country) params.set("country", country);
|
|
4901
|
+
if (query) params.set("query", query);
|
|
4902
|
+
return this.client.request(`/mobile/numbers/search?${params}`);
|
|
4903
|
+
}
|
|
4904
|
+
assignMobileNumber(agentId, phoneNumber, countryCode) {
|
|
4905
|
+
return this.client.request("/mobile/numbers/assign", {
|
|
4906
|
+
method: "POST",
|
|
4907
|
+
body: JSON.stringify({
|
|
4908
|
+
agentId,
|
|
4909
|
+
phoneNumber,
|
|
4910
|
+
countryCode
|
|
4911
|
+
})
|
|
4912
|
+
});
|
|
4913
|
+
}
|
|
4914
|
+
releaseMobileNumber(agentId) {
|
|
4915
|
+
return this.client.request("/mobile/numbers/release", {
|
|
4916
|
+
method: "POST",
|
|
4917
|
+
body: JSON.stringify({ agentId })
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4920
|
+
getMobileNumber(agentId) {
|
|
4921
|
+
return this.client.request(`/mobile/numbers?agentId=${encodeURIComponent(agentId)}`);
|
|
4922
|
+
}
|
|
4923
|
+
disconnectGoogle(agentId, email) {
|
|
4924
|
+
const query = email ? `?email=${encodeURIComponent(email)}` : "";
|
|
4925
|
+
return this.client.request(`/google/agents/${encodeURIComponent(agentId)}/account${query}`, { method: "DELETE" });
|
|
4926
|
+
}
|
|
4927
|
+
getAtlassianSites(agentId) {
|
|
4928
|
+
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`);
|
|
4929
|
+
}
|
|
4930
|
+
selectAtlassianSite(agentId, cloudId) {
|
|
4931
|
+
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`, {
|
|
4932
|
+
method: "PUT",
|
|
4933
|
+
body: JSON.stringify({ cloudId })
|
|
4934
|
+
});
|
|
4935
|
+
}
|
|
4936
|
+
listSlackChannels(agentId) {
|
|
4937
|
+
return this.client.request(`/slack/agents/${encodeURIComponent(agentId)}/channels`);
|
|
4938
|
+
}
|
|
4939
|
+
sendSlackMessage(agentId, channel, text) {
|
|
4940
|
+
return this.client.request(`/slack/agents/${encodeURIComponent(agentId)}/send`, {
|
|
4941
|
+
method: "POST",
|
|
4942
|
+
body: JSON.stringify({
|
|
4943
|
+
channel,
|
|
4944
|
+
text
|
|
4945
|
+
})
|
|
4946
|
+
});
|
|
4947
|
+
}
|
|
4924
4948
|
};
|
|
4925
|
-
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.StartupGrantEnded, 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;
|
|
4926
4949
|
//#endregion
|
|
4927
4950
|
//#region src/config.ts
|
|
4928
4951
|
/**
|
|
@@ -5146,6 +5169,17 @@ async function loadDaemonConfig() {
|
|
|
5146
5169
|
const gatewayWsUrl = alfeConfig.gateway_url ?? deriveGatewayWsUrl(apiEndpoint);
|
|
5147
5170
|
const runtimes = await loadRuntimeConfigs();
|
|
5148
5171
|
const runtime = alfeConfig.runtime ?? identity.runtime;
|
|
5172
|
+
let defaultModel;
|
|
5173
|
+
if (runtime === "claude-code") {
|
|
5174
|
+
let timer;
|
|
5175
|
+
const ws = await Promise.race([fetchAgentConfig(alfeConfig.api_key, apiEndpoint), new Promise((resolve) => {
|
|
5176
|
+
timer = setTimeout(() => {
|
|
5177
|
+
resolve(null);
|
|
5178
|
+
}, 5e3);
|
|
5179
|
+
})]);
|
|
5180
|
+
if (timer) clearTimeout(timer);
|
|
5181
|
+
defaultModel = ws?.defaultModel;
|
|
5182
|
+
}
|
|
5149
5183
|
return {
|
|
5150
5184
|
apiKey: alfeConfig.api_key,
|
|
5151
5185
|
apiEndpoint,
|
|
@@ -5156,7 +5190,8 @@ async function loadDaemonConfig() {
|
|
|
5156
5190
|
orgId: identity.orgId,
|
|
5157
5191
|
runtime,
|
|
5158
5192
|
runtimes,
|
|
5159
|
-
autoStartRuntime: alfeConfig.auto_start_runtime ?? true
|
|
5193
|
+
autoStartRuntime: alfeConfig.auto_start_runtime ?? true,
|
|
5194
|
+
...defaultModel ? { defaultModel } : {}
|
|
5160
5195
|
};
|
|
5161
5196
|
}
|
|
5162
5197
|
/**
|
|
@@ -23999,7 +24034,7 @@ async function startDaemon() {
|
|
|
23999
24034
|
runtimeProcess = new RuntimeProcess({
|
|
24000
24035
|
runtime: config.runtime,
|
|
24001
24036
|
workspace: runtimeCfg.workspace,
|
|
24002
|
-
env: {}
|
|
24037
|
+
env: config.runtime === "claude-code" && config.defaultModel ? { ALFE_DEFAULT_MODEL: config.defaultModel } : {}
|
|
24003
24038
|
});
|
|
24004
24039
|
runtimeProcess.setTurnActivityProbe(turnActivityProbe);
|
|
24005
24040
|
runtimeProcess.start();
|
|
@@ -24191,7 +24226,7 @@ async function executeCloudCommand(command) {
|
|
|
24191
24226
|
};
|
|
24192
24227
|
const payload = command.payload;
|
|
24193
24228
|
const runtime = config.runtime;
|
|
24194
|
-
const version = payload?.version ?? (runtime === "openclaw" ? "2026.6.11" : runtime === "claude-code" ? "0.1.
|
|
24229
|
+
const version = payload?.version ?? (runtime === "openclaw" ? "2026.6.11" : runtime === "claude-code" ? "0.1.3" : void 0);
|
|
24195
24230
|
upgradingRuntime = true;
|
|
24196
24231
|
setTimeout(() => {
|
|
24197
24232
|
(async () => {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ declare const PINNED_OPENCLAW_VERSION = "2026.6.11";
|
|
|
77
77
|
* `PINNED_OPENCLAW_VERSION` — there is no `services/compute/Dockerfile` mirror to
|
|
78
78
|
* keep in sync.
|
|
79
79
|
*/
|
|
80
|
-
declare const PINNED_CLAUDE_CODE_HOST_VERSION = "0.1.
|
|
80
|
+
declare const PINNED_CLAUDE_CODE_HOST_VERSION = "0.1.3";
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/sentry.d.ts
|
|
83
83
|
/**
|
|
@@ -281,6 +281,13 @@ interface DaemonConfig {
|
|
|
281
281
|
runtimes: Record<string, RuntimeConfig>;
|
|
282
282
|
/** Whether to auto-start the agent runtime process (e.g. openclaw) */
|
|
283
283
|
autoStartRuntime: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* The agent's bare `defaultModel`, resolved for claude-code only (other
|
|
286
|
+
* runtimes receive their model via the desired-state reconcile, not here).
|
|
287
|
+
* The daemon injects it into the host env so `claude -p --model` uses the
|
|
288
|
+
* dashboard-selected model. Never provider-qualified.
|
|
289
|
+
*/
|
|
290
|
+
defaultModel?: string;
|
|
284
291
|
}
|
|
285
292
|
interface AgentIdentity {
|
|
286
293
|
agentId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/gateway",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Alfe local gateway daemon — persistent control plane for agent integrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"pino-roll": "^1.2.0",
|
|
24
24
|
"smol-toml": ">=1.6.1",
|
|
25
25
|
"ws": "^8.18.0",
|
|
26
|
-
"@alfe.ai/agent-api-client": "^0.
|
|
26
|
+
"@alfe.ai/agent-api-client": "^0.12.0",
|
|
27
27
|
"@alfe.ai/ai-proxy-local": "^0.0.13",
|
|
28
28
|
"@alfe.ai/config": "^0.3.0",
|
|
29
|
-
"@alfe.ai/integration-manifest": "^0.3.
|
|
30
|
-
"@alfe.ai/integrations": "^0.5.
|
|
29
|
+
"@alfe.ai/integration-manifest": "^0.3.4",
|
|
30
|
+
"@alfe.ai/integrations": "^0.5.4",
|
|
31
31
|
"@alfe.ai/mcp-bundler": "^0.3.2"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|