@jskit-ai/agent-docs 0.1.379 → 0.1.381

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 (29) hide show
  1. package/guide/agent/app-extras/assistant-conversation.md +3 -1
  2. package/guide/agent/app-extras/assistant.md +143 -20
  3. package/guide/agent/app-setup/material-3-migration.md +2 -1
  4. package/guide/agent/framework/material-3.md +2 -0
  5. package/guide/agent/framework/test-pass.md +3 -2
  6. package/guide/agent/framework/typed-features.md +16 -7
  7. package/package.json +1 -1
  8. package/patterns/minimal-foundation/example/package.json +1 -1
  9. package/patterns/shell-foundation/example/package.json +2 -2
  10. package/reference/autogen/PATTERN_INDEX.md +30 -19
  11. package/reference/autogen/packages/assistant-core.md +71 -4
  12. package/reference/autogen/packages/assistant-runtime.md +9 -1
  13. package/reference/autogen/packages/shell-web.md +13 -0
  14. package/reference/autogen/tooling/jskit-catalog.md +13 -2
  15. package/skills/jskit/references/material-3.md +2 -0
  16. package/skills/jskit/references/pattern-index.md +30 -19
  17. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +1 -1
  18. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +2 -2
  19. package/skills/jskit/references/patterns/assistant/model-sized-results/PATTERN.md +147 -0
  20. package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/inbox.js +37 -0
  21. package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/inboxActions.js +90 -0
  22. package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/types.js +21 -0
  23. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  24. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +1 -1
  25. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  26. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +2 -2
  27. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +3 -3
  28. package/skills/jskit/references/test-pass.md +3 -2
  29. package/skills/jskit/references/typed-features.md +16 -7
@@ -588,6 +588,9 @@ Exports
588
588
  - `type CodexConversationResult`
589
589
  - `type CodexProviderBorrow`
590
590
  - `type CodexConversationCommands`
591
+ Local functions
592
+ - `codexTurnMessages(conversationId, turn, messageId)`
593
+ - `readCodexTurns(provider, conversationId, after, messageId)`
591
594
 
592
595
  ### `src/server/conversation/codexConversationStops.js`
593
596
  Exports
@@ -1460,6 +1463,11 @@ Exports
1460
1463
  - `createNativeHistoryExport(onRecord, { signal, maxBytes = 2 * 1024 ** 3 } = {})`
1461
1464
  - `retireNativeConversation({ binding, inspect, remove, beforeDelete, readConversation, exportConversation })`
1462
1465
 
1466
+ ### `src/server/conversation/nativeOutputCursor.js`
1467
+ Exports
1468
+ - `nativeOutputKey(message)`
1469
+ - `messagesFromCursor(messages, after, { anywhere = false } = {})`
1470
+
1463
1471
  ### `src/server/conversation/nativeStorage.js`
1464
1472
  Exports
1465
1473
  - `nativeConversationStoragePolicy(engineId)`
@@ -1721,6 +1729,7 @@ Exports
1721
1729
  - `scopedConversationInput(conversationId)`
1722
1730
  - `unsupportedScopedConversation()`
1723
1731
  - `createScopedConversationHandle({ conversationId, sendNative, readNative, waitNative, cancel, deleteConversation, disposeOpening })`
1732
+ - `persistentConversationReadAfter(record)`
1724
1733
  - `projectStoredPersistentConversation(options)`
1725
1734
  - `readPersistentConversation(options)`
1726
1735
  - `startPersistentConversationTurn(options)`
@@ -1738,8 +1747,16 @@ Local functions
1738
1747
  - `qualifyTranscript(turns, record, response, receipts)`
1739
1748
  - `publishTranscript({ sessionId, store, receipts, publish }, context, record, turns, response = {})`
1740
1749
  - `streamMessage({ sessionId, store, projection, publish }, context, record, event)`
1741
- - `projectPersistentConversation(options, context, record, response, turns)`
1742
- - `requestTurn(store, sessionId, messageId)`
1750
+ - `nativeOutputCursor(record)`
1751
+ - `indexedTurn(store, scope, messageId)`
1752
+ - `requestTurn(store, scope, messageId)`
1753
+ - `requestTurnsOf(turns)`
1754
+ - `holdsNativeMessage(turn, message)`
1755
+ - `readNativeOutput(options, context, record, cursor)`
1756
+ - `snapshotMessages(turns, record, response, { receipts, projection })`
1757
+ - `incompleteMessages(response, record, projection, shown)`
1758
+ - `windowedMessages(options, scope, record, response, { beforeMessageId = "", limit = 0 })`
1759
+ - `projectPersistentConversation(options, context, record, response)`
1743
1760
 
1744
1761
  ### `src/server/conversation/runtime.js`
1745
1762
  Exports
@@ -2034,6 +2051,7 @@ Exports
2034
2051
  - `writeNdjson`
2035
2052
  - `resolveWorkspaceSlug`
2036
2053
  - `createServiceToolCatalog`
2054
+ - `readTextPart`
2037
2055
  - `MCP_PROTOCOL_VERSIONS`
2038
2056
  - `MCP_TOOL_CATALOG_OPTIONS`
2039
2057
  - `createMcpToolServer`
@@ -2053,6 +2071,16 @@ Exports
2053
2071
  Local functions
2054
2072
  - `sdkMessages(messages)`
2055
2073
 
