@fiction/sdk 1.0.124 → 1.0.125

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 (67) hide show
  1. package/README.md +75 -75
  2. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js +42 -0
  3. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js.map +1 -0
  4. package/dist/AgentWidgetInline-Dr5UeJT_.js +35 -0
  5. package/dist/AgentWidgetInline-Dr5UeJT_.js.map +1 -0
  6. package/dist/AgentWidgetModal-BNyYeE7u.js +66 -0
  7. package/dist/AgentWidgetModal-BNyYeE7u.js.map +1 -0
  8. package/dist/{SelfWidgetPopup-BnjmBEmw.js → AgentWidgetPopup-R32cuU36.js} +43 -43
  9. package/dist/AgentWidgetPopup-R32cuU36.js.map +1 -0
  10. package/dist/{SelfWrap.vue_vue_type_script_setup_true_lang-CpHmPyFy.js → AgentWrap.vue_vue_type_script_setup_true_lang-n7BzV9vn.js} +949 -948
  11. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-n7BzV9vn.js.map +1 -0
  12. package/dist/{self/SelfController.d.ts → agent/AgentController.d.ts} +5 -5
  13. package/dist/agent/index.d.ts +10 -0
  14. package/dist/{self → agent}/schema.d.ts +1 -1
  15. package/dist/{self/ui/SelfAgent.vue.d.ts → agent/ui/AgentChat.vue.d.ts} +2 -2
  16. package/dist/{self/ui/SelfModal.vue.d.ts → agent/ui/AgentModal.vue.d.ts} +2 -2
  17. package/dist/{self/ui/SelfProvider.vue.d.ts → agent/ui/AgentProvider.vue.d.ts} +2 -2
  18. package/dist/{self/ui/SelfWrap.vue.d.ts → agent/ui/AgentWrap.vue.d.ts} +7 -6
  19. package/dist/{self/ui/ElSelfAbout.vue.d.ts → agent/ui/ElAgentAbout.vue.d.ts} +2 -2
  20. package/dist/{self/ui/ElSelfAudioVisualizer.vue.d.ts → agent/ui/ElAgentAudioVisualizer.vue.d.ts} +2 -2
  21. package/dist/{self/ui/ElSelfChat.vue.d.ts → agent/ui/ElAgentChat.vue.d.ts} +4 -4
  22. package/dist/{self/ui/ElSelfHeader.vue.d.ts → agent/ui/ElAgentHeader.vue.d.ts} +2 -2
  23. package/dist/{self/ui/ElSelfModeSidebar.vue.d.ts → agent/ui/ElAgentModeSidebar.vue.d.ts} +2 -2
  24. package/dist/{self/ui/ElSelfSidebar.vue.d.ts → agent/ui/ElAgentSidebar.vue.d.ts} +2 -2
  25. package/dist/{self/ui/ElSelfVoice.vue.d.ts → agent/ui/ElAgentVoice.vue.d.ts} +2 -2
  26. package/dist/{self → agent}/ui/ElModeHeader.vue.d.ts +2 -2
  27. package/dist/{self → agent}/utils.d.ts +3 -3
  28. package/dist/{self.js → agent.js} +54 -54
  29. package/dist/agent.js.map +1 -0
  30. package/dist/demo/index.d.ts +14 -13
  31. package/dist/demo.js +41 -41
  32. package/dist/demo.js.map +1 -1
  33. package/dist/sdk.js +1 -1
  34. package/dist/{sdkClient-BdDFoZkI.js → sdkClient-DckMHusL.js} +237 -225
  35. package/dist/sdkClient-DckMHusL.js.map +1 -0
  36. package/dist/sdkClient.d.ts +282 -29
  37. package/dist/sdkStorage.d.ts +4 -0
  38. package/dist/widget/FictionWidget.d.ts +3 -3
  39. package/dist/widget/composables/useFictionWidget.d.ts +4 -4
  40. package/dist/widget/ui/{SelfWidgetInline.vue.d.ts → AgentWidgetInline.vue.d.ts} +2 -2
  41. package/dist/widget/ui/{SelfWidgetModal.vue.d.ts → AgentWidgetModal.vue.d.ts} +2 -2
  42. package/dist/widget/ui/{SelfWidgetPopup.vue.d.ts → AgentWidgetPopup.vue.d.ts} +2 -2
  43. package/dist/widget.js +45 -45
  44. package/dist/widget.js.map +1 -1
  45. package/package.json +5 -5
  46. package/dist/SelfProvider.vue_vue_type_script_setup_true_lang-CLvvlhXk.js +0 -42
  47. package/dist/SelfProvider.vue_vue_type_script_setup_true_lang-CLvvlhXk.js.map +0 -1
  48. package/dist/SelfWidgetInline-Dos-s0sc.js +0 -35
  49. package/dist/SelfWidgetInline-Dos-s0sc.js.map +0 -1
  50. package/dist/SelfWidgetModal-CMLIaqii.js +0 -66
  51. package/dist/SelfWidgetModal-CMLIaqii.js.map +0 -1
  52. package/dist/SelfWidgetPopup-BnjmBEmw.js.map +0 -1
  53. package/dist/SelfWrap.vue_vue_type_script_setup_true_lang-CpHmPyFy.js.map +0 -1
  54. package/dist/sdkClient-BdDFoZkI.js.map +0 -1
  55. package/dist/self/index.d.ts +0 -10
  56. package/dist/self.js.map +0 -1
  57. /package/dist/{self → agent}/ClientAudio.d.ts +0 -0
  58. /package/dist/{self → agent}/constants.d.ts +0 -0
  59. /package/dist/{self/test/SelfController.test.d.ts → agent/test/AgentController.test.d.ts} +0 -0
  60. /package/dist/{self → agent}/test/utils.test.d.ts +0 -0
  61. /package/dist/{self/ui/SelfInputEmail.vue.d.ts → agent/ui/AgentInputEmail.vue.d.ts} +0 -0
  62. /package/dist/{self/ui/SelfInputOneTimeCode.vue.d.ts → agent/ui/AgentInputOneTimeCode.vue.d.ts} +0 -0
  63. /package/dist/{self/ui/SelfSidebarClose.vue.d.ts → agent/ui/AgentSidebarClose.vue.d.ts} +0 -0
  64. /package/dist/{self/ui/SelfWidget.vue.d.ts → agent/ui/AgentWidget.vue.d.ts} +0 -0
  65. /package/dist/{self/ui/ElSelfButton.vue.d.ts → agent/ui/ElAgentButton.vue.d.ts} +0 -0
  66. /package/dist/{self → agent}/ui/ElAuthGate.vue.d.ts +0 -0
  67. /package/dist/{self → agent}/ui/ElSidebar.vue.d.ts +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fiction SDK
