@ai-accounts/vue-headless 0.3.9 → 0.3.11

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.cjs CHANGED
@@ -268,9 +268,16 @@ function useLoginSession() {
268
268
  }
269
269
  }
270
270
  async function respond(answer) {
271
- if (!sessionId.value || !accountId.value) return;
271
+ if (!sessionId.value) {
272
+ throw new Error("No active login session (sessionId is unset)");
273
+ }
274
+ if (!accountId.value) {
275
+ throw new Error("No active backend account (accountId is unset)");
276
+ }
272
277
  const activePrompt = textPrompt.value ?? menuPrompt.value;
273
- if (!activePrompt) return;
278
+ if (!activePrompt) {
279
+ throw new Error("No active prompt to respond to");
280
+ }
274
281
  const promptId = activePrompt.prompt_id;
275
282
  textPrompt.value = null;
276
283
  menuPrompt.value = null;
@@ -281,9 +288,14 @@ function useLoginSession() {
281
288
  await client.writeEagerLogin(accountId.value, sessionId.value, text);
282
289
  }
283
290
  async function cancel() {
284
- if (!sessionId.value || !accountId.value) return;
285
- await client.cancelLogin(accountId.value, sessionId.value);
291
+ const id = accountId.value;
292
+ const sid = sessionId.value;
286
293
  status.value = "cancelled";
294
+ if (!id || !sid) return;
295
+ try {
296
+ await client.cancelLogin(id, sid);
297
+ } catch {
298
+ }
287
299
  }
288
300
  function reset() {
289
301
  status.value = "idle";
@@ -939,7 +951,7 @@ function useStreamingParser(options = {}) {
939
951
  }
940
952
 
941
953
  // src/index.ts
942
- var version = "0.3.9";
954
+ var version = "0.3.11";
943
955
  // Annotate the CommonJS export names for ESM import in node:
944
956
  0 && (module.exports = {
945
957
  aiAccountsKey,
package/dist/index.d.cts CHANGED
@@ -216,6 +216,6 @@ interface UseStreamingParserReturn {
216
216
  */
217
217
  declare function useStreamingParser(options?: UseStreamingParserOptions): UseStreamingParserReturn;
218
218
 
219
- declare const version = "0.3.9";
219
+ declare const version = "0.3.11";
220
220
 
221
221
  export { type AiAccountsContext, type AiAccountsPluginOptions, type BackendResponseState, type LoginStatus, type ProcessGroup, type SynthesisStateRef, type UseAccountWizardOptions, type UseAccountWizardReturn, type UseConversationReturn, type UseLoginSession, type UseOnboardingOptions, type UseOnboardingReturn, type UseProcessGroupsReturn, type UseSmartChatReturn, type UseSmartScrollReturn, type UseStreamingParserOptions, type UseStreamingParserReturn, aiAccountsKey, aiAccountsPlugin, useAccountWizard, useAiAccounts, useBackendRegistry, useConversation, useLoginSession, useOnboarding, useProcessGroups, useSmartChat, useSmartScroll, useStreamingParser, version };
package/dist/index.d.ts CHANGED
@@ -216,6 +216,6 @@ interface UseStreamingParserReturn {
216
216
  */
217
217
  declare function useStreamingParser(options?: UseStreamingParserOptions): UseStreamingParserReturn;
218
218
 
219
- declare const version = "0.3.9";
219
+ declare const version = "0.3.11";
220
220
 
221
221
  export { type AiAccountsContext, type AiAccountsPluginOptions, type BackendResponseState, type LoginStatus, type ProcessGroup, type SynthesisStateRef, type UseAccountWizardOptions, type UseAccountWizardReturn, type UseConversationReturn, type UseLoginSession, type UseOnboardingOptions, type UseOnboardingReturn, type UseProcessGroupsReturn, type UseSmartChatReturn, type UseSmartScrollReturn, type UseStreamingParserOptions, type UseStreamingParserReturn, aiAccountsKey, aiAccountsPlugin, useAccountWizard, useAiAccounts, useBackendRegistry, useConversation, useLoginSession, useOnboarding, useProcessGroups, useSmartChat, useSmartScroll, useStreamingParser, version };
package/dist/index.js CHANGED
@@ -224,9 +224,16 @@ function useLoginSession() {
224
224
  }
225
225
  }
226
226
  async function respond(answer) {
227
- if (!sessionId.value || !accountId.value) return;
227
+ if (!sessionId.value) {
228
+ throw new Error("No active login session (sessionId is unset)");
229
+ }
230
+ if (!accountId.value) {
231
+ throw new Error("No active backend account (accountId is unset)");
232
+ }
228
233
  const activePrompt = textPrompt.value ?? menuPrompt.value;
229
- if (!activePrompt) return;
234
+ if (!activePrompt) {
235
+ throw new Error("No active prompt to respond to");
236
+ }
230
237
  const promptId = activePrompt.prompt_id;
231
238
  textPrompt.value = null;
232
239
  menuPrompt.value = null;
@@ -237,9 +244,14 @@ function useLoginSession() {
237
244
  await client.writeEagerLogin(accountId.value, sessionId.value, text);
238
245
  }
239
246
  async function cancel() {
240
- if (!sessionId.value || !accountId.value) return;
241
- await client.cancelLogin(accountId.value, sessionId.value);
247
+ const id = accountId.value;
248
+ const sid = sessionId.value;
242
249
  status.value = "cancelled";
250
+ if (!id || !sid) return;
251
+ try {
252
+ await client.cancelLogin(id, sid);
253
+ } catch {
254
+ }
243
255
  }
244
256
  function reset() {
245
257
  status.value = "idle";
@@ -895,7 +907,7 @@ function useStreamingParser(options = {}) {
895
907
  }
896
908
 
897
909
  // src/index.ts
898
- var version = "0.3.9";
910
+ var version = "0.3.11";
899
911
  export {
900
912
  aiAccountsKey,
901
913
  aiAccountsPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-accounts/vue-headless",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "Vue 3 headless composables for ai-accounts",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@ai-accounts/ts-core": "0.3.9"
30
+ "@ai-accounts/ts-core": "0.3.11"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vue": "^3.4.0",