2074
+ ### `src/server/lib/longTextFields.js`
2075
+ Exports
2076
+ - `cutLongTextFields(result, declarations)`
2077
+ - `longTextNote(declarations)`
2078
+ - `normalizeLongTextDeclarations(actionId, value, isReadAction)`
2079
+ Local functions
2080
+ - `parseLongTextPath(actionId, path)`
2081
+ - `cutRecord(record, declaration)`
2082
+ - `cutRecords(value, steps, declaration)`
2083
+
2056
2084
  ### `src/server/lib/mcpToolServer.js`
2057
2085
  Exports
2058
2086
  - `MCP_PROTOCOL_VERSIONS`
@@ -2134,9 +2162,7 @@ Exports
2134
2162
  Local functions
2135
2163
  - `parseToolPayload(argumentsText)`
2136
2164
  - `normalizeNonNegativeInteger(value, fallback)`
2137
- - `serializedByteLength(value)`
2138
2165
  - `createToolError(status, code, message)`
2139
- - `ensureSerializedSize(value, maxBytes, { code = "assistant_tool_result_too_large", label = "Tool result" } = {})`
2140
2166
  - `ensureToolArgumentsSize(argumentsText, maxBytes)`
2141
2167
  - `normalizeActionLookupKey(actionId, version)`
2142
2168
  - `normalizeDiscoveryQuery(value)`
@@ -2150,6 +2176,7 @@ Local functions
2150
2176
  - `stripWorkspaceSlugFromSchema(schema, context = {})`
2151
2177
  - `canUseToolOnSurface(entry = {}, context = {})`
2152
2178
  - `reportNoToolFailure()`
2179
+ - `resultOwner(context)`
2153
2180
 
2154
2181
  ### `src/server/lib/serviceToolEntries.js`
2155
2182
  Exports
@@ -2168,6 +2195,28 @@ Local functions
2168
2195
  - `normalizeSurfaceList(value)`
2169
2196
  - `resolveActionBackedToolEntries(actions, { includeActionsWithoutOutput = false } = {})`
2170
2197
 
2198
+ ### `src/server/lib/textParts.js`
2199
+ Exports
2200
+ - `readTextPart(text, offset, length)`
2201
+ Local functions
2202
+ - `splitsCharacter(text, index)`
2203
+
2204
+ ### `src/server/lib/toolResultParts.js`
2205
+ Exports
2206
+ - `KEPT_RESULT_CHARACTERS`
2207
+ - `KEPT_RESULT_MILLISECONDS`
2208
+ - `RESULT_READ_ACTION_ID`
2209
+ - `RESULT_READ_TOOL`
2210
+ - `createToolResultParts({ maxResultBytes, now = Date.now })`
2211
+ Local functions
2212
+ - `pieceWidth(json, index, inString)`
2213
+ - `escapedBytes(json, index, width)`
2214
+ - `pieceAt(json, offset)`
2215
+ - `partEnd(json, start, inString, budget)`
2216
+ - `partNote({ offset, end, total, resultId, readOn })`
2217
+ - `toolResultPart({ json, offset, end, resultId, readOn })`
2218
+ - `resultUnknownError()`
2219
+
2171
2220
  ### `src/server/types.js`
2172
2221
  Exports
2173
2222
  - `type ConversationRuntime`
@@ -2538,3 +2587,21 @@ Local functions
2538
2587
  ### `fixtures/responsive-assistant/vite.config.mjs`
2539
2588
  Exports
2540
2589
  - None
2590
+
2591
+ ### patterns
2592
+
2593
+ ### `patterns/model-sized-results/example/packages/inbox/src/server/inbox.js`
2594
+ Exports
2595
+ - `createInbox({ messages })`
2596
+
2597
+ ### `patterns/model-sized-results/example/packages/inbox/src/server/inboxActions.js`
2598
+ Exports
2599
+ - `ACTION_READ_MESSAGE_TEXT`
2600
+ - `ACTION_READ_THREAD`
2601
+ - `createInboxActions({ inbox })`
2602
+
2603
+ ### `patterns/model-sized-results/example/packages/inbox/src/server/types.js`
2604
+ Exports
2605
+ - `type InboxMessage`
2606
+ - `type InboxMessages`
2607
+ - `type Inbox`
@@ -156,6 +156,13 @@ Local functions
156
156
  - `ignoreConversationEvent()`
157
157
  - `ignoreSubscriptionError()`
158
158
 
159
+ ### `src/client/support/turnRecovery.js`
160
+ Exports
161
+ - `UNCONFIRMED_TURN_CODE`
162
+ - `askServerToStop(sendStop, endsAt)`
163
+ - `endedWithoutOutcome({ doneStatus, failed, error })`
164
+ - `pauseBeforeReading(attempt, signal)`
165
+
159
166
  ### `src/client/support/workspaceScopeSupport.js`
160
167
  Exports
161
168
  - `useWorkspaceWebScopeSupport()`
@@ -403,7 +410,7 @@ Exports
403
410
  Local functions
404
411
  - `normalizeStreamInput(payload = {})`
405
412
  - `savedMessageFields(error)`
406
- - `streamErrorMessageFields(error, aborted)`
413
+ - `streamErrorMessageFields(error)`
407
414
  - `waitUnlessAborted(previous, signal)`
408
415
  - `isAbortError(error)`
