@shadowob/shared 1.1.3 → 1.1.4

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.
@@ -190,6 +190,7 @@ function uniqueValues(values) {
190
190
  function canonicalMentionToken(mention) {
191
191
  if (mention.kind === "channel") return `<#${mention.channelId ?? mention.targetId}>`;
192
192
  if (mention.kind === "server") return `<@server:${mention.serverId ?? mention.targetId}>`;
193
+ if (mention.kind === "app") return `<@app:${mention.appId ?? mention.targetId}>`;
193
194
  if (mention.kind === "here" || mention.kind === "everyone") {
194
195
  const scope = mention.serverId ?? mention.targetId;
195
196
  return scope ? `<!${mention.kind}:${scope}>` : `<!${mention.kind}>`;
@@ -197,6 +198,8 @@ function canonicalMentionToken(mention) {
197
198
  return `<@${mention.userId ?? mention.targetId}>`;
198
199
  }
199
200
  function parseCanonicalMentionToken(token) {
201
+ const app = token.match(/^<@app:([^>]+)>$/u);
202
+ if (app?.[1]) return { kind: "app", targetId: app[1] };
200
203
  const user = token.match(/^<@([^>:]+)>$/u);
201
204
  if (user?.[1]) return { kind: "user", targetId: user[1] };
202
205
  const server = token.match(/^<@server:([^>]+)>$/u);
package/dist/index.cjs CHANGED
@@ -718,6 +718,7 @@ function uniqueValues(values) {
718
718
  function canonicalMentionToken(mention) {
719
719
  if (mention.kind === "channel") return `<#${mention.channelId ?? mention.targetId}>`;
720
720
  if (mention.kind === "server") return `<@server:${mention.serverId ?? mention.targetId}>`;
721
+ if (mention.kind === "app") return `<@app:${mention.appId ?? mention.targetId}>`;
721
722
  if (mention.kind === "here" || mention.kind === "everyone") {
722
723
  const scope = mention.serverId ?? mention.targetId;
723
724
  return scope ? `<!${mention.kind}:${scope}>` : `<!${mention.kind}>`;
@@ -725,6 +726,8 @@ function canonicalMentionToken(mention) {
725
726
  return `<@${mention.userId ?? mention.targetId}>`;
726
727
  }
727
728
  function parseCanonicalMentionToken(token) {
729
+ const app = token.match(/^<@app:([^>]+)>$/u);
730
+ if (app?.[1]) return { kind: "app", targetId: app[1] };
728
731
  const user = token.match(/^<@([^>:]+)>$/u);
729
732
  if (user?.[1]) return { kind: "user", targetId: user[1] };
730
733
  const server = token.match(/^<@server:([^>]+)>$/u);
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.cjs';
2
2
  export { DEFAULT_HOMEPLAY_CATALOG, SHADOW_PLAY_SERVER_TEMPLATE, ShadowHomePlayCatalogItem, ShadowPlayAction, ShadowPlayAvailability, ShadowPlayServerTemplate, getDefaultHomePlay, getPlayBuddyEmail, getPlayBuddyUsername } from './play-catalog/index.cjs';
3
3
  export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, RegisterRequest, Server, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus } from './types/index.cjs';
4
- export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from './message.types-lG4qBSus.cjs';
4
+ export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from './message.types-Ca8col0f.cjs';
5
5
  export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, MessageMentionTextSegment, assignMentionRanges, buildMentionMarkdownLinks, canonicalMentionToken, canonicalizeMentionContent, escapeMarkdownLinkLabel, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isCanonicalMentionToken, isValidEmail, mentionDisplayText, parseCanonicalMentionToken, renderCatSvg, segmentTextByMentions, slugify } from './utils/index.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.js';
2
2
  export { DEFAULT_HOMEPLAY_CATALOG, SHADOW_PLAY_SERVER_TEMPLATE, ShadowHomePlayCatalogItem, ShadowPlayAction, ShadowPlayAvailability, ShadowPlayServerTemplate, getDefaultHomePlay, getPlayBuddyEmail, getPlayBuddyUsername } from './play-catalog/index.js';
3
3
  export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, AuthResponse, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, RegisterRequest, Server, UpdateChannelRequest, UpdateServerRequest, User, UserMembership, UserMembershipTier, UserProfile, UserStatus } from './types/index.js';
4
- export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from './message.types-lG4qBSus.js';
4
+ export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from './message.types-Ca8col0f.js';
5
5
  export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, MessageMentionTextSegment, assignMentionRanges, buildMentionMarkdownLinks, canonicalMentionToken, canonicalizeMentionContent, escapeMarkdownLinkLabel, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isCanonicalMentionToken, isValidEmail, mentionDisplayText, parseCanonicalMentionToken, renderCatSvg, segmentTextByMentions, slugify } from './utils/index.js';
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  renderCatSvg,
33
33
  segmentTextByMentions,
34
34
  slugify
35
- } from "./chunk-E3UBH4AI.js";
35
+ } from "./chunk-44D7I4ZW.js";
36
36
  export {
37
37
  CAT_AVATAR_COUNT,
38
38
  CLIENT_EVENTS,
@@ -20,7 +20,7 @@ interface Message {
20
20
  reactions?: ReactionGroup[];
21
21
  metadata?: MessageMetadata | null;
22
22
  }
23
- type MessageMentionKind = 'user' | 'buddy' | 'channel' | 'server' | 'here' | 'everyone';
23
+ type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone';
24
24
  interface MessageMentionRange {
25
25
  start: number;
26
26
  end: number;
@@ -42,6 +42,10 @@ interface MessageMention {
42
42
  serverName?: string | null;
43
43
  channelId?: string;
44
44
  channelName?: string | null;
45
+ appId?: string;
46
+ appKey?: string;
47
+ appName?: string | null;
48
+ iconUrl?: string | null;
45
49
  userId?: string;
46
50
  username?: string | null;
47
51
  displayName?: string | null;
@@ -57,6 +61,7 @@ interface MessageMetadata {
57
61
  interactiveState?: Record<string, unknown>;
58
62
  commerceCards?: CommerceMessageCard[];
59
63
  paidFileCards?: PaidFileCard[];
64
+ oauthLinkCards?: OAuthLinkCard[];
60
65
  [key: string]: unknown;
61
66
  }
62
67
  interface CommerceOfferCardInput {
@@ -110,6 +115,30 @@ interface PaidFileCard {
110
115
  mode: 'open_paid_file';
111
116
  };
112
117
  }
118
+ interface OAuthLinkCard {
119
+ id: string;
120
+ kind: 'oauth_link';
121
+ appId: string;
122
+ clientId?: string | null;
123
+ title: string;
124
+ description?: string | null;
125
+ iconUrl?: string | null;
126
+ meta?: {
127
+ appName?: string | null;
128
+ avatarUrl?: string | null;
129
+ iconUrl?: string | null;
130
+ coverUrl?: string | null;
131
+ homepageUrl?: string | null;
132
+ origin?: string | null;
133
+ };
134
+ url: string;
135
+ embedUrl?: string | null;
136
+ fallbackUrl?: string | null;
137
+ scopes?: string[];
138
+ action: {
139
+ mode: 'open_iframe' | 'open_external';
140
+ };
141
+ }
113
142
  type MentionSuggestionTrigger = '@' | '#';
114
143
  interface MentionSuggestion {
115
144
  id: string;
@@ -123,6 +152,10 @@ interface MentionSuggestion {
123
152
  serverName?: string | null;
124
153
  channelId?: string;
125
154
  channelName?: string | null;
155
+ appId?: string;
156
+ appKey?: string;
157
+ appName?: string | null;
158
+ iconUrl?: string | null;
126
159
  userId?: string;
127
160
  username?: string | null;
128
161
  displayName?: string | null;
@@ -179,4 +212,4 @@ interface Notification {
179
212
  createdAt: string;
180
213
  }
181
214
 
182
- export type { Attachment as A, CommerceMessageCard as C, MentionSuggestion as M, Notification as N, PaidFileCard as P, ReactionGroup as R, SendMessageRequest as S, Thread as T, UpdateMessageRequest as U, CommerceOfferCardInput as a, CommerceProductCard as b, MentionSuggestionTrigger as c, Message as d, MessageMention as e, MessageMentionKind as f, MessageMentionRange as g, MessageMetadata as h, NotificationType as i };
215
+ export type { Attachment as A, CommerceMessageCard as C, MentionSuggestion as M, Notification as N, OAuthLinkCard as O, PaidFileCard as P, ReactionGroup as R, SendMessageRequest as S, Thread as T, UpdateMessageRequest as U, CommerceOfferCardInput as a, CommerceProductCard as b, MentionSuggestionTrigger as c, Message as d, MessageMention as e, MessageMentionKind as f, MessageMentionRange as g, MessageMetadata as h, NotificationType as i };
@@ -20,7 +20,7 @@ interface Message {
20
20
  reactions?: ReactionGroup[];
21
21
  metadata?: MessageMetadata | null;
22
22
  }
23
- type MessageMentionKind = 'user' | 'buddy' | 'channel' | 'server' | 'here' | 'everyone';
23
+ type MessageMentionKind = 'user' | 'buddy' | 'app' | 'channel' | 'server' | 'here' | 'everyone';
24
24
  interface MessageMentionRange {
25
25
  start: number;
26
26
  end: number;
@@ -42,6 +42,10 @@ interface MessageMention {
42
42
  serverName?: string | null;
43
43
  channelId?: string;
44
44
  channelName?: string | null;
45
+ appId?: string;
46
+ appKey?: string;
47
+ appName?: string | null;
48
+ iconUrl?: string | null;
45
49
  userId?: string;
46
50
  username?: string | null;
47
51
  displayName?: string | null;
@@ -57,6 +61,7 @@ interface MessageMetadata {
57
61
  interactiveState?: Record<string, unknown>;
58
62
  commerceCards?: CommerceMessageCard[];
59
63
  paidFileCards?: PaidFileCard[];
64
+ oauthLinkCards?: OAuthLinkCard[];
60
65
  [key: string]: unknown;
61
66
  }
62
67
  interface CommerceOfferCardInput {
@@ -110,6 +115,30 @@ interface PaidFileCard {
110
115
  mode: 'open_paid_file';
111
116
  };
112
117
  }
118
+ interface OAuthLinkCard {
119
+ id: string;
120
+ kind: 'oauth_link';
121
+ appId: string;
122
+ clientId?: string | null;
123
+ title: string;
124
+ description?: string | null;
125
+ iconUrl?: string | null;
126
+ meta?: {
127
+ appName?: string | null;
128
+ avatarUrl?: string | null;
129
+ iconUrl?: string | null;
130
+ coverUrl?: string | null;
131
+ homepageUrl?: string | null;
132
+ origin?: string | null;
133
+ };
134
+ url: string;
135
+ embedUrl?: string | null;
136
+ fallbackUrl?: string | null;
137
+ scopes?: string[];
138
+ action: {
139
+ mode: 'open_iframe' | 'open_external';
140
+ };
141
+ }
113
142
  type MentionSuggestionTrigger = '@' | '#';
114
143
  interface MentionSuggestion {
115
144
  id: string;
@@ -123,6 +152,10 @@ interface MentionSuggestion {
123
152
  serverName?: string | null;
124
153
  channelId?: string;
125
154
  channelName?: string | null;
155
+ appId?: string;
156
+ appKey?: string;
157
+ appName?: string | null;
158
+ iconUrl?: string | null;
126
159
  userId?: string;
127
160
  username?: string | null;
128
161
  displayName?: string | null;
@@ -179,4 +212,4 @@ interface Notification {
179
212
  createdAt: string;
180
213
  }
181
214
 
182
- export type { Attachment as A, CommerceMessageCard as C, MentionSuggestion as M, Notification as N, PaidFileCard as P, ReactionGroup as R, SendMessageRequest as S, Thread as T, UpdateMessageRequest as U, CommerceOfferCardInput as a, CommerceProductCard as b, MentionSuggestionTrigger as c, Message as d, MessageMention as e, MessageMentionKind as f, MessageMentionRange as g, MessageMetadata as h, NotificationType as i };
215
+ export type { Attachment as A, CommerceMessageCard as C, MentionSuggestion as M, Notification as N, OAuthLinkCard as O, PaidFileCard as P, ReactionGroup as R, SendMessageRequest as S, Thread as T, UpdateMessageRequest as U, CommerceOfferCardInput as a, CommerceProductCard as b, MentionSuggestionTrigger as c, Message as d, MessageMention as e, MessageMentionKind as f, MessageMentionRange as g, MessageMetadata as h, NotificationType as i };
@@ -1,4 +1,4 @@
1
- export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from '../message.types-lG4qBSus.cjs';
1
+ export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from '../message.types-Ca8col0f.cjs';
2
2
 
3
3
  type AgentStatus = 'running' | 'stopped' | 'error';
4
4
  type AgentKernelType = 'claude-code' | 'cursor' | 'mcp-server' | 'custom';
@@ -1,4 +1,4 @@
1
- export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from '../message.types-lG4qBSus.js';
1
+ export { A as Attachment, C as CommerceMessageCard, a as CommerceOfferCardInput, b as CommerceProductCard, M as MentionSuggestion, c as MentionSuggestionTrigger, d as Message, e as MessageMention, f as MessageMentionKind, g as MessageMentionRange, h as MessageMetadata, N as Notification, i as NotificationType, O as OAuthLinkCard, P as PaidFileCard, R as ReactionGroup, S as SendMessageRequest, T as Thread, U as UpdateMessageRequest } from '../message.types-Ca8col0f.js';
2
2
 
3
3
  type AgentStatus = 'running' | 'stopped' | 'error';
4
4
  type AgentKernelType = 'claude-code' | 'cursor' | 'mcp-server' | 'custom';
@@ -233,6 +233,7 @@ function uniqueValues(values) {
233
233
  function canonicalMentionToken(mention) {
234
234
  if (mention.kind === "channel") return `<#${mention.channelId ?? mention.targetId}>`;
235
235
  if (mention.kind === "server") return `<@server:${mention.serverId ?? mention.targetId}>`;
236
+ if (mention.kind === "app") return `<@app:${mention.appId ?? mention.targetId}>`;
236
237
  if (mention.kind === "here" || mention.kind === "everyone") {
237
238
  const scope = mention.serverId ?? mention.targetId;
238
239
  return scope ? `<!${mention.kind}:${scope}>` : `<!${mention.kind}>`;
@@ -240,6 +241,8 @@ function canonicalMentionToken(mention) {
240
241
  return `<@${mention.userId ?? mention.targetId}>`;
241
242
  }
242
243
  function parseCanonicalMentionToken(token) {
244
+ const app = token.match(/^<@app:([^>]+)>$/u);
245
+ if (app?.[1]) return { kind: "app", targetId: app[1] };
243
246
  const user = token.match(/^<@([^>:]+)>$/u);
244
247
  if (user?.[1]) return { kind: "user", targetId: user[1] };
245
248
  const server = token.match(/^<@server:([^>]+)>$/u);
@@ -1,4 +1,4 @@
1
- import { g as MessageMentionRange, e as MessageMention } from '../message.types-lG4qBSus.cjs';
1
+ import { g as MessageMentionRange, e as MessageMention } from '../message.types-Ca8col0f.cjs';
2
2
 
3
3
  type CatPattern = 'none' | 'tabby' | 'tuxedo' | 'siamese' | 'calico' | 'bicolor';
4
4
  type CatExpression = 'smile' | 'open' | 'flat' | 'sad' | 'surprised' | 'kawaii' | 'winking' | 'smirk';
@@ -30,6 +30,9 @@ declare function canonicalMentionToken(mention: Pick<MessageMention, 'kind' | 't
30
30
  declare function parseCanonicalMentionToken(token: string): {
31
31
  kind: 'user';
32
32
  targetId: string;
33
+ } | {
34
+ kind: 'app';
35
+ targetId: string;
33
36
  } | {
34
37
  kind: 'channel';
35
38
  targetId: string;
@@ -1,4 +1,4 @@
1
- import { g as MessageMentionRange, e as MessageMention } from '../message.types-lG4qBSus.js';
1
+ import { g as MessageMentionRange, e as MessageMention } from '../message.types-Ca8col0f.js';
2
2
 
3
3
  type CatPattern = 'none' | 'tabby' | 'tuxedo' | 'siamese' | 'calico' | 'bicolor';
4
4
  type CatExpression = 'smile' | 'open' | 'flat' | 'sad' | 'surprised' | 'kawaii' | 'winking' | 'smirk';
@@ -30,6 +30,9 @@ declare function canonicalMentionToken(mention: Pick<MessageMention, 'kind' | 't
30
30
  declare function parseCanonicalMentionToken(token: string): {
31
31
  kind: 'user';
32
32
  targetId: string;
33
+ } | {
34
+ kind: 'app';
35
+ targetId: string;
33
36
  } | {
34
37
  kind: 'channel';
35
38
  targetId: string;
@@ -19,7 +19,7 @@ import {
19
19
  renderCatSvg,
20
20
  segmentTextByMentions,
21
21
  slugify
22
- } from "../chunk-E3UBH4AI.js";
22
+ } from "../chunk-44D7I4ZW.js";
23
23
  export {
24
24
  CAT_AVATAR_COUNT,
25
25
  assignMentionRanges,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadowob/shared",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",