@pagelines/sdk 1.0.877 → 1.0.879

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.
Files changed (92) hide show
  1. package/README.md +68 -68
  2. package/dist/BotProvider.js +777 -0
  3. package/dist/BotProvider.js.map +1 -0
  4. package/dist/{AgentWidgetInline.js → BotWidgetInline.js} +8 -8
  5. package/dist/BotWidgetInline.js.map +1 -0
  6. package/dist/{AgentWidgetModal.js → BotWidgetModal.js} +7 -7
  7. package/dist/BotWidgetModal.js.map +1 -0
  8. package/dist/{AgentWrap.js → BotWrap.js} +1202 -1155
  9. package/dist/BotWrap.js.map +1 -0
  10. package/dist/{agent/AgentController.d.ts → bot/BotController.d.ts} +36 -18
  11. package/dist/bot/index.d.ts +14 -0
  12. package/dist/{agent → bot}/schema.d.ts +6 -6
  13. package/dist/{agent/ui/AgentAvatar.vue.d.ts → bot/ui/BotAvatar.vue.d.ts} +6 -6
  14. package/dist/{agent/ui/AgentChat.vue.d.ts → bot/ui/BotChat.vue.d.ts} +5 -5
  15. package/dist/{agent/ui/AgentProvider.vue.d.ts → bot/ui/BotProvider.vue.d.ts} +3 -3
  16. package/dist/{agent/ui/AgentWrap.vue.d.ts → bot/ui/BotWrap.vue.d.ts} +3 -4
  17. package/dist/{agent/ui/ElAgentAbout.vue.d.ts → bot/ui/ElBotAbout.vue.d.ts} +2 -2
  18. package/dist/{agent/ui/ElAgentChat.vue.d.ts → bot/ui/ElBotChat.vue.d.ts} +5 -5
  19. package/dist/{agent/ui/ElAgentChatPreview.vue.d.ts → bot/ui/ElBotChatPreview.vue.d.ts} +1 -1
  20. package/dist/{agent/ui/ElAgentHeader.vue.d.ts → bot/ui/ElBotHeader.vue.d.ts} +2 -2
  21. package/dist/{agent/ui/ElAgentModeSidebar.vue.d.ts → bot/ui/ElBotModeSidebar.vue.d.ts} +2 -2
  22. package/dist/{agent/ui/ElAgentSidebar.vue.d.ts → bot/ui/ElBotSidebar.vue.d.ts} +2 -2
  23. package/dist/bot/ui/ElCreateBot.vue.d.ts +12 -0
  24. package/dist/{agent → bot}/ui/ElModeHeader.vue.d.ts +2 -2
  25. package/dist/{agent → bot}/ui/ElProvisioningStatus.vue.d.ts +1 -1
  26. package/dist/{agent → bot}/ui/VoiceMode.vue.d.ts +4 -4
  27. package/dist/{agent → bot}/utils.d.ts +5 -5
  28. package/dist/{agent → bot}/voice/provider.d.ts +2 -2
  29. package/dist/{agent → bot}/voice/providers/livekit/provider.d.ts +8 -7
  30. package/dist/{agent → bot}/voice/voice-session-client.d.ts +2 -1
  31. package/dist/{agent → bot}/work-journal.d.ts +1 -1
  32. package/dist/{agent.js → bot.js} +89 -84
  33. package/dist/bot.js.map +1 -0
  34. package/dist/clients/BillingClient.d.ts +1 -1
  35. package/dist/clients/BotClient.d.ts +26 -0
  36. package/dist/clients/ChatClient.d.ts +6 -5
  37. package/dist/clients/ComputerClient.d.ts +16 -0
  38. package/dist/clients/UserClient.d.ts +4 -7
  39. package/dist/clients/types.d.ts +7 -2
  40. package/dist/contract/build.d.ts +1 -2
  41. package/dist/index.d.ts +3 -2
  42. package/dist/provider.js +1 -1
  43. package/dist/provider.js.map +1 -1
  44. package/dist/provider2.js +28 -36
  45. package/dist/provider2.js.map +1 -1
  46. package/dist/sdk.css +1 -1
  47. package/dist/sdk.js +4 -4
  48. package/dist/sdkClient.d.ts +33 -376
  49. package/dist/sdkClient.js +168 -170
  50. package/dist/sdkClient.js.map +1 -1
  51. package/dist/useWidgetState.js +9 -9
  52. package/dist/useWidgetState.js.map +1 -1
  53. package/dist/widget/PLWidget.d.ts +6 -6
  54. package/dist/widget/composables/useWidgetState.d.ts +3 -402
  55. package/dist/widget/index.d.ts +2 -2
  56. package/dist/widget/mode.d.ts +2 -2
  57. package/dist/widget/ui/{AgentWidgetInline.vue.d.ts → BotWidgetInline.vue.d.ts} +2 -2
  58. package/dist/widget/ui/{AgentWidgetModal.vue.d.ts → BotWidgetModal.vue.d.ts} +2 -2
  59. package/dist/widget/ui/{AgentWidgetPopup.vue.d.ts → BotWidgetPopup.vue.d.ts} +4 -4
  60. package/dist/widget.js +206 -206
  61. package/dist/widget.js.map +1 -1
  62. package/package.json +5 -5
  63. package/dist/AgentProvider.js +0 -764
  64. package/dist/AgentProvider.js.map +0 -1
  65. package/dist/AgentWidgetInline.js.map +0 -1
  66. package/dist/AgentWidgetModal.js.map +0 -1
  67. package/dist/AgentWrap.js.map +0 -1
  68. package/dist/agent/index.d.ts +0 -14
  69. package/dist/agent/ui/ElCreateAgent.vue.d.ts +0 -277
  70. package/dist/agent.js.map +0 -1
  71. package/dist/clients/AgentClient.d.ts +0 -48
  72. /package/dist/{agent → bot}/VoiceRecorderController.d.ts +0 -0
  73. /package/dist/{agent/ui/AgentInputEmail.vue.d.ts → bot/ui/BotInputEmail.vue.d.ts} +0 -0
  74. /package/dist/{agent/ui/AgentInputOneTimeCode.vue.d.ts → bot/ui/BotInputOneTimeCode.vue.d.ts} +0 -0
  75. /package/dist/{agent/ui/AgentSidebarClose.vue.d.ts → bot/ui/BotSidebarClose.vue.d.ts} +0 -0
  76. /package/dist/{agent/ui/AgentToolActivityGroup.vue.d.ts → bot/ui/BotToolActivityGroup.vue.d.ts} +0 -0
  77. /package/dist/{agent/ui/AgentWidget.vue.d.ts → bot/ui/BotWidget.vue.d.ts} +0 -0
  78. /package/dist/{agent → bot}/ui/ChatCardBlock.vue.d.ts +0 -0
  79. /package/dist/{agent → bot}/ui/ChatRichText.vue.d.ts +0 -0
  80. /package/dist/{agent → bot}/ui/ChatScroller.vue.d.ts +0 -0
  81. /package/dist/{agent → bot}/ui/ChatVisualBlock.vue.d.ts +0 -0
  82. /package/dist/{agent → bot}/ui/ElAuthGate.vue.d.ts +0 -0
  83. /package/dist/{agent → bot}/ui/ElAuthPanel.vue.d.ts +0 -0
  84. /package/dist/{agent/ui/ElAgentButton.vue.d.ts → bot/ui/ElBotButton.vue.d.ts} +0 -0
  85. /package/dist/{agent → bot}/ui/ElSidebar.vue.d.ts +0 -0
  86. /package/dist/{agent → bot}/ui/VoiceHistogramController.d.ts +0 -0
  87. /package/dist/{agent → bot}/ui/chat-diagram-layout.d.ts +0 -0
  88. /package/dist/{agent → bot}/ui/chat-visual-format.d.ts +0 -0
  89. /package/dist/{agent → bot}/ui/voice-mode-presentation.d.ts +0 -0
  90. /package/dist/{agent → bot}/voice/voice-error-copy.d.ts +0 -0
  91. /package/dist/{agent → bot}/voice/voice-work-state.d.ts +0 -0
  92. /package/dist/widget/ui/{AgentWidgetOnboard.vue.d.ts → BotWidgetOnboard.vue.d.ts} +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PageLines SDK