409
416
  - `toCompactJson(value, fallback = "{}")`
@@ -529,6 +536,7 @@ Exports
529
536
  Exports
530
537
  - `DEFAULT_CONVERSATION_TITLE`
531
538
  - `assistantRuntimeConfig`
539
+ - `resolveTurnTimeoutMs(appConfig)`
532
540
 
533
541
  ### `src/shared/assistantSurfaces.js`
534
542
  Exports
@@ -144,6 +144,10 @@ Local functions
144
144
  Exports
145
145
  - None
146
146
 
147
+ ### `src/client/components/ShellPageTitleTrailing.vue`
148
+ Exports
149
+ - None
150
+
147
151
  ### `src/client/components/ShellPrimaryAction.vue`
148
152
  Exports
149
153
  - None
@@ -371,6 +375,7 @@ Exports
371
375
  - `ShellListDetail`
372
376
  - `ShellUpButton`
373
377
  - `ShellPageTitle`
378
+ - `ShellPageTitleTrailing`
374
379
  - `ShellPageActionsTarget`
375
380
  - `useShellAppBar`
376
381
  - `useShellLayoutState`
@@ -628,6 +633,7 @@ Exports
628
633
  - `ICON_BUTTON_WIDTH`
629
634
  - `WIDE_BAR_TITLE_FLOOR`
630
635
  - `contentWidth(element)`
636
+ - `titleRowWidth(title, wholeTitle)`
631
637
  - `wholeTitleWidth(title)`
632
638
  - `widthInRow(element)`
633
639
  - `widthOfChildren(element)`
@@ -684,11 +690,14 @@ Exports
684
690
  Exports
685
691
  - `NO_SHELL_NAVIGATION_PRESENTATION`
686
692
  - `NO_SHELL_PAGE_ACTIONS_TARGET`
693
+ - `NO_SHELL_PAGE_TITLE_TRAILING_TARGET`
687
694
  - `NO_VUETIFY_ICONS`
688
695
  - `NO_VUETIFY_LIST`
689
696
  - `SHELL_NAVIGATION_PRESENTATION_KEY`
690
697
  - `SHELL_PAGE_ACTIONS_ID`
691
698
  - `SHELL_PAGE_ACTIONS_TARGET_KEY`
699
+ - `SHELL_PAGE_TITLE_TRAILING_ID`
700
+ - `SHELL_PAGE_TITLE_TRAILING_TARGET_KEY`
692
701
  - `VUETIFY_ICONS_KEY`
693
702
  - `VUETIFY_LIST_KEY`
694
703
  - `filledIconAlias(icon, aliases)`
@@ -855,6 +864,10 @@ Exports
855
864
  Local functions
856
865
  - `press(name)`
857
866
 
867
+ ### `fixtures/adaptive-shell/src/JobPage.vue`
868
+ Exports
869
+ - None
870
+
858
871
  ### `fixtures/adaptive-shell/src/LongActionsPage.vue`
859
872
  Exports
860
873
  - None
@@ -455,17 +455,20 @@ Exports
455
455
  - `planTestRuns(args, { cwd = process.cwd(), concurrency = testConcurrency() } = {})`
456
456
  - `runTestPool(groups)`
457
457
  - `runTests(args)`
458
+ - `runnerInvocation(options)`
458
459
  - `withTimeReporter(run, destination)`
459
460
  Local functions
460
461
  - `readMarkedFiles(files, cwd)`
461
462
  - `markedDestination(destination, kind)`
462
463
  - `markedRunOptions(options, kind)`
463
- - `markedShard(files, options)`
464
+ - `splitArguments(args, cwd)`
465
+ - `takeShard(options)`
466
+ - `longestFirst(first, second)`
467
+ - `startOrder(files, recorded, shard)`
464
468
  - `databaseShortfall(databases, asked)`
465
469
  - `runNode(args, env)`
466
470
  - `listTestFiles(args)`
467
471
  - `pooledName({ group, file })`
468
- - `longestFirst(first, second)`
469
472
  - `reportPoolTimes(groups, wallMs)`
470
473
  - `textOf(stream)`
471
474
 
@@ -515,6 +518,14 @@ Local functions
515
518
  - `refusal(command, host, port)`
516
519
  - `connectTarget(args)`
517
520
 
521
+ ### `scripts/testing/run-files.mjs`
522
+ Exports
523
+ - None
524
+ Local functions
525
+ - `reporterSpecifier(name)`
526
+ - `loadReporter(name)`
527
+ - `interrupt()`
528
+
518
529
  ### `scripts/testing/runs.mjs`
519
530
  Exports
520
531
  - `checkTestRuns({ projectRoot, manifests })`
@@ -280,6 +280,8 @@ dialog, chip or FAB.
280
280
  the whole title, wider bars beside 200px of it (a longer title truncates);
281
281
  the rest go there, last first, then top-right items that don't fit, after
282
282
  wider bars hide the account's name. Put the most used first.
283
+ - **After the title:** status chips go in `ShellPageTitleTrailing` on large
284
+ windows, else in the content.
283
285
  - **Window size classes:** compact under 600 (navigation bar), medium 600–839
284
286
  (navigation rail), expanded 840–1199 and large from 1200 (drawer), read from
285
287
  `useShellWindowSizeClass()`
@@ -15,7 +15,7 @@ A concrete Fastify, Vue, and JSKIT application foundation for products that do n
15
15
 