2
2
 
3
- Lightweight client library for Fiction digital self integration. Built for Fiction-owned properties (app, www, widget).
3
+ Lightweight client library for Fiction digital agent integration. Built for Fiction-owned properties (app, www, widget).
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,8 +16,8 @@ import { FictionSDK } from '@fiction/sdk'
16
16
  // Singleton pattern - shares state across your app
17
17
  const sdk = FictionSDK.getInstance({ isDev: true })
18
18
 
19
- // Get public digital self
20
- const self = await sdk.getPublicSelf({ handle: 'andrew' })
19
+ // Get public digital agent
20
+ const agent = await sdk.getPublicAgent({ 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.currentSelf.value)
28
+ console.log(sdk.currentAgent.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
- **Self-First Architecture**: Digital selves are primary entities. Organization context derived from self, not passed redundantly.
36
+ **Agent-First Architecture**: Digital agents are primary entities. Organization context derived from agent, 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
 
@@ -60,14 +60,14 @@ const user = await sdk.getCurrentUser()
60
60
  await sdk.logout()
61
61
  ```
62
62
 
63
- ### Digital Self Access
63
+ ### Digital Agent Access
64
64
 
65
65
  ```typescript
66
- // Public self by handle (no auth)
67
- const self = await sdk.getPublicSelf({ handle: 'andrew' })
66
+ // Public agent by handle (no auth)
67
+ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
68
68
 
69
- // Public self by email (no auth)
70
- const self = await sdk.getSelfByEmail({ email: 'andrew@fiction.com' })
69
+ // Public agent by email (no auth)
70
+ const agent = await sdk.getAgentByEmail({ email: 'andrew@fiction.com' })
71
71
  ```
72
72
 
73
73
  ### Usage Tracking
@@ -75,7 +75,7 @@ const self = await sdk.getSelfByEmail({ email: 'andrew@fiction.com' })
75
75
  ```typescript
76
76
  // Unified tracking method
77
77
  await sdk.trackUsage({
78
- selfId: 'slf_456', // Self contains orgId
78
+ agentId: 'agt_456', // Agent contains orgId
79
79
  type: 'voice', // 'voice' | 'chat'
80
80
  quantity: 45, // Seconds for voice, characters for chat
81
81
  participantId: 'usr_123' // Optional: conversation participant
@@ -92,7 +92,7 @@ sdk.loading.value // boolean
92
92
  sdk.error.value // string | null
93
93
 
94
94
  // Computed properties (auto-derived from activeUser)
95
- sdk.currentSelf.value // Self | undefined
95
+ sdk.currentAgent.value // Agent | undefined
96
96
  sdk.currentOrg.value // OrgInfo | undefined
97
97
  ```
98
98
 
@@ -163,12 +163,12 @@ const testSDK = FictionSDK.getInstance({
163
163
  import { FictionSDK } from '@fiction/sdk'
164
164
 
165
165
  const sdk = FictionSDK.getInstance({ isDev: import.meta.env.DEV })
166
- const authorSelf = await sdk.getSelfByEmail({ email: 'andrew@fiction.com' })
166
+ const authorAgent = await sdk.getAgentByEmail({ email: 'andrew@fiction.com' })
167
167
 
168
- // Use digital self data instead of static strings
169
- const authorAvatar = authorSelf?.avatar?.url
170
- const authorName = authorSelf?.name
171
- const authorBio = authorSelf?.summary
168
+ // Use digital agent data instead of static strings
169
+ const authorAvatar = authorAgent?.avatar?.url
170
+ const authorName = authorAgent?.name
171
+ const authorBio = authorAgent?.summary
172
172
  ```
173
173
 
174
174
  ### Widget Integration
@@ -178,14 +178,14 @@ import { FictionWidget } from '@fiction/sdk/widget'
178
178
 
179
179
  const widget = new FictionWidget({
180
180
  mode: 'modal', // 'inline' | 'popup' | 'modal'
181
- handle: 'andrew', // Or provide self object directly
181
+ handle: 'andrew', // Or provide agent object directly
182
182
  context: 'support', // Optional: agent context override
183
183
  firstMessage: 'Hi!' // Optional: custom greeting
184
184
  })
185
185
 
186
186
  // Update without re-mount
187
187
  widget.update({
188
- self: newSelf,
188
+ agent: newAgent,
189
189
  context: 'sales'
190
190
  })
191
191
 
@@ -196,17 +196,17 @@ widget.destroy()
196
196
  ### Profile Page
197
197
 
198
198
  ```typescript
199
- import { SelfAgent } from '@fiction/sdk/self'
199
+ import { AgentChat } from '@fiction/sdk/agent'
200
200
 
201
201
  const sdk = FictionSDK.getInstance({ isDev: true })
202
- const self = await sdk.getPublicSelf({ handle: 'andrew' })
202
+ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
203
203
  ```
204
204
 
205
205
  ```vue
206
206
  <template>
207
- <SelfAgent
207
+ <AgentChat
208
208
  :sdk="sdk"
209
- :self="self"
209
+ :agent="agent"
210
210
  theme-color="#3b82f6"
211
211
  />
212
212
  </template>
@@ -217,10 +217,10 @@ const self = await sdk.getPublicSelf({ handle: 'andrew' })
217
217
  All wrapper methods return `undefined` on error (no exceptions thrown). Check reactive error state for details.
218
218
 
219
219
  ```typescript
220
- const self = await sdk.getPublicSelf({ handle: 'nonexistent' })
220
+ const agent = await sdk.getPublicAgent({ handle: 'nonexistent' })
221
221
 
222
- if (!self) {
223
- console.error(sdk.error.value) // 'Self not found'
222
+ if (!agent) {
223
+ console.error(sdk.error.value) // 'Agent not found'
224
224
  }
225
225
  ```
226
226
 
@@ -241,13 +241,13 @@ if (!self) {
241
241
  ```typescript
242
242
  // ✅ Correct - Use bundled entry points
243
243
  import { FictionSDK } from '@fiction/sdk'
244
- import { SelfAgent, SelfProvider } from '@fiction/sdk/self'
244
+ import { AgentChat, AgentProvider } from '@fiction/sdk/agent'
245
245
  import { FictionWidget } from '@fiction/sdk/widget'
246
- import { getDemoSelves } from '@fiction/sdk/demo'
246
+ import { getDemoAgents } from '@fiction/sdk/demo'
247
247
 
248
248
  // ❌ Wrong - Deep imports don't work
249
249
  import { FictionSDK } from '@fiction/sdk/FictionSDK'
250
- import SelfAgent from '@fiction/sdk/self/ui/SelfAgent.vue'
250
+ import AgentChat from '@fiction/sdk/agent/ui/AgentChat.vue'
251
251
  ```
252
252
 
253
253
  ## Package Exports
@@ -259,9 +259,9 @@ import SelfAgent from '@fiction/sdk/self/ui/SelfAgent.vue'
259
259
  "import": "./dist/sdk.js",
260
260
  "types": "./dist/sdk.d.ts"
261
261
  },
262
- "./self": {
263
- "import": "./dist/self.js",
264
- "types": "./dist/self.d.ts"
262
+ "./agent": {
263
+ "import": "./dist/agent.js",
264
+ "types": "./dist/agent.d.ts"
265
265
  },
266
266
  "./widget": {
267
267
  "import": "./dist/widget.js",
@@ -275,22 +275,22 @@ import SelfAgent from '@fiction/sdk/self/ui/SelfAgent.vue'
275
275
  }
276
276
  ```
277
277
 
278
- ## Self-First Architecture
278
+ ## Agent-First Architecture
279
279
 
280
- Digital selves are primary entities that determine organizational context.
280
+ Digital agents are primary entities that determine organizational context.
281
281
 
282
282
  ```typescript
283
- // ✅ Self contains all context
283
+ // ✅ Agent contains all context
284
284
  await sdk.trackUsage({
285
- selfId: 'slf_456', // Includes orgId internally
285
+ agentId: 'agt_456', // Includes orgId internally
286
286
  type: 'voice',
287
287
  quantity: 45
288
288
  })
289
289
 
290
290
  // ❌ Don't pass redundant orgId
291
291
  await sdk.trackUsage({
292
- orgId: 'org_123', // Redundant - derived from selfId
293
- selfId: 'slf_456',
292
+ orgId: 'org_123', // Redundant - derived from agentId
293
+ agentId: 'agt_456',
294
294
  type: 'voice',
295
295
  quantity: 45
296
296
  })
@@ -298,7 +298,7 @@ await sdk.trackUsage({
298
298
 
299
299
  **Benefits**:
300
300
  - Simpler APIs (fewer parameters)
301
- - Single source of truth (self determines org)
301
+ - Single source of truth (agent determines org)
302
302
  - Automatic context resolution
303
303
  - Consistent across all SDK methods
304
304
 
@@ -316,20 +316,20 @@ sdk.loading.value // Updated during API calls
316
316
  sdk.error.value // Updated on errors
317
317
 
318
318
  // Computed properties (auto-derived)
319
- sdk.currentSelf.value = computed(() => {
319
+ sdk.currentAgent.value = computed(() => {
320
320
  const user = sdk.activeUser.value
321
- if (!user?.selves) return undefined
321
+ if (!user?.agents) return undefined
322
322
 
323
- const selfId = user.primarySelfId || user.selves[0]?.selfId
324
- return user.selves.find(s => s.selfId === selfId)
323
+ const agentId = user.primaryAgentId || user.agents[0]?.agentId
324
+ return user.agents.find(a => a.agentId === agentId)
325
325
  })
326
326
 
327
327
  sdk.currentOrg.value = computed(() => {
328
- const self = sdk.currentSelf.value
329
- if (!self?.orgId) return undefined
328
+ const agent = sdk.currentAgent.value
329
+ if (!agent?.orgId) return undefined
330
330
 
331
331
  return sdk.activeUser.value?.orgs.find(org =>
332
- org.orgId === self.orgId
332
+ org.orgId === agent.orgId
333
333
  )
334
334
  })
335
335
  ```
@@ -338,7 +338,7 @@ sdk.currentOrg.value = computed(() => {
338
338
  - Components auto-update when user changes
339
339
  - No manual state management needed
340
340
  - Consistent with Fiction app patterns
341
- - Self-first architecture (org derived from self)
341
+ - Agent-first architecture (org derived from agent)
342
342
 
343
343
  ## Component Integration
344
344
 
@@ -349,16 +349,16 @@ SDK components accept `sdk` prop instead of using global services.
349
349
  ```vue
350
350
  <script setup>
351
351
  import { FictionSDK } from '@fiction/sdk'
352
- import { SelfAgent } from '@fiction/sdk/self'
352
+ import { AgentChat } from '@fiction/sdk/agent'
353
353
 
354
354
  const sdk = FictionSDK.getInstance({ isDev: true })
355
- const self = await sdk.getPublicSelf({ handle: 'andrew' })
355
+ const agent = await sdk.getPublicAgent({ handle: 'andrew' })
356
356
  </script>
357
357
 
358
358
  <template>
359
- <SelfAgent
359
+ <AgentChat
360
360
  :sdk="sdk"
361
- :self="self"
361
+ :agent="agent"
362
362
  theme-color="#3b82f6"
363
363
  />
364
364
  </template>
@@ -366,36 +366,36 @@ const self = await sdk.getPublicSelf({ handle: 'andrew' })
366
366
 
367
367
  ### Available Components
368
368
 
369
- **SelfAgent** - Main agent interface (chat/voice)
370
- **SelfProvider** - Handle → self resolver wrapper
371
- **SelfAbout** - Profile information display
372
- **SelfChat** - Text chat interface
373
- **SelfVoice** - Voice call interface
374
- **SelfSidebar** - Navigation sidebar
369
+ **AgentChat** - Main agent interface (chat/voice)
370
+ **AgentProvider** - Handle → agent resolver wrapper
371
+ **ElAgentAbout** - Profile information display
372
+ **ElAgentChat** - Text chat interface
373
+ **ElAgentVoice** - Voice call interface
374
+ **ElAgentSidebar** - Navigation sidebar
375
375
 
376
376
  ## Demo Data
377
377
 
378
- Static demo selves for marketing/showcase.
378
+ Static demo agents for marketing/showcase.
379
379
 
380
380
  ```typescript
381
- import { getDemoSelves, getDemoSelfByHandle } from '@fiction/sdk/demo'
381
+ import { getDemoAgents, getDemoAgentByHandle } from '@fiction/sdk/demo'
382
382
 
383
- // All demo selves
384
- const demoSelves = getDemoSelves()
383
+ // All demo agents
384
+ const demoAgents = getDemoAgents()
385
385
 
386
- // Specific demo self
387
- const andrew = getDemoSelfByHandle('andrew')
386
+ // Specific demo agent
387
+ const andrew = getDemoAgentByHandle('andrew')
388
388
  ```
389
389
 
390
- **Single Source of Truth**: Demo data maintained in Fiction app at `src/modules/self/static/data.ts`, bundled into SDK at build time.
390
+ **Single Source of Truth**: Demo data maintained in Fiction app at `src/modules/agent/static/data.ts`, bundled into SDK at build time.
391
391
 
392
392
  ## Security Model
393
393
 
394
- **Public-Only Access**: `getPublicSelf()` and `getSelfByEmail()` only return selves with `visibility: 'public'`.
394
+ **Public-Only Access**: `getPublicAgent()` and `getAgentByEmail()` only return agents with `visibility: 'public'`.
395
395
 
396
396
  **Authentication Required**: User operations require valid JWT token in `sdk.token.value`.
397
397
 
398
- **Rate Limiting**: Widget includes 10 comments/hour per self, 100 likes/hour (future).
398
+ **Rate Limiting**: Widget includes 10 comments/hour per agent, 100 likes/hour (future).
399
399
 
400
400
  ## Performance Optimization
401
401
 
@@ -413,16 +413,16 @@ const andrew = getDemoSelfByHandle('andrew')
413
413
 
414
414
  **Wrapper Method Pattern**: Clean function signatures serialize perfectly to `.d.ts` files.
415
415
 
416
- **No Complex Types**: Simple `Promise<Self | undefined>` instead of Hono RPC types.
416
+ **No Complex Types**: Simple `Promise<Agent | undefined>` instead of Hono RPC types.
417
417
 
418
418
  ```typescript
419
419
  // Clean wrapper method
420
- async getPublicSelf(args: {
420
+ async getPublicAgent(args: {
421
421
  handle: string
422
- }): Promise<Self | undefined>
422
+ }): Promise<Agent | undefined>
423
423
 
424
424
  // Internal complexity hidden
425
- const response = await this.api.self.public[':handle'].$get({
425
+ const response = await this.api.agent.public[':handle'].$get({
426
426
  param: { handle: args.handle }
427
427
  })
428
428
  ```
@@ -463,20 +463,20 @@ afterEach(() => {
463
463
  **4. Check Error State**: Methods return `undefined` on error.
464
464
 
465
465
  ```typescript
466
- const self = await sdk.getPublicSelf({ handle: 'test' })
467
- if (!self) {
466
+ const agent = await sdk.getPublicAgent({ handle: 'test' })
467
+ if (!agent) {
468
468
  console.error(sdk.error.value)
469
469
  }
470
470
  ```
471
471
 
472
- **5. Self-First APIs**: Pass `selfId`, let SDK resolve `orgId`.
472
+ **5. Agent-First APIs**: Pass `agentId`, let SDK resolve `orgId`.
473
473
 
474
474
  ```typescript
475
475
  // ✅ Minimal args
476
- await sdk.trackUsage({ selfId, type, quantity })
476
+ await sdk.trackUsage({ agentId, type, quantity })
477
477
 
478
478
  // ❌ Redundant args
479
- await sdk.trackUsage({ orgId, selfId, type, quantity })
479
+ await sdk.trackUsage({ orgId, agentId, type, quantity })
480
480
  ```
481
481
 
482
482
  ## Architecture Principles
@@ -0,0 +1,42 @@
1
+ import { defineComponent as i, createBlock as c, openBlock as l, mergeProps as u, withCtx as m, createVNode as f } from "vue";
2
+ import { _ as g, a as p } from "./AgentWrap.vue_vue_type_script_setup_true_lang-n7BzV9vn.js";
3
+ const b = /* @__PURE__ */ i({
4
+ __name: "AgentProvider",
5
+ props: {
6
+ sdk: {},
7
+ agent: {},
8
+ handle: {},
9
+ context: {},
10
+ firstMessage: {},
11
+ buttonText: {},
12
+ buttonIcon: {},
13
+ hasClose: { type: Boolean },
14
+ apiBase: {}
15
+ },
16
+ emits: ["close", "error"],
17
+ setup(r, { emit: a }) {
18
+ const e = r, n = a;
19
+ return (x, t) => (l(), c(g, u(e, { class: "agent-provider size-full relative" }), {
20
+ default: m((o) => [
21
+ f(p, {
22
+ sdk: o.sdk,
23
+ agent: o.agent,
24
+ context: o.context,
25
+ "first-message": o.firstMessage,
26
+ "button-text": e.buttonText,
27
+ "button-icon": e.buttonIcon,
28
+ "has-close": e.hasClose,
29
+ "is-active": !0,
30
+ class: "size-full",
31
+ onClose: t[0] || (t[0] = (s) => n("close", s)),
32
+ onError: t[1] || (t[1] = (s) => n("error", s))
33
+ }, null, 8, ["sdk", "agent", "context", "first-message", "button-text", "button-icon", "has-close"])
34
+ ]),
35
+ _: 1
36
+ }, 16));
37
+ }
38
+ });
39
+ export {
40
+ b as _
41
+ };
42
+ //# sourceMappingURL=AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js","sources":["../agent/ui/AgentProvider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { ButtonIconPreset } from '../../widget/FictionWidget'\nimport type { Agent } from '../schema'\nimport AgentChat from './AgentChat.vue'\nimport AgentWrap from './AgentWrap.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n agent?: Agent\n handle?: string\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\n hasClose?: boolean\n apiBase?: string\n}>()\n\nconst emit = defineEmits<{\n close: [value: string]\n error: [message: string]\n}>()\n\n</script>\n\n<template>\n <AgentWrap\n v-slot=\"slotProps\"\n v-bind=\"props\"\n class=\"agent-provider size-full relative\"\n >\n <AgentChat\n :sdk=\"slotProps.sdk\"\n :agent=\"slotProps.agent\"\n :context=\"slotProps.context\"\n :first-message=\"slotProps.firstMessage\"\n :button-text=\"props.buttonText\"\n :button-icon=\"props.buttonIcon\"\n :has-close=\"props.hasClose\"\n :is-active=\"true\"\n class=\"size-full\"\n @close=\"emit('close', $event)\"\n @error=\"emit('error', $event)\"\n />\n </AgentWrap>\n</template>\n"],"names":["props","__props","emit","__emit","_openBlock","_createBlock","AgentWrap","_mergeProps","_withCtx","slotProps","_createVNode","AgentChat","_cache","$event"],"mappings":";;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAYRC,IAAOC;sBAQXC,EAAA,GAAAC,EAkBYC,GAlBZC,EAkBYP,GAhBG,EACb,OAAM,oCAAA,CAAmC,GAAA;AAAA,MAEzC,SAAAQ,EAAA,CAJQC,MAAS;AAAA,QAIjBC,EAYEC,GAAA;AAAA,UAXC,KAAKF,EAAU;AAAA,UACf,OAAOA,EAAU;AAAA,UACjB,SAASA,EAAU;AAAA,UACnB,iBAAeA,EAAU;AAAA,UACzB,eAAaT,EAAM;AAAA,UACnB,eAAaA,EAAM;AAAA,UACnB,aAAWA,EAAM;AAAA,UACjB,aAAW;AAAA,UACZ,OAAM;AAAA,UACL,SAAKY,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEX,EAAI,SAAUW,CAAM;AAAA,UAC3B,SAAKD,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEX,EAAI,SAAUW,CAAM;AAAA,QAAA;;;;;;"}
@@ -0,0 +1,35 @@
1
+ var x = Object.defineProperty;
2
+ var l = (n, c) => x(n, "name", { value: c, configurable: !0 });
3
+ import { defineComponent as g, ref as o, createBlock as v, openBlock as b } from "vue";
4
+ import { _ as m } from "./AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js";
5
+ const M = /* @__PURE__ */ g({
6
+ __name: "AgentWidgetInline",
7
+ props: {
8
+ sdk: {},
9
+ handle: {},
10
+ agent: {},
11
+ context: {},
12
+ firstMessage: {},
13
+ buttonText: {},
14
+ buttonIcon: {}
15
+ },
16
+ setup(n, { expose: c }) {
17
+ const e = n, s = o(e.agent), r = o(e.context), a = o(e.firstMessage), i = o(e.buttonText), u = o(e.buttonIcon);
18
+ function f(t) {
19
+ t.agent !== void 0 && (s.value = t.agent), t.context !== void 0 && (r.value = t.context), t.firstMessage !== void 0 && (a.value = t.firstMessage), t.buttonText !== void 0 && (i.value = t.buttonText), t.buttonIcon !== void 0 && (u.value = t.buttonIcon);
20
+ }
21
+ return l(f, "update"), c({ update: f }), (t, d) => (b(), v(m, {
22
+ sdk: n.sdk,
23
+ handle: n.handle,
24
+ agent: s.value,
25
+ context: r.value,
26
+ "first-message": a.value,
27
+ "button-text": i.value,
28
+ "button-icon": u.value
29
+ }, null, 8, ["sdk", "handle", "agent", "context", "first-message", "button-text", "button-icon"]));
30
+ }
31
+ });
32
+ export {
33
+ M as default
34
+ };
35
+ //# sourceMappingURL=AgentWidgetInline-Dr5UeJT_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentWidgetInline-Dr5UeJT_.js","sources":["../widget/ui/AgentWidgetInline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Agent } from '@fiction/types'\nimport type { ButtonIconPreset, WidgetUpdate } from '../FictionWidget'\nimport { ref } from 'vue'\nimport AgentProvider from '../../agent/ui/AgentProvider.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n agent?: Agent\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\n}>()\n\n// Local state for updateable props\nconst currentAgent = ref<Agent | undefined>(props.agent)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\nconst currentButtonText = ref<string | undefined>(props.buttonText)\nconst currentButtonIcon = ref<ButtonIconPreset | undefined>(props.buttonIcon)\n\nfunction update(updates: WidgetUpdate) {\n if (updates.agent !== undefined)\n currentAgent.value = updates.agent\n if (updates.context !== undefined)\n currentContext.value = updates.context\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n if (updates.buttonText !== undefined)\n currentButtonText.value = updates.buttonText\n if (updates.buttonIcon !== undefined)\n currentButtonIcon.value = updates.buttonIcon\n}\n\ndefineExpose({ update })\n</script>\n\n<template>\n <AgentProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :agent=\"currentAgent\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\n />\n</template>\n"],"names":["props","__props","currentAgent","ref","currentContext","currentFirstMessage","currentButtonText","currentButtonIcon","update","updates","__name","__expose","_createBlock","AgentProvider"],"mappings":";;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAWRC,IAAeC,EAAuBH,EAAM,KAAK,GACjDI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY,GAChEM,IAAoBH,EAAwBH,EAAM,UAAU,GAC5DO,IAAoBJ,EAAkCH,EAAM,UAAU;AAE5E,aAASQ,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,UAAU,WACpBP,EAAa,QAAQO,EAAQ,QAC3BA,EAAQ,YAAY,WACtBL,EAAe,QAAQK,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BJ,EAAoB,QAAQI,EAAQ,eAClCA,EAAQ,eAAe,WACzBH,EAAkB,QAAQG,EAAQ,aAChCA,EAAQ,eAAe,WACzBF,EAAkB,QAAQE,EAAQ;AAAA,IACtC;AAXS,WAAAC,EAAAF,GAAA,WAaTG,EAAa,EAAE,QAAAH,GAAQ,mBAIrBI,EAQEC,GAAA;AAAA,MAPC,KAAKZ,EAAA;AAAA,MACL,QAAQA,EAAA;AAAA,MACR,OAAOC,EAAA;AAAA,MACP,SAASE,EAAA;AAAA,MACT,iBAAeC,EAAA;AAAA,MACf,eAAaC,EAAA;AAAA,MACb,eAAaC,EAAA;AAAA,IAAA;;;"}
@@ -0,0 +1,66 @@
1
+ var b = Object.defineProperty;
2
+ var a = (o, i) => b(o, "name", { value: i, configurable: !0 });
3
+ import { defineComponent as h, ref as n, onMounted as C, nextTick as T, createBlock as k, openBlock as M, withCtx as _, createVNode as p } from "vue";
4
+ import { _ as I } from "./FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js";
5
+ import { _ as B } from "./AgentProvider.vue_vue_type_script_setup_true_lang-CGVFcOmd.js";
6
+ const V = /* @__PURE__ */ h({
7
+ __name: "AgentWidgetModal",
8
+ props: {
9
+ sdk: {},
10
+ handle: {},
11
+ agent: {},
12
+ context: {},
13
+ firstMessage: {},
14
+ buttonText: {},
15
+ buttonIcon: {},
16
+ onClose: { type: Function }
17
+ },
18
+ setup(o, { expose: i }) {
19
+ const e = o, u = n(e.agent), c = n(e.context), r = n(e.firstMessage), f = n(e.buttonText), v = n(e.buttonIcon), s = n(!1);
20
+ C(async () => {
21
+ await T(), setTimeout(() => {
22
+ s.value = !0;
23
+ }, 10);
24
+ });
25
+ function m(t) {
26
+ t.agent !== void 0 && (u.value = t.agent), t.context !== void 0 && (c.value = t.context), t.firstMessage !== void 0 && (r.value = t.firstMessage), t.buttonText !== void 0 && (f.value = t.buttonText), t.buttonIcon !== void 0 && (v.value = t.buttonIcon);
27
+ }
28
+ a(m, "update");
29
+ function l() {
30
+ s.value = !1, setTimeout(() => {
31
+ e.onClose && e.onClose();
32
+ }, 300);
33
+ }
34
+ a(l, "close");
35
+ function d() {
36
+ s.value = !0;
37
+ }
38
+ return a(d, "open"), i({ update: m, close: l, open: d }), (t, x) => (M(), k(I, {
39
+ vis: s.value,
40
+ "disable-teleport": !0,
41
+ "modal-class": "max-w-4xl h-[80vh] md:h-[600px]",
42
+ "has-close": !1,
43
+ "onUpdate:vis": x[0] || (x[0] = (g) => s.value = g),
44
+ onClose: l
45
+ }, {
46
+ default: _(() => [
47
+ p(B, {
48
+ sdk: o.sdk,
49
+ handle: o.handle,
50
+ agent: u.value,
51
+ context: c.value,
52
+ "first-message": r.value,
53
+ "button-text": f.value,
54
+ "button-icon": v.value,
55
+ "has-close": !0,
56
+ onClose: l
57
+ }, null, 8, ["sdk", "handle", "agent", "context", "first-message", "button-text", "button-icon"])
58
+ ]),
59
+ _: 1
60
+ }, 8, ["vis"]));
61
+ }
62
+ });
63
+ export {
64
+ V as default
65
+ };
66
+ //# sourceMappingURL=AgentWidgetModal-BNyYeE7u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentWidgetModal-BNyYeE7u.js","sources":["../widget/ui/AgentWidgetModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Agent } from '@fiction/types'\nimport type { ButtonIconPreset, WidgetUpdate } from '../FictionWidget'\nimport { nextTick, onMounted, ref } from 'vue'\nimport FModal from '@/ui/common/FModal.vue'\nimport AgentProvider from '../../agent/ui/AgentProvider.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n agent?: Agent\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\n onClose?: () => void\n}>()\n\nconst currentAgent = ref<Agent | undefined>(props.agent)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\nconst currentButtonText = ref<string | undefined>(props.buttonText)\nconst currentButtonIcon = ref<ButtonIconPreset | undefined>(props.buttonIcon)\nconst isVisible = ref(false)\n\n// Trigger transition after mount\nonMounted(async () => {\n await nextTick()\n // Small delay to ensure DOM is ready and transition fires\n setTimeout(() => {\n isVisible.value = true\n }, 10)\n})\n\nfunction update(updates: WidgetUpdate) {\n if (updates.agent !== undefined)\n currentAgent.value = updates.agent\n if (updates.context !== undefined)\n currentContext.value = updates.context\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n if (updates.buttonText !== undefined)\n currentButtonText.value = updates.buttonText\n if (updates.buttonIcon !== undefined)\n currentButtonIcon.value = updates.buttonIcon\n}\n\nfunction close() {\n isVisible.value = false\n // Wait for transition to complete before calling onClose\n setTimeout(() => {\n if (props.onClose) {\n props.onClose()\n }\n }, 300) // Match FModal transition duration\n}\n\nfunction open() {\n isVisible.value = true\n}\n\ndefineExpose({ update, close, open })\n</script>\n\n<template>\n <FModal\n :vis=\"isVisible\"\n :disable-teleport=\"true\"\n modal-class=\"max-w-4xl h-[80vh] md:h-[600px]\"\n :has-close=\"false\"\n @update:vis=\"isVisible = $event\"\n @close=\"close\"\n >\n <AgentProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :agent=\"currentAgent\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\n :has-close=\"true\"\n @close=\"close\"\n />\n </FModal>\n</template>\n"],"names":["props","__props","currentAgent","ref","currentContext","currentFirstMessage","currentButtonText","currentButtonIcon","isVisible","onMounted","nextTick","update","updates","__name","close","open","__expose","_createBlock","FModal","_cache","$event","_createVNode","AgentProvider"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,UAAMA,IAAQC,GAWRC,IAAeC,EAAuBH,EAAM,KAAK,GACjDI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY,GAChEM,IAAoBH,EAAwBH,EAAM,UAAU,GAC5DO,IAAoBJ,EAAkCH,EAAM,UAAU,GACtEQ,IAAYL,EAAI,EAAK;AAG3B,IAAAM,EAAU,YAAY;AACpB,YAAMC,EAAA,GAEN,WAAW,MAAM;AACf,QAAAF,EAAU,QAAQ;AAAA,MACpB,GAAG,EAAE;AAAA,IACP,CAAC;AAED,aAASG,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,UAAU,WACpBV,EAAa,QAAQU,EAAQ,QAC3BA,EAAQ,YAAY,WACtBR,EAAe,QAAQQ,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BP,EAAoB,QAAQO,EAAQ,eAClCA,EAAQ,eAAe,WACzBN,EAAkB,QAAQM,EAAQ,aAChCA,EAAQ,eAAe,WACzBL,EAAkB,QAAQK,EAAQ;AAAA,IACtC;AAXS,IAAAC,EAAAF,GAAA;AAaT,aAASG,IAAQ;AACf,MAAAN,EAAU,QAAQ,IAElB,WAAW,MAAM;AACf,QAAIR,EAAM,WACRA,EAAM,QAAA;AAAA,MAEV,GAAG,GAAG;AAAA,IACR;AARS,IAAAa,EAAAC,GAAA;AAUT,aAASC,IAAO;AACd,MAAAP,EAAU,QAAQ;AAAA,IACpB;AAFS,WAAAK,EAAAE,GAAA,SAITC,EAAa,EAAE,QAAAL,GAAQ,OAAAG,GAAO,MAAAC,EAAA,CAAM,mBAIlCE,EAmBSC,GAAA;AAAA,MAlBN,KAAKV,EAAA;AAAA,MACL,oBAAkB;AAAA,MACnB,eAAY;AAAA,MACX,aAAW;AAAA,MACX,gBAAUW,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEZ,EAAA,QAAYY;AAAA,MACxB,SAAON;AAAA,IAAA;iBAER,MAUE;AAAA,QAVFO,EAUEC,GAAA;AAAA,UATC,KAAKrB,EAAA;AAAA,UACL,QAAQA,EAAA;AAAA,UACR,OAAOC,EAAA;AAAA,UACP,SAASE,EAAA;AAAA,UACT,iBAAeC,EAAA;AAAA,UACf,eAAaC,EAAA;AAAA,UACb,eAAaC,EAAA;AAAA,UACb,aAAW;AAAA,UACX,SAAOO;AAAA,QAAA;;;;;;"}