@things-factory/ai-assistant 10.1.278 → 10.1.280
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,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Who works here - the organization's `employees` list opened to every conversation as a read target
|
|
3
|
-
* (operato-application/design/ai/read-targets.md), the way an application opens its own lists.
|
|
4
|
-
*
|
|
5
|
-
* Asked to bring 정연희 into a group conversation, the model answered that it had no tool to look up people and
|
|
6
|
-
* sent the person to search a screen (2026-10-24). The list existed; no conversation could read it.
|
|
7
|
-
*
|
|
8
|
-
* Nothing new is built: the read runs the organization module's own query as the person, so its door
|
|
9
|
-
* (`employee` query, or the domain owner) decides who may read people, and an application without the organization
|
|
10
|
-
* module has no such door - the tool is not offered there. The selection is the projection: name, department,
|
|
11
|
-
* position and the user an invite takes. No phone, e-mail, address, bank account or emergency contact is read.
|
|
12
|
-
*/
|
|
13
|
-
import { listReadTarget } from '../data-read/list-read.js'
|
|
14
|
-
import type { ReadTarget } from '../data-read/read-target.js'
|
|
15
|
-
import { PEOPLE_READ_KEY } from './people-keys.js'
|
|
16
|
-
|
|
17
|
-
/** The fields read of each person - the answer may carry nothing else. */
|
|
18
|
-
export const PEOPLE_SELECTION = 'id name alias jobPosition jobResponsibility department { id name } user { id }'
|
|
19
|
-
|
|
20
|
-
export function peopleReadTarget(): ReadTarget {
|
|
21
|
-
const target = listReadTarget({
|
|
22
|
-
key: PEOPLE_READ_KEY,
|
|
23
|
-
title: 'ai-assistant.people.title',
|
|
24
|
-
name: 'people of the organization',
|
|
25
|
-
listQuery: 'employees',
|
|
26
|
-
/* People who left are not offered - an invite, a mention or an answer about who does what is about who is here. */
|
|
27
|
-
fixedFilters: [{ name: 'active', operator: 'eq', value: true }],
|
|
28
|
-
selection: PEOPLE_SELECTION,
|
|
29
|
-
columns: [
|
|
30
|
-
{ name: 'name', type: 'string', labelKey: 'ai-assistant.people.name' },
|
|
31
|
-
{ name: 'department', type: 'string', path: 'department.name', labelKey: 'ai-assistant.people.department' },
|
|
32
|
-
{ name: 'position', type: 'string', path: 'jobPosition', labelKey: 'ai-assistant.people.position' },
|
|
33
|
-
{ name: 'responsibility', type: 'string', path: 'jobResponsibility', labelKey: 'ai-assistant.people.responsibility' },
|
|
34
|
-
{ name: 'userId', type: 'string', path: 'user.id', labelKey: 'ai-assistant.people.user' }
|
|
35
|
-
],
|
|
36
|
-
search: 'name, employee number and alias'
|
|
37
|
-
})
|
|
38
|
-
/*
|
|
39
|
-
* Who holds a position, who is in a team - asked 「프로 직책인 사람은 누구야?」 the model put the position into the search
|
|
40
|
-
* term, which matches names, numbers and aliases only, and answered that nobody held it (2026-10-24).
|
|
41
|
-
*/
|
|
42
|
-
const contains = (name: string) => (value: any) => ({ name, operator: 'i_like', value })
|
|
43
|
-
return {
|
|
44
|
-
...target,
|
|
45
|
-
criteria: [
|
|
46
|
-
...target.criteria,
|
|
47
|
-
{ name: 'department', type: 'string', labelKey: 'ai-assistant.people.department', description: "part of the department's name", filter: contains('departmentName') },
|
|
48
|
-
{ name: 'position', type: 'string', labelKey: 'ai-assistant.people.position', description: 'part of the position (직책)', filter: contains('jobPosition') },
|
|
49
|
-
{ name: 'responsibility', type: 'string', labelKey: 'ai-assistant.people.responsibility', description: 'part of what they are responsible for (담당)', filter: contains('jobResponsibility') }
|
|
50
|
-
],
|
|
51
|
-
description:
|
|
52
|
-
'the people who work here, as the organization lists them - name, department, position, responsibility, and the user id ' +
|
|
53
|
-
'an invite into a conversation takes (empty when the person has no account). Read only who the asker may see. ' +
|
|
54
|
-
'The text condition finds by name, employee number or alias only - a department, position or responsibility has its own condition.'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* SQLite integration tests for person-anchored conversation creation and updates. Conversations about
|
|
3
|
-
* another person remain groups containing that person. Self-anchored conversations use ordinary visibility
|
|
4
|
-
* rules. Verify the model context includes record sources and person-conversation constraints.
|
|
5
|
-
*/
|
|
6
|
-
import type { DataSource } from 'typeorm'
|
|
7
|
-
|
|
8
|
-
const { DataSource: TypeOrmDataSource } = require('typeorm')
|
|
9
|
-
const shell = require('@things-factory/shell')
|
|
10
|
-
const authBase = require('@things-factory/auth-base')
|
|
11
|
-
|
|
12
|
-
function loadCompiled(modulePath: string): any {
|
|
13
|
-
const { existsSync } = require('fs')
|
|
14
|
-
const { join } = require('path')
|
|
15
|
-
const resolved = join(__dirname, '..', '..', '..', 'dist-server', 'service', `${modulePath}.js`)
|
|
16
|
-
if (!existsSync(resolved)) throw new Error(`ai-assistant has no build output: ${resolved}\nBuild first:\n yarn workspace @things-factory/ai-assistant build:server`)
|
|
17
|
-
return require(resolved)
|
|
18
|
-
}
|
|
19
|
-
const { ChatSession } = loadCompiled('chat-session/chat-session')
|
|
20
|
-
const { ChatMessage } = loadCompiled('chat-message/chat-message')
|
|
21
|
-
const { ChatSessionParticipant } = loadCompiled('chat-session-participant/chat-session-participant')
|
|
22
|
-
const { ChatSessionResolver } = loadCompiled('chat-session-resolver')
|
|
23
|
-
const { onRoomTurn } = loadCompiled('chat-message/room-turn')
|
|
24
|
-
const { personOfAnchor, personSeatOf, personRoomRefusal, personSubjectDescriber, PERSON_GUIDANCE } = loadCompiled('people/person-subject')
|
|
25
|
-
const { openSubjectLine } = require('@things-factory/ai-client-base')
|
|
26
|
-
|
|
27
|
-
let db: DataSource
|
|
28
|
-
let domain: any
|
|
29
|
-
let manager: any
|
|
30
|
-
let employee: any
|
|
31
|
-
let colleague: any
|
|
32
|
-
|
|
33
|
-
const doors = new ChatSessionResolver()
|
|
34
|
-
const as = (user: any) => ({ state: { domain, user, tx: db.manager, sendNotice: () => undefined } }) as any
|
|
35
|
-
|
|
36
|
-
beforeAll(async () => {
|
|
37
|
-
db = new TypeOrmDataSource({
|
|
38
|
-
type: 'sqlite',
|
|
39
|
-
database: ':memory:',
|
|
40
|
-
synchronize: true,
|
|
41
|
-
dropSchema: true,
|
|
42
|
-
namingStrategy: new shell.NamingStrategy(),
|
|
43
|
-
entities: [...shell.entities, ...authBase.entities, ChatSession, ChatMessage, ChatSessionParticipant],
|
|
44
|
-
logging: false
|
|
45
|
-
})
|
|
46
|
-
await db.initialize()
|
|
47
|
-
shell.addDataSource('default', db)
|
|
48
|
-
domain = await db.getRepository(shell.Domain).save({ name: 'acme', subdomain: 'acme' })
|
|
49
|
-
const person = (name: string) => db.getRepository(authBase.User).save({ name, username: name, email: `${name}@example.com`, status: 'activated', domains: [domain] })
|
|
50
|
-
manager = await person('manager')
|
|
51
|
-
employee = await person('employee')
|
|
52
|
-
colleague = await person('colleague')
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
afterAll(async () => {
|
|
56
|
-
shell.removeDataSource('default')
|
|
57
|
-
await db?.destroy()
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const seats = async (session: any) =>
|
|
61
|
-
(await db.getRepository(ChatSessionParticipant).find({ where: { session: { id: session.id } } as any })).map((row: any) => [row.userId, row.role]).sort()
|
|
62
|
-
|
|
63
|
-
const about = (user: any) => `person:${user.id}`
|
|
64
|
-
|
|
65
|
-
describe('who a conversation is about', () => {
|
|
66
|
-
it('a person anchor names them; anything else names nobody', () => {
|
|
67
|
-
expect(personOfAnchor('subject', 'person:u-1')).toBe('u-1')
|
|
68
|
-
expect(personOfAnchor('subject', 'contract:c-1')).toBeUndefined()
|
|
69
|
-
expect(personOfAnchor('domain', 'person:u-1')).toBeUndefined()
|
|
70
|
-
expect(personOfAnchor('subject', 'person:')).toBeUndefined()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('asking about someone seats them in a group; asking about oneself seats nobody', () => {
|
|
74
|
-
expect(personSeatOf('subject', 'person:u-1', { id: 'u-2' })).toEqual({ userId: 'u-1', visibility: 'group' })
|
|
75
|
-
expect(personSeatOf('subject', 'person:u-1', { id: 'u-1' })).toBeUndefined()
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('it stays a group with them in it; a conversation about oneself is free', () => {
|
|
79
|
-
const room = { anchorType: 'subject', anchorId: 'person:u-1', creatorId: 'u-2' }
|
|
80
|
-
expect(personRoomRefusal(room, { visibility: 'private' })).toBe('person-room-group-only')
|
|
81
|
-
expect(personRoomRefusal(room, { visibility: 'open' })).toBe('person-room-group-only')
|
|
82
|
-
expect(personRoomRefusal(room, { visibility: 'group' })).toBeUndefined()
|
|
83
|
-
expect(personRoomRefusal(room, { removing: 'u-1' })).toBe('person-room-keeps-person')
|
|
84
|
-
expect(personRoomRefusal(room, { removing: 'u-3' })).toBeUndefined()
|
|
85
|
-
expect(personRoomRefusal({ ...room, creatorId: 'u-1' }, { visibility: 'private' })).toBeUndefined()
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
describe("conversation entry points", () => {
|
|
90
|
-
it('a conversation opened on someone is a group with them seated as a member', async () => {
|
|
91
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
92
|
-
expect(session.visibility).toBe('group')
|
|
93
|
-
expect(await seats(session)).toEqual([[employee.id, 'member'], [manager.id, 'owner']].sort())
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it("reuses the existing group for the same subject", async () => {
|
|
97
|
-
const session = await doors.startAISession('subject', about(colleague), as(manager))
|
|
98
|
-
expect(session.visibility).toBe('group')
|
|
99
|
-
expect(await seats(session)).toEqual([[colleague.id, 'member'], [manager.id, 'owner']].sort())
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('a conversation about oneself is private and seats nobody else', async () => {
|
|
103
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(employee))
|
|
104
|
-
expect(session.visibility).toBe('private')
|
|
105
|
-
expect(await seats(session)).toEqual([[employee.id, 'owner']])
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('it cannot be made private or open', async () => {
|
|
109
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
110
|
-
await expect(doors.setSessionVisibility(session.id, 'private', as(manager))).rejects.toThrow(/stays a group/)
|
|
111
|
-
await expect(doors.setSessionVisibility(session.id, 'open', as(manager))).rejects.toThrow(/stays a group/)
|
|
112
|
-
expect(await seats(session)).toContainEqual([employee.id, 'member'])
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it('the person is neither sent out nor leaves; someone else brought in can be', async () => {
|
|
116
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
117
|
-
await doors.inviteToAISession(session.id, [colleague.id], as(manager))
|
|
118
|
-
await expect(doors.removeFromAISession(session.id, employee.id, as(manager))).rejects.toThrow(/always reads it/)
|
|
119
|
-
await expect(doors.leaveAISession(session.id, as(employee))).rejects.toThrow(/always reads it/)
|
|
120
|
-
expect(await doors.removeFromAISession(session.id, colleague.id, as(manager))).toBe(true)
|
|
121
|
-
expect(await seats(session)).toContainEqual([employee.id, 'member'])
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it('the screen is told who stays, so it offers no button to send them out', async () => {
|
|
125
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
126
|
-
expect(await doors.keptInAISession(session.id, as(manager))).toBe(employee.id)
|
|
127
|
-
const own = await doors.createAISession('subject', about(manager), undefined, as(manager))
|
|
128
|
-
expect(await doors.keptInAISession(own.id, as(manager))).toBeNull()
|
|
129
|
-
const general = await doors.createAISession('domain', domain.id, undefined, as(manager))
|
|
130
|
-
expect(await doors.keptInAISession(general.id, as(manager))).toBeNull()
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
it('what the person says to the room is told to the modules that wait for it, with who spoke', async () => {
|
|
134
|
-
const heard: any[] = []
|
|
135
|
-
const stop = onRoomTurn((turn: any) => {
|
|
136
|
-
heard.push([turn.user.id, turn.session.anchorId, turn.message.content])
|
|
137
|
-
})
|
|
138
|
-
const session = await doors.createAISession('subject', about(employee), undefined, as(manager))
|
|
139
|
-
await doors.sayToRoom(session.id, '목요일 입고면 금요일 납품 가능합니다.', undefined, as(employee))
|
|
140
|
-
stop()
|
|
141
|
-
await doors.sayToRoom(session.id, 'after stop', undefined, as(employee))
|
|
142
|
-
expect(heard).toEqual([[employee.id, about(employee), '목요일 입고면 금요일 납품 가능합니다.']])
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
describe("person-conversation model context", () => {
|
|
147
|
-
it('the person by name, with how a conversation about someone is held', async () => {
|
|
148
|
-
const line = await openSubjectLine({ anchorType: 'subject', anchorId: about(employee), domain, state: as(manager).state })
|
|
149
|
-
expect(line).toContain('"employee"')
|
|
150
|
-
expect(line).toContain(PERSON_GUIDANCE)
|
|
151
|
-
expect(PERSON_GUIDANCE).toMatch(/never speak as them/)
|
|
152
|
-
expect(PERSON_GUIDANCE).toMatch(/Never guess their character/)
|
|
153
|
-
expect(PERSON_GUIDANCE).toMatch(/proposeWorklistPersonQuestionEntries/)
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('someone who does not work here is not named', async () => {
|
|
157
|
-
const describer = personSubjectDescriber(async () => false)
|
|
158
|
-
expect(await describer.describe({ anchorId: about(employee), domain })).toBeUndefined()
|
|
159
|
-
expect(await describer.describe({ anchorId: 'person:missing', domain })).toBeUndefined()
|
|
160
|
-
})
|
|
161
|
-
})
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Centralize rules for sessions anchored to subject / person:<user id> (ADR-0200). Identify the person in
|
|
3
|
-
* model context and require record sources and timestamps; do not infer personality, intent, mood or
|
|
4
|
-
* ability, or speak on their behalf. Add the subject as a participant and preserve group visibility and
|
|
5
|
-
* membership. Requests requiring their decision become assigned tasks. Self-anchored sessions use ordinary
|
|
6
|
-
* conversation rules.
|
|
7
|
-
*/
|
|
8
|
-
import { User } from '@things-factory/auth-base'
|
|
9
|
-
import { entersDomainAsAssignee } from '@things-factory/auth-base/dist-server/utils/get-domain-users.js'
|
|
10
|
-
import { registerAssistantSubject, type AssistantSubjectDescriber } from '@things-factory/ai-client-base'
|
|
11
|
-
import { getRepository } from '@things-factory/shell'
|
|
12
|
-
|
|
13
|
-
import { entryToolName } from '../data-entry/entry-target.js'
|
|
14
|
-
|
|
15
|
-
/** The 360 kind of a person - auth-ui's `person`. */
|
|
16
|
-
export const PERSON_AXIS = 'person'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Response-request card registered by worklist to create an assigned task (ADR-0200).
|
|
20
|
-
*/
|
|
21
|
-
export const PERSON_QUESTION_KEY = 'worklist.person-question'
|
|
22
|
-
|
|
23
|
-
/** The person a conversation is about, by its anchor - `undefined` when it is about no one. */
|
|
24
|
-
export function personOfAnchor(anchorType: string | null | undefined, anchorId: string | null | undefined): string | undefined {
|
|
25
|
-
if (anchorType !== 'subject' || typeof anchorId !== 'string' || !anchorId.startsWith(`${PERSON_AXIS}:`)) return undefined
|
|
26
|
-
return anchorId.slice(PERSON_AXIS.length + 1) || undefined
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Add the subject user to a new group conversation unless the creator is the subject. Private sessions have
|
|
31
|
-
* no additional participants; public sessions are domain-readable.
|
|
32
|
-
*/
|
|
33
|
-
export function personSeatOf(anchorType: string | null | undefined, anchorId: string | null | undefined, starter: { id?: string } | null | undefined): { userId: string; visibility: 'group' } | undefined {
|
|
34
|
-
const userId = personOfAnchor(anchorType, anchorId)
|
|
35
|
-
return userId && userId !== starter?.id ? { userId, visibility: 'group' } : undefined
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Return the reason a person-conversation update is invalid, or no reason when allowed.
|
|
40
|
-
*/
|
|
41
|
-
export function personRoomRefusal(
|
|
42
|
-
session: { anchorType?: string | null; anchorId?: string | null; creatorId?: string | null },
|
|
43
|
-
change: { visibility?: string; removing?: string }
|
|
44
|
-
): 'person-room-group-only' | 'person-room-keeps-person' | undefined {
|
|
45
|
-
const userId = personOfAnchor(session.anchorType, session.anchorId)
|
|
46
|
-
if (!userId || userId === session.creatorId) return undefined
|
|
47
|
-
if (change.visibility && change.visibility !== 'group') return 'person-room-group-only'
|
|
48
|
-
if (change.removing && change.removing === userId) return 'person-room-keeps-person'
|
|
49
|
-
return undefined
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** The words of a refusal above. */
|
|
53
|
-
export const PERSON_ROOM_REFUSALS: Record<string, string> = {
|
|
54
|
-
'person-room-group-only': 'a conversation about someone stays a group they read - it cannot be opened to everyone or made private.',
|
|
55
|
-
'person-room-keeps-person': 'the person this conversation is about always reads it - they cannot be sent out. they can hide it from their own list.'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Model guidance appended after the subject name on each conversation turn.
|
|
60
|
-
*/
|
|
61
|
-
export const PERSON_GUIDANCE = [
|
|
62
|
-
'This conversation is about that person, and they read it. Rules:',
|
|
63
|
-
"- Answer from the records the read tools return about them. Say which record each fact comes from and when it was last changed; when a record is missing or old, say so.",
|
|
64
|
-
'- Never guess their character, intent, mood or ability, never judge their performance, and never speak as them - say "their weekly report says", never "I".',
|
|
65
|
-
`- What would bind them - whether something can be done, a deadline, an agreement, a refusal, their opinion - is theirs to say. Say it needs their confirmation and offer the confirmation card (${entryToolName(PERSON_QUESTION_KEY)}): the question, what the records already answered, what they must decide, and a draft answer drawn only from their records.`
|
|
66
|
-
].join('\n')
|
|
67
|
-
|
|
68
|
-
export function personSubjectDescriber(entersDomain = entersDomainAsAssignee): AssistantSubjectDescriber {
|
|
69
|
-
return {
|
|
70
|
-
anchorType: 'subject',
|
|
71
|
-
axis: PERSON_AXIS,
|
|
72
|
-
async describe({ anchorId, domain }) {
|
|
73
|
-
const userId = personOfAnchor('subject', anchorId)
|
|
74
|
-
if (!userId) return undefined
|
|
75
|
-
const user = await getRepository(User).findOne({ where: { id: userId } })
|
|
76
|
-
if (!user || !(await entersDomain(domain as any, user))) return undefined
|
|
77
|
-
const name = user.name || user.email || ''
|
|
78
|
-
return name ? { noun: 'person', name, guidance: PERSON_GUIDANCE } : undefined
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
registerAssistantSubject(personSubjectDescriber())
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What this guards: a sentence written for a person comes back in that person's language.
|
|
3
|
-
*
|
|
4
|
-
* The koa middleware writes the detected language into an options object among `ctx.t`'s
|
|
5
|
-
* arguments. `ctx.t(key, undefined)` has an argument that is not an object, so nothing is written
|
|
6
|
-
* and the answer falls back to the default language — which is what a Korean screen got from the
|
|
7
|
-
* mode query on 2026-09-18 while the Korean translation was sitting in the dictionary.
|
|
8
|
-
*/
|
|
9
|
-
import { requestTranslator } from './request-translator'
|
|
10
|
-
|
|
11
|
-
/** Stands in for the middleware: it writes `lng` into an object argument, exactly as ctx.t does. */
|
|
12
|
-
function fakeContext(lng: string) {
|
|
13
|
-
const seen: any[] = []
|
|
14
|
-
return {
|
|
15
|
-
seen,
|
|
16
|
-
t(...args: any[]) {
|
|
17
|
-
if (args.length === 1) args.push({})
|
|
18
|
-
for (const arg of args) {
|
|
19
|
-
if (typeof arg === 'object' && !Array.isArray(arg) && arg !== null) arg.lng = lng
|
|
20
|
-
}
|
|
21
|
-
seen.push(args)
|
|
22
|
-
return `${args[0]}@${args[1]?.lng ?? 'default'}`
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
it('★ a key with no params still carries the request language', () => {
|
|
28
|
-
const context = fakeContext('ko')
|
|
29
|
-
|
|
30
|
-
expect(requestTranslator(context)('ai-assistant.notice.stopped')).toBe('ai-assistant.notice.stopped@ko')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('★ params are passed through, and the language is set on them', () => {
|
|
34
|
-
const context = fakeContext('ja')
|
|
35
|
-
|
|
36
|
-
expect(requestTranslator(context)('ai-assistant.notice.too-long', { iter: 8 })).toBe('ai-assistant.notice.too-long@ja')
|
|
37
|
-
expect(context.seen[0][1]).toEqual({ iter: 8, lng: 'ja' })
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('passing undefined explicitly is the case that used to lose the language', () => {
|
|
41
|
-
const context = fakeContext('ko')
|
|
42
|
-
const naive = (key: string, params?: Record<string, any>) => context.t(key, params)
|
|
43
|
-
|
|
44
|
-
expect(naive('ai-assistant.notice.stopped')).toBe('ai-assistant.notice.stopped@default')
|
|
45
|
-
})
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The request's translator, in a shape that keeps the request's language.
|
|
3
|
-
*
|
|
4
|
-
* `ctx.t` sets the detected language **on an options object**: it walks its arguments and writes
|
|
5
|
-
* `lng` into the first object it finds (`i18n-base/server/middlewares/koa-i18next`). Called with
|
|
6
|
-
* one argument it appends `{}` itself and everything works — but called as `ctx.t(key, undefined)`,
|
|
7
|
-
* which is what a wrapper with an optional `params` does, there is an argument and it is not an
|
|
8
|
-
* object, so no `lng` is written and i18next answers in its default language.
|
|
9
|
-
*
|
|
10
|
-
* Found 2026-09-18 on the running twin: the mode query handed a Korean screen English `/` sentences
|
|
11
|
-
* while `GET /translations/translate/ko/...` returned the Korean. Every sentence this package
|
|
12
|
-
* writes for a person goes through here now, so the omission cannot come back one call site at a
|
|
13
|
-
* time.
|
|
14
|
-
*/
|
|
15
|
-
export type Translate = (key: string, params?: Record<string, any>) => string
|
|
16
|
-
|
|
17
|
-
export function requestTranslator(context: any): Translate {
|
|
18
|
-
return (key: string, params?: Record<string, any>) => {
|
|
19
|
-
/*
|
|
20
|
-
* 구독(websocket)에는 koa 요청이 없어 `ctx.t` 가 없다. 방송 한 줄 때문에 터뜨리지 않는다 —
|
|
21
|
-
* 그때는 `defaultValue` 를 그대로 채워 쓴다. i18next 자신의 fallbackLng 이 'en' 이므로 이것은
|
|
22
|
-
* 프레임워크가 하는 것과 같은 답이다. 키만 내보내면 화면에 키가 뜬다.
|
|
23
|
-
*/
|
|
24
|
-
if (typeof context?.t !== 'function') return interpolate(String(params?.defaultValue ?? key), params)
|
|
25
|
-
|
|
26
|
-
return context.t(key, params ?? {})
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** 프레임워크와 같은 single brace 자리표 — `{doors}`. */
|
|
31
|
-
function interpolate(text: string, params?: Record<string, any>): string {
|
|
32
|
-
return text.replace(/\{(\w+)\}/g, (whole, name) => (params && name in params ? String(params[name]) : whole))
|
|
33
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* 세션 앵커 검증 — 대화가 무엇에 매달리는가.
|
|
3
|
-
*
|
|
4
|
-
* 대화는 보드에만 매달리지 않는다. 저작 대화는 보드에, 운영 대화는 공간(사이트와 그 공간에서
|
|
5
|
-
* 도는 트윈들)에 매달린다. 앵커가 대화의 성격과 **이력 경계**를 정한다.
|
|
6
|
-
*
|
|
7
|
-
* 이 테스트가 지키는 것:
|
|
8
|
-
* ① **하위호환** — 앵커 컬럼이 빈 옛 행(boardId 만 있는 행)도 board 앵커 조회에 잡혀야 한다.
|
|
9
|
-
* 백필 마이그레이션 없이 컬럼 추가만으로 끝내는 것이 이 설계의 전제다.
|
|
10
|
-
* ② **dual-write** — board 앵커 세션은 anchorId 와 boardId 를 함께 써야 한다. 그래야 기존
|
|
11
|
-
* 조회·인덱스·소비자(operato-board 등)가 그대로 동작한다.
|
|
12
|
-
* ③ 공간·인스턴스 앵커는 boardId 를 오염시키지 않는다(보드 조회에 섞이면 이력 경계가 무너진다).
|
|
13
|
-
*/
|
|
14
|
-
import { anchorColumns, anchorWhere, isSessionAnchorType, SESSION_ANCHOR_TYPES } from './chat-session/session-anchor'
|
|
15
|
-
import { initialVisibility } from './chat-session/session-visibility'
|
|
16
|
-
|
|
17
|
-
const SUBJECT_ID = 'items:6f1c2a90-3b4d-4e5f-8a6b-7c8d9e0f1a2b'
|
|
18
|
-
|
|
19
|
-
describe('앵커 저장 값 (anchorColumns)', () => {
|
|
20
|
-
it('board 앵커는 anchorId 와 boardId 에 같은 값을 쓴다 — 기존 조회 하위호환', () => {
|
|
21
|
-
expect(anchorColumns('board', 'B1')).toEqual({ anchorType: 'board', anchorId: 'B1', boardId: 'B1' })
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('space 앵커는 boardId 를 쓰지 않는다 — 보드 조회에 섞이면 이력 경계가 무너진다', () => {
|
|
25
|
-
expect(anchorColumns('space', 'busan')).toEqual({ anchorType: 'space', anchorId: 'busan', boardId: undefined })
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('instance 앵커도 boardId 를 쓰지 않는다', () => {
|
|
29
|
-
expect(anchorColumns('instance', 'busan-wms')).toEqual({
|
|
30
|
-
anchorType: 'instance',
|
|
31
|
-
anchorId: 'busan-wms',
|
|
32
|
-
boardId: undefined
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('앵커 종류 미지정은 none — 임의로 board 로 승격하지 않는다(잘못된 소속 방지)', () => {
|
|
37
|
-
expect(anchorColumns(undefined, 'X')).toEqual({ anchorType: 'none', anchorId: 'X', boardId: undefined })
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
* This case used to assert that an empty id was normalised to undefined, and it was green while
|
|
42
|
-
* encoding the defect. Storing ('space', NULL) is not harmless: `anchorWhere` then searches for
|
|
43
|
-
* the empty string it was handed, misses the row it just wrote, and the caller creates another
|
|
44
|
-
* session on every call — with no error anywhere. An anchor is a pointer, so no id is a caller
|
|
45
|
-
* error and the only correct answer is a refusal.
|
|
46
|
-
*/
|
|
47
|
-
it('an anchor with no id is refused — normalising it would hide a lookup that misses its own row', () => {
|
|
48
|
-
for (const type of ['board', 'space', 'instance', 'domain']) {
|
|
49
|
-
expect(() => anchorColumns(type, '')).toThrow(/was given no id/)
|
|
50
|
-
expect(() => anchorColumns(type, undefined)).toThrow(/was given no id/)
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it("'none' is the one anchor that may have no id — it means not addressable by anchor", () => {
|
|
55
|
-
expect(anchorColumns('none', '')).toEqual({ anchorType: 'none', anchorId: undefined, boardId: undefined })
|
|
56
|
-
expect(anchorColumns(undefined, undefined)).toEqual({
|
|
57
|
-
anchorType: 'none',
|
|
58
|
-
anchorId: undefined,
|
|
59
|
-
boardId: undefined
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it("'domain' anchors a conversation whose subject is the whole tenant", () => {
|
|
64
|
-
/* A factory-wide question has nothing narrower to point at, but it still needs a history
|
|
65
|
-
* boundary and a bucket in the inbox — which is what 'none' cannot give it. */
|
|
66
|
-
expect(anchorColumns('domain', 'dom-1')).toEqual({
|
|
67
|
-
anchorType: 'domain',
|
|
68
|
-
anchorId: 'dom-1',
|
|
69
|
-
boardId: undefined
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
describe('anchor types are checked, not cast', () => {
|
|
75
|
-
/*
|
|
76
|
-
* `anchorColumns` used to do `(anchorType || 'none') as SessionAnchorType`. The type existed and
|
|
77
|
-
* nothing enforced it, so any string reached a nullable varchar and was stored. What makes that
|
|
78
|
-
* expensive is not one bad row: the anchor decides which conversations are listed together, so a
|
|
79
|
-
* typo writes a session into a bucket nothing queries — the conversation is simply absent from
|
|
80
|
-
* the list and no error is raised on either side.
|
|
81
|
-
*/
|
|
82
|
-
it('an unknown anchor type is refused on the write path', () => {
|
|
83
|
-
expect(() => anchorColumns('facility', 'F1')).toThrow(/is not an anchor type/)
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
it('an unknown anchor type is refused on the read path too — otherwise it reads as 0 rows', () => {
|
|
87
|
-
expect(() => anchorWhere('dom-1', 'facility', 'F1')).toThrow(/is not an anchor type/)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('the refusal names what is allowed — a lane should not have to read this file', () => {
|
|
91
|
-
let message = ''
|
|
92
|
-
try {
|
|
93
|
-
anchorColumns('plant', 'P1')
|
|
94
|
-
} catch (e: any) {
|
|
95
|
-
message = String(e?.message)
|
|
96
|
-
}
|
|
97
|
-
for (const type of SESSION_ANCHOR_TYPES) expect(message).toContain(type)
|
|
98
|
-
expect(message).toMatch(/raise it/)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('defaulting to none is not the fallback — a typo must not become "about nothing"', () => {
|
|
102
|
-
expect(() => anchorColumns('spaces', 'busan')).toThrow()
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('isSessionAnchorType accepts exactly the declared set', () => {
|
|
106
|
-
for (const type of SESSION_ANCHOR_TYPES) expect(isSessionAnchorType(type)).toBe(true)
|
|
107
|
-
for (const bad of ['', 'Board', 'facility', 'plant', null, undefined, 0, {}]) {
|
|
108
|
-
expect(isSessionAnchorType(bad)).toBe(false)
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
describe('앵커 조회 조건 (anchorWhere)', () => {
|
|
114
|
-
it('애플리케이션 대화는 모델 및 다른 제품·도메인과 분리한다', () => {
|
|
115
|
-
expect(anchorColumns('application', 'operato-figure')).toEqual({ anchorType: 'application', anchorId: 'operato-figure', boardId: undefined })
|
|
116
|
-
expect(anchorWhere('D1', 'application', 'operato-figure')).not.toEqual(anchorWhere('D1', 'figure', 'F1'))
|
|
117
|
-
expect(anchorWhere('D1', 'application', 'operato-figure')).not.toEqual(anchorWhere('D1', 'application', 'operato-plant'))
|
|
118
|
-
})
|
|
119
|
-
it('Figure 이력은 같은 id의 Board 및 다른 도메인과 분리한다', () => {
|
|
120
|
-
expect(anchorColumns('figure', 'F1')).toEqual({ anchorType: 'figure', anchorId: 'F1', boardId: undefined })
|
|
121
|
-
expect(anchorWhere('D1', 'figure', 'F1')).toEqual({ anchorType: 'figure', anchorId: 'F1', domain: { id: 'D1' } })
|
|
122
|
-
expect(anchorWhere('D2', 'figure', 'F1')).not.toEqual(anchorWhere('D1', 'figure', 'F1'))
|
|
123
|
-
expect(() => anchorColumns('figure', '')).toThrow()
|
|
124
|
-
})
|
|
125
|
-
it('board 앵커는 boardId 로 찾는다 — 앵커 컬럼이 빈 옛 행도 잡힌다', () => {
|
|
126
|
-
/* 신규 행은 dual-write 로 boardId 도 채워지므로 같은 조건에 함께 걸린다. */
|
|
127
|
-
expect(anchorWhere('dom-1', 'board', 'B1')).toEqual({ boardId: 'B1', domain: { id: 'dom-1' } })
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
it('space 앵커는 앵커 컬럼으로 찾는다', () => {
|
|
131
|
-
expect(anchorWhere('dom-1', 'space', 'busan')).toEqual({
|
|
132
|
-
anchorType: 'space',
|
|
133
|
-
anchorId: 'busan',
|
|
134
|
-
domain: { id: 'dom-1' }
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
it('모든 조회에 domain 조건이 포함된다 — 빠지면 남의 테넌트 대화가 보인다', () => {
|
|
139
|
-
for (const type of SESSION_ANCHOR_TYPES) {
|
|
140
|
-
/* A subject anchor has a shape of its own (below); every other type takes any id. */
|
|
141
|
-
const id = type === 'subject' ? SUBJECT_ID : 'X'
|
|
142
|
-
expect(anchorWhere('dom-9', type, id).domain).toEqual({ id: 'dom-9' })
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('공간 앵커 조회 조건에는 boardId 가 없다 — 보드 세션을 끌어오지 않는다', () => {
|
|
147
|
-
expect(anchorWhere('dom-1', 'space', 'busan').boardId).toBeUndefined()
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
/*
|
|
152
|
-
* The subject anchor — one subject in a 360 (ruled 2026-09-24).
|
|
153
|
-
*
|
|
154
|
-
* `<axis>:<itemId>`: the 360 frame's axis word and that row's uuid. Tested on both sides the ruling
|
|
155
|
-
* split: without an id it throws, and with one it is stored as given and finds its own list again.
|
|
156
|
-
*/
|
|
157
|
-
describe('the subject anchor', () => {
|
|
158
|
-
it('★ without an id it throws — a pointer to nothing would never be found again', () => {
|
|
159
|
-
expect(() => anchorColumns('subject', '')).toThrow(/was given no id/)
|
|
160
|
-
expect(() => anchorColumns('subject', undefined)).toThrow(/was given no id/)
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
it('★ `<axis>:<itemId>` is stored as given, and the lookup for that subject finds it', () => {
|
|
164
|
-
const stored = anchorColumns('subject', SUBJECT_ID)
|
|
165
|
-
expect(stored).toEqual({ anchorType: 'subject', anchorId: SUBJECT_ID, boardId: undefined })
|
|
166
|
-
|
|
167
|
-
const where = anchorWhere('dom-1', 'subject', SUBJECT_ID)
|
|
168
|
-
expect(where).toEqual({ anchorType: stored.anchorType, anchorId: stored.anchorId, domain: { id: 'dom-1' } })
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
it("another subject, another axis or another domain is another list", () => {
|
|
172
|
-
const other = 'items:0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d'
|
|
173
|
-
const sameRowOtherAxis = SUBJECT_ID.replace('items:', 'locations:')
|
|
174
|
-
|
|
175
|
-
expect(anchorWhere('dom-1', 'subject', other)).not.toEqual(anchorWhere('dom-1', 'subject', SUBJECT_ID))
|
|
176
|
-
expect(anchorWhere('dom-1', 'subject', sameRowOtherAxis)).not.toEqual(anchorWhere('dom-1', 'subject', SUBJECT_ID))
|
|
177
|
-
expect(anchorWhere('dom-2', 'subject', SUBJECT_ID)).not.toEqual(anchorWhere('dom-1', 'subject', SUBJECT_ID))
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it.each([
|
|
181
|
-
['an EPC, as the screen shows a pallet', 'items:urn:epc:id:sgtin:0614141.107346.2017'],
|
|
182
|
-
['a name, as the screen shows an order', 'orders:SO-A887417'],
|
|
183
|
-
['a uuid with no axis', '6f1c2a90-3b4d-4e5f-8a6b-7c8d9e0f1a2b'],
|
|
184
|
-
['an axis with no item', 'items:']
|
|
185
|
-
])('★ refuses %s — on write and on read', (_what, id) => {
|
|
186
|
-
expect(() => anchorColumns('subject', id)).toThrow(/is not a subject anchor/)
|
|
187
|
-
expect(() => anchorWhere('dom-1', 'subject', id)).toThrow(/is not a subject anchor/)
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
it('the shape rule is the subject anchor\'s alone — other anchors keep taking the ids they take', () => {
|
|
191
|
-
expect(anchorColumns('space', 'busan').anchorId).toBe('busan')
|
|
192
|
-
expect(anchorColumns('application', 'operato-figure').anchorId).toBe('operato-figure')
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
it('★ a subject conversation is born private — opening it is the owner\'s choice (ADR-0073 decision 2, 2026-09-30)', () => {
|
|
196
|
-
expect(initialVisibility({ anchorType: 'subject' })).toBe('private')
|
|
197
|
-
})
|
|
198
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { assertStationSession } from './chat-session/station-session-guard'
|
|
2
|
-
|
|
3
|
-
describe('Station authoring session boundary',()=>{
|
|
4
|
-
const host={surface:'station-screen-modeller',boardId:'A'}
|
|
5
|
-
it('accepts matching Board and legacy Board sessions',()=>{
|
|
6
|
-
expect(()=>assertStationSession({anchorType:'board',anchorId:'A',boardId:'A'},host)).not.toThrow()
|
|
7
|
-
expect(()=>assertStationSession({boardId:'A'},host)).not.toThrow()
|
|
8
|
-
})
|
|
9
|
-
it('rejects a different Board or inconsistent dual-write fields',()=>{
|
|
10
|
-
expect(()=>assertStationSession({anchorType:'board',anchorId:'B'},host)).toThrow(/another station screen/)
|
|
11
|
-
expect(()=>assertStationSession({anchorType:'board',anchorId:'A',boardId:'B'},host)).toThrow(/another station screen/)
|
|
12
|
-
})
|
|
13
|
-
it('rejects missing session, missing Board id and other anchor types',()=>{
|
|
14
|
-
expect(()=>assertStationSession(undefined,host)).toThrow(/another station screen/)
|
|
15
|
-
expect(()=>assertStationSession({anchorType:'board',anchorId:'A'},{surface:host.surface})).toThrow(/another station screen/)
|
|
16
|
-
for(const anchorType of ['domain','application','figure','none']){
|
|
17
|
-
expect(()=>assertStationSession({anchorType,anchorId:'A'},host)).toThrow(/another station screen/)
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
it('does not change other consumers of assistantChat',()=>{
|
|
21
|
-
expect(()=>assertStationSession(undefined,undefined)).not.toThrow()
|
|
22
|
-
expect(()=>assertStationSession({anchorType:'domain',anchorId:'D'},{surface:'plant-operations'})).not.toThrow()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('★ 문장은 읽는 사람의 말이다 — 번역기를 주면 그것이 쓴 문장으로 막는다', () => {
|
|
26
|
-
const host = { surface: 'station-screen-modeller', boardId: 'A' }
|
|
27
|
-
expect(() =>
|
|
28
|
-
assertStationSession({ anchorType: 'board', anchorId: 'B' }, host, (key, params) => `[${key}] ${params?.defaultValue ? 'has-default' : ''}`)
|
|
29
|
-
).toThrow(/ai-assistant.text.other-station-history/)
|
|
30
|
-
})
|
|
31
|
-
})
|