16
16
  - Id: `app/minimal-foundation`
17
17
  - Keywords: `app`, `fastify`, `foundation`, `minimal`, `server`, `vite`, `vue`
18
- - Owner: `@jskit-ai/agent-docs@0.1.379`
18
+ - Owner: `@jskit-ai/agent-docs@0.1.381`
19
19
  - Read: [PATTERN.md](patterns/app/minimal-foundation/PATTERN.md)
20
20
  - Examples: [example/](patterns/app/minimal-foundation/example/)
21
21
  - Requires: `@jskit-ai/http-runtime`, `@jskit-ai/kernel`
@@ -26,7 +26,7 @@ A concrete JSKIT web application foundation with responsive shell navigation, se
26
26
 
27
27
  - Id: `app/shell-foundation`
28
28
  - Keywords: `app`, `foundation`, `material`, `navigation`, `placements`, `shell`, `vite`, `vue`
29
- - Owner: `@jskit-ai/agent-docs@0.1.379`
29
+ - Owner: `@jskit-ai/agent-docs@0.1.381`
30
30
  - Read: [PATTERN.md](patterns/app/shell-foundation/PATTERN.md)
31
31
  - Examples: [example/](patterns/app/shell-foundation/example/)
32
32
  - Requires: `@jskit-ai/http-runtime`, `@jskit-ai/kernel`, `@jskit-ai/shell-web`
@@ -37,11 +37,22 @@ Configure an assistant runtime for one application surface and expose its chat a
37
37
 
38
38
  - Id: `assistant/assistant-surface`
39
39
  - Keywords: `ai`, `assistant`, `chat`, `config`, `environment`, `page`, `placement`, `settings`, `surface`
40
- - Owner: `@jskit-ai/assistant-runtime@0.2.113`
40
+ - Owner: `@jskit-ai/assistant-runtime@0.2.115`
41
41
  - Read: [PATTERN.md](patterns/assistant/assistant-surface/PATTERN.md)
42
42
  - Examples: [example/](patterns/assistant/assistant-surface/example/)
43
43
  - Requires: `@jskit-ai/assistant-runtime`, `@jskit-ai/connectors-catalog`, `@jskit-ai/connectors-core`, `@jskit-ai/shell-web`
44
44
 
45
+ ## Model-sized tool results
46
+
47
+ Keep what an action gives the assistant within its result limit with text over markup, the first part of long text and the action that reads the rest, and paged lists, so the catalogue's own cut stays the last resort.
48
+
49
+ - Id: `assistant/model-sized-results`
50
+ - Keywords: `ai`, `assistant`, `document`, `email`, `limit`, `long text`, `maxToolResultBytes`, `paging`, `read on`, `result`, `size`, `tool`
51
+ - Owner: `@jskit-ai/assistant-core@0.2.107`
52
+ - Read: [PATTERN.md](patterns/assistant/model-sized-results/PATTERN.md)
53
+ - Examples: [example/](patterns/assistant/model-sized-results/example/)
54
+ - Requires: `@jskit-ai/assistant-core`
55
+
45
56
  ## Accounts hub
46
57
 
47
58
  Run one OpenID Connect sign-in for all of an owner's apps as its own JSKIT project, with production apps approved by the owner.
@@ -59,7 +70,7 @@ Compose JSKIT authentication routes, views, profile controls, and public surface
59
70
 
60
71
  - Id: `auth/auth-surface`
61
72
  - Keywords: `account`, `auth`, `login`, `logout`, `password`, `placement`, `profile`, `reset`, `surface`
62
- - Owner: `@jskit-ai/auth-web@0.2.71`
73
+ - Owner: `@jskit-ai/auth-web@0.2.72`
63
74
  - Read: [PATTERN.md](patterns/auth/auth-surface/PATTERN.md)
64
75
  - Examples: [example/](patterns/auth/auth-surface/example/)
65
76
  - Requires: `@jskit-ai/auth-core`, `@jskit-ai/auth-web`, `@jskit-ai/shell-web`
@@ -70,7 +81,7 @@ Let people sign in with the accounts they already have in an accounts hub or ano
70
81
 
71
82
  - Id: `auth/oidc-sign-in`
72
83
  - Keywords: `accounts hub`, `auth`, `authentication`, `back-channel logout`, `dynamic client registration`, `issuer`, `master login`, `oidc`, `openid connect`, `single sign-on`, `sso`
73
- - Owner: `@jskit-ai/auth-provider-oidc-core@0.2.81`
84
+ - Owner: `@jskit-ai/auth-provider-oidc-core@0.2.82`
74
85
  - Read: [PATTERN.md](patterns/auth/oidc-sign-in/PATTERN.md)
75
86
  - Examples: [example/](patterns/auth/oidc-sign-in/example/)
76
87
  - Requires: `@jskit-ai/auth-provider-oidc-core`, `@jskit-ai/auth-web`
@@ -81,7 +92,7 @@ Write the sign-in screen and the second-factor prompt in an application's own de
81
92
 
82
93
  - Id: `auth/own-design-sign-in`
83
94
  - Keywords: `auth`, `custom design`, `design system`, `login`, `own look`, `second factor`, `sign in`, `step up`, `style`, `without vuetify`