2
2
 
3
- Lightweight client library for PageLines agent integration. Built for PageLines-owned properties (app, www, widget).
3
+ Lightweight client library for PageLines bot integration. Built for PageLines-owned properties (app, www, widget).
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,8 +16,8 @@ import { PageLinesSDK } from '@pagelines/sdk'
16
16
  // Singleton pattern - shares state across your app
17
17
  const sdk = PageLinesSDK.getInstance({ isDev: true })
18
18
 
19
- // Get public agent
20
- const agent = await sdk.getPublicAgent({ handle: 'andrew' })
19
+ // Get public bot
20
+ const bot = await sdk.getPublicBot({ handle: 'andrew' })
21
21
 
22
22
  // Authenticate user
23
23
  await sdk.requestAuthCode({ email: 'user@example.com' })
@@ -25,7 +25,7 @@ await sdk.loginWithCode({ email: 'user@example.com', code: '123456' })
25
25
 
26
26
  // Access reactive state
27
27
  console.log(sdk.activeUser.value)
28
- console.log(sdk.currentAgent.value)
28
+ console.log(sdk.currentBot.value)
29
29
  console.log(sdk.currentOrg.value)
30
30
  ```
31
31
 
@@ -33,7 +33,7 @@ console.log(sdk.currentOrg.value)
33
33
 
34
34
  **Minimal API Surface**: Clean wrapper methods hide internal complexity. No direct `apiClient` exposure prevents type generation issues.
35
35
 
36
- **Agent-First Architecture**: Agents are primary entities. Organization context derived from agent, not passed redundantly.
36
+ **Bot-First Architecture**: Bots are primary entities. Organization context derived from bot, not passed redundantly.
37
37
 
38
38
  **Singleton by Default**: Browser-only singleton prevents duplicate API calls and separate reactive state. Multiple `getInstance()` calls return same instance.
39
39
 
@@ -63,14 +63,14 @@ const user = await sdk.getCurrentUser()
63
63
  await sdk.logout()
64
64
  ```
