@jskit-ai/agent-docs 0.1.48 → 0.1.50

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.
@@ -554,6 +554,52 @@ The default error policy is intent-based. Runtime code reports what kind of erro
554
554
  - `app-recoverable` uses `banner`; shell refresh and recoverable navigation failures stay visible without blocking the app.
555
555
  - `blocking` uses `dialog`; unexpected UI failures and other blocking errors require explicit attention.
556
556
 
557
+ When app code catches a dynamic import failure itself, report it through the shell async module recovery runtime so it uses the same reload banner as router chunk failures:
558
+
559
+ ```js
560
+ import { useShellAsyncModuleRecoveryRuntime } from "@jskit-ai/shell-web/client/asyncModuleRecovery";
561
+
562
+ const asyncModuleRecovery = useShellAsyncModuleRecoveryRuntime();
563
+
564
+ try {
565
+ await import("@xterm/xterm");
566
+ } catch (error) {
567
+ asyncModuleRecovery?.notify(error, {
568
+ label: "Terminal"
569
+ });
570
+ }
571
+ ```
572
+
573
+ `useShellAsyncModuleRecoveryRuntime()` returns `null` when the shell runtime is not available in the current Vue context. That lets app-owned components use optional chaining instead of duplicating shell-web's internal injection token.
574
+
575
+ Use the narrow `@jskit-ai/shell-web/client/asyncModuleRecovery` subpath for this runtime, especially from modules that are imported by Node-mode Vitest suites. The aggregate `@jskit-ai/shell-web/client` barrel also exports the composable for normal Vite app code, but that barrel includes `.vue` component exports and can require Vue SFC handling in tests.
576
+
577
+ Request connectivity failures use a separate shell recovery path. Generated apps already configure TanStack Query to retry transient failures with capped backoff. `shell-web` then observes the app's `jskit.client.query-client` and, when an active query finishes in a transport failure such as `Network request failed.` or `Failed to fetch`, reports an `app-recoverable` banner with a `Retry` action that refetches that exact query. Normal HTTP validation and application errors stay local to the screen.
578
+
579
+ Imperative app code only needs the public runtime when it catches a request failure outside the standard query/resource composables:
580
+
581
+ ```js
582
+ import { useShellRequestRecoveryRuntime } from "@jskit-ai/shell-web/client/requestRecovery";
583
+
584
+ const requestRecovery = useShellRequestRecoveryRuntime();
585
+
586
+ async function loadProjectAccess() {
587
+ try {
588
+ return await fetch("/api/project-access");
589
+ } catch (error) {
590
+ requestRecovery?.report(error, {
591
+ label: "Project access",
592
+ retry: loadProjectAccess
593
+ });
594
+ throw error;
595
+ }
596
+ }
597
+ ```
598
+
599
+ `useShellRequestRecoveryRuntime()` returns `null` when the shell runtime is not available in the current Vue context. Use the narrow `@jskit-ai/shell-web/client/requestRecovery` subpath for the same reason as async module recovery: it avoids pulling `.vue` component exports into Node-mode test suites.
600
+
601
+ For query-backed screens, the default is automatic. Set `meta: { jskit: { requestRecovery: false } }` only when a query deliberately owns its entire connectivity recovery UI. Set `meta: { jskit: { requestRecoveryLabel: "Project access" } }` when the default `Request` label is too generic.
602
+
557
603
  ### The home page talks to the backend
558
604
 
559
605
  `src/pages/home/index.vue` uses Vue Query to fetch `/api/health` and display the result in the UI.
@@ -358,7 +358,7 @@ void bootstrapClientShellApp({
358
358
  });