84
- - Owner: `@jskit-ai/auth-web@0.2.71`
95
+ - Owner: `@jskit-ai/auth-web@0.2.72`
85
96
  - Read: [PATTERN.md](patterns/auth/own-design-sign-in/PATTERN.md)
86
97
  - Examples: [example/](patterns/auth/own-design-sign-in/example/)
87
98
  - Requires: `@jskit-ai/auth-web`, `@jskit-ai/kernel`
@@ -257,7 +268,7 @@ Add a protected administration surface, settings shell, and semantic navigation
257
268
 
258
269
  - Id: `console/console-surface`
259
270
  - Keywords: `admin`, `console`, `navigation`, `owner`, `placement`, `settings`, `surface`
260
- - Owner: `@jskit-ai/console-web@0.1.314`
271
+ - Owner: `@jskit-ai/console-web@0.1.315`
261
272
  - Read: [PATTERN.md](patterns/console/console-surface/PATTERN.md)
262
273
  - Examples: [example/](patterns/console/console-surface/example/)
263
274
  - Requires: `@jskit-ai/console-core`, `@jskit-ai/console-web`, `@jskit-ai/shell-web`
@@ -279,7 +290,7 @@ Build a complete application-owned CRUD server package from a migration, a table
279
290
 
280
291
  - Id: `crud/crud-feature-package`
281
292
  - Keywords: `actions`, `crud`, `database`, `defineCrudFeature`, `json-api`, `migration`, `owns`, `permissions`, `repository`, `routes`, `service`, `table resource`
282
- - Owner: `@jskit-ai/crud-core@0.2.65`
293
+ - Owner: `@jskit-ai/crud-core@0.2.66`
283
294
  - Read: [PATTERN.md](patterns/crud/crud-feature-package/PATTERN.md)
284
295
  - Examples: [example/](patterns/crud/crud-feature-package/example/)
285
296
  - Requires: `@jskit-ai/crud-core`, `@jskit-ai/resource-core`, `@jskit-ai/resource-crud-core`
@@ -290,7 +301,7 @@ Build a routed CRUD user interface as thin application pages over JSKIT's shared
290
301
 
291
302
  - Id: `crud/crud-screen-set`
292
303
  - Keywords: `actions`, `add`, `crud`, `delete`, `edit`, `filters`, `list`, `material`, `routes`, `view`, `vue`
293
- - Owner: `@jskit-ai/http-web@0.2.72`
304
+ - Owner: `@jskit-ai/http-web@0.2.73`
294
305
  - Read: [PATTERN.md](patterns/crud/crud-screen-set/PATTERN.md)
295
306
  - Examples: [example/](patterns/crud/crud-screen-set/example/)
296
307
  - Requires: `@jskit-ai/http-web`, `@jskit-ai/resource-core`, `@jskit-ai/resource-crud-core`
@@ -334,7 +345,7 @@ Wrap a JSKIT web application in a Capacitor Android shell using native Capacitor
334
345
 
335
346
  - Id: `mobile/android-application`
336
347
  - Keywords: `android`, `capacitor`, `device`, `mobile`, `native`, `shell`, `webview`
337
- - Owner: `@jskit-ai/mobile-capacitor@0.2.63`
348
+ - Owner: `@jskit-ai/mobile-capacitor@0.2.64`
338
349
  - Read: [PATTERN.md](patterns/mobile/android-application/PATTERN.md)
339
350
  - Examples: [example/](patterns/mobile/android-application/example/)
340
351
  - Requires: `@capacitor/android`, `@capacitor/app`, `@capacitor/cli`, `@jskit-ai/mobile-capacitor`
@@ -345,7 +356,7 @@ Add JSKIT realtime events with an optional Redis backplane and an explicit shell
345
356
 
346
357
  - Id: `realtime/realtime-application`
347
358
  - Keywords: `realtime`, `redis`, `socket.io`, `sockets`, `status`, `websocket`
348
- - Owner: `@jskit-ai/realtime@0.2.66`
359
+ - Owner: `@jskit-ai/realtime@0.2.67`
349
360
  - Read: [PATTERN.md](patterns/realtime/realtime-application/PATTERN.md)
350
361
  - Examples: [example/](patterns/realtime/realtime-application/example/)
351
362
  - Requires: `@jskit-ai/realtime`, `@jskit-ai/shell-web`
@@ -356,7 +367,7 @@ Compose application-owned Google Publisher Tag delivery with the generic rewarde
356
367
 
357
368
  - Id: `rewards/google-rewarded`
358
369
  - Keywords: `ads`, `google`, `publisher tag`, `rewarded`, `unlock`
359
- - Owner: `@jskit-ai/rewarded-web@0.2.90`
370
+ - Owner: `@jskit-ai/rewarded-web@0.2.91`
360
371
  - Read: [PATTERN.md](patterns/rewards/google-rewarded/PATTERN.md)
361
372
  - Examples: [example/](patterns/rewards/google-rewarded/example/)
362
373
  - Requires: `@jskit-ai/rewarded-web`
@@ -367,7 +378,7 @@ Define a server feature through explicit capabilities and first-class actions, a
367
378
 
368
379
  - Id: `server/feature-package`
369
380
  - Keywords: `actions`, `aggregate`, `feature`, `handle`, `orchestration`, `owns`, `package`, `provider`, `repository`, `routes`, `server`, `table resource`