65
65
 
66
- ### Agent Access
66
+ ### Bot Access
67
67
 
68
68
  ```typescript
69
- // Public agent by handle (no auth)
70
- const agent = await sdk.getPublicAgent({ handle: 'andrew' })
69
+ // Public bot by handle (no auth)
70
+ const bot = await sdk.getPublicBot({ handle: 'andrew' })
71
71
 
72
- // Public agent by email (no auth)
73
- const agent = await sdk.getAgentByEmail({ email: 'andrew@pagelines.com' })
72
+ // Public bot by email (no auth)
73
+ const bot = await sdk.getBotByEmail({ email: 'andrew@pagelines.com' })
74
74
  ```
75
75
 
76
76
  ### Usage Tracking
@@ -78,7 +78,7 @@ const agent = await sdk.getAgentByEmail({ email: 'andrew@pagelines.com' })
78
78
  ```typescript
79
79
  // Unified tracking method
80
80
  await sdk.trackUsage({
81
- agentId: 'agt_456', // Agent contains orgId
81
+ botId: 'agt_456', // Bot contains orgId
82
82
  type: 'voice', // 'voice' | 'chat'
83
83
  quantity: 45, // Seconds for voice, characters for chat
84
84
  participantId: 'usr_123' // Optional: conversation participant
@@ -95,7 +95,7 @@ sdk.loading.value // boolean
95
95
  sdk.error.value // string | null
96
96
 
97
97
  // Computed properties (auto-derived from activeUser)
98
- sdk.currentAgent.value // Agent | undefined
98
+ sdk.currentBot.value // Bot | undefined
99
99
  sdk.currentOrg.value // OrgInfo | undefined
100
100
  ```
101
101
 
