@lobehub/market-sdk 0.34.0-beta.3 → 0.34.0-beta.5

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/index.d.mts CHANGED
@@ -1159,6 +1159,7 @@ interface AgentGroupDetail {
1159
1159
  author?: {
1160
1160
  avatar?: string;
1161
1161
  name?: string;
1162
+ type?: string;
1162
1163
  userName?: string;
1163
1164
  };
1164
1165
  group: {
@@ -5313,17 +5314,10 @@ declare class PluginEnvService extends BaseSDK {
5313
5314
  }>;
5314
5315
  }
5315
5316
 
5316
- /**
5317
- * Organization membership-authority source
5318
- */
5319
- type AdminOrganizationSource = 'native' | 'workspace';
5320
5317
  /**
5321
5318
  * Admin organization list query parameters
5322
5319
  */
5323
- interface AdminOrganizationListQueryParams extends AdminListQueryParams {
5324
- /** Filter by membership-authority source (defaults to all) */
5325
- source?: AdminOrganizationSource | 'all';
5326
- }
5320
+ type AdminOrganizationListQueryParams = AdminListQueryParams;
5327
5321
  /**
5328
5322
  * Organization list item in admin context
5329
5323
  */
@@ -5337,10 +5331,9 @@ interface AdminOrganizationItem {
5337
5331
  email: string | null;
5338
5332
  memberCount: number;
5339
5333
  namespace: string;
5340
- source: AdminOrganizationSource;
5341
5334
  updatedAt: string | null;
5342
5335
  websiteUrl: string | null;
5343
- /** Associated cloud workspace id, derived from clerkId for workspace-source orgs */
5336
+ /** Associated cloud workspace id, derived from the `workspace:<id>` clerkId convention */
5344
5337
  workspaceId: string | null;
5345
5338
  }
5346
5339
  /**
@@ -7337,6 +7330,22 @@ declare class MarketSkillService extends BaseSDK {
7337
7330
  }>;
7338
7331
  }
7339
7332
 
7333
+ /**
7334
+ * Organization reference for SDK calls.
7335
+ *
7336
+ * Either the numeric Market `accounts.id` (legacy) or a cloud workspace key.
7337
+ * A workspace ref is sent to the API as the `workspace:<workspaceId>` path
7338
+ * segment, which the Market resolves server-side via the same `clerkId`
7339
+ * convention — so callers can address an org by its cloud workspaceId without
7340
+ * ever holding the integer account id (mirroring how users are addressed by
7341
+ * their cloud userId).
7342
+ */
7343
+ type OrgRef = number | {
7344
+ workspaceId: string;
7345
+ };
7346
+ /** Build the org path segment for a {@link OrgRef}. */
7347
+ declare const orgRefToPathSegment: (ref: OrgRef) => string;
7348
+
7340
7349
  /**
7341
7350
  * Organization Credentials Service
7342
7351
  *
@@ -7359,11 +7368,12 @@ declare class MarketSkillService extends BaseSDK {
7359
7368
  */
7360
7369
  declare class OrganizationCredsService extends BaseSDK {
7361
7370
  /**
7362
- * Numeric organization account ID this service is bound to. Stored so every
7363
- * URL builder method below can prefix `/v1/organizations/${orgId}/`.
7371
+ * Org path segment this service is bound to a numeric account id or a
7372
+ * `workspace:<workspaceId>` key. Stored so every URL builder method below can
7373
+ * prefix `/v1/organizations/${orgSegment}/`.
7364
7374
  */
7365
- private readonly orgId;
7366
- constructor(orgId: number, options?: MarketSDKOptions, sharedHeaders?: Record<string, string>, sharedTokenState?: SharedTokenState);
7375
+ private readonly orgSegment;
7376
+ constructor(orgId: OrgRef, options?: MarketSDKOptions, sharedHeaders?: Record<string, string>, sharedTokenState?: SharedTokenState);
7367
7377
  private base;
7368
7378
  list(options?: globalThis.RequestInit): Promise<ListCredsResponse>;
7369
7379
  get(id: number, getOptions?: GetCredOptions, options?: globalThis.RequestInit): Promise<CredWithPlaintext>;
@@ -7415,13 +7425,17 @@ declare class OrganizationService extends BaseSDK {
7415
7425
  * Returns a fresh instance per call; suitable for short-lived UIs where the
7416
7426
  * orgId varies. For long-lived use, cache the returned service.
7417
7427
  *
7428
+ * Accepts either a numeric account id or a `{ workspaceId }` ref; the latter
7429
+ * is addressed server-side as `workspace:<workspaceId>`.
7430
+ *
7418
7431
  * @example
7419
7432
  * ```typescript
7420
7433
  * const orgCreds = market.organizations.creds(42);
7434
+ * const byWs = market.organizations.creds({ workspaceId: 'wks_abc' });
7421
7435
  * await orgCreds.list();
7422
7436
  * ```
7423
7437
  */
7424
- creds(orgId: number): OrganizationCredsService;
7438
+ creds(orgId: OrgRef): OrganizationCredsService;
7425
7439
  /**
7426
7440
  * Retrieves an organization's public profile and everything it has
7427
7441
  * published — agents, agent groups, skills, plugins.
@@ -7462,7 +7476,7 @@ declare class OrganizationService extends BaseSDK {
7462
7476
  * @param data - Fields to update
7463
7477
  * @returns The updated organization
7464
7478
  */
7465
- updateOrganization(orgId: number, data: UpdateOrganizationRequest, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7479
+ updateOrganization(orgId: OrgRef, data: UpdateOrganizationRequest, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7466
7480
  /**
7467
7481
  * Soft-disables an organization (e.g. its cloud workspace was deleted).
7468
7482
  * Trusted-client only. Reversible; creds and published content are preserved.
@@ -7470,21 +7484,21 @@ declare class OrganizationService extends BaseSDK {
7470
7484
  * @param orgId - Organization account id
7471
7485
  * @returns The archived organization
7472
7486
  */
7473
- archiveOrganization(orgId: number, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7487
+ archiveOrganization(orgId: OrgRef, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7474
7488
  /**
7475
7489
  * Reactivates a previously archived organization. Trusted-client only.
7476
7490
  *
7477
7491
  * @param orgId - Organization account id
7478
7492
  * @returns The reactivated organization
7479
7493
  */
7480
- unarchiveOrganization(orgId: number, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7494
+ unarchiveOrganization(orgId: OrgRef, options?: globalThis.RequestInit): Promise<OrganizationItem>;
7481
7495
  /**
7482
7496
  * Lists the members of an organization. Any authenticated org member may call.
7483
7497
  *
7484
7498
  * @param orgId - Organization account id
7485
7499
  * @returns Hydrated member rows
7486
7500
  */
7487
- listMembers(orgId: number, options?: globalThis.RequestInit): Promise<OrganizationMemberItem[]>;
7501
+ listMembers(orgId: OrgRef, options?: globalThis.RequestInit): Promise<OrganizationMemberItem[]>;
7488
7502
  /**
7489
7503
  * Adds a member to an organization. Trusted-client only. Idempotent: if the
7490
7504
  * user is already a member, the existing role is preserved (`added: false`).
@@ -7494,7 +7508,7 @@ declare class OrganizationService extends BaseSDK {
7494
7508
  * @param role - Role to grant (defaults server-side to `member`)
7495
7509
  * @returns Whether the member was newly added and their effective role
7496
7510
  */
7497
- addMember(orgId: number, userAccountId: number, role?: OrganizationMemberRole, options?: globalThis.RequestInit): Promise<AddMemberResponse>;
7511
+ addMember(orgId: OrgRef, userAccountId: number, role?: OrganizationMemberRole, options?: globalThis.RequestInit): Promise<AddMemberResponse>;
7498
7512
  /**
7499
7513
  * Removes a member from an organization. Trusted-client only. Refuses to
7500
7514
  * remove the last admin (server returns 409).
@@ -7503,7 +7517,7 @@ declare class OrganizationService extends BaseSDK {
7503
7517
  * @param userAccountId - The user's account id
7504
7518
  * @returns Whether a membership row was removed
7505
7519
  */
7506
- removeMember(orgId: number, userAccountId: number, options?: globalThis.RequestInit): Promise<{
7520
+ removeMember(orgId: OrgRef, userAccountId: number, options?: globalThis.RequestInit): Promise<{
7507
7521
  removed: boolean;
7508
7522
  }>;
7509
7523
  /**
@@ -7515,7 +7529,7 @@ declare class OrganizationService extends BaseSDK {
7515
7529
  * @param role - The new role
7516
7530
  * @returns The effective role and whether it changed
7517
7531
  */
7518
- updateMemberRole(orgId: number, userAccountId: number, role: OrganizationMemberRole, options?: globalThis.RequestInit): Promise<UpdateMemberRoleResponse>;
7532
+ updateMemberRole(orgId: OrgRef, userAccountId: number, role: OrganizationMemberRole, options?: globalThis.RequestInit): Promise<UpdateMemberRoleResponse>;
7519
7533
  /**
7520
7534
  * Reconciles the full member list against a desired snapshot (idempotent).
7521
7535
  * Trusted-client only — the canonical way for Cloud to mirror a workspace's
@@ -7527,7 +7541,7 @@ declare class OrganizationService extends BaseSDK {
7527
7541
  * @param members - The complete desired member list
7528
7542
  * @returns Counts of added / removed / updated members and skipped ids
7529
7543
  */
7530
- reconcileMembers(orgId: number, members: ReconcileMembersRequest['members'], options?: globalThis.RequestInit): Promise<ReconcileMembersResponse>;
7544
+ reconcileMembers(orgId: OrgRef, members: ReconcileMembersRequest['members'], options?: globalThis.RequestInit): Promise<ReconcileMembersResponse>;
7531
7545
  }
7532
7546
 
7533
7547
  /**
@@ -8176,31 +8190,6 @@ declare const SDK_VERSION = "0.31.3";
8176
8190
  */
8177
8191
  declare const SDK_USER_AGENT = "LobeHub-Market-SDK/0.31.3";
8178
8192
 
8179
- /**
8180
- * Trusted Client Token Utilities
8181
- *
8182
- * Provides encryption utilities for creating trusted client tokens
8183
- * that can be used with the Market SDK.
8184
- *
8185
- * @example
8186
- * ```typescript
8187
- * import { createTrustedClientToken, TrustedClientPayload } from '@lobehub/market-sdk';
8188
- *
8189
- * const payload: TrustedClientPayload = {
8190
- * userId: 'user_xxx',
8191
- * clientId: 'lobechat-com',
8192
- * email: 'user@example.com',
8193
- * timestamp: Date.now(),
8194
- * nonce: generateNonce(),
8195
- * name: 'John Doe',
8196
- * };
8197
- *
8198
- * const token = createTrustedClientToken(payload, secret);
8199
- *
8200
- * // Use with MarketSDK
8201
- * const sdk = new MarketSDK({ trustedClientToken: token });
8202
- * ```
8203
- */
8204
8193
  /**
8205
8194
  * Trusted client payload structure
8206
8195
  */
@@ -8219,6 +8208,13 @@ interface TrustedClientPayload {
8219
8208
  timestamp: number;
8220
8209
  /** Clerk user ID (format: user_xxx) */
8221
8210
  userId: string;
8211
+ /**
8212
+ * Cloud workspace id the request acts on behalf of. When present, the caller
8213
+ * acts as the workspace's mirrored organization (resolved server-side via the
8214
+ * `workspace:<workspaceId>` clerkId convention), mirroring how `userId`
8215
+ * identifies the personal account. Omit for personal requests.
8216
+ */
8217
+ workspaceId?: string;
8222
8218
  }
8223
8219
  /**
8224
8220
  * Encrypt a trusted client payload
@@ -8247,6 +8243,7 @@ declare function buildTrustedClientPayload(params: {
8247
8243
  emailVerified?: boolean;
8248
8244
  name?: string;
8249
8245
  userId: string;
8246
+ workspaceId?: string;
8250
8247
  }): TrustedClientPayload;
8251
8248
 
8252
- export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type CimdClientMetadata, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateFileCredRequest, type CreateKVCredRequest, type CreateMemberAgent, type CreateOAuthCredRequest, type CredWithPlaintext, type DeleteCredResponse, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetCredOptions, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListCredsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillCollectionDetail, type MarketSkillCollectionDetailQuery, type MarketSkillCollectionItemSort, type MarketSkillCollectionListItem, type MarketSkillCollectionListQuery, type MarketSkillCollectionListResponse, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OrganizationInfoQuery, type OrganizationInfoResponse, type OrganizationProfile, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginCommentAuthor, type PluginCommentCreateItem, type PluginCommentCreateResponse, type PluginCommentDeleteResponse, type PluginCommentItem, type PluginCommentListQuery, type PluginCommentListResponse, type PluginCommentRating, type PluginCommentReactionResponse, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginLatestOwnComment, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginRatingDistribution, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentCreateItem, type SkillCommentCreateResponse, type SkillCommentDeleteResponse, type SkillCommentItem, type SkillCommentListItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillCommentRating, type SkillErrorResponse, type SkillLatestOwnComment, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, type SkillToolsSource, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateCredRequest, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserPluginItem, type UserProfile, type UserSkillItem, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce };
8249
+ export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type CimdClientMetadata, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateFileCredRequest, type CreateKVCredRequest, type CreateMemberAgent, type CreateOAuthCredRequest, type CredWithPlaintext, type DeleteCredResponse, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetCredOptions, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListCredsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillCollectionDetail, type MarketSkillCollectionDetailQuery, type MarketSkillCollectionItemSort, type MarketSkillCollectionListItem, type MarketSkillCollectionListQuery, type MarketSkillCollectionListResponse, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OrgRef, type OrganizationInfoQuery, type OrganizationInfoResponse, type OrganizationProfile, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginCommentAuthor, type PluginCommentCreateItem, type PluginCommentCreateResponse, type PluginCommentDeleteResponse, type PluginCommentItem, type PluginCommentListQuery, type PluginCommentListResponse, type PluginCommentRating, type PluginCommentReactionResponse, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginLatestOwnComment, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginRatingDistribution, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentCreateItem, type SkillCommentCreateResponse, type SkillCommentDeleteResponse, type SkillCommentItem, type SkillCommentListItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillCommentRating, type SkillErrorResponse, type SkillLatestOwnComment, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, type SkillToolsSource, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateCredRequest, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserPluginItem, type UserProfile, type UserSkillItem, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce, orgRefToPathSegment };
package/dist/index.mjs CHANGED
@@ -4939,30 +4939,43 @@ var MarketSkillService = class extends BaseSDK {
4939
4939
 
4940
4940
  // src/market/services/OrganizationCredsService.ts
4941
4941
  import debug24 from "debug";
4942
+
4943
+ // src/utils/orgRef.ts
4944
+ var orgRefToPathSegment = (ref) => typeof ref === "number" ? String(ref) : `workspace:${encodeURIComponent(ref.workspaceId)}`;
4945
+
4946
+ // src/market/services/OrganizationCredsService.ts
4942
4947
  var log24 = debug24("lobe-market-sdk:org-creds");
4943
4948
  var OrganizationCredsService = class extends BaseSDK {
4944
4949
  constructor(orgId, options = {}, sharedHeaders, sharedTokenState) {
4945
4950
  super(options, sharedHeaders, sharedTokenState);
4946
- if (!Number.isInteger(orgId) || orgId <= 0) {
4947
- throw new Error(`OrganizationCredsService requires a positive integer orgId, got: ${orgId}`);
4951
+ if (typeof orgId === "number") {
4952
+ if (!Number.isInteger(orgId) || orgId <= 0) {
4953
+ throw new Error(
4954
+ `OrganizationCredsService requires a positive integer orgId, got: ${orgId}`
4955
+ );
4956
+ }
4957
+ } else if (!(orgId == null ? void 0 : orgId.workspaceId)) {
4958
+ throw new Error(
4959
+ "OrganizationCredsService requires a positive integer orgId or { workspaceId }"
4960
+ );
4948
4961
  }
4949
- this.orgId = orgId;
4962
+ this.orgSegment = orgRefToPathSegment(orgId);
4950
4963
  }
4951
4964
  base() {
4952
- return `/v1/organizations/${this.orgId}/creds`;
4965
+ return `/v1/organizations/${this.orgSegment}/creds`;
4953
4966
  }
4954
4967
  // ===========================================================================
4955
4968
  // Read
4956
4969
  // ===========================================================================
4957
4970
  async list(options) {
4958
4971
  var _a;
4959
- log24("Listing org %d credentials", this.orgId);
4972
+ log24("Listing org %s credentials", this.orgSegment);
4960
4973
  const result = await this.request(this.base(), options);
4961
- log24("Found %d credentials for org %d", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgId);
4974
+ log24("Found %d credentials for org %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgSegment);
4962
4975
  return result;
4963
4976
  }
4964
4977
  async get(id, getOptions, options) {
4965
- log24("Getting org %d credential %d (decrypt=%s)", this.orgId, id, getOptions == null ? void 0 : getOptions.decrypt);
4978
+ log24("Getting org %s credential %d (decrypt=%s)", this.orgSegment, id, getOptions == null ? void 0 : getOptions.decrypt);
4966
4979
  const queryString = this.buildQueryString((getOptions == null ? void 0 : getOptions.decrypt) ? { decrypt: "true" } : {});
4967
4980
  const result = await this.request(
4968
4981
  `${this.base()}/${id}${queryString}`,
@@ -4975,7 +4988,7 @@ var OrganizationCredsService = class extends BaseSDK {
4975
4988
  // Create
4976
4989
  // ===========================================================================
4977
4990
  async createKV(data, options) {
4978
- log24("Creating org %d KV credential: %s (type=%s)", this.orgId, data.key, data.type);
4991
+ log24("Creating org %s KV credential: %s (type=%s)", this.orgSegment, data.key, data.type);
4979
4992
  return this.request(`${this.base()}/kv`, {
4980
4993
  body: JSON.stringify(data),
4981
4994
  headers: { "Content-Type": "application/json" },
@@ -4984,7 +4997,7 @@ var OrganizationCredsService = class extends BaseSDK {
4984
4997
  });
4985
4998
  }
4986
4999
  async createOAuth(data, options) {
4987
- log24("Creating org %d OAuth credential: %s", this.orgId, data.key);
5000
+ log24("Creating org %s OAuth credential: %s", this.orgSegment, data.key);
4988
5001
  return this.request(`${this.base()}/oauth`, {
4989
5002
  body: JSON.stringify(data),
4990
5003
  headers: { "Content-Type": "application/json" },
@@ -4993,7 +5006,7 @@ var OrganizationCredsService = class extends BaseSDK {
4993
5006
  });
4994
5007
  }
4995
5008
  async createFile(data, options) {
4996
- log24("Creating org %d file credential: %s", this.orgId, data.key);
5009
+ log24("Creating org %s file credential: %s", this.orgSegment, data.key);
4997
5010
  return this.request(`${this.base()}/file`, {
4998
5011
  body: JSON.stringify(data),
4999
5012
  headers: { "Content-Type": "application/json" },
@@ -5005,7 +5018,7 @@ var OrganizationCredsService = class extends BaseSDK {
5005
5018
  // Update
5006
5019
  // ===========================================================================
5007
5020
  async update(id, data, options) {
5008
- log24("Updating org %d credential %d", this.orgId, id);
5021
+ log24("Updating org %s credential %d", this.orgSegment, id);
5009
5022
  return this.request(`${this.base()}/${id}`, {
5010
5023
  body: JSON.stringify(data),
5011
5024
  headers: { "Content-Type": "application/json" },
@@ -5017,14 +5030,14 @@ var OrganizationCredsService = class extends BaseSDK {
5017
5030
  // Delete
5018
5031
  // ===========================================================================
5019
5032
  async delete(id, options) {
5020
- log24("Deleting org %d credential %d", this.orgId, id);
5033
+ log24("Deleting org %s credential %d", this.orgSegment, id);
5021
5034
  return this.request(`${this.base()}/${id}`, {
5022
5035
  method: "DELETE",
5023
5036
  ...options
5024
5037
  });
5025
5038
  }
5026
5039
  async deleteByKey(key, options) {
5027
- log24("Deleting org %d credential by key: %s", this.orgId, key);
5040
+ log24("Deleting org %s credential by key: %s", this.orgSegment, key);
5028
5041
  return this.request(`${this.base()}/key/${encodeURIComponent(key)}`, {
5029
5042
  method: "DELETE",
5030
5043
  ...options
@@ -5038,8 +5051,8 @@ var OrganizationCredsService = class extends BaseSDK {
5038
5051
  * the org has bound vs. is missing. Reads only; any org member may call.
5039
5052
  */
5040
5053
  async getSkillCredStatus(skillIdentifier, options) {
5041
- log24("Getting org %d skill cred status: %s", this.orgId, skillIdentifier);
5042
- const path = `/v1/organizations/${this.orgId}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
5054
+ log24("Getting org %s skill cred status: %s", this.orgSegment, skillIdentifier);
5055
+ const path = `/v1/organizations/${this.orgSegment}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
5043
5056
  const result = await this.request(
5044
5057
  path,
5045
5058
  options
@@ -5068,9 +5081,13 @@ var OrganizationService2 = class extends BaseSDK {
5068
5081
  * Returns a fresh instance per call; suitable for short-lived UIs where the
5069
5082
  * orgId varies. For long-lived use, cache the returned service.
5070
5083
  *
5084
+ * Accepts either a numeric account id or a `{ workspaceId }` ref; the latter
5085
+ * is addressed server-side as `workspace:<workspaceId>`.
5086
+ *
5071
5087
  * @example
5072
5088
  * ```typescript
5073
5089
  * const orgCreds = market.organizations.creds(42);
5090
+ * const byWs = market.organizations.creds({ workspaceId: 'wks_abc' });
5074
5091
  * await orgCreds.list();
5075
5092
  * ```
5076
5093
  */
@@ -5143,11 +5160,14 @@ var OrganizationService2 = class extends BaseSDK {
5143
5160
  */
5144
5161
  async updateOrganization(orgId, data, options) {
5145
5162
  log25("Updating organization %d: %O", orgId, data);
5146
- const result = await this.request(`/v1/organizations/${orgId}`, {
5147
- ...options,
5148
- body: JSON.stringify(data),
5149
- method: "PATCH"
5150
- });
5163
+ const result = await this.request(
5164
+ `/v1/organizations/${orgRefToPathSegment(orgId)}`,
5165
+ {
5166
+ ...options,
5167
+ body: JSON.stringify(data),
5168
+ method: "PATCH"
5169
+ }
5170
+ );
5151
5171
  return result.data;
5152
5172
  }
5153
5173
  /**
@@ -5160,7 +5180,7 @@ var OrganizationService2 = class extends BaseSDK {
5160
5180
  async archiveOrganization(orgId, options) {
5161
5181
  log25("Archiving organization %d", orgId);
5162
5182
  const result = await this.request(
5163
- `/v1/organizations/${orgId}/archive`,
5183
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/archive`,
5164
5184
  { ...options, method: "POST" }
5165
5185
  );
5166
5186
  return result.data;
@@ -5174,7 +5194,7 @@ var OrganizationService2 = class extends BaseSDK {
5174
5194
  async unarchiveOrganization(orgId, options) {
5175
5195
  log25("Unarchiving organization %d", orgId);
5176
5196
  const result = await this.request(
5177
- `/v1/organizations/${orgId}/unarchive`,
5197
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/unarchive`,
5178
5198
  { ...options, method: "POST" }
5179
5199
  );
5180
5200
  return result.data;
@@ -5188,7 +5208,7 @@ var OrganizationService2 = class extends BaseSDK {
5188
5208
  async listMembers(orgId, options) {
5189
5209
  log25("Listing members of organization %d", orgId);
5190
5210
  const result = await this.request(
5191
- `/v1/organizations/${orgId}/members`,
5211
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
5192
5212
  options
5193
5213
  );
5194
5214
  return result.data;
@@ -5204,11 +5224,14 @@ var OrganizationService2 = class extends BaseSDK {
5204
5224
  */
5205
5225
  async addMember(orgId, userAccountId, role, options) {
5206
5226
  log25("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
5207
- return this.request(`/v1/organizations/${orgId}/members`, {
5208
- ...options,
5209
- body: JSON.stringify({ role, userAccountId }),
5210
- method: "POST"
5211
- });
5227
+ return this.request(
5228
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
5229
+ {
5230
+ ...options,
5231
+ body: JSON.stringify({ role, userAccountId }),
5232
+ method: "POST"
5233
+ }
5234
+ );
5212
5235
  }
5213
5236
  /**
5214
5237
  * Removes a member from an organization. Trusted-client only. Refuses to
@@ -5221,7 +5244,7 @@ var OrganizationService2 = class extends BaseSDK {
5221
5244
  async removeMember(orgId, userAccountId, options) {
5222
5245
  log25("Removing member %d from organization %d", userAccountId, orgId);
5223
5246
  return this.request(
5224
- `/v1/organizations/${orgId}/members/${userAccountId}`,
5247
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
5225
5248
  { ...options, method: "DELETE" }
5226
5249
  );
5227
5250
  }
@@ -5237,7 +5260,7 @@ var OrganizationService2 = class extends BaseSDK {
5237
5260
  async updateMemberRole(orgId, userAccountId, role, options) {
5238
5261
  log25("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
5239
5262
  return this.request(
5240
- `/v1/organizations/${orgId}/members/${userAccountId}`,
5263
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
5241
5264
  { ...options, body: JSON.stringify({ role }), method: "PATCH" }
5242
5265
  );
5243
5266
  }
@@ -5254,11 +5277,14 @@ var OrganizationService2 = class extends BaseSDK {
5254
5277
  */
5255
5278
  async reconcileMembers(orgId, members, options) {
5256
5279
  log25("Reconciling %d members for organization %d", members.length, orgId);
5257
- return this.request(`/v1/organizations/${orgId}/members`, {
5258
- ...options,
5259
- body: JSON.stringify({ members }),
5260
- method: "PUT"
5261
- });
5280
+ return this.request(
5281
+ `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
5282
+ {
5283
+ ...options,
5284
+ body: JSON.stringify({ members }),
5285
+ method: "PUT"
5286
+ }
5287
+ );
5262
5288
  }
5263
5289
  };
5264
5290
 
@@ -6182,6 +6208,7 @@ export {
6182
6208
  VisibilityEnumSchema,
6183
6209
  buildTrustedClientPayload,
6184
6210
  createTrustedClientToken,
6185
- generateNonce
6211
+ generateNonce,
6212
+ orgRefToPathSegment
6186
6213
  };
6187
6214
  //# sourceMappingURL=index.mjs.map