370
- - Owner: `@jskit-ai/agent-docs@0.1.379`
381
+ - Owner: `@jskit-ai/agent-docs@0.1.381`
371
382
  - Read: [PATTERN.md](patterns/server/feature-package/PATTERN.md)
372
383
  - Examples: [example/](patterns/server/feature-package/example/)
373
384
  - Requires: `@jskit-ai/kernel`
@@ -378,7 +389,7 @@ Compose the JSKIT responsive shell, semantic placements, settings navigation, an
378
389
 
379
390
  - Id: `shell/application-shell`
380
391
  - Keywords: `adaptive`, `app`, `layout`, `navigation`, `placement`, `responsive`, `settings`, `shell`
381
- - Owner: `@jskit-ai/shell-web@0.2.63`
392
+ - Owner: `@jskit-ai/shell-web@0.2.64`
382
393
  - Read: [PATTERN.md](patterns/shell/application-shell/PATTERN.md)
383
394
  - Examples: [example/](patterns/shell/application-shell/example/)
384
395
  - Requires: `@jskit-ai/kernel`, `@jskit-ai/shell-web`
@@ -389,7 +400,7 @@ Add product routes and shell extensions through file routing, semantic placement
389
400
 
390
401
  - Id: `ui/page-and-placement`
391
402
  - Keywords: `component`, `navigation`, `outlet`, `page`, `placement`, `routes`, `section`, `shell`, `subpages`, `vue`
392
- - Owner: `@jskit-ai/shell-web@0.2.63`
403
+ - Owner: `@jskit-ai/shell-web@0.2.64`
393
404
  - Read: [PATTERN.md](patterns/ui/page-and-placement/PATTERN.md)
394
405
  - Examples: [example/](patterns/ui/page-and-placement/example/)
395
406
  - Requires: `@jskit-ai/kernel`, `@jskit-ai/shell-web`
@@ -400,7 +411,7 @@ Compose an account settings route and profile, preference, notification, and sig
400
411
 
401
412
  - Id: `users/account-settings`
402
413
  - Keywords: `account`, `link provider`, `notifications`, `oauth`, `preferences`, `profile`, `settings`, `sign-in methods`, `user`, `vue`
403
- - Owner: `@jskit-ai/users-web@0.2.98`
414
+ - Owner: `@jskit-ai/users-web@0.2.99`
404
415
  - Read: [PATTERN.md](patterns/users/account-settings/PATTERN.md)
405
416
  - Examples: [example/](patterns/users/account-settings/example/)
406
417
  - Requires: `@jskit-ai/http-web`, `@jskit-ai/shell-web`, `@jskit-ai/users-core`, `@jskit-ai/users-web`
@@ -411,7 +422,7 @@ Expose user administration and workspace-scoped member operations through app-ow
411
422
 
412
423
  - Id: `users/user-administration-server`
413
424
  - Keywords: `account`, `admin`, `member`, `repository`, `resource`, `routes`, `service`, `user`, `workspace`
414
- - Owner: `@jskit-ai/users-core@0.2.76`
425
+ - Owner: `@jskit-ai/users-core@0.2.77`
415
426
  - Read: [PATTERN.md](patterns/users/user-administration-server/PATTERN.md)
416
427
  - Examples: [example/](patterns/users/user-administration-server/example/)
417
428
  - Requires: `@jskit-ai/crud-core`, `@jskit-ai/users-core`
@@ -422,7 +433,7 @@ Configure roles, workspace access policy, invitations, and app-owned invitation
422
433
 
423
434
  - Id: `workspaces/workspace-server`
424
435
  - Keywords: `access`, `invite`, `membership`, `multitenancy`, `policy`, `role`, `tenancy`, `workspace`
425
- - Owner: `@jskit-ai/workspaces-core@0.2.76`
436
+ - Owner: `@jskit-ai/workspaces-core@0.2.77`
426
437
  - Read: [PATTERN.md](patterns/workspaces/workspace-server/PATTERN.md)
427
438
  - Examples: [example/](patterns/workspaces/workspace-server/example/)
428
439
  - Requires: `@jskit-ai/users-core`, `@jskit-ai/workspaces-core`
@@ -433,7 +444,7 @@ Compose workspace selection, invitation, member administration, settings, and re
433
444
 
434
445
  - Id: `workspaces/workspace-surfaces`
435
446
  - Keywords: `admin`, `invite`, `member`, `navigation`, `settings`, `surface`, `switcher`, `workspace`
436
- - Owner: `@jskit-ai/workspaces-web@0.2.98`
447
+ - Owner: `@jskit-ai/workspaces-web@0.2.99`
437
448
  - Read: [PATTERN.md](patterns/workspaces/workspace-surfaces/PATTERN.md)
438
449
  - Examples: [example/](patterns/workspaces/workspace-surfaces/example/)
439
450
  - Requires: `@jskit-ai/shell-web`, `@jskit-ai/workspaces-core`, `@jskit-ai/workspaces-web`
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jskit-ai/config-eslint": "0.1.255",
53
- "@jskit-ai/jskit-catalog": "0.2.131",
53
+ "@jskit-ai/jskit-catalog": "0.2.133",
54
54
  "@playwright/test": "1.61.1",
55
55
  "@vitejs/plugin-vue": "^6.0.7",
56
56
  "eslint": "^10.8.0",
@@ -45,13 +45,13 @@
45
45
  "vue-router": "^5.3.1",