@@ -166,12 +166,12 @@ const testSDK = PageLinesSDK.getInstance({
166
166
  import { PageLinesSDK } from '@pagelines/sdk'
167
167
 
168
168
  const sdk = PageLinesSDK.getInstance({ isDev: import.meta.env.DEV })
169
- const authorAgent = await sdk.getAgentByEmail({ email: 'andrew@pagelines.com' })
169
+ const authorBot = await sdk.getBotByEmail({ email: 'andrew@pagelines.com' })
170
170
 
171
- // Use agent data instead of static strings
172
- const authorAvatar = authorAgent?.avatar?.url
173
- const authorName = authorAgent?.name
174
- const authorBio = authorAgent?.summary
171
+ // Use bot data instead of static strings
172
+ const authorAvatar = authorBot?.avatar?.url
173
+ const authorName = authorBot?.name
174
+ const authorBio = authorBot?.summary
175
175
  ```
176
176
 
177
177
  ### Widget Integration
@@ -181,14 +181,14 @@ import { PLWidget } from '@pagelines/sdk/widget'
181
181
 
182
182
  const widget = new PLWidget({
183
183
  mode: 'modal', // 'inline' | 'popup' | 'modal'
184
- handle: 'andrew', // Or provide agent object directly
185
- context: 'support', // Optional: agent context override
184
+ handle: 'andrew', // Or provide bot object directly
185
+ context: 'support', // Optional: bot context override
186
186
  firstMessage: 'Hi!' // Optional: custom greeting
187
187
  })
188
188
 
189
189
  // Update without re-mount
190
190
  widget.update({
191
- agent: newAgent,
191
+ bot: newBot,
192
192
  context: 'sales'
193
193
  })
194
194
 
@@ -199,17 +199,17 @@ widget.destroy()
199
199
  ### Profile Page
200
200
 
201
201
  ```typescript
202
- import { AgentChat } from '@pagelines/sdk/agent'
202
+ import { BotChat } from '@pagelines/sdk/bot'
203
203
 
204
204
  const sdk = PageLinesSDK.getInstance({ isDev: true })
205
- const agent = await sdk.getPublicAgent({ handle: 'andrew' })
205
+ const bot = await sdk.getPublicBot({ handle: 'andrew' })
206
206
  ```
207
207
 
208
208
  ```vue
209
209
  <template>
210
- <AgentChat
210
+ <BotChat
211
211
  :sdk="sdk"
212
- :agent="agent"
212
+ :bot="bot"
213
213
  theme-color="#3b82f6"
214
214
  />
215
215
  </template>
@@ -220,10 +220,10 @@ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
220
220
  All wrapper methods return `undefined` on error (no exceptions thrown). Check reactive error state for details.
221
221
 
222
222
  ```typescript
223
- const agent = await sdk.getPublicAgent({ handle: 'nonexistent' })
223
+ const bot = await sdk.getPublicBot({ handle: 'nonexistent' })
224
224
 
225
- if (!agent) {
226
- console.error(sdk.error.value) // 'Agent not found'
225
+ if (!bot) {
226
+ console.error(sdk.error.value) // 'Bot not found'
227
227
  }
228
228
  ```
229
229
 
@@ -244,12 +244,12 @@ if (!agent) {
244
244
  ```typescript
245
245
  // ✅ Correct - Use bundled entry points
246
246
  import { PageLinesSDK } from '@pagelines/sdk'
247
- import { AgentChat, AgentProvider } from '@pagelines/sdk/agent'
247
+ import { BotChat, BotProvider } from '@pagelines/sdk/bot'
248
248
  import { PLWidget } from '@pagelines/sdk/widget'
249
249
 
250
250
  // ❌ Wrong - Deep imports don't work
251
251
  import { PageLinesSDK } from '@pagelines/sdk/PageLinesSDK'
252
- import AgentChat from '@pagelines/sdk/agent/ui/AgentChat.vue'
252
+ import BotChat from '@pagelines/sdk/bot/ui/BotChat.vue'
253
253
  ```
254
254
 
255
255
  ## Package Exports
@@ -261,9 +261,9 @@ import AgentChat from '@pagelines/sdk/agent/ui/AgentChat.vue'
261
261
  "import": "./dist/sdk.js",
262
262
  "types": "./dist/sdk.d.ts"
263
263
  },
264
- "./agent": {
265
- "import": "./dist/agent.js",
266
- "types": "./dist/agent.d.ts"
264
+ "./bot": {
265
+ "import": "./dist/bot.js",
266
+ "types": "./dist/bot.d.ts"
267
267
  },
268
268
  "./widget": {
269
269
  "import": "./dist/widget.js",
@@ -273,22 +273,22 @@ import AgentChat from '@pagelines/sdk/agent/ui/AgentChat.vue'
273
273
  }
274
274
  ```
275
275
 
276
- ## Agent-First Architecture
276
+ ## Bot-First Architecture
277
277
 
278
- Agents are primary entities that determine organizational context.
278
+ Bots are primary entities that determine organizational context.
279
279
 
280
280
  ```typescript
281
- // ✅ Agent contains all context
281
+ // ✅ Bot contains all context
282
282
  await sdk.trackUsage({
283
- agentId: 'agt_456', // Includes orgId internally
283
+ botId: 'agt_456', // Includes orgId internally
284
284
  type: 'voice',
285
285
  quantity: 45
286
286
  })
287
287
 
288
288
  // ❌ Don't pass redundant orgId
289
289
  await sdk.trackUsage({
290
- orgId: 'org_123', // Redundant - derived from agentId
291
- agentId: 'agt_456',
290
+ orgId: 'org_123', // Redundant - derived from botId
291
+ botId: 'agt_456',
292
292
  type: 'voice',
293
293
  quantity: 45
294
294
  })
@@ -296,7 +296,7 @@ await sdk.trackUsage({
296
296
 
297
297
  **Benefits**:
298
298
  - Simpler APIs (fewer parameters)
299
- - Single source of truth (agent determines org)
299
+ - Single source of truth (bot determines org)
300
300
  - Automatic context resolution
301
301
  - Consistent across all SDK methods
302
302
 
@@ -314,20 +314,20 @@ sdk.loading.value // Updated during API calls
314
314
  sdk.error.value // Updated on errors
315
315
 
316
316
  // Computed properties (auto-derived)
317
- sdk.currentAgent.value = computed(() => {
317
+ sdk.currentBot.value = computed(() => {
318
318
  const user = sdk.activeUser.value
319
- if (!user?.agents) return undefined
319
+ if (!user?.bots) return undefined
320
320
 
321
- const agentId = user.primaryAgentId || user.agents[0]?.agentId
322
- return user.agents.find(a => a.agentId === agentId)
321
+ const botId = user.primaryBotId || user.bots[0]?.botId
322
+ return user.bots.find(a => a.botId === botId)
323
323
  })
324
324
 
325
325
  sdk.currentOrg.value = computed(() => {
326
- const agent = sdk.currentAgent.value
327
- if (!agent?.orgId) return undefined
326
+ const bot = sdk.currentBot.value
327
+ if (!bot?.orgId) return undefined
328
328
 
329
329
  return sdk.activeUser.value?.orgs.find(org =>
330
- org.orgId === agent.orgId
330
+ org.orgId === bot.orgId
331
331
  )
332
332
  })
333
333
  ```
@@ -336,7 +336,7 @@ sdk.currentOrg.value = computed(() => {
336
336
  - Components auto-update when user changes
337
337
  - No manual state management needed
338
338
  - Consistent with PageLines app patterns
339
- - Agent-first architecture (org derived from agent)
339
+ - Bot-first architecture (org derived from bot)
340
340
 
341
341
  ## Component Integration
342
342
 
@@ -347,16 +347,16 @@ SDK components accept `sdk` prop instead of using global services.
347
347
  ```vue
348
348
  <script setup>
349
349
  import { PageLinesSDK } from '@pagelines/sdk'
350
- import { AgentChat } from '@pagelines/sdk/agent'
350
+ import { BotChat } from '@pagelines/sdk/bot'
351
351
 
352
352
  const sdk = PageLinesSDK.getInstance({ isDev: true })
353
- const agent = await sdk.getPublicAgent({ handle: 'andrew' })
353
+ const bot = await sdk.getPublicBot({ handle: 'andrew' })
354
354
  </script>
355
355
 
356
356
  <template>
357
- <AgentChat
357
+ <BotChat
358
358
  :sdk="sdk"
359
- :agent="agent"
359
+ :bot="bot"
360
360
  theme-color="#3b82f6"
361
361
  />
362
362
  </template>
@@ -364,20 +364,20 @@ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
364
364
 
365
365
  ### Available Components
366
366
 
367
- **AgentChat** - Main agent interface (chat/voice)
368
- **AgentProvider** - Handle → agent resolver wrapper
369
- **ElAgentAbout** - Profile information display
370
- **ElAgentChat** - Text chat interface
371
- **ElAgentVoice** - Voice call interface
372
- **ElAgentSidebar** - Navigation sidebar
367
+ **BotChat** - Main bot interface (chat/voice)
368
+ **BotProvider** - Handle → bot resolver wrapper
369
+ **ElBotAbout** - Profile information display
370
+ **ElBotChat** - Text chat interface
371
+ **ElBotVoice** - Voice call interface
372
+ **ElBotSidebar** - Navigation sidebar
373
373
 
374
374
  ## Security Model
375
375
 
376
- **Public-Only Access**: `getPublicAgent()` and `getAgentByEmail()` only return agents with `visibility: 'public'`.
376
+ **Public-Only Access**: `getPublicBot()` and `getBotByEmail()` only return bots with `visibility: 'public'`.
377
377
 
378
378
  **Authentication Required**: User operations require a valid opaque session token in `sdk.token.value`.
379
379
 
380
- **Rate Limiting**: Widget includes 10 comments/hour per agent, 100 likes/hour (future).
380
+ **Rate Limiting**: Widget includes 10 comments/hour per bot, 100 likes/hour (future).
381
381
 
382
382
  ## Performance Optimization
383
383
 
@@ -395,16 +395,16 @@ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
395
395
 
396
396
  **Wrapper Method Pattern**: Clean function signatures serialize perfectly to `.d.ts` files.
397
397
 
398
- **No Complex Types**: Simple `Promise<Agent | undefined>` instead of Hono RPC types.
398
+ **No Complex Types**: Simple `Promise<Bot | undefined>` instead of Hono RPC types.
399
399
 
400
400
  ```typescript
401
401
  // Clean wrapper method
402
- async getPublicAgent(args: {
402
+ async getPublicBot(args: {
403
403
  handle: string
404
- }): Promise<Agent | undefined>
404
+ }): Promise<Bot | undefined>
405
405
 
406
406
  // Internal complexity hidden
407
- const response = await this.api.agent.public[':handle'].$get({
407
+ const response = await this.api.bot.public[':handle'].$get({
408
408
  param: { handle: args.handle }
409
409
  })
410
410
  ```
@@ -445,20 +445,20 @@ afterEach(() => {
445
445
  **4. Check Error State**: Methods return `undefined` on error.
446
446
 
447
447
  ```typescript
448
- const agent = await sdk.getPublicAgent({ handle: 'test' })
449
- if (!agent) {
448
+ const bot = await sdk.getPublicBot({ handle: 'test' })
449
+ if (!bot) {
450
450
  console.error(sdk.error.value)
451
451
  }
452
452
  ```
453
453
 
454
- **5. Agent-First APIs**: Pass `agentId`, let SDK resolve `orgId`.
454
+ **5. Bot-First APIs**: Pass `botId`, let SDK resolve `orgId`.
455
455
 
456
456
  ```typescript
457
457
  // ✅ Minimal args
458
- await sdk.trackUsage({ agentId, type, quantity })
458
+ await sdk.trackUsage({ botId, type, quantity })
459
459
 
460
460
  // ❌ Redundant args
461
- await sdk.trackUsage({ orgId, agentId, type, quantity })
461
+ await sdk.trackUsage({ orgId, botId, type, quantity })
462
462
  ```
463
463
 
464
464
  ## Architecture Principles