@things-factory/ai-assistant 10.1.278 → 10.1.279
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-client/bootstrap.d.ts +4 -4
- package/dist-client/bootstrap.js +4 -8
- package/dist-client/components/ai-model-price-table.d.ts +32 -0
- package/dist-client/components/ai-model-price-table.js +311 -0
- package/dist-client/components/ai-usage-table.d.ts +17 -0
- package/dist-client/components/ai-usage-table.js +151 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/pages/ai-model-price-page.d.ts +37 -0
- package/dist-client/pages/ai-model-price-page.js +312 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +4 -0
- package/dist-client/settings/ai-agent-setting-let.js +11 -0
- package/dist-client/utils/model-price-model.d.ts +31 -0
- package/dist-client/utils/model-price-model.js +30 -0
- package/dist-client/utils/usage-charts.d.ts +21 -0
- package/dist-client/utils/usage-charts.js +45 -0
- package/dist-client/utils/usage-model.d.ts +44 -0
- package/dist-client/utils/usage-model.js +44 -0
- package/dist-server/service/ai-agent-resolver.d.ts +46 -0
- package/dist-server/service/ai-agent-resolver.js +252 -0
- package/package.json +25 -10
- package/things-factory.config.js +4 -1
- package/translations/en.json +46 -4
- package/translations/es.json +43 -1
- package/translations/ja.json +43 -1
- package/translations/ko.json +46 -4
- package/translations/ms.json +43 -1
- package/translations/zh.json +43 -1
- package/client/bootstrap.ts +0 -27
- package/client/components/assistant-chat.test.ts +0 -149
- package/client/components/assistant-chat.ts +0 -5599
- package/client/components/assistant-dock.ts +0 -1036
- package/client/components/assistant-invite.ts +0 -138
- package/client/components/assistant-mode.test.ts +0 -119
- package/client/components/assistant-mode.ts +0 -174
- package/client/components/assistant-selection-bar.test.ts +0 -167
- package/client/components/assistant-selection-bar.ts +0 -178
- package/client/components/assistant-session-manager.ts +0 -915
- package/client/components/assistant-session-toolbar.ts +0 -80
- package/client/components/chat-defaults.ts +0 -64
- package/client/components/chat-echo-dedup.test.ts +0 -253
- package/client/components/chat-echo-dedup.ts +0 -190
- package/client/components/chat-input-builder.test.ts +0 -86
- package/client/components/chat-input-builder.ts +0 -133
- package/client/components/chat-proposal-survival.test.ts +0 -73
- package/client/components/entry-review.ts +0 -346
- package/client/components/markdown.test.ts +0 -518
- package/client/components/markdown.ts +0 -508
- package/client/components/mention-popup-helpers.ts +0 -433
- package/client/components/mention-popup.test.ts +0 -588
- package/client/components/mention-popup.ts +0 -261
- package/client/components/panel-aria.test.ts +0 -59
- package/client/components/proposal-outcome-line.ts +0 -74
- package/client/components/proposal-request.test.ts +0 -73
- package/client/components/reply-message.test.ts +0 -15
- package/client/components/reply-message.ts +0 -11
- package/client/components/roster-identity.test.ts +0 -8
- package/client/components/roster-identity.ts +0 -4
- package/client/components/workspace-view.ts +0 -486
- package/client/index.ts +0 -36
- package/client/pages/assistant-workspace-page.ts +0 -317
- package/client/route.ts +0 -9
- package/client/settings/agent-settings-model.ts +0 -164
- package/client/settings/ai-agent-setting-let.ts +0 -667
- package/client/settings/ai-usage-setting-let.ts +0 -240
- package/client/settings/usage-model.ts +0 -46
- package/client/setup-assistant-dock.ts +0 -177
- package/client/tsconfig.json +0 -13
- package/client/utils/addressed-draft.test.ts +0 -31
- package/client/utils/agent-choice.ts +0 -56
- package/client/utils/applied-screens.ts +0 -36
- package/client/utils/assistant-activity.ts +0 -122
- package/client/utils/assistant-ask.test.ts +0 -38
- package/client/utils/assistant-ask.ts +0 -93
- package/client/utils/assistant-capability-read.ts +0 -24
- package/client/utils/assistant-capability.test.ts +0 -17
- package/client/utils/assistant-capability.ts +0 -19
- package/client/utils/assistant-navigation.test.ts +0 -66
- package/client/utils/assistant-navigation.ts +0 -11
- package/client/utils/assistant-proposals.ts +0 -85
- package/client/utils/assistant-request-context.ts +0 -63
- package/client/utils/assistant-selection.test.ts +0 -54
- package/client/utils/assistant-selection.ts +0 -75
- package/client/utils/assistant-session-actions.ts +0 -32
- package/client/utils/assistant-session-admin.ts +0 -239
- package/client/utils/assistant-session-controller.test.ts +0 -75
- package/client/utils/assistant-session-controller.ts +0 -208
- package/client/utils/assistant-session-transport.ts +0 -46
- package/client/utils/assistant-surface.ts +0 -178
- package/client/utils/assistant-typing.test.ts +0 -33
- package/client/utils/assistant-typing.ts +0 -53
- package/client/utils/attachment-policy.ts +0 -106
- package/client/utils/composer-frame.ts +0 -77
- package/client/utils/document-text.ts +0 -332
- package/client/utils/entry-hash.ts +0 -35
- package/client/utils/entry-proposal.ts +0 -215
- package/client/utils/entry-workspace.ts +0 -70
- package/client/utils/invite-proposal-register.ts +0 -31
- package/client/utils/invite-proposal.test.ts +0 -40
- package/client/utils/invite-proposal.ts +0 -54
- package/client/utils/menu-room.ts +0 -33
- package/client/utils/open-page.ts +0 -21
- package/client/utils/pasted-table.ts +0 -145
- package/client/utils/pdf-pages.ts +0 -25
- package/client/utils/spreadsheet-text.ts +0 -125
- package/client/utils/workspace.ts +0 -89
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/components/assistant-chat.js.map +0 -1
- package/dist-client/components/assistant-chat.test.d.ts +0 -1
- package/dist-client/components/assistant-chat.test.js +0 -138
- package/dist-client/components/assistant-chat.test.js.map +0 -1
- package/dist-client/components/assistant-dock.js.map +0 -1
- package/dist-client/components/assistant-invite.js.map +0 -1
- package/dist-client/components/assistant-mode.js.map +0 -1
- package/dist-client/components/assistant-mode.test.d.ts +0 -1
- package/dist-client/components/assistant-mode.test.js +0 -100
- package/dist-client/components/assistant-mode.test.js.map +0 -1
- package/dist-client/components/assistant-selection-bar.js.map +0 -1
- package/dist-client/components/assistant-selection-bar.test.d.ts +0 -1
- package/dist-client/components/assistant-selection-bar.test.js +0 -148
- package/dist-client/components/assistant-selection-bar.test.js.map +0 -1
- package/dist-client/components/assistant-session-manager.js.map +0 -1
- package/dist-client/components/assistant-session-toolbar.js.map +0 -1
- package/dist-client/components/chat-defaults.js.map +0 -1
- package/dist-client/components/chat-echo-dedup.js.map +0 -1
- package/dist-client/components/chat-echo-dedup.test.d.ts +0 -1
- package/dist-client/components/chat-echo-dedup.test.js +0 -223
- package/dist-client/components/chat-echo-dedup.test.js.map +0 -1
- package/dist-client/components/chat-input-builder.js.map +0 -1
- package/dist-client/components/chat-input-builder.test.d.ts +0 -1
- package/dist-client/components/chat-input-builder.test.js +0 -70
- package/dist-client/components/chat-input-builder.test.js.map +0 -1
- package/dist-client/components/chat-proposal-survival.test.d.ts +0 -1
- package/dist-client/components/chat-proposal-survival.test.js +0 -61
- package/dist-client/components/chat-proposal-survival.test.js.map +0 -1
- package/dist-client/components/entry-review.js.map +0 -1
- package/dist-client/components/markdown.js.map +0 -1
- package/dist-client/components/markdown.test.d.ts +0 -1
- package/dist-client/components/markdown.test.js +0 -418
- package/dist-client/components/markdown.test.js.map +0 -1
- package/dist-client/components/mention-popup-helpers.js.map +0 -1
- package/dist-client/components/mention-popup.js.map +0 -1
- package/dist-client/components/mention-popup.test.d.ts +0 -1
- package/dist-client/components/mention-popup.test.js +0 -474
- package/dist-client/components/mention-popup.test.js.map +0 -1
- package/dist-client/components/panel-aria.test.d.ts +0 -1
- package/dist-client/components/panel-aria.test.js +0 -53
- package/dist-client/components/panel-aria.test.js.map +0 -1
- package/dist-client/components/proposal-outcome-line.js.map +0 -1
- package/dist-client/components/proposal-request.test.d.ts +0 -1
- package/dist-client/components/proposal-request.test.js +0 -63
- package/dist-client/components/proposal-request.test.js.map +0 -1
- package/dist-client/components/reply-message.js.map +0 -1
- package/dist-client/components/reply-message.test.d.ts +0 -1
- package/dist-client/components/reply-message.test.js +0 -16
- package/dist-client/components/reply-message.test.js.map +0 -1
- package/dist-client/components/roster-identity.js.map +0 -1
- package/dist-client/components/roster-identity.test.d.ts +0 -1
- package/dist-client/components/roster-identity.test.js +0 -9
- package/dist-client/components/roster-identity.test.js.map +0 -1
- package/dist-client/components/workspace-view.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/pages/assistant-workspace-page.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/settings/agent-settings-model.js.map +0 -1
- package/dist-client/settings/ai-agent-setting-let.js.map +0 -1
- package/dist-client/settings/ai-usage-setting-let.d.ts +0 -25
- package/dist-client/settings/ai-usage-setting-let.js +0 -258
- package/dist-client/settings/ai-usage-setting-let.js.map +0 -1
- package/dist-client/settings/usage-model.d.ts +0 -32
- package/dist-client/settings/usage-model.js +0 -25
- package/dist-client/settings/usage-model.js.map +0 -1
- package/dist-client/setup-assistant-dock.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/utils/addressed-draft.test.d.ts +0 -1
- package/dist-client/utils/addressed-draft.test.js +0 -27
- package/dist-client/utils/addressed-draft.test.js.map +0 -1
- package/dist-client/utils/agent-choice.js.map +0 -1
- package/dist-client/utils/applied-screens.js.map +0 -1
- package/dist-client/utils/assistant-activity.js.map +0 -1
- package/dist-client/utils/assistant-ask.js.map +0 -1
- package/dist-client/utils/assistant-ask.test.d.ts +0 -1
- package/dist-client/utils/assistant-ask.test.js +0 -40
- package/dist-client/utils/assistant-ask.test.js.map +0 -1
- package/dist-client/utils/assistant-capability-read.js.map +0 -1
- package/dist-client/utils/assistant-capability.js.map +0 -1
- package/dist-client/utils/assistant-capability.test.d.ts +0 -1
- package/dist-client/utils/assistant-capability.test.js +0 -16
- package/dist-client/utils/assistant-capability.test.js.map +0 -1
- package/dist-client/utils/assistant-navigation.js.map +0 -1
- package/dist-client/utils/assistant-navigation.test.d.ts +0 -1
- package/dist-client/utils/assistant-navigation.test.js +0 -63
- package/dist-client/utils/assistant-navigation.test.js.map +0 -1
- package/dist-client/utils/assistant-proposals.js.map +0 -1
- package/dist-client/utils/assistant-request-context.js.map +0 -1
- package/dist-client/utils/assistant-selection.js.map +0 -1
- package/dist-client/utils/assistant-selection.test.d.ts +0 -1
- package/dist-client/utils/assistant-selection.test.js +0 -46
- package/dist-client/utils/assistant-selection.test.js.map +0 -1
- package/dist-client/utils/assistant-session-actions.js.map +0 -1
- package/dist-client/utils/assistant-session-admin.js.map +0 -1
- package/dist-client/utils/assistant-session-controller.js.map +0 -1
- package/dist-client/utils/assistant-session-controller.test.d.ts +0 -1
- package/dist-client/utils/assistant-session-controller.test.js +0 -56
- package/dist-client/utils/assistant-session-controller.test.js.map +0 -1
- package/dist-client/utils/assistant-session-transport.js.map +0 -1
- package/dist-client/utils/assistant-surface.js.map +0 -1
- package/dist-client/utils/assistant-typing.js.map +0 -1
- package/dist-client/utils/assistant-typing.test.d.ts +0 -1
- package/dist-client/utils/assistant-typing.test.js +0 -30
- package/dist-client/utils/assistant-typing.test.js.map +0 -1
- package/dist-client/utils/attachment-policy.js.map +0 -1
- package/dist-client/utils/composer-frame.js.map +0 -1
- package/dist-client/utils/document-text.js.map +0 -1
- package/dist-client/utils/entry-hash.js.map +0 -1
- package/dist-client/utils/entry-proposal.js.map +0 -1
- package/dist-client/utils/entry-workspace.js.map +0 -1
- package/dist-client/utils/invite-proposal-register.js.map +0 -1
- package/dist-client/utils/invite-proposal.js.map +0 -1
- package/dist-client/utils/invite-proposal.test.d.ts +0 -1
- package/dist-client/utils/invite-proposal.test.js +0 -35
- package/dist-client/utils/invite-proposal.test.js.map +0 -1
- package/dist-client/utils/menu-room.js.map +0 -1
- package/dist-client/utils/open-page.js.map +0 -1
- package/dist-client/utils/pasted-table.js.map +0 -1
- package/dist-client/utils/pdf-pages.js.map +0 -1
- package/dist-client/utils/spreadsheet-text.js.map +0 -1
- package/dist-client/utils/workspace.js.map +0 -1
- package/dist-server/door-declaration-report.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/service/ai-agent-resolver.js.map +0 -1
- package/dist-server/service/assistant-capability-resolver.js.map +0 -1
- package/dist-server/service/assistant-chat-resolver.js.map +0 -1
- package/dist-server/service/assistant-mode/assistant-mode-resolver.js.map +0 -1
- package/dist-server/service/assistant-mode/fallback-subjects.js.map +0 -1
- package/dist-server/service/assistant-mode/index.js.map +0 -1
- package/dist-server/service/assistant-mode/mode-categories.js.map +0 -1
- package/dist-server/service/assistant-mode/record-subject.js.map +0 -1
- package/dist-server/service/assistant-mode/registry.js.map +0 -1
- package/dist-server/service/assistant-mode/resolve.js.map +0 -1
- package/dist-server/service/assistant-mode/screen-rules.js.map +0 -1
- package/dist-server/service/assistant-mode/turn-lines.js.map +0 -1
- package/dist-server/service/assistant-mode/types.js.map +0 -1
- package/dist-server/service/chat-message/carried-turns.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-broadcast.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-publish.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-room.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-subscription.js.map +0 -1
- package/dist-server/service/chat-message/chat-message.js.map +0 -1
- package/dist-server/service/chat-message/chat-typing-subscription.js.map +0 -1
- package/dist-server/service/chat-message/chat-typing.js.map +0 -1
- package/dist-server/service/chat-message/door-access.js.map +0 -1
- package/dist-server/service/chat-message/fold-history.js.map +0 -1
- package/dist-server/service/chat-message/fold-session-history.js.map +0 -1
- package/dist-server/service/chat-message/history-summary.js.map +0 -1
- package/dist-server/service/chat-message/index.js.map +0 -1
- package/dist-server/service/chat-message/llm-history.js.map +0 -1
- package/dist-server/service/chat-message/message-doors.js.map +0 -1
- package/dist-server/service/chat-message/proposal-outcome.js.map +0 -1
- package/dist-server/service/chat-message/reader-gate.js.map +0 -1
- package/dist-server/service/chat-message/room-message.js.map +0 -1
- package/dist-server/service/chat-message/room-turn.js.map +0 -1
- package/dist-server/service/chat-message/used-tools.js.map +0 -1
- package/dist-server/service/chat-session/attachment-policy.js.map +0 -1
- package/dist-server/service/chat-session/attachment-route.js.map +0 -1
- package/dist-server/service/chat-session/attachment-tool-result.js.map +0 -1
- package/dist-server/service/chat-session/attachment-tools.js.map +0 -1
- package/dist-server/service/chat-session/chat-session.js.map +0 -1
- package/dist-server/service/chat-session/index.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-broadcast.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-publish.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-subscription.js.map +0 -1
- package/dist-server/service/chat-session/session-anchor.js.map +0 -1
- package/dist-server/service/chat-session/session-attachments.js.map +0 -1
- package/dist-server/service/chat-session/session-cleanup.js.map +0 -1
- package/dist-server/service/chat-session/session-inbox.js.map +0 -1
- package/dist-server/service/chat-session/session-kind.js.map +0 -1
- package/dist-server/service/chat-session/session-name.js.map +0 -1
- package/dist-server/service/chat-session/session-purge.js.map +0 -1
- package/dist-server/service/chat-session/session-retention.js.map +0 -1
- package/dist-server/service/chat-session/session-visibility.js.map +0 -1
- package/dist-server/service/chat-session/session-write-gate.js.map +0 -1
- package/dist-server/service/chat-session/station-session-guard.js.map +0 -1
- package/dist-server/service/chat-session/turn-attachments.js.map +0 -1
- package/dist-server/service/chat-session-participant/chat-session-participant.js.map +0 -1
- package/dist-server/service/chat-session-participant/index.js.map +0 -1
- package/dist-server/service/chat-session-participant/invite-notification.js.map +0 -1
- package/dist-server/service/chat-session-participant/mention-invite.js.map +0 -1
- package/dist-server/service/chat-session-participant/participant-lookup-roles.js.map +0 -1
- package/dist-server/service/chat-session-participant/participant-lookup.js.map +0 -1
- package/dist-server/service/chat-session-participant/presence.js.map +0 -1
- package/dist-server/service/chat-session-participant/read-roster.js.map +0 -1
- package/dist-server/service/chat-session-resolver.js.map +0 -1
- package/dist-server/service/data-entry/entry-apply.js.map +0 -1
- package/dist-server/service/data-entry/entry-hash.js.map +0 -1
- package/dist-server/service/data-entry/entry-refusal.js.map +0 -1
- package/dist-server/service/data-entry/entry-resolver.js.map +0 -1
- package/dist-server/service/data-entry/entry-screen.js.map +0 -1
- package/dist-server/service/data-entry/entry-sources.js.map +0 -1
- package/dist-server/service/data-entry/entry-target.js.map +0 -1
- package/dist-server/service/data-entry/entry-tools.js.map +0 -1
- package/dist-server/service/data-entry/entry-update.js.map +0 -1
- package/dist-server/service/data-read/list-read.js.map +0 -1
- package/dist-server/service/data-read/read-target.js.map +0 -1
- package/dist-server/service/data-read/read-tools.js.map +0 -1
- package/dist-server/service/grounding-sources.js.map +0 -1
- package/dist-server/service/help-documents/help-keys.js.map +0 -1
- package/dist-server/service/help-documents/help-tools.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/service/people/index.js.map +0 -1
- package/dist-server/service/people/invite-tools.js.map +0 -1
- package/dist-server/service/people/people-keys.js.map +0 -1
- package/dist-server/service/people/people-read.js.map +0 -1
- package/dist-server/service/people/person-subject.js.map +0 -1
- package/dist-server/service/request-translator.js.map +0 -1
- package/dist-server/service/testing/conversation-script.js.map +0 -1
- package/dist-server/service/testing/mode-conformance.js.map +0 -1
- package/dist-server/service/tool-access.js.map +0 -1
- package/dist-server/service/types.js.map +0 -1
- package/dist-server/service/unattended-run/assistant-run.js.map +0 -1
- package/dist-server/service/unattended-run/index.js.map +0 -1
- package/dist-server/service/unattended-run/limits.js.map +0 -1
- package/dist-server/service/unattended-run/run-as.js.map +0 -1
- package/dist-server/service/unattended-run/run-budget.js.map +0 -1
- package/dist-server/service/unattended-run/run-ledger.js.map +0 -1
- package/dist-server/service/unattended-run/run-outcome.js.map +0 -1
- package/dist-server/service/unattended-run/run-store.js.map +0 -1
- package/dist-server/service/unattended-run/run-unattended.js.map +0 -1
- package/dist-server/service/unattended-run/unattended-prompt.js.map +0 -1
- package/dist-server/service/workspace/workspace-blocks.js.map +0 -1
- package/dist-server/service/workspace/workspace-tools.js.map +0 -1
- package/dist-server/tool-registry-boot-report.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/docs/session-controller.md +0 -52
- package/server/door-declaration-report.test.ts +0 -53
- package/server/door-declaration-report.ts +0 -61
- package/server/explicit-graphql-types.test.ts +0 -56
- package/server/index.ts +0 -36
- package/server/role-tasks.ts +0 -14
- package/server/service/ai-agent-resolver.ts +0 -330
- package/server/service/assistant-capability-resolver.ts +0 -66
- package/server/service/assistant-chat-resolver.ts +0 -640
- package/server/service/assistant-mode/assistant-mode-resolver.ts +0 -101
- package/server/service/assistant-mode/conversation-category.test.ts +0 -48
- package/server/service/assistant-mode/fallback-subjects.ts +0 -36
- package/server/service/assistant-mode/index.ts +0 -22
- package/server/service/assistant-mode/mode-categories.ts +0 -178
- package/server/service/assistant-mode/mode-front.test.ts +0 -183
- package/server/service/assistant-mode/one-conversation-per-subject.test.ts +0 -37
- package/server/service/assistant-mode/open-subject-door.test.ts +0 -52
- package/server/service/assistant-mode/record-subject.test.ts +0 -41
- package/server/service/assistant-mode/record-subject.ts +0 -44
- package/server/service/assistant-mode/registry.test.ts +0 -171
- package/server/service/assistant-mode/registry.ts +0 -139
- package/server/service/assistant-mode/resolve.test.ts +0 -129
- package/server/service/assistant-mode/resolve.ts +0 -113
- package/server/service/assistant-mode/screen-rules.test.ts +0 -99
- package/server/service/assistant-mode/screen-rules.ts +0 -103
- package/server/service/assistant-mode/turn-lines.ts +0 -43
- package/server/service/assistant-mode/types.ts +0 -138
- package/server/service/chat-message/carried-turns.test.ts +0 -80
- package/server/service/chat-message/carried-turns.ts +0 -112
- package/server/service/chat-message/chat-message-broadcast.integration.test.ts +0 -73
- package/server/service/chat-message/chat-message-broadcast.test.ts +0 -40
- package/server/service/chat-message/chat-message-broadcast.ts +0 -70
- package/server/service/chat-message/chat-message-publish.ts +0 -22
- package/server/service/chat-message/chat-message-room.test.ts +0 -145
- package/server/service/chat-message/chat-message-room.ts +0 -50
- package/server/service/chat-message/chat-message-subscription.ts +0 -77
- package/server/service/chat-message/chat-message.ts +0 -289
- package/server/service/chat-message/chat-typing-subscription.ts +0 -52
- package/server/service/chat-message/chat-typing.test.ts +0 -45
- package/server/service/chat-message/chat-typing.ts +0 -48
- package/server/service/chat-message/door-access.test.ts +0 -72
- package/server/service/chat-message/door-access.ts +0 -65
- package/server/service/chat-message/fold-history-window.test.ts +0 -184
- package/server/service/chat-message/fold-history.test.ts +0 -98
- package/server/service/chat-message/fold-history.ts +0 -77
- package/server/service/chat-message/fold-session-history.test.ts +0 -116
- package/server/service/chat-message/fold-session-history.ts +0 -115
- package/server/service/chat-message/history-summary.test.ts +0 -127
- package/server/service/chat-message/history-summary.ts +0 -100
- package/server/service/chat-message/index.ts +0 -13
- package/server/service/chat-message/llm-history.test.ts +0 -245
- package/server/service/chat-message/llm-history.ts +0 -182
- package/server/service/chat-message/message-doors.test.ts +0 -124
- package/server/service/chat-message/message-doors.ts +0 -132
- package/server/service/chat-message/proposal-outcome.test.ts +0 -111
- package/server/service/chat-message/proposal-outcome.ts +0 -99
- package/server/service/chat-message/reader-gate.ts +0 -44
- package/server/service/chat-message/room-message.test.ts +0 -21
- package/server/service/chat-message/room-message.ts +0 -22
- package/server/service/chat-message/room-turn.ts +0 -42
- package/server/service/chat-message/used-tools.test.ts +0 -19
- package/server/service/chat-message/used-tools.ts +0 -25
- package/server/service/chat-session/attachment-policy.test.ts +0 -42
- package/server/service/chat-session/attachment-policy.ts +0 -91
- package/server/service/chat-session/attachment-route.ts +0 -45
- package/server/service/chat-session/attachment-tool-result.test.ts +0 -63
- package/server/service/chat-session/attachment-tool-result.ts +0 -37
- package/server/service/chat-session/attachment-tools.ts +0 -66
- package/server/service/chat-session/chat-session.ts +0 -244
- package/server/service/chat-session/group-room.test.ts +0 -233
- package/server/service/chat-session/index.ts +0 -5
- package/server/service/chat-session/session-activity-broadcast.ts +0 -77
- package/server/service/chat-session/session-activity-publish.ts +0 -49
- package/server/service/chat-session/session-activity-receivers.test.ts +0 -26
- package/server/service/chat-session/session-activity-subscription.ts +0 -66
- package/server/service/chat-session/session-anchor.ts +0 -142
- package/server/service/chat-session/session-attachments.ts +0 -90
- package/server/service/chat-session/session-cleanup.test.ts +0 -83
- package/server/service/chat-session/session-cleanup.ts +0 -69
- package/server/service/chat-session/session-inbox.test.ts +0 -273
- package/server/service/chat-session/session-inbox.ts +0 -240
- package/server/service/chat-session/session-kind.test.ts +0 -24
- package/server/service/chat-session/session-kind.ts +0 -32
- package/server/service/chat-session/session-name.ts +0 -32
- package/server/service/chat-session/session-purge.test.ts +0 -24
- package/server/service/chat-session/session-purge.ts +0 -117
- package/server/service/chat-session/session-retention.ts +0 -17
- package/server/service/chat-session/session-visibility.test.ts +0 -130
- package/server/service/chat-session/session-visibility.ts +0 -68
- package/server/service/chat-session/session-write-gate.test.ts +0 -59
- package/server/service/chat-session/session-write-gate.ts +0 -31
- package/server/service/chat-session/station-session-guard.ts +0 -25
- package/server/service/chat-session/turn-attachments.test.ts +0 -106
- package/server/service/chat-session/turn-attachments.ts +0 -45
- package/server/service/chat-session-participant/chat-session-participant.ts +0 -135
- package/server/service/chat-session-participant/index.ts +0 -8
- package/server/service/chat-session-participant/invite-notification.test.ts +0 -80
- package/server/service/chat-session-participant/invite-notification.ts +0 -118
- package/server/service/chat-session-participant/mention-invite.test.ts +0 -173
- package/server/service/chat-session-participant/mention-invite.ts +0 -180
- package/server/service/chat-session-participant/participant-lookup-roles.ts +0 -6
- package/server/service/chat-session-participant/participant-lookup.ts +0 -22
- package/server/service/chat-session-participant/presence.test.ts +0 -39
- package/server/service/chat-session-participant/presence.ts +0 -21
- package/server/service/chat-session-participant/read-roster.test.ts +0 -27
- package/server/service/chat-session-participant/read-roster.ts +0 -17
- package/server/service/chat-session-resolver.ts +0 -1455
- package/server/service/data-entry/data-entry-update.test.ts +0 -378
- package/server/service/data-entry/data-entry.test.ts +0 -494
- package/server/service/data-entry/entry-apply.ts +0 -247
- package/server/service/data-entry/entry-hash.ts +0 -35
- package/server/service/data-entry/entry-refusal.test.ts +0 -73
- package/server/service/data-entry/entry-refusal.ts +0 -20
- package/server/service/data-entry/entry-resolver.ts +0 -74
- package/server/service/data-entry/entry-screen.ts +0 -14
- package/server/service/data-entry/entry-sources.ts +0 -39
- package/server/service/data-entry/entry-target.ts +0 -774
- package/server/service/data-entry/entry-tools.ts +0 -282
- package/server/service/data-entry/entry-update.ts +0 -238
- package/server/service/data-read/data-read.test.ts +0 -395
- package/server/service/data-read/detail-lists.test.ts +0 -61
- package/server/service/data-read/list-missing.test.ts +0 -49
- package/server/service/data-read/list-read.ts +0 -146
- package/server/service/data-read/list-status.test.ts +0 -46
- package/server/service/data-read/read-target.ts +0 -509
- package/server/service/data-read/read-tools.ts +0 -334
- package/server/service/data-read/read-words.test.ts +0 -99
- package/server/service/data-read/record-keys.test.ts +0 -42
- package/server/service/grounding-sources.test.ts +0 -55
- package/server/service/grounding-sources.ts +0 -46
- package/server/service/help-documents/help-keys.ts +0 -2
- package/server/service/help-documents/help-tools.test.ts +0 -40
- package/server/service/help-documents/help-tools.ts +0 -88
- package/server/service/index.ts +0 -99
- package/server/service/people/index.ts +0 -15
- package/server/service/people/invite-tools.ts +0 -159
- package/server/service/people/invite.test.ts +0 -159
- package/server/service/people/people-keys.ts +0 -16
- package/server/service/people/people-read.test.ts +0 -82
- package/server/service/people/people-read.ts +0 -56
- package/server/service/people/person-subject.test.ts +0 -161
- package/server/service/people/person-subject.ts +0 -83
- package/server/service/request-translator.test.ts +0 -45
- package/server/service/request-translator.ts +0 -33
- package/server/service/session-anchor.test.ts +0 -198
- package/server/service/station-session-guard.test.ts +0 -31
- package/server/service/testing/conversation-scenario.test.ts +0 -164
- package/server/service/testing/conversation-script.test.ts +0 -133
- package/server/service/testing/conversation-script.ts +0 -296
- package/server/service/testing/mode-conformance.test.ts +0 -61
- package/server/service/testing/mode-conformance.ts +0 -165
- package/server/service/tool-access.test.ts +0 -96
- package/server/service/tool-access.ts +0 -36
- package/server/service/types.ts +0 -15
- package/server/service/unattended-run/assistant-run.ts +0 -199
- package/server/service/unattended-run/index.ts +0 -10
- package/server/service/unattended-run/limits.ts +0 -24
- package/server/service/unattended-run/run-as.ts +0 -38
- package/server/service/unattended-run/run-budget.ts +0 -58
- package/server/service/unattended-run/run-ledger.ts +0 -31
- package/server/service/unattended-run/run-outcome.ts +0 -43
- package/server/service/unattended-run/run-store-race.pg.test.ts +0 -83
- package/server/service/unattended-run/run-store.ts +0 -162
- package/server/service/unattended-run/run-unattended.test.ts +0 -478
- package/server/service/unattended-run/run-unattended.ts +0 -248
- package/server/service/unattended-run/unattended-prompt.ts +0 -24
- package/server/service/workspace/workspace-blocks.ts +0 -134
- package/server/service/workspace/workspace-tools.ts +0 -108
- package/server/service/workspace/workspace.test.ts +0 -74
- package/server/tool-registry-boot-report.test.ts +0 -41
- package/server/tool-registry-boot-report.ts +0 -63
- package/test/ai-agent-settings.test.ts +0 -123
- package/test/applied-screens.test.ts +0 -65
- package/test/assistant-chat-call-sites.test.ts +0 -92
- package/test/assistant-dock.test.ts +0 -294
- package/test/assistant-request-context.test.ts +0 -72
- package/test/assistant-session-controller.test.ts +0 -87
- package/test/assistant-session-manager.test.ts +0 -186
- package/test/assistant-session-toolbar.test.ts +0 -43
- package/test/attachment-one-rule.test.ts +0 -46
- package/test/attachment-policy-agree.test.ts +0 -38
- package/test/composer-frame.test.ts +0 -173
- package/test/document-text.test.ts +0 -175
- package/test/entry-card-styles.test.ts +0 -18
- package/test/entry-proposal.test.ts +0 -186
- package/test/entry-workspace.test.ts +0 -89
- package/test/menu-room.test.ts +0 -33
- package/test/open-doors.test.ts +0 -164
- package/test/open-page.test.ts +0 -31
- package/test/pasted-table.test.ts +0 -147
- package/test/refusals-in-korean.test.ts +0 -80
- package/test/session-discovery.test.ts +0 -43
- package/test/spreadsheet-text.test.ts +0 -92
- package/test/translations.test.ts +0 -80
- package/test/workspace.test.ts +0 -54
- package/tsconfig.json +0 -9
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The screen asks what its conversation offers.
|
|
3
|
-
*
|
|
4
|
-
* The `/` sentences, the `@` catalog and the two notices used to travel from the browser into the
|
|
5
|
-
* request, which meant the screen and the door could describe the same conversation differently.
|
|
6
|
-
* They are declared once, in the mode, as i18n keys — and this query hands them over already
|
|
7
|
-
* written in the request's locale (ADR-0054, and the same rule A11 applied to the stop notice).
|
|
8
|
-
* The persona, the tool categories and the limits stay on the server: nothing here returns them.
|
|
9
|
-
*/
|
|
10
|
-
import { Arg, Ctx, Directive, Field, ObjectType, Query, Resolver } from 'type-graphql'
|
|
11
|
-
import { GraphQLJSON } from 'graphql-scalars'
|
|
12
|
-
import '@things-factory/auth-base'
|
|
13
|
-
|
|
14
|
-
import { assistantModeView } from './resolve.js'
|
|
15
|
-
import { assistantModeForSubject } from './registry.js'
|
|
16
|
-
import { requestTranslator } from '../request-translator.js'
|
|
17
|
-
|
|
18
|
-
@ObjectType({ description: 'One `/` sentence, in the words of this request.' })
|
|
19
|
-
class AssistantModeSlashView {
|
|
20
|
-
@Field({ description: 'Short name shown in the list.' })
|
|
21
|
-
name: string
|
|
22
|
-
|
|
23
|
-
@Field({ description: 'One line about what it does.' })
|
|
24
|
-
description: string
|
|
25
|
-
|
|
26
|
-
@Field({ description: 'The sentence that lands in the input.' })
|
|
27
|
-
template: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@ObjectType({ description: 'What a conversation offers on screen.' })
|
|
31
|
-
class AssistantModeView {
|
|
32
|
-
@Field({ description: 'The mode kind this describes.' })
|
|
33
|
-
kind: string
|
|
34
|
-
|
|
35
|
-
@Field(() => [AssistantModeSlashView], { description: 'What `/` offers.' })
|
|
36
|
-
slashTemplates: AssistantModeSlashView[]
|
|
37
|
-
|
|
38
|
-
@Field(() => GraphQLJSON, { description: 'What `@` offers.' })
|
|
39
|
-
catalogEntries: any[]
|
|
40
|
-
|
|
41
|
-
@Field(() => GraphQLJSON, { description: 'Follow-up chips for a proposal that arrived without its own.' })
|
|
42
|
-
proposalChoices: any[]
|
|
43
|
-
|
|
44
|
-
@Field({ nullable: true, description: 'What the empty input says — what this conversation is for.' })
|
|
45
|
-
placeholder?: string
|
|
46
|
-
|
|
47
|
-
@Field(() => GraphQLJSON, { nullable: true, description: 'Title and one line for an empty conversation.' })
|
|
48
|
-
intro?: { title: string; subtitle: string }
|
|
49
|
-
|
|
50
|
-
@Field(() => GraphQLJSON, { nullable: true, description: 'Example sentences this conversation can actually answer.' })
|
|
51
|
-
examples?: Array<{ label: string; items: string[] }>
|
|
52
|
-
|
|
53
|
-
@Field({ nullable: true, description: 'The line under an empty conversation.' })
|
|
54
|
-
footerNotice?: string
|
|
55
|
-
|
|
56
|
-
@Field({ nullable: true, description: 'The line shown once the host reports a proposal staged.' })
|
|
57
|
-
stagedNotice?: string
|
|
58
|
-
|
|
59
|
-
@Field(() => GraphQLJSON, {
|
|
60
|
-
nullable: true,
|
|
61
|
-
description: "What this conversation accepts as attachments: { kinds: ('image'|'text'|'spreadsheet'|'document')[], maxBytes, maxFiles, maxChars }. Null: none."
|
|
62
|
-
})
|
|
63
|
-
attachments?: any
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@ObjectType({ description: 'The conversation a screen opens for what it is showing.' })
|
|
67
|
-
class AssistantModeChoice {
|
|
68
|
-
@Field({ description: 'The mode kind to open.' })
|
|
69
|
-
kind: string
|
|
70
|
-
|
|
71
|
-
@Field({ description: 'What the conversation is called in the conversation list, in the words of this request.' })
|
|
72
|
-
label: string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@Resolver()
|
|
76
|
-
export class AssistantModeResolver {
|
|
77
|
-
/*
|
|
78
|
-
* 이 화면의 대화 — 화면에 대화 하나(design/ai/screen-pattern.md §3).
|
|
79
|
-
*
|
|
80
|
-
* 화면은 자기가 무엇을 보여 주는지(`subject`)만 안다. 그 위에 어느 대화가 서는지는 앱 서버가 선언한다.
|
|
81
|
-
*/
|
|
82
|
-
@Query(() => AssistantModeChoice, {
|
|
83
|
-
nullable: true,
|
|
84
|
-
description: 'The one conversation for this kind of subject. Null when no application declared one.'
|
|
85
|
-
})
|
|
86
|
-
@Directive('@privilege(category: "ai-assistant", privilege: "query", domainOwnerGranted: true)')
|
|
87
|
-
async assistantModeFor(@Arg('subject') subject: string, @Ctx() context: any): Promise<AssistantModeChoice | null> {
|
|
88
|
-
const mode = assistantModeForSubject(subject)
|
|
89
|
-
if (!mode) return null
|
|
90
|
-
const t = requestTranslator(context)
|
|
91
|
-
return { kind: mode.kind, label: mode.labelKey ? t(mode.labelKey) : mode.kind }
|
|
92
|
-
}
|
|
93
|
-
@Query(() => AssistantModeView, {
|
|
94
|
-
description: 'What this conversation offers on screen — `/` sentences, the `@` catalog and the notices, translated.'
|
|
95
|
-
})
|
|
96
|
-
/* Reading what a conversation offers is reading, and the same door the session list uses. */
|
|
97
|
-
@Directive('@privilege(category: "ai-assistant", privilege: "query", domainOwnerGranted: true)')
|
|
98
|
-
async assistantMode(@Arg('kind') kind: string, @Ctx() context: any): Promise<AssistantModeView> {
|
|
99
|
-
return assistantModeView(kind, requestTranslator(context)) as AssistantModeView
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A category another package opens in every conversation (ADR-0160 decision 9) - in reach everywhere, in front only on
|
|
3
|
-
* the pages it names, never in an unattended run.
|
|
4
|
-
*/
|
|
5
|
-
import { clearConversationCategories, modeFrontCategories, modeScreens, modeToolCategories, registerConversationCategory, turnSystemPrompt, unattendedToolCategories } from './mode-categories'
|
|
6
|
-
|
|
7
|
-
const mode = { toolCategories: ['office-ops'], readTargets: ['office.receivables'] }
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
clearConversationCategories()
|
|
11
|
-
registerConversationCategory({ name: 'dashboard-card', frontPages: ['my-dashboard'], frontAxes: ['dashboard-card'] })
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
afterAll(() => clearConversationCategories())
|
|
15
|
-
|
|
16
|
-
describe('a category every conversation opens', () => {
|
|
17
|
-
it('★ every mode opens it', () => {
|
|
18
|
-
expect(modeToolCategories(mode)).toContain('dashboard-card')
|
|
19
|
-
expect(modeToolCategories({})).toContain('dashboard-card')
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('★ it goes in front on its page, and only there', () => {
|
|
23
|
-
expect(modeFrontCategories(mode, { page: 'my-dashboard' })).toContain('dashboard-card')
|
|
24
|
-
expect(modeFrontCategories(mode, { page: 'receivable-page' })).not.toContain('dashboard-card')
|
|
25
|
-
expect(modeFrontCategories(mode, {})).not.toContain('dashboard-card')
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('★ a record of its axis picked or anchored puts it in front, on any page - a picked card is changed by its tools', () => {
|
|
29
|
-
expect(modeFrontCategories(mode, { page: 'receivable-page', selectionAxes: ['dashboard-card'] })).toContain('dashboard-card')
|
|
30
|
-
expect(modeFrontCategories(mode, { subjectAxis: 'dashboard-card' })).toContain('dashboard-card')
|
|
31
|
-
expect(modeFrontCategories(mode, { page: 'receivable-page', selectionAxes: ['contract'] })).not.toContain('dashboard-card')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('★ its page rule is said in the turns asked from its pages, and only there', () => {
|
|
35
|
-
registerConversationCategory({ name: 'dashboard-card', frontPages: ['my-dashboard'], pageRule: 'end in a card.' })
|
|
36
|
-
expect(turnSystemPrompt('persona', { page: 'my-dashboard', subjectLine: 'open: x' })).toBe('persona\n\nopen: x\n\nend in a card.')
|
|
37
|
-
expect(turnSystemPrompt('persona', { page: 'receivable-page' })).toBe('persona')
|
|
38
|
-
expect(turnSystemPrompt('persona', {})).toBe('persona')
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('an unattended run never opens it - nobody is there to press the card', () => {
|
|
42
|
-
expect(unattendedToolCategories(mode)).not.toContain('dashboard-card')
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('the boot report walks its page, so a budget overrun there is said at boot', () => {
|
|
46
|
-
expect(modeScreens(mode)).toContainEqual({ page: 'my-dashboard' })
|
|
47
|
-
})
|
|
48
|
-
})
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The open subjects the shared parts can name without an application's help (design/ai/screen-pattern.md §2-1):
|
|
3
|
-
* the site (`domain`), an application's home (`application`) and a board (`board`). An application that names
|
|
4
|
-
* one of these differently registers its own describer, which is read first.
|
|
5
|
-
*
|
|
6
|
-
* A board is read by entity name: the board entity belongs to board-service, and this package does not depend on
|
|
7
|
-
* it. A deployment without boards has no board anchors, and a read that fails says the subject could not be read.
|
|
8
|
-
*/
|
|
9
|
-
import { Domain, getRepository } from '@things-factory/shell'
|
|
10
|
-
import { registerFallbackSubject } from '@things-factory/ai-client-base'
|
|
11
|
-
|
|
12
|
-
registerFallbackSubject({
|
|
13
|
-
anchorType: 'domain',
|
|
14
|
-
async describe({ anchorId, domain }) {
|
|
15
|
-
/* The site of this conversation only - another domain's name is not this person's to read. */
|
|
16
|
-
if (anchorId !== domain.id) return undefined
|
|
17
|
-
const found = await getRepository(Domain).findOne({ where: { id: anchorId } })
|
|
18
|
-
return found ? { noun: 'site', name: found.description || found.name } : undefined
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
registerFallbackSubject({
|
|
23
|
-
anchorType: 'application',
|
|
24
|
-
async describe({ anchorId }) {
|
|
25
|
-
/* The application's home is a place, not a record: nothing narrower is open. */
|
|
26
|
-
return { noun: 'home of the application', name: anchorId }
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
registerFallbackSubject({
|
|
31
|
-
anchorType: 'board',
|
|
32
|
-
async describe({ anchorId, domain }) {
|
|
33
|
-
const found: any = await getRepository('Board').findOne({ where: { id: anchorId, domain: { id: domain.id } } })
|
|
34
|
-
return found?.name ? { noun: 'board', name: found.name } : undefined
|
|
35
|
-
}
|
|
36
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Modes — what each conversation is, declared by the app server that owns the screen.
|
|
3
|
-
*
|
|
4
|
-
* Design: ADR-0061 decision 7 (`operato-application/adr/ADR-0061.md`) and the AI standard's A2.
|
|
5
|
-
*/
|
|
6
|
-
export {
|
|
7
|
-
registerAssistantMode,
|
|
8
|
-
getAssistantMode,
|
|
9
|
-
listAssistantModes,
|
|
10
|
-
assistantModeForSubject,
|
|
11
|
-
getAssistantModeWarnings,
|
|
12
|
-
clearAssistantModes
|
|
13
|
-
} from './registry.js'
|
|
14
|
-
export { resolveModeSettings, assistantModeView } from './resolve.js'
|
|
15
|
-
/* A category another package opens in every conversation, in front on the pages it names (ADR-0160 decision 9). */
|
|
16
|
-
export { registerConversationCategory, conversationCategoriesOf, turnSystemPrompt, type ConversationCategory } from './mode-categories.js'
|
|
17
|
-
/* The record an open 360 is about, named by the module that owns it (screen-pattern §2-1). */
|
|
18
|
-
export { recordSubjectDescriber, registerRecordSubject, type RecordSubject } from './record-subject.js'
|
|
19
|
-
export { ABSENCE_RULE, FINISH_RULE, NEXT_REQUEST_RULE, SELECTION_RULE, SPEAKER_RULE, conversationPrompt, isPersonRequest, splitNextRequest } from './screen-rules.js'
|
|
20
|
-
export type { AssistantModeSpec, AssistantModeSlash, AssistantModeWarning, UnattendedLimits } from './types.js'
|
|
21
|
-
export type { AssistantModeRef, ModeSettings, AssistantModeView, AssistantModeSlashView, Translate } from './resolve.js'
|
|
22
|
-
export { registerTurnLine, turnLinesOf, type TurnLine, type TurnLineInput } from './turn-lines.js'
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/* Read by the resolver and by the boot report, so the report and the conversation open the same tools. */
|
|
2
|
-
import { entryTargetOf } from '../data-entry/entry-target.js'
|
|
3
|
-
import { detailReadOf, readTargetOf } from '../data-read/read-target.js'
|
|
4
|
-
import { HELP_CATEGORY } from '../help-documents/help-keys.js'
|
|
5
|
-
import { PEOPLE_CATEGORIES } from '../people/people-keys.js'
|
|
6
|
-
/**
|
|
7
|
-
* A category another package opens in every conversation - a dashboard card (ADR-0160 decision 9). It is in reach of
|
|
8
|
-
* every conversation; it is put in front only on the pages it names, and found with `openTools` elsewhere (ADR-0061
|
|
9
|
-
* decision 9). Never in an unattended run: its tools are proposals, and nobody is there to press the card.
|
|
10
|
-
*/
|
|
11
|
-
export interface ConversationCategory {
|
|
12
|
-
name: string
|
|
13
|
-
/** The application routes whose conversations put it in front (`my-dashboard`). */
|
|
14
|
-
frontPages?: string[]
|
|
15
|
-
/**
|
|
16
|
-
* The axes of the records whose selection or anchor puts it in front (`dashboard-card`) - a card picked to change is
|
|
17
|
-
* changed by this category's tools, wherever the dock is open.
|
|
18
|
-
*/
|
|
19
|
-
frontAxes?: string[]
|
|
20
|
-
/**
|
|
21
|
-
* What a turn asked from one of its front pages must end in - said in that turn's system prompt only. On 나의 대시보드
|
|
22
|
-
* a request to see a figure is a card; asked 「이번 달 지출 합계」 there, the model answered 「0원」 in words (2026-10-25).
|
|
23
|
-
*/
|
|
24
|
-
pageRule?: string
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const conversationCategories = new Map<string, ConversationCategory>()
|
|
28
|
-
|
|
29
|
-
export function registerConversationCategory(category: ConversationCategory): void {
|
|
30
|
-
conversationCategories.set(category.name, category)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function conversationCategoriesOf(): ConversationCategory[] {
|
|
34
|
-
return [...conversationCategories.values()]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function clearConversationCategories(): void {
|
|
38
|
-
conversationCategories.clear()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** The system prompt of one turn - the mode's, the open record's line, and the rules of the page it is asked from. */
|
|
42
|
-
export function turnSystemPrompt(modePrompt: string, screen: { page?: string; subjectLine?: string } = {}): string {
|
|
43
|
-
const pageRules = screen.page ? conversationCategoriesOf().filter(one => one.pageRule && (one.frontPages ?? []).includes(screen.page!)).map(one => one.pageRule!) : []
|
|
44
|
-
return [modePrompt, screen.subjectLine, ...pageRules].filter(Boolean).join('\n\n')
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The categories a mode opens: its own, the AI 작업 패널 (design/ai/workspace.md), the attachment reader when it
|
|
49
|
-
* takes files (design/ai/shared-dock.md §9-4), and one propose tool per record it may enter (design/ai/data-entry.md).
|
|
50
|
-
*/
|
|
51
|
-
export function modeToolCategories(mode: { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }): string[] | undefined {
|
|
52
|
-
const extra = [
|
|
53
|
-
/* Every conversation may put a large result on the AI 작업 패널 (design/ai/workspace.md). */
|
|
54
|
-
'assistant-workspace',
|
|
55
|
-
/* Every conversation may read who works here and offer to bring one of them in (people/, ADR-0073 decision 3). */
|
|
56
|
-
...PEOPLE_CATEGORIES,
|
|
57
|
-
/* Every conversation may read the application's help (ADR-0181). */
|
|
58
|
-
HELP_CATEGORY,
|
|
59
|
-
...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),
|
|
60
|
-
...(mode.entryTargets ?? []).map(key => `data-entry:${key}`),
|
|
61
|
-
...(mode.readTargets ?? []).map(key => `data-read:${key}`),
|
|
62
|
-
...conversationCategoriesOf().map(one => one.name)
|
|
63
|
-
]
|
|
64
|
-
return [...new Set([...(mode.toolCategories ?? []), ...extra])]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* The categories an unattended run of a mode opens: its own and the lists it reads (design/ai/unattended-run.md §3).
|
|
69
|
-
*
|
|
70
|
-
* Not the 입력안 tools - nobody is there to press the card - nor the AI 작업 패널 or the attachment reader: there is no
|
|
71
|
-
* conversation for a card or a file to belong to.
|
|
72
|
-
*/
|
|
73
|
-
export function unattendedToolCategories(mode: { toolCategories?: string[]; readTargets?: string[] }): string[] {
|
|
74
|
-
return [...new Set([...(mode.toolCategories ?? []), ...(mode.readTargets ?? []).map(key => `data-read:${key}`)])]
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** The screen a turn is asked from - the page the dock is on, and the record its conversation is anchored to. */
|
|
78
|
-
export interface TurnScreen {
|
|
79
|
-
/** The application's route of the open page (`cash-transaction-list`), as the dock sends it. */
|
|
80
|
-
page?: string
|
|
81
|
-
/** The axis of the record the conversation is anchored to (`contract` of `subject` · `contract:<id>`), from the stored anchor. */
|
|
82
|
-
subjectAxis?: string
|
|
83
|
-
/** The axes of the records the latest selection named (`contract` of `[keys] contracts contract:<id>`) - `selectionAxesOf`. */
|
|
84
|
-
selectionAxes?: string[]
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** The line of a selection note the model reads - the client's `SELECTION_KEYS_PREFIX` (assistant-selection.ts). */
|
|
88
|
-
export const SELECTION_KEYS_LINE = '[keys]'
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The axes of the records the latest selection note names (「AI와 작업」, shared-dock §2-11-1): a list hands its rows as
|
|
92
|
-
* `<axis>:<uuid>`, so the rows' list is read with the tool of that axis. Put in front like an anchored record's - picked
|
|
93
|
-
* on 미수금, the contracts' read was not in front, and the model looked for them among attachments and a dashboard's cards
|
|
94
|
-
* before it opened the right tool (2026-10-25). A note is the server's (`appendSessionNote`, system); a person's words
|
|
95
|
-
* are never read for it.
|
|
96
|
-
*/
|
|
97
|
-
export function selectionAxesOf(rows: { role?: string; content?: string | null }[]): string[] {
|
|
98
|
-
for (let i = rows.length - 1; i >= 0; i--) {
|
|
99
|
-
if (rows[i].role !== 'system') continue
|
|
100
|
-
const line = String(rows[i].content ?? '')
|
|
101
|
-
.split('\n')
|
|
102
|
-
.find(one => one.startsWith(SELECTION_KEYS_LINE))
|
|
103
|
-
if (!line) continue
|
|
104
|
-
const keys = line.slice(SELECTION_KEYS_LINE.length).trim().split(/\s+/)
|
|
105
|
-
return [...new Set(keys.map(one => one.match(/^([a-z0-9-]+):/)?.[1]).filter((one): one is string => !!one))]
|
|
106
|
-
}
|
|
107
|
-
return []
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
type FrontMode = { toolCategories?: string[]; attachments?: { kinds?: string[] }; entryTargets?: string[]; readTargets?: string[] }
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* The records the open screen is about, among those the mode reads and enters (ADR-0061 decision 9). A key's page is
|
|
114
|
-
* the screen that lists its records (ReadTarget.screen.route), the screen a card's records are seen on
|
|
115
|
-
* (EntryTarget.screen) and the pages a read of one record names (DetailRead.frontPages); a key's last part is the axis
|
|
116
|
-
* of its record (`office.contract` is the record of the axis `contract`) - reading and entering one record share its key.
|
|
117
|
-
*/
|
|
118
|
-
export function screenTargetKeys(mode: FrontMode, screen: TurnScreen, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): string[] {
|
|
119
|
-
const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]
|
|
120
|
-
return keys.filter(
|
|
121
|
-
key =>
|
|
122
|
-
(!!screen.page && pagesOfKey(mode, key, routeOf).includes(screen.page)) ||
|
|
123
|
-
(!!screen.subjectAxis && axesOfKey(mode, key).includes(screen.subjectAxis)) ||
|
|
124
|
-
(!!screen.selectionAxes?.length && axesOfKey(mode, key).some(axis => screen.selectionAxes!.includes(axis)))
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Pages that prioritize this tool or card. Include a card's editing page so assistant draft requests can
|
|
130
|
-
* use it directly.
|
|
131
|
-
*/
|
|
132
|
-
function pagesOfKey(mode: FrontMode, key: string, routeOf: (key: string) => string | undefined): string[] {
|
|
133
|
-
const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.screen : undefined
|
|
134
|
-
const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.frontPages ?? [] : []
|
|
135
|
-
return [routeOf(key), card, ...answer].filter((page): page is string => !!page)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/** The records a key is about: its last part, and the axes a card joins or a whole answer covers (EntryTarget.axes · DetailRead.axes). */
|
|
139
|
-
function axesOfKey(mode: FrontMode, key: string): string[] {
|
|
140
|
-
const card = (mode.entryTargets ?? []).includes(key) ? entryTargetOf(key)?.axes ?? [] : []
|
|
141
|
-
const answer = (mode.readTargets ?? []).includes(key) ? detailReadOf(key)?.axes ?? [] : []
|
|
142
|
-
return [key.split('.').pop()!, ...card, ...answer]
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* The categories a turn puts in front when the mode's tools do not fit in one call: the mode's own, the AI 작업 패널, the
|
|
147
|
-
* people list and the invite card, the attachment reader, and the open screen's records. The rest the model opens with `openTools`.
|
|
148
|
-
*/
|
|
149
|
-
export function modeFrontCategories(mode: FrontMode, screen: TurnScreen = {}): string[] {
|
|
150
|
-
const keys = screenTargetKeys(mode, screen)
|
|
151
|
-
return [
|
|
152
|
-
...new Set([
|
|
153
|
-
...(mode.toolCategories ?? []),
|
|
154
|
-
'assistant-workspace',
|
|
155
|
-
/*
|
|
156
|
-
* Two tools, always in front: 「정연희 초대해 줘」 asked in a conversation whose tools did not fit got the answer that
|
|
157
|
-
* there was no tool to look people up (2026-10-24).
|
|
158
|
-
*/
|
|
159
|
-
...PEOPLE_CATEGORIES,
|
|
160
|
-
/* Two tools, always in front: 「지출결의는 어디서 올려?」 is asked on any screen (ADR-0181). */
|
|
161
|
-
HELP_CATEGORY,
|
|
162
|
-
...(mode.attachments?.kinds?.length ? ['chat-attachments'] : []),
|
|
163
|
-
...keys.filter(key => (mode.readTargets ?? []).includes(key)).map(key => `data-read:${key}`),
|
|
164
|
-
...keys.filter(key => (mode.entryTargets ?? []).includes(key)).map(key => `data-entry:${key}`),
|
|
165
|
-
...conversationCategoriesOf()
|
|
166
|
-
.filter(one => (!!screen.page && (one.frontPages ?? []).includes(screen.page)) || (one.frontAxes ?? []).some(axis => axis === screen.subjectAxis || !!screen.selectionAxes?.includes(axis)))
|
|
167
|
-
.map(one => one.name)
|
|
168
|
-
])
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/** Each screen the mode could be asked from - a page that lists one of its records, a record's axis - for the boot report. */
|
|
173
|
-
export function modeScreens(mode: FrontMode, routeOf: (key: string) => string | undefined = key => readTargetOf(key)?.screen?.route): TurnScreen[] {
|
|
174
|
-
const keys = [...new Set([...(mode.readTargets ?? []), ...(mode.entryTargets ?? [])])]
|
|
175
|
-
const pages = [...new Set([...keys.flatMap(key => pagesOfKey(mode, key, routeOf)), ...conversationCategoriesOf().flatMap(one => one.frontPages ?? [])])]
|
|
176
|
-
const axes = [...new Set(keys.flatMap(key => axesOfKey(mode, key)))]
|
|
177
|
-
return [{}, ...pages.map(page => ({ page })), ...axes.map(subjectAxis => ({ subjectAxis }))]
|
|
178
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What a turn puts in front when its mode's tools do not fit in one call (ADR-0061 decision 9) - the open screen's
|
|
3
|
-
* records, found from what is already declared: a list's screen route and a key's last part.
|
|
4
|
-
*/
|
|
5
|
-
import { clearReadTargets, declareDetailRead, declareReadTarget } from '../data-read/read-target'
|
|
6
|
-
import { listReadTarget } from '../data-read/list-read'
|
|
7
|
-
import { modeFrontCategories, modeScreens, screenTargetKeys, selectionAxesOf, SELECTION_KEYS_LINE } from './mode-categories'
|
|
8
|
-
import { readFileSync } from 'node:fs'
|
|
9
|
-
import { join } from 'node:path'
|
|
10
|
-
import { clearEntryTargets, declareEntryTarget } from '../data-entry/entry-target'
|
|
11
|
-
|
|
12
|
-
const list = (key: string, route?: string) =>
|
|
13
|
-
listReadTarget({ key, title: `title.${key}`, name: key, listQuery: 'rows', selection: 'id name', columns: [{ name: 'name', type: 'string' }], ...(route ? { route } : {}) } as any)
|
|
14
|
-
|
|
15
|
-
const mode = {
|
|
16
|
-
toolCategories: ['office-ops'],
|
|
17
|
-
attachments: { kinds: ['image'] },
|
|
18
|
-
readTargets: ['office.cash-transaction', 'office.contract', 'office.contract-allocation', 'office.loan-summary'],
|
|
19
|
-
entryTargets: ['office.cash-transaction', 'office.contract', 'office.contract-round', 'office.expense-line']
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
clearReadTargets()
|
|
24
|
-
declareReadTarget(list('office.cash-transaction', 'cash-transaction-list'))
|
|
25
|
-
declareReadTarget(list('office.contract', 'contract-list'))
|
|
26
|
-
declareReadTarget(list('office.contract-allocation', 'contract-allocation-list'))
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
describe('the open screen decides what goes in front', () => {
|
|
30
|
-
it('★ a list page: that list read and its record entered - one key, both ways', () => {
|
|
31
|
-
expect(modeFrontCategories(mode, { page: 'cash-transaction-list' })).toEqual([
|
|
32
|
-
'office-ops',
|
|
33
|
-
'assistant-workspace',
|
|
34
|
-
'data-read:organization.employee',
|
|
35
|
-
'chat-invite',
|
|
36
|
-
'help-documents',
|
|
37
|
-
'chat-attachments',
|
|
38
|
-
'data-read:office.cash-transaction',
|
|
39
|
-
'data-entry:office.cash-transaction'
|
|
40
|
-
])
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('★ a record\'s conversation: the keys whose last part is its axis - never a key that only starts with it', () => {
|
|
44
|
-
expect(screenTargetKeys(mode, { subjectAxis: 'contract' })).toEqual(['office.contract'])
|
|
45
|
-
expect(screenTargetKeys(mode, { subjectAxis: 'contract-round' })).toEqual(['office.contract-round'])
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('★ the rows a person picked put their list in front - by the axis of their keys, from the latest note only', () => {
|
|
49
|
-
const rows = [
|
|
50
|
-
{ role: 'system', content: 'Selected 1 · 미수금: H1\n[keys] contracts contract:a1' },
|
|
51
|
-
{ role: 'user', content: '[keys] loans loan:x - typed by a person, never read for it' },
|
|
52
|
-
{ role: 'system', content: 'Selected 2 · 입출금: A, B\n[keys] transactions cash-transaction:b1 cash-transaction:b2' }
|
|
53
|
-
]
|
|
54
|
-
expect(selectionAxesOf(rows)).toEqual(['cash-transaction'])
|
|
55
|
-
expect(selectionAxesOf(rows.slice(0, 2))).toEqual(['contract'])
|
|
56
|
-
expect(selectionAxesOf([{ role: 'system', content: 'Selected 1 · L\n[keys] rows a1' }])).toEqual([])
|
|
57
|
-
expect(selectionAxesOf([])).toEqual([])
|
|
58
|
-
expect(screenTargetKeys(mode, { selectionAxes: ['contract'] })).toEqual(['office.contract'])
|
|
59
|
-
expect(modeFrontCategories(mode, { page: 'receivable-page', selectionAxes: ['contract'] })).toEqual(expect.arrayContaining(['data-read:office.contract', 'data-entry:office.contract']))
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('★ a turn puts the stored conversation\'s selection in front - never the client\'s', () => {
|
|
63
|
-
const resolver = readFileSync(join(__dirname, '../assistant-chat-resolver.ts'), 'utf-8')
|
|
64
|
-
expect(resolver).toMatch(/modeFrontCategories\([\s\S]{0,400}selectionAxes: selectionAxesOf\(storedRows as any\)/)
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('the note\'s key line is the one the client writes', () => {
|
|
68
|
-
const client = readFileSync(join(__dirname, '../../../client/utils/assistant-selection.ts'), 'utf-8')
|
|
69
|
-
expect(client).toContain(`export const SELECTION_KEYS_PREFIX = '${SELECTION_KEYS_LINE}'`)
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('★ a record the mode does not read or enter is not put in front', () => {
|
|
73
|
-
expect(modeFrontCategories({ ...mode, readTargets: [], entryTargets: [] }, { page: 'cash-transaction-list' })).toEqual(['office-ops', 'assistant-workspace', 'data-read:organization.employee', 'chat-invite', 'help-documents', 'chat-attachments'])
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('no screen: the mode\'s own, the AI 작업 패널 and the attachment reader', () => {
|
|
77
|
-
expect(modeFrontCategories(mode)).toEqual(['office-ops', 'assistant-workspace', 'data-read:organization.employee', 'chat-invite', 'help-documents', 'chat-attachments'])
|
|
78
|
-
expect(modeFrontCategories(mode, { page: 'some-other-page' })).toEqual(['office-ops', 'assistant-workspace', 'data-read:organization.employee', 'chat-invite', 'help-documents', 'chat-attachments'])
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it('the screens the boot report walks: none, each list page, each axis', () => {
|
|
82
|
-
expect(modeScreens(mode)).toEqual([
|
|
83
|
-
{},
|
|
84
|
-
{ page: 'cash-transaction-list' },
|
|
85
|
-
{ page: 'contract-list' },
|
|
86
|
-
{ page: 'contract-allocation-list' },
|
|
87
|
-
{ subjectAxis: 'cash-transaction' },
|
|
88
|
-
{ subjectAxis: 'contract' },
|
|
89
|
-
{ subjectAxis: 'contract-allocation' },
|
|
90
|
-
{ subjectAxis: 'loan-summary' },
|
|
91
|
-
{ subjectAxis: 'contract-round' },
|
|
92
|
-
{ subjectAxis: 'expense-line' }
|
|
93
|
-
])
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
/* 2026-10-24: asked to link a deposit from its 360, the model read the evidence and never opened the link card. */
|
|
98
|
-
describe('a card about several records is in front on each of their screens', () => {
|
|
99
|
-
const link = {
|
|
100
|
-
key: 'office.tax-invoice-binding',
|
|
101
|
-
labelKey: 'label.link',
|
|
102
|
-
description: 'a link of an invoice to a bank line or a round.',
|
|
103
|
-
mutation: 'mutation ($binding: Binding!) { bind(binding: $binding) { id } }',
|
|
104
|
-
variables: (row: any) => ({ binding: row.values }),
|
|
105
|
-
appliedOf: (data: any) => ({ id: data?.bind?.id }),
|
|
106
|
-
fields: [{ name: 'amount', type: 'number' as const, required: true }],
|
|
107
|
-
axes: ['cash-transaction', 'tax-invoice', 'contract-round']
|
|
108
|
-
}
|
|
109
|
-
const linking = { ...mode, entryTargets: [...mode.entryTargets, link.key] }
|
|
110
|
-
beforeEach(() => {
|
|
111
|
-
clearEntryTargets()
|
|
112
|
-
declareEntryTarget(link as any)
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it('★ a deposit\'s 360 puts the link card in front with the deposit\'s own', () => {
|
|
116
|
-
expect(screenTargetKeys(linking, { subjectAxis: 'cash-transaction' })).toEqual(['office.cash-transaction', 'office.tax-invoice-binding'])
|
|
117
|
-
expect(modeFrontCategories(linking, { subjectAxis: 'cash-transaction' })).toContain('data-entry:office.tax-invoice-binding')
|
|
118
|
-
expect(screenTargetKeys(linking, { subjectAxis: 'contract-round' })).toEqual(['office.contract-round', 'office.tax-invoice-binding'])
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('★ not on a screen of a record it does not join, and not for a mode that does not enter it', () => {
|
|
122
|
-
expect(screenTargetKeys(linking, { subjectAxis: 'contract' })).toEqual(['office.contract'])
|
|
123
|
-
expect(screenTargetKeys(mode, { subjectAxis: 'cash-transaction' })).toEqual(['office.cash-transaction'])
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('the boot report walks the axes a card declares, so its screens are counted against the budget', () => {
|
|
127
|
-
expect(modeScreens(linking)).toContainEqual({ subjectAxis: 'tax-invoice' })
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
/* 2026-10-24: asked on a deposit's 360 why it was in the management check, the model never opened the check read. */
|
|
132
|
-
describe('a whole answer about any record is in front on their screens', () => {
|
|
133
|
-
const checks = { key: 'office.checks', description: 'the management check.', query: 'query { officeChecks { today } }', axes: ['cash-transaction', 'contract'] }
|
|
134
|
-
const reading = { ...mode, readTargets: [...mode.readTargets, checks.key] }
|
|
135
|
-
beforeEach(() => declareDetailRead(checks as any))
|
|
136
|
-
|
|
137
|
-
it('★ the check read is in front on a deposit\'s and a contract\'s 360', () => {
|
|
138
|
-
expect(modeFrontCategories(reading, { subjectAxis: 'cash-transaction' })).toContain('data-read:office.checks')
|
|
139
|
-
expect(modeFrontCategories(reading, { subjectAxis: 'contract' })).toContain('data-read:office.checks')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('★ not on a record it does not cover, nor for a mode that does not read it', () => {
|
|
143
|
-
expect(modeFrontCategories(reading, { subjectAxis: 'expense-line' })).not.toContain('data-read:office.checks')
|
|
144
|
-
expect(modeFrontCategories(mode, { subjectAxis: 'cash-transaction' })).not.toContain('data-read:office.checks')
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
/*
|
|
149
|
-
* Prioritize the weekly-report reader and line-entry card on the personal report page.
|
|
150
|
-
*/
|
|
151
|
-
describe('a page puts in front the cards seen on it and the reads that name it', () => {
|
|
152
|
-
const line = {
|
|
153
|
-
key: 'office.weekly-report-line',
|
|
154
|
-
labelKey: 'label.line',
|
|
155
|
-
description: 'a line of the weekly report.',
|
|
156
|
-
mutation: 'mutation ($line: Line!) { saveLine(line: $line) { id } }',
|
|
157
|
-
variables: (row: any) => ({ line: row.values }),
|
|
158
|
-
appliedOf: (data: any) => ({ id: data?.saveLine?.id }),
|
|
159
|
-
fields: [{ name: 'content', type: 'string' as const, required: true }],
|
|
160
|
-
screen: 'my-weekly-report'
|
|
161
|
-
}
|
|
162
|
-
const week = { key: 'office.my-weekly-report', description: 'the week.', query: 'query ($weekStart: String!) { myWeeklyReport(weekStart: $weekStart) { id } }', args: [{ name: 'weekStart', type: 'date', required: true }], frontPages: ['my-weekly-report'] }
|
|
163
|
-
const writing = { ...mode, readTargets: [...mode.readTargets, week.key], entryTargets: [...mode.entryTargets, line.key] }
|
|
164
|
-
beforeEach(() => {
|
|
165
|
-
clearEntryTargets()
|
|
166
|
-
declareEntryTarget(line as any)
|
|
167
|
-
declareDetailRead(week as any)
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
it("prioritizes the weekly-report reader and line-entry card on the personal report page", () => {
|
|
171
|
-
expect(screenTargetKeys(writing, { page: 'my-weekly-report' })).toEqual(['office.my-weekly-report', 'office.weekly-report-line'])
|
|
172
|
-
expect(modeFrontCategories(writing, { page: 'my-weekly-report' })).toEqual(expect.arrayContaining(['data-read:office.my-weekly-report', 'data-entry:office.weekly-report-line']))
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
it('not on another page, nor for a mode that does not read or enter them', () => {
|
|
176
|
-
expect(screenTargetKeys(writing, { page: 'cash-transaction-list' })).toEqual(['office.cash-transaction'])
|
|
177
|
-
expect(screenTargetKeys(mode, { page: 'my-weekly-report' })).toEqual([])
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it('the boot report walks those pages, so they are counted against the budget', () => {
|
|
181
|
-
expect(modeScreens(writing)).toContainEqual({ page: 'my-weekly-report' })
|
|
182
|
-
})
|
|
183
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A screen has one conversation (operato-application design/ai/screen-pattern.md §3).
|
|
3
|
-
*
|
|
4
|
-
* Two conversations on one subject put a picker in front of the person, a choice between our internal units. The
|
|
5
|
-
* boot report names the subject instead, and the screen opens the one conversation for what it shows.
|
|
6
|
-
*/
|
|
7
|
-
import { assistantModeForSubject, clearAssistantModes, getAssistantModeWarnings, registerAssistantMode } from './registry'
|
|
8
|
-
|
|
9
|
-
const persona = 'you are here'
|
|
10
|
-
|
|
11
|
-
describe('assistant mode — one conversation per subject', () => {
|
|
12
|
-
beforeEach(() => clearAssistantModes())
|
|
13
|
-
afterAll(() => clearAssistantModes())
|
|
14
|
-
|
|
15
|
-
it('★ two conversations on one subject is a boot warning naming both', () => {
|
|
16
|
-
registerAssistantMode({ kind: 'twin.board', systemPrompt: persona, subjects: ['board'] })
|
|
17
|
-
registerAssistantMode({ kind: 'twin.space', systemPrompt: persona, subjects: ['space', 'board'] })
|
|
18
|
-
|
|
19
|
-
const twice = getAssistantModeWarnings().filter(w => w.code === 'assistant-mode-subject-claimed-twice')
|
|
20
|
-
expect(twice.map(w => w.params.subject)).toEqual(['board'])
|
|
21
|
-
expect(twice[0].params.kinds).toEqual(['twin.board', 'twin.space'])
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('one conversation on each subject says nothing', () => {
|
|
25
|
-
registerAssistantMode({ kind: 'twin.board', systemPrompt: persona, subjects: ['board'] })
|
|
26
|
-
registerAssistantMode({ kind: 'twin.space', systemPrompt: persona, subjects: ['space'] })
|
|
27
|
-
|
|
28
|
-
expect(getAssistantModeWarnings()).toEqual([])
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('★ a screen opens the conversation for its subject, and nothing for a subject nobody declared', () => {
|
|
32
|
-
registerAssistantMode({ kind: 'plant.station', systemPrompt: persona, subjects: ['station'] })
|
|
33
|
-
|
|
34
|
-
expect(assistantModeForSubject('station')?.kind).toBe('plant.station')
|
|
35
|
-
expect(assistantModeForSubject('nothing-shows-this')).toBeUndefined()
|
|
36
|
-
})
|
|
37
|
-
})
|