46
46
  "vuetify": "^4.3.0",
47
47
  "@jskit-ai/http-runtime": "0.2.39",
48
- "@jskit-ai/shell-web": "0.2.63",
48
+ "@jskit-ai/shell-web": "0.2.64",
49
49
  "@fastify/fast-json-stringify-compiler": "^5.1.0",
50
50
  "@vue/devtools-api": "^8.2.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@jskit-ai/config-eslint": "0.1.255",
54
- "@jskit-ai/jskit-catalog": "0.2.131",
54
+ "@jskit-ai/jskit-catalog": "0.2.133",
55
55
  "@playwright/test": "1.61.1",
56
56
  "@vitejs/plugin-vue": "^6.0.7",
57
57
  "eslint": "^10.8.0",
@@ -0,0 +1,147 @@
1
+ ---
2
+ id: assistant/model-sized-results
3
+ title: Model-sized tool results
4
+ summary: Keep what an action gives the assistant within its result limit with text over markup, the first part of long text and the action that reads the rest, and paged lists, so the catalogue's own cut stays the last resort.
5
+ keywords: ai, assistant, tool, result, size, limit, long text, read on, paging, email, document, maxToolResultBytes
6
+ requires: @jskit-ai/assistant-core
7
+ ---
8
+
9
+ # Model-sized tool results
10
+
11
+ ## Use when
12
+
13
+ Use this pattern when an action the assistant calls can answer with more than
14
+ its surface's `maxToolResultBytes` (48 KiB by default, 256 KiB on the MCP
15
+ endpoint): an inbox conversation whose emails quote each other, a document, a
16
+ log, a long settings record, or a list read without a page size.
17
+
18
+ ## Do not use when
19
+
20
+ Do not use it for a result that is always small, such as one record by id or
21
+ a count. Do not use it to keep data from the model: what the model may read is
22
+ the action's permission and its assistant output. A screen that needs the whole
23
+ value keeps its route's result; this pattern shapes only what the assistant
24
+ reads.
25
+
26
+ ## Product decisions
27
+
28
+ - Which fields the model reads, and which stay on the screen: an email's
29
+ HTML body, its raw source and its attachments' bytes are the screen's.
30
+ - Each long text's first part (`partLength`): enough to answer most questions
31
+ without reading on, and small enough that the largest record's first parts
32
+ fit together. An inbox whose surface allows 128 KiB gives 2,000 characters
33
+ of each email, so a conversation of 35 emails that each quote all the ones
34
+ before, about 900 KB stored, fits whole.
35
+ - How much one read-on part holds (16,000 characters in the example).
36
+ - Each list's page size, and the filters a model narrows it with.
37
+
38
+ ## Invariants
39
+
40
+ - The model reads text, not markup. An action's assistant output carries an
41
+ email's or a page's plain text once, never its HTML beside it.
42
+ - A long text field is declared in `extensions.assistant.longText`. The
43
+ catalogue cuts it to its first part and adds `<field>Rest` beside it:
44
+ `{ characters, actionId, input }`, where `input` is the record's own keys
45
+ (`input(record)`) and the `offset` the next part starts at. A record never
46
+ holds a field of that name itself.
47
+ - The read action is a query on the automation channel, with the same
48
+ permission and surfaces as the action whose text it reads on. It reads the
49
+ same stored text the first part came from, from the offset given, with
50
+ `readTextPart`, which the catalogue cuts with too, so the offsets agree.
51
+ - The catalogue cuts the text the model receives: after the action, its
52
+ policy and its `transformResult` have run. A text marked or rewritten
53
+ before then, such as an email's text wrapped in markers that say it is
54
+ untrusted, is cut as marked, and the Rest pointer's offset counts the
55
+ marked text. So either the read action slices that same marked text (it
56
+ marks the stored text exactly as the policy does, then calls
57
+ `readTextPart`), or the marking sits outside the text field (a sibling
58
+ field, or a wrapper around the record), so the text field holds the stored
59
+ text unchanged. A read action that slices the stored text while the first
60
+ part was cut from marked text reads on from the wrong place: a marker
61
+ that adds 20 characters skips or repeats 20 characters at every part's
62
+ edge. A change that keeps the text's length, such as defusing `[` as `(`,
63
+ leaves the offsets aligned; the read action applies it too, so every part
64
+ reaches the model defused alike.
65
+ - Both text fields are `noTrim: true`. json-rest-schema trims strings, so a
66
+ trimmed part loses the spaces at its edges, and a text trimmed at its start
67
+ moves every offset after it.
68
+ - A list is paged in the query: a limit, and the cursor or offset of the next
69
+ page, which the model asks for when it needs more.
70
+ - `maxToolResultBytes` is not raised to fit the largest record. Every byte of
71
+ a result is read by the model on every later step of the turn and, in the
72
+ API engine, in later turns' history, and the largest record keeps growing;
73
+ a raised limit only moves where the result is cut.
74
+ - A result still over the limit is cut by the catalogue, never refused: the
75
+ model reads its first part, with a note saying how much is left out, and
76
+ reads on only if what it needs may be further on.
77
+
78
+ ## Framework APIs
79
+
80
+ `extensions.assistant.longText` maps each long text's path in the tool's
81
+ result (the assistant output when the action declares one) to
82
+ `{ partLength, readAction, input }`. A path is field names joined by dots, with
83
+ `[]` after a name for each item of an array (`messages[].bodyText`) or alone
84
+ first when the result is an array (`[].bodyText`). `partLength` is a whole
85
+ number of characters; `readAction` names an automation query; `input(record)`
86
+ returns the read action's input without its `offset`. A wrong declaration stops
87
+ the catalogue with an error naming the action and the path. The tool's
88
+ description tells the model how its long text comes.
89
+
90
+ `readTextPart(text, offset, length)` from `@jskit-ai/assistant-core/server`
91
+ returns `{ text, offset, nextOffset, total }`. Offsets count JavaScript
92
+ characters; a part never splits a character outside the Basic Multilingual
93
+ Plane, so it may end one character early, or take that one character whole
94
+ when it is all the part would hold. `nextOffset` is `null` on the last part;
95
+ an offset at or past the end gives an empty last part at `total`.
96
+
97
+ A result over the limit comes as `{ toolResultPart: { note, resultId, offset,
98
+ nextOffset, total, text } }`, where `text` is the next stretch of the result's
99
+ JSON text, cut between two items or members when one is near, else after a
100
+ space in a long string, and never inside an escape or a character. Direct tool
101
+ sets read on with the `assistant_result_read` tool (`{ resultId, offset }`);
102
+ discovery tool sets with `assistant_action_execute` and
103
+ `actionId: "assistant.result.read"`. The catalogue keeps a cut result in its
104
+ process's memory for 15 minutes, up to 4 Mi characters of all its cut results,
105
+ oldest first, for the same signed-in person, surface and workspace while the
106
+ action is still theirs; a result it no longer keeps answers `assistant_tool_result_unknown`
107
+ (404), and the model calls the tool again. An unsaved action's result and one
108
+ for a caller that resolved its tool set with `offerResultReader: false` are cut
109
+ with nothing kept, and the note says to ask for less.
110
+
111
+ ## Example files
112
+
113
+ `example/packages/inbox/src/server/inboxActions.js` declares a conversation
114
+ read whose emails' text is long text, and the read action that reads an
115
+ email's text on from an offset. `example/packages/inbox/src/server/inbox.js`
116
+ is the service: the conversation read gives each email's plain text, and the
117
+ text read answers one part with `readTextPart`. `types.js` names the
118
+ repository the service reads.
119
+
120
+ ## Variation points
121
+
122
+ Change the paths, part lengths, read action ids and their input keys. A result
123
+ whose long text sits at its top (`bodyText`) or in an array result
124
+ (`[].bodyText`) declares that path. One read action can serve several fields
125
+ when its input says which. A list action pages instead of declaring long text,
126
+ and one whose items hold long text does both.
127
+
128
+ ## Verification
129
+
130
+ - call the action with the largest real record, not a test's small one, and
131
+ see its result within the surface's `maxToolResultBytes`
132
+ - read every long text on from its Rest pointer to `nextOffset: null` and see
133
+ the parts join to the stored text exactly, with a space and a character
134
+ outside the Basic Multilingual Plane at a part's edge
135
+ - see a short text come whole, with no Rest field
136
+ - see the read action refuse a person without the permission
137
+
138
+ ## Avoid
139
+
140
+ - raising `maxToolResultBytes` to fit the largest record
141
+ - HTML, raw source or base64 beside the text the model reads
142
+ - a read action that slices the stored text while the first part was cut
143
+ from text the action or its policy marked or rewrote, so its offsets point
144
+ elsewhere
145
+ - trimmed text fields on either side
146
+ - a Rest field the action writes itself
147
+ - a list read without a limit
@@ -0,0 +1,37 @@
1
+ import { readTextPart } from "@jskit-ai/assistant-core/server";
2
+
3
+ // How much of an email's text one read-on part holds.
4
+ const MESSAGE_TEXT_PART = 16_000;
5
+
6
+ /** @param {{ messages: import("./types.js").InboxMessages }} dependencies */
7
+ function createInbox({ messages }) {
8
+ /**
9
+ * One conversation as its screen and the assistant read it: each email's plain text, never its HTML, which says
10
+ * the same in many times the characters.
11
+ * @param {{ threadId: string }} input
12
+ * @param {{ context: object }} options
13
+ */
14
+ async function readThread({ threadId }, { context }) {
15
+ const thread = await messages.readThread(threadId, { context });
16
+ return Object.freeze({
17
+ id: thread.id,
18
+ subject: thread.subject,
19
+ messages: thread.messages.map(({ id, fromName, receivedAt, bodyText }) => Object.freeze({ id, fromName, receivedAt, bodyText }))
20
+ });
21
+ }
22
+
23
+ /**
24
+ * One email's text from `offset`: the same stored text whose first part the conversation read gave, so the
25
+ * offset its Rest pointer names is where this part starts.
26
+ * @param {{ messageId: string, offset: number }} input
27
+ * @param {{ context: object }} options
28
+ */
29
+ async function readMessageText({ messageId, offset }, { context }) {
30
+ const message = await messages.readMessage(messageId, { context });
31
+ return Object.freeze({ messageId: message.id, ...readTextPart(message.bodyText, offset, MESSAGE_TEXT_PART) });
32
+ }
33
+
34
+ return Object.freeze({ readThread, readMessageText });
35
+ }
36
+
37
+ export { createInbox };