359
359
  ```
360
360
 
361
- The flow is simple once you read it in order: config in, runtime in memory, router built from that runtime, app-owned Vue plugins created once, app bootstrapped. Pinia, Vue Query, the router, and Vuetify are owned by the base app bootstrap so runtime packages share the same instances instead of carrying independent copies.
361
+ The flow is simple once you read it in order: config in, runtime in memory, router built from that runtime, app-owned Vue plugins created once, app bootstrapped. Pinia, Vue Query, the router, and Vuetify are owned by the base app bootstrap so runtime packages share the same instances instead of carrying independent copies. Passing the same `queryClient` into `bootstrapClientShellApp(...)` also gives `shell-web` the QueryClient it observes for automatic request recovery when transport failures exhaust their normal retries.
362
362
 
363
363
  <DocsInDepth title="In depth" preview-height="15rem">
364
364
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Distributed JSKIT agent references, prompts, guides, and generated reference maps.",
5
5
  "type": "module",
6
6
  "files": [
@@ -68,6 +68,9 @@ Error presentation rules:
68
68
 
69
69
  - Resource load failures should stay local to the screen with the runtime's `loadError` state and a retry action.
70
70
  - Do not force global banners for ordinary list/view/add-edit load failures; the shell error policy treats `resource-load` as `silent` by default.
71
+ - Transport/connectivity failures are different from ordinary resource-load errors. `shell-web` observes the app QueryClient and reports active query failures such as `Network request failed.` or `Failed to fetch` through request recovery with a `Retry` action.
72
+ - For imperative app-caught request failures outside the standard query/resource composables, use `useShellRequestRecoveryRuntime()` from `@jskit-ai/shell-web/client/requestRecovery` and pass a retry callback.
73
+ - Use query meta `jskit.requestRecovery = false` only when a query owns its full connectivity recovery UI, and `jskit.requestRecoveryLabel` when the recovery banner needs a better label.
71
74
  - Use `useUiFeedback()` or `useCommand()` for user-triggered action feedback. Those flows report `action-feedback`, and the app-owned shell error policy decides the channel.
72
75
  - Use explicit shell error intents only for exceptional app-level cases: `app-recoverable` for recoverable shell/runtime failures and `blocking` for failures that require user attention.
73
76
 
@@ -14,6 +14,17 @@ Use this on demand; do not load the full index at startup.
14
14
 
15
15
  ### src
16
16
 
17
+ ### `src/client/asyncModuleRecovery/index.js`
18
+ Exports
19
+ - `SHELL_ASYNC_MODULE_RECOVERY_RUNTIME_KEY`
20
+ - `useShellAsyncModuleRecoveryRuntime`
21
+
22
+ ### `src/client/asyncModuleRecovery/inject.js`
23
+ Exports
24
+ - `SHELL_ASYNC_MODULE_RECOVERY_RUNTIME_KEY`
25
+ - `isShellAsyncModuleRecoveryRuntime(value)`
26
+ - `useShellAsyncModuleRecoveryRuntime()`
27
+
17
28
  ### `src/client/bootstrap/bootstrapErrorStatus.js`
18
29
  Exports
19
30
  - `resolveBootstrapErrorStatusCode(error)`
@@ -194,6 +205,12 @@ Exports
194
205
  - `useShellLayoutState`
195
206
  - `useShellLayoutStore`
196
207
  - `useShellErrorPresentationStore`
208
+ - `SHELL_ASYNC_MODULE_RECOVERY_RUNTIME_KEY`
209
+ - `useShellAsyncModuleRecoveryRuntime`
210
+ - `SHELL_REQUEST_RECOVERY_RUNTIME_KEY`
211
+ - `isRecoverableRequestError`
212
+ - `requestRecoveryMessage`
213
+ - `useShellRequestRecoveryRuntime`
197
214
  - `BOOTSTRAP_PAYLOAD_HANDLER_TAG`
198
215
  - `registerBootstrapPayloadHandler`
199
216
  - `resolveBootstrapPayloadHandlers`
@@ -329,6 +346,40 @@ Local functions
329
346
  - `installRouterErrorBridge(app, errorRuntime, logger)`
330
347
  - `createShellAsyncModuleRecoveryRuntime({ app, logger = null } = {})`
331
348
 
349
+ ### `src/client/requestRecovery/index.js`
350
+ Exports
351
+ - `SHELL_REQUEST_RECOVERY_RUNTIME_KEY`
352
+ - `useShellRequestRecoveryRuntime`
353
+ - `isRecoverableRequestError`
354
+ - `requestRecoveryMessage`
355
+
356
+ ### `src/client/requestRecovery/inject.js`
357
+ Exports
358
+ - `SHELL_REQUEST_RECOVERY_RUNTIME_KEY`
359
+ - `isShellRequestRecoveryRuntime(value)`
360
+ - `useShellRequestRecoveryRuntime()`
361
+
362
+ ### `src/client/requestRecovery/runtime.js`
363
+ Exports
364
+ - `createShellRequestRecoveryRuntime({ app, logger = null } = {})`
365
+ - `isRecoverableRequestError(error = null)`
366
+ - `requestRecoveryMessage(error = null, { label = "Request", message = "" } = {})`
367
+ Local functions
368
+ - `normalizeText(value, fallback = "")`
369
+ - `errorMessage(error = null)`
370
+ - `errorCode(error = null)`
371
+ - `errorName(error = null)`
372
+ - `normalizeRequestErrorStatus(error = null)`
373
+ - `isCanceledRequestError(error = null)`
374
+ - `resolveQueryMeta(query = null)`
375
+ - `isRequestRecoveryDisabled(query = null)`
376
+ - `resolveQueryRecoveryLabel(query = null)`
377
+ - `isActiveQuery(query = null)`
378
+ - `recoverableQueryError(query = null)`
379
+ - `createQueryRetry(queryClient, query = null)`
380
+ - `resolveQueryHash(query = null)`
381
+ - `installRecoverableQueryObserver({ app, runtime, logger } = {})`
382
+
332
383
  ### `src/client/runtime/bootstrapRuntime.js`
333
384
  Exports
334
385
  - `createShellBootstrapRuntime({ app, logger = null, fetchImplementation = globalThis.fetch, bootstrapPath = DEFAULT_BOOTSTRAP_PATH } = {})`