@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,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* At boot, say what registered but is not yet what the contracts require — tools that named no doors
|
|
3
|
-
* (ADR-0071 decision 2) and modes offering `/` sentences their tools cannot answer (ADR-0058
|
|
4
|
-
* decision 3).
|
|
5
|
-
*
|
|
6
|
-
* One window, because it is one question: what state is this deployment's AI in (standard A7-a).
|
|
7
|
-
*
|
|
8
|
-
* A tool that names no doors still registers; refusing at registration would stop a whole app from
|
|
9
|
-
* booting over one omission. It is the **gate** that refuses it, tool by tool — such a tool is
|
|
10
|
-
* offered to no conversation (`resolveToolScope`). So this list is not a soft warning about
|
|
11
|
-
* something that still works: it names the tools that are not working, and why.
|
|
12
|
-
*/
|
|
13
|
-
import { logger } from '@things-factory/env'
|
|
14
|
-
import { getToolRegistryWarnings, type ToolRegistryWarning } from '@things-factory/ai-client-base'
|
|
15
|
-
|
|
16
|
-
import { getAssistantModeWarnings, type AssistantModeWarning } from './service/assistant-mode/index.js'
|
|
17
|
-
import { doorDeclarationWarnings, formatDoorDeclarationWarnings } from './door-declaration-report.js'
|
|
18
|
-
|
|
19
|
-
/** One line per code: the code, how many, and which tools. Empty when there is nothing to report. */
|
|
20
|
-
export function formatToolRegistryWarnings(warnings: ReadonlyArray<ToolRegistryWarning>): string[] {
|
|
21
|
-
const byCode = new Map<string, string[]>()
|
|
22
|
-
for (const warning of warnings) {
|
|
23
|
-
const tools = byCode.get(warning.code) ?? []
|
|
24
|
-
/* 문 이름이 있으면 함께 적는다 — 「어느 문이 아직 선언이 없나」가 다음에 할 일이다. */
|
|
25
|
-
tools.push(`${warning.params.category}/${warning.params.tool}(${warning.params.kind})`)
|
|
26
|
-
byCode.set(warning.code, tools)
|
|
27
|
-
}
|
|
28
|
-
return [...byCode].map(([code, tools]) => `[ai-assistant] ${code} ×${tools.length}: ${tools.join(', ')}`)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** What one warning is about, in the words its code needs - a subject claimed twice names the subject and both. */
|
|
32
|
-
function detailOf(warning: AssistantModeWarning): string {
|
|
33
|
-
const { kind, slash, tool, subject, kinds, target } = warning.params
|
|
34
|
-
switch (warning.code) {
|
|
35
|
-
case 'assistant-mode-subject-claimed-twice':
|
|
36
|
-
return `${subject}:${(kinds ?? []).join('+')}`
|
|
37
|
-
case 'assistant-mode-entry-target-unknown':
|
|
38
|
-
return `${kind}→${target}`
|
|
39
|
-
default:
|
|
40
|
-
return `${kind}:/${slash}→${tool}`
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** One line per code: the code, how many, and what each is about. */
|
|
45
|
-
export function formatAssistantModeWarnings(warnings: ReadonlyArray<AssistantModeWarning>): string[] {
|
|
46
|
-
const byCode = new Map<string, string[]>()
|
|
47
|
-
for (const warning of warnings) byCode.set(warning.code, [...(byCode.get(warning.code) ?? []), detailOf(warning)])
|
|
48
|
-
return [...byCode].map(([code, details]) => `[ai-assistant] ${code} ×${details.length}: ${details.join(', ')}`)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/*
|
|
52
|
-
* After every module has registered: a mode may declare its slash sentences before the package
|
|
53
|
-
* that registers the tools they need, so this cannot be checked when the mode registers.
|
|
54
|
-
*/
|
|
55
|
-
process.on('bootstrap-module-start' as any, () => {
|
|
56
|
-
for (const line of formatToolRegistryWarnings(getToolRegistryWarnings())) logger.warn(line)
|
|
57
|
-
for (const line of formatAssistantModeWarnings(getAssistantModeWarnings())) logger.warn(line)
|
|
58
|
-
/*
|
|
59
|
-
* 이 자리에서만 물을 수 있는 것 — 적어 둔 문이 스키마에 있나. AUTH 의 필드 표는 스키마를 지은 뒤에
|
|
60
|
-
* 차고, 이 훅은 그 뒤에 돈다(`builtSchema` 를 함께 받는다).
|
|
61
|
-
*/
|
|
62
|
-
for (const line of formatDoorDeclarationWarnings(doorDeclarationWarnings())) logger.warn(line)
|
|
63
|
-
})
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What this guards: **the dock sends the agent a person picked while the domain still offers it, and every action on
|
|
3
|
-
* the settings card saves the domain's agents as one whole list without pinning what was inherited**
|
|
4
|
-
* (design/ai/agent-settings.md §5, §7).
|
|
5
|
-
*/
|
|
6
|
-
import { offersAgentPicker, pickAgentId } from '../client/utils/agent-choice'
|
|
7
|
-
import { draftOf, groupByOwner, saveInput, type AgentSettings, type AgentView } from '../client/settings/agent-settings-model'
|
|
8
|
-
import { periodRange } from '../client/settings/usage-model'
|
|
9
|
-
|
|
10
|
-
const choice = (id: string, isDefault = false) => ({ id, name: id, provider: 'openai', model: 'gpt-4o', isDefault })
|
|
11
|
-
|
|
12
|
-
describe('the dock\'s agent', () => {
|
|
13
|
-
it('★ the remembered agent while the domain still offers it, else the default, else the first', () => {
|
|
14
|
-
const choices = [choice('a'), choice('b', true), choice('c')]
|
|
15
|
-
expect(pickAgentId(choices, 'c')).toBe('c')
|
|
16
|
-
expect(pickAgentId(choices, 'gone')).toBe('b')
|
|
17
|
-
expect(pickAgentId([choice('a'), choice('c')], undefined)).toBe('a')
|
|
18
|
-
expect(pickAgentId([], 'a')).toBeUndefined()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('★ no picker for one agent or none', () => {
|
|
22
|
-
expect(offersAgentPicker([])).toBe(false)
|
|
23
|
-
expect(offersAgentPicker([choice('a')])).toBe(false)
|
|
24
|
-
expect(offersAgentPicker([choice('a'), choice('b')])).toBe(true)
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const domain = (id: string, name: string) => ({ id, name })
|
|
29
|
-
const plant = domain('plant', '서울공장')
|
|
30
|
-
const hq = domain('hq', '본사')
|
|
31
|
-
const group = domain('group', '그룹')
|
|
32
|
-
|
|
33
|
-
function agent(id: string, owner: { id: string; name: string }, extra: Partial<AgentView> = {}): AgentView {
|
|
34
|
-
return {
|
|
35
|
-
id,
|
|
36
|
-
name: id.toUpperCase(),
|
|
37
|
-
provider: 'openai',
|
|
38
|
-
model: 'gpt-4o',
|
|
39
|
-
baseURL: null,
|
|
40
|
-
organization: null,
|
|
41
|
-
active: true,
|
|
42
|
-
owner,
|
|
43
|
-
inherited: owner.id !== 'plant',
|
|
44
|
-
turnedOff: false,
|
|
45
|
-
keyState: owner.id !== 'plant' ? 'inherited' : 'own',
|
|
46
|
-
usable: true,
|
|
47
|
-
isDefault: false,
|
|
48
|
-
usedBelow: [],
|
|
49
|
-
...extra
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const settings = (extra: Partial<AgentSettings> = {}): AgentSettings => ({
|
|
54
|
-
chain: [plant, hq, group],
|
|
55
|
-
agents: [agent('p1', plant), agent('h1', hq), agent('h2', hq, { turnedOff: true }), agent('g1', group)],
|
|
56
|
-
defaultAgentId: 'h1',
|
|
57
|
-
defaultFrom: 'inherited',
|
|
58
|
-
state: 'configured',
|
|
59
|
-
...extra
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
describe('the card\'s groups', () => {
|
|
63
|
-
it('★ this domain first, then each domain above closest first, named by its place when there are several', () => {
|
|
64
|
-
expect(groupByOwner(settings()).map(one => [one.ownerId, one.inherited, one.path, one.agents.map(a => a.id)])).toEqual([
|
|
65
|
-
['plant', false, '그룹 › 본사 › 서울공장', ['p1']],
|
|
66
|
-
['hq', true, '그룹 › 본사', ['h1', 'h2']],
|
|
67
|
-
['group', true, '그룹', ['g1']]
|
|
68
|
-
])
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('a domain above with no agents has no group; this domain always has one', () => {
|
|
72
|
-
const groups = groupByOwner(settings({ agents: [agent('g1', group)] }))
|
|
73
|
-
expect(groups.map(one => one.ownerId)).toEqual(['plant', 'group'])
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
describe('what the card saves', () => {
|
|
78
|
-
it('★ only this domain\'s own agents are written, and an inherited default is not pinned here', () => {
|
|
79
|
-
const input = saveInput(settings(), { kind: 'active', agentId: 'p1', active: false })
|
|
80
|
-
expect(input.agents).toEqual([{ id: 'p1', name: 'P1', provider: 'openai', model: 'gpt-4o', active: false }])
|
|
81
|
-
expect(input).not.toHaveProperty('defaultAgentId')
|
|
82
|
-
expect(input.turnedOff).toEqual(['h2'])
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('★ picking a default writes this domain\'s own choice', () => {
|
|
86
|
-
expect(saveInput(settings(), { kind: 'default', agentId: 'g1' })).toMatchObject({ defaultAgentId: 'g1' })
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('★ turning an inherited agent off here adds it to this domain\'s list; on again takes it out', () => {
|
|
90
|
-
expect(saveInput(settings(), { kind: 'turn-off', agentId: 'h1', off: true }).turnedOff).toEqual(['h2', 'h1'])
|
|
91
|
-
expect(saveInput(settings(), { kind: 'turn-off', agentId: 'h2', off: false }).turnedOff).toEqual([])
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('★ a new agent is appended with its key; an edit keeps the stored key when none was typed', () => {
|
|
95
|
-
const added = saveInput(settings(), { kind: 'upsert', draft: { ...draftOf(), name: ' New ', provider: 'gemini', model: 'gemini-x', apiKey: ' k ' } })
|
|
96
|
-
expect(added.agents.at(-1)).toEqual({ name: 'New', provider: 'gemini', model: 'gemini-x', active: true, apiKey: 'k' })
|
|
97
|
-
|
|
98
|
-
const edited = saveInput(settings(), { kind: 'upsert', draft: { ...draftOf(agent('p1', plant)), model: 'gpt-4o-mini' } })
|
|
99
|
-
expect(edited.agents).toEqual([{ id: 'p1', name: 'P1', provider: 'openai', model: 'gpt-4o-mini', active: true }])
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('an organization is only an OpenAI field', () => {
|
|
103
|
-
const input = saveInput(settings(), { kind: 'upsert', draft: { ...draftOf(), name: 'C', provider: 'anthropic', model: 'c', organization: 'org-x' } })
|
|
104
|
-
expect(input.agents.at(-1)).not.toHaveProperty('organization')
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
it('★ deleting the agent that was this domain\'s default drops the default with it', () => {
|
|
108
|
-
const own = settings({ defaultAgentId: 'p1', defaultFrom: 'own' })
|
|
109
|
-
expect(saveInput(own, { kind: 'delete', agentId: 'p1' })).toEqual({ agents: [], turnedOff: ['h2'] })
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it('★ an inherited agent answered with this domain\'s key, and given back', () => {
|
|
113
|
-
expect(saveInput(settings(), { kind: 'key-override', agentId: 'h1', apiKey: 'k' }).inheritedKeys).toEqual([{ agentId: 'h1', apiKey: 'k' }])
|
|
114
|
-
expect(saveInput(settings(), { kind: 'key-clear', agentId: 'h1' }).inheritedKeys).toEqual([{ agentId: 'h1', clear: true }])
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
it('a period runs from the start of its first day to the end of the hour in progress', () => {
|
|
119
|
-
const now = new Date(2026, 9, 12, 14, 25)
|
|
120
|
-
expect(periodRange('today', now)).toEqual({ from: new Date(2026, 9, 12, 0, 0), to: new Date(2026, 9, 12, 15, 0) })
|
|
121
|
-
expect(periodRange('7d', now).from).toEqual(new Date(2026, 9, 6, 0, 0))
|
|
122
|
-
expect(periodRange('30d', now).from).toEqual(new Date(2026, 8, 13, 0, 0))
|
|
123
|
-
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What an applied card wrote is read again by the screens that show it, and only by them (applied-screens.ts).
|
|
3
|
-
*/
|
|
4
|
-
import { refreshAppliedScreens } from '../client/utils/applied-screens'
|
|
5
|
-
|
|
6
|
-
function deps(page: { name?: string; dirty?: boolean; refresh?: boolean } = {}, shown?: { kind: string; id: string }) {
|
|
7
|
-
const asked: any[] = []
|
|
8
|
-
let read360 = false
|
|
9
|
-
return {
|
|
10
|
-
asked,
|
|
11
|
-
read360: () => read360,
|
|
12
|
-
deps: {
|
|
13
|
-
page: () => ({
|
|
14
|
-
name: page.name,
|
|
15
|
-
element: page.refresh === false ? {} : { refresh: async (options?: any) => (asked.push(options), !page.dirty) }
|
|
16
|
-
}),
|
|
17
|
-
refresh360: (about: (subject: { kind: string; id: string }) => boolean) => (read360 = !!shown && about(shown))
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const card = { target: 'office.counterparty', screen: 'counterparty-list' }
|
|
23
|
-
|
|
24
|
-
describe('the screens behind the dock after a card is applied', () => {
|
|
25
|
-
it('★ the page that is the card\'s screen reads again, never asking about unsaved edits', async () => {
|
|
26
|
-
const one = deps({ name: 'counterparty-list' })
|
|
27
|
-
await refreshAppliedScreens(card, ['a'], one.deps)
|
|
28
|
-
expect(one.asked).toEqual([{ ask: false }])
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('★ a page with unsaved edits is left as it is, and that is said', async () => {
|
|
32
|
-
const one = deps({ name: 'counterparty-list', dirty: true })
|
|
33
|
-
expect(await refreshAppliedScreens(card, ['a'], one.deps)).toBe('kept-edits')
|
|
34
|
-
expect(await refreshAppliedScreens(card, ['a'], deps({ name: 'counterparty-list' }).deps)).toBeUndefined()
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('★ another page keeps its rows and its scroll', async () => {
|
|
38
|
-
const one = deps({ name: 'contract-list' })
|
|
39
|
-
await refreshAppliedScreens(card, ['a'], one.deps)
|
|
40
|
-
expect(one.asked).toEqual([])
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('a shell without the page refresh leaves the page as it is', async () => {
|
|
44
|
-
await expect(refreshAppliedScreens(card, ['a'], deps({ name: 'counterparty-list', refresh: false }).deps)).resolves.toBeUndefined()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('★ the shown 360 reads again when it is one of the records, or a record the card is about', async () => {
|
|
48
|
-
const own = deps({}, { kind: 'counterparty', id: 'a' })
|
|
49
|
-
await refreshAppliedScreens(card, ['a'], own.deps)
|
|
50
|
-
expect(own.read360()).toBe(true)
|
|
51
|
-
|
|
52
|
-
const other = deps({}, { kind: 'counterparty', id: 'z' })
|
|
53
|
-
await refreshAppliedScreens(card, ['a'], other.deps)
|
|
54
|
-
expect(other.read360()).toBe(false)
|
|
55
|
-
|
|
56
|
-
const about = deps({}, { kind: 'contract', id: 'c' })
|
|
57
|
-
await refreshAppliedScreens({ target: 'office.collection-match', axes: ['cash-transaction', 'contract'] }, ['l'], about.deps)
|
|
58
|
-
expect(about.read360()).toBe(true)
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('a refresh that throws keeps the screen and the card', async () => {
|
|
62
|
-
const failing = { page: () => ({ name: 'counterparty-list', element: { refresh: async () => { throw new Error('x') } } }), refresh360: () => { throw new Error('y') } }
|
|
63
|
-
await expect(refreshAppliedScreens(card, ['a'], failing as any)).resolves.toBeUndefined()
|
|
64
|
-
})
|
|
65
|
-
})
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What this guards: nothing sends the conversation's persona, tools, model or limits any more.
|
|
3
|
-
*
|
|
4
|
-
* ADR-0061 decision 7 took six fields off `assistantChat` with no compatibility field, on the
|
|
5
|
-
* condition that a test counts the callers still passing them. Types catch a caller that compiles
|
|
6
|
-
* against this source; an app compiled against an installed copy, or a hand-written GraphQL
|
|
7
|
-
* document, would not be caught by anything else.
|
|
8
|
-
*/
|
|
9
|
-
import { readFileSync, readdirSync, statSync } from 'fs'
|
|
10
|
-
import path from 'path'
|
|
11
|
-
|
|
12
|
-
const PACKAGES = path.resolve(__dirname, '../..')
|
|
13
|
-
const MOVED = ['systemPrompt', 'toolCategories', 'model', 'temperature', 'maxTokens', 'requireGroundingTools']
|
|
14
|
-
|
|
15
|
-
/** Source files only — a built copy of yesterday's source is not a call site. */
|
|
16
|
-
function sources(dir: string, out: string[] = []): string[] {
|
|
17
|
-
for (const entry of readdirSync(dir)) {
|
|
18
|
-
if (entry === 'node_modules' || entry === 'dist-server' || entry === 'dist-client' || entry.startsWith('.')) continue
|
|
19
|
-
const full = path.join(dir, entry)
|
|
20
|
-
if (statSync(full).isDirectory()) sources(full, out)
|
|
21
|
-
else if (/\.(ts|js)$/.test(entry)) out.push(full)
|
|
22
|
-
}
|
|
23
|
-
return out
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const files = sources(PACKAGES)
|
|
27
|
-
/* This file names the fields it looks for; counting itself would report itself. */
|
|
28
|
-
.filter(file => !file.endsWith('assistant-chat-call-sites.test.ts'))
|
|
29
|
-
.map(file => ({ file, text: readFileSync(file, 'utf-8') }))
|
|
30
|
-
|
|
31
|
-
it('★ one place builds the neutral door input, and it sends none of the moved fields', () => {
|
|
32
|
-
const builders = files.filter(f => f.text.includes('buildAssistantChatInput(')).map(f => path.relative(PACKAGES, f.file))
|
|
33
|
-
|
|
34
|
-
expect(builders.sort()).toEqual(
|
|
35
|
-
[
|
|
36
|
-
'ai-assistant/client/components/assistant-chat.ts',
|
|
37
|
-
'ai-assistant/client/components/chat-input-builder.test.ts',
|
|
38
|
-
'ai-assistant/client/components/chat-input-builder.ts'
|
|
39
|
-
].sort()
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
const builder = files.find(f => f.file.endsWith('chat-input-builder.ts'))!.text
|
|
43
|
-
const neutral = builder.slice(builder.indexOf('export function buildAssistantChatInput'))
|
|
44
|
-
for (const field of MOVED) expect(neutral).not.toContain(`args.${field}`)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('★ no hand-written document sends the moved fields to assistantChat', () => {
|
|
48
|
-
const offenders: string[] = []
|
|
49
|
-
for (const { file, text } of files) {
|
|
50
|
-
/* The mutation document, wherever it is written. */
|
|
51
|
-
const at = text.indexOf('assistantChat(input:')
|
|
52
|
-
if (at < 0) continue
|
|
53
|
-
const document = text.slice(Math.max(0, at - 2000), at + 2000)
|
|
54
|
-
for (const field of MOVED) {
|
|
55
|
-
if (new RegExp(`${field}\\s*:`).test(document)) offenders.push(`${path.relative(PACKAGES, file)} → ${field}`)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
expect(offenders).toEqual([])
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
/*
|
|
63
|
-
* `model` and `temperature` are left out here on purpose: a board surface passes `.model=` for the
|
|
64
|
-
* board it is editing, and matching that would report the wrong thing. The door test above covers
|
|
65
|
-
* them on the wire, which is where they mattered.
|
|
66
|
-
*/
|
|
67
|
-
const ELEMENT_PROPERTIES = ['systemPrompt', 'toolCategories', 'requireGroundingTools']
|
|
68
|
-
|
|
69
|
-
it('★ 긴 제안 상태 문구가 좁은 도크의 제목 폭을 0으로 밀어내지 않는다', () => {
|
|
70
|
-
const source = readFileSync(path.resolve(__dirname, '../client/components/assistant-chat.ts'), 'utf-8')
|
|
71
|
-
const proposalCss = source.slice(source.indexOf(' .proposal {'), source.indexOf(' .proposal-choices {'))
|
|
72
|
-
|
|
73
|
-
expect(proposalCss).toContain('flex-wrap: wrap')
|
|
74
|
-
expect(proposalCss).toContain('flex: 1 1 132px')
|
|
75
|
-
expect(proposalCss).toContain('max-width: 100%')
|
|
76
|
-
expect(proposalCss).toContain('overflow-wrap: anywhere')
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('★ no surface in this repo declares a conversation the server should own', () => {
|
|
80
|
-
const offenders: string[] = []
|
|
81
|
-
for (const { file, text } of files) {
|
|
82
|
-
if (!/<ox-assistant-chat/.test(text)) continue
|
|
83
|
-
if (file.includes('ai-assistant/client/components/')) continue
|
|
84
|
-
for (const field of ELEMENT_PROPERTIES) {
|
|
85
|
-
if (new RegExp(`\\.${field}=|${field.replace(/[A-Z]/g, c => '-' + c.toLowerCase())}=`).test(text)) {
|
|
86
|
-
offenders.push(`${path.relative(PACKAGES, file)} → ${field}`)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
expect(offenders).toEqual([])
|
|
92
|
-
})
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The shared AI dock's contract (design/ai/shared-dock.md §8) - checked once here instead of in every app.
|
|
3
|
-
* The dock is read as text: importing it would pull the shell and i18n, which the runner cannot load.
|
|
4
|
-
*/
|
|
5
|
-
import assert from 'node:assert/strict'
|
|
6
|
-
import { readFileSync } from 'node:fs'
|
|
7
|
-
import { join } from 'node:path'
|
|
8
|
-
|
|
9
|
-
import { runProposal, registerProposalHandler } from '../client/utils/assistant-proposals'
|
|
10
|
-
|
|
11
|
-
const read = (file: string) => readFileSync(join(__dirname, file), 'utf8')
|
|
12
|
-
const code = (file: string) => read(file).replace(/\/\*[\s\S]*?\*\//g, '').replace(/^\s*\/\/.*$/gm, '')
|
|
13
|
-
const dock = code('../client/components/assistant-dock.ts')
|
|
14
|
-
/* Not comment-stripped: the chat has strings like 'image/*' that a comment regex would eat. */
|
|
15
|
-
const chat = read('../client/components/assistant-chat.ts')
|
|
16
|
-
const transport = read('../client/utils/assistant-session-transport.ts')
|
|
17
|
-
|
|
18
|
-
describe('no empty panel', () => {
|
|
19
|
-
it('not configured, unreadable, no surface and a stuck anchor are each said', () => {
|
|
20
|
-
for (const key of ['not-configured', 'capability-unknown', 'no-surface']) assert.match(dock, new RegExp(`t\\('${key}'`))
|
|
21
|
-
assert.match(dock, /if \(anchor && !isAnchor\(anchor\)\) return anchor\.message/)
|
|
22
|
-
assert.match(dock, /readAiCapability\(\)/)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('an unreadable capability offers a retry', () => {
|
|
26
|
-
assert.match(dock, /this\.capability === 'unknown'\s*\?\s*html`<div><button class="sbtn" @click=\$\{\(\) => this\.open\(\)\}>/)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('a surface can give the person one concrete next route', () => {
|
|
30
|
-
assert.match(dock, /surface\?\.nextStep \? html`<div class="next-step" role="status">/)
|
|
31
|
-
assert.match(dock, /<a href=\$\{surface\.nextStep\.href\}>\$\{surface\.nextStep\.label\(\)\}/)
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
describe('the dock opens on every screen', () => {
|
|
36
|
-
it('it stays on editors that bleed wide - the board modeller hides the aside bar', () => {
|
|
37
|
-
assert.match(code('../client/setup-assistant-dock.ts'), /persistent: true/)
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
describe('every request the chat makes is taken', () => {
|
|
42
|
-
it('new conversation and proposal execute', () => {
|
|
43
|
-
assert.match(dock, /addEventListener\('assistant-start-new-session'/)
|
|
44
|
-
assert.match(dock, /@assistant-proposal-execute=\$\{this\.onProposal\}/)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('a board surface gets the scene edits, reverts and actions', () => {
|
|
48
|
-
for (const event of ['scene-edit-patch', 'board-edit-revert', 'scene-action-execute']) assert.match(dock, new RegExp(`@${event}=`))
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('the toolbar opens the manager, and the manager asks with the same events', () => {
|
|
52
|
-
assert.match(dock, /historyEnabled/)
|
|
53
|
-
assert.match(dock, /@assistant-session-history=/)
|
|
54
|
-
assert.match(dock, /<ox-assistant-session-manager/)
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
describe('every proposal ends in one reported outcome', () => {
|
|
59
|
-
it('the dock reports whatever the handler returned', () => {
|
|
60
|
-
assert.match(dock, /const outcome: ProposalOutcome =[\s\S]*await runProposal\(proposal, this\.proposalContext\(sessionId\)\)[\s\S]*const \{ records, \.\.\.reported \} = outcome\s*await this\.report\(sessionId, proposalKey, reported\)/)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('★ an applied card has the screens that show its records read them again - not a refused one', () => {
|
|
64
|
-
assert.match(dock, /if \(outcome\.verdict === 'accepted' && \(outcome\.applied \?\? 1\) > 0\)\s*void refreshAppliedScreens\(proposal, records, APPLIED_SCREENS\)\.then\(kept => \{\s*if \(kept\) notify\(\{ level: 'info', message: t\('screen-kept-edits'/)
|
|
65
|
-
assert.match(dock, /page: \(\) => \{\s*const route = \(store\.getState\(\) as any\)\?\.route \?\? \{\}\s*return \{ name: route\.page, element: route\.activePage \}/)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('a kind nobody handles is unavailable, by name', async () => {
|
|
69
|
-
const outcome = await runProposal({ tool: 'proposeNothingKnown' }, {} as any)
|
|
70
|
-
assert.deepEqual(outcome, { verdict: 'unavailable', errorCode: 'unknown-proposal-kind' })
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('a handler that throws is refused with its message, never a silent pass', async () => {
|
|
74
|
-
registerProposalHandler('proposeThrows', async () => {
|
|
75
|
-
throw new Error('kernel-refused')
|
|
76
|
-
})
|
|
77
|
-
assert.deepEqual(await runProposal({ tool: 'proposeThrows' }, {} as any), { verdict: 'refused', errorCode: 'kernel-refused' })
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('a handler that answers nothing is not taken as done', async () => {
|
|
81
|
-
registerProposalHandler('proposeSilent', async () => undefined as any)
|
|
82
|
-
assert.deepEqual(await runProposal({ tool: 'proposeSilent' }, {} as any), { verdict: 'unavailable', errorCode: 'no-outcome' })
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('a handler that asks the person uses the platform confirm', () => {
|
|
86
|
-
assert.match(dock, /OxPrompt\.open\(/)
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
describe('sessions', () => {
|
|
91
|
-
it('the key carries the conversation kind', () => {
|
|
92
|
-
assert.match(dock, /scope: JSON\.stringify\(\[this\.app\.contextPath, userId, this\.kind\]\)/)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it('★ a screen opens its one conversation - nothing to pick, nothing to follow (design/ai/screen-pattern.md §3)', () => {
|
|
96
|
-
assert.match(dock, /assistantModeFor\(subject: \$subject\)/)
|
|
97
|
-
assert.match(dock, /this\.kind = mode\?\.kind \?\? ''/)
|
|
98
|
-
assert.doesNotMatch(dock, /chosenKind|onModeChange|assistant-mode-change|followPickedConversation/)
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
describe('what is being written stays with its conversation (ADR-0072 rule, ruled 2026-10-13)', () => {
|
|
103
|
-
const chat = readFileSync(join(__dirname, '../client/components/assistant-chat.ts'), 'utf8')
|
|
104
|
-
|
|
105
|
-
it('★ the unsent text and the attachments both leave the box with the conversation, and come back to it', () => {
|
|
106
|
-
const take = chat.slice(chat.indexOf(' takeDraft()'), chat.indexOf(' restoreDraft('))
|
|
107
|
-
assert.match(take, /const draft = \{ text: this\.input, attachments: this\.attachments \}/)
|
|
108
|
-
assert.match(take, /this\.input = ''\s+this\.attachments = \[\]/)
|
|
109
|
-
const restore = chat.slice(chat.indexOf(' restoreDraft('), chat.indexOf(' restoreDraft(') + 200)
|
|
110
|
-
assert.match(restore, /this\.input = draft\.text\s+this\.attachments = draft\.attachments/)
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('★ the dock keeps it per subject when the page moves, except when the person signed in changed', () => {
|
|
114
|
-
assert.match(dock, /if \(transition !== 'reset'\) this\.keepDraft\(\)/)
|
|
115
|
-
assert.match(dock, /if \(draft\) this\.drafts\.set\(this\.openedFor!, draft\)/)
|
|
116
|
-
assert.match(dock, /void this\.restoreDraft\(\)/)
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
it('★ a page change while answering waits for the answer - it lands in the conversation it was asked in', () => {
|
|
120
|
-
assert.match(dock, /if \(!force && transition === 'wait'\) \{[\s\S]{0,160}this\.followWhenIdle\(\)/)
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
describe('the screen is checked at send time', () => {
|
|
125
|
-
it('a send after the screen moved on is refused', () => {
|
|
126
|
-
assert.match(dock, /if \(openedFor !== this\.scopeKey\(currentAssistantSurface\(\)\) \|\| this\.openedIdentity !== this\.identityKey\(\)\) throw new Error/)
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
it('the draft is read at send time, never cached', () => {
|
|
130
|
-
assert.match(dock, /return \{ hostContext: surface\?\.hostContext\?\.\(\) \?\? \{\} \}/)
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
describe('the dock knows no application', () => {
|
|
135
|
-
it('no app names and no proposal kinds in the dock', () => {
|
|
136
|
-
assert.doesNotMatch(dock, /\b(twin|plant|figure|warehouse|ecs|operato-[a-z]+)\b/i)
|
|
137
|
-
assert.doesNotMatch(dock, /'propose[A-Z]\w*'/)
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
describe('attachments in the chat follow the mode', () => {
|
|
142
|
-
it('no attach button when the mode declares nothing (the board door keeps its images)', () => {
|
|
143
|
-
assert.match(chat, /this\.acceptsAttachments\s*\?\s*html`<button/)
|
|
144
|
-
assert.match(chat, /return !this\.usesAttachmentPolicy \|\| !!this\.modeView\?\.attachments\?\.kinds\?\.length/)
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
it('said before sending, then uploaded to the conversation and sent by id', () => {
|
|
148
|
-
assert.match(chat, /refuseAttachments\(\s*this\.modeView\?\.attachments/)
|
|
149
|
-
assert.match(chat, /mutation: ATTACH_TO_CONVERSATION_MUTATION/)
|
|
150
|
-
/* Without it the client sends the File as {} and the server refuses the upload (found on :3700, 2026-09-25). */
|
|
151
|
-
assert.match(chat, /context: \{ hasUpload: true \}/)
|
|
152
|
-
/* Sent with the turn's input - the agent the person picked follows it (design/ai/agent-settings.md §5). */
|
|
153
|
-
assert.match(chat, /\n\s*attachmentIds,\s*\n\s*agentId: this\.agentId,\s*\n\s*page: \(store\.getState\(\) as any\)\?\.route\?\.page \|\| undefined\s*\n\s*\}\)/)
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('a stored file opens through the conversation route', () => {
|
|
157
|
-
assert.match(chat, /chatAttachmentUrl\(this\.sessionId, att\.id\)/)
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
describe('what twin needed of the dock', () => {
|
|
162
|
-
it('a surface that says its words changed repaints the header without reopening the conversation', () => {
|
|
163
|
-
assert.match(dock, /transition === 'refresh'\) \{\s*this\.surface = next\s*this\.requestUpdate\(\)\s*return/)
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
it('a question with no conversation to go to is said now, never sent later; a draft waits', () => {
|
|
167
|
-
assert.match(dock, /if \(waiting\.ask\) notify\(/)
|
|
168
|
-
assert.match(dock, /else holdAssistantAsk\(waiting\)/)
|
|
169
|
-
/* Taken when the opening ends whatever it found - a stuck anchor is said by takeAsk at once. */
|
|
170
|
-
assert.match(dock, /this\.loading = false\s*if \(this\.anchor\) void this\.takeAsk\(\)/)
|
|
171
|
-
assert.match(dock, /if \(!isAnchor\(this\.anchor\)\) \{/)
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
it('a handler\'s note stays in the conversation after its outcome is reported', () => {
|
|
175
|
-
assert.match(dock, /await this\.report\(sessionId, proposalKey, outcome\)\s*if \(outcome\.note && sessionId\) await this\.appendNote\(sessionId, outcome\.note\)/)
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
it('a carried conversation that could not be made is said, not swallowed', () => {
|
|
179
|
-
assert.match(dock, /this\.startCarried\(ask\)\.catch\(\(?\w*\)? => \{\s*notify\(\{ level: 'error'/)
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
it('★ a request made on the screen is never dropped while an answer is written - it waits and is taken after', () => {
|
|
183
|
-
const busy = dock.slice(dock.indexOf('if (this.navigationState.busy) {', dock.indexOf('private async takeAsk')), dock.indexOf('if (this.navigationState.draft', dock.indexOf('private async takeAsk')))
|
|
184
|
-
assert.match(busy, /this\.takeWhenIdle\(\)\s*return/)
|
|
185
|
-
assert.doesNotMatch(busy, /takeAssistantAsk\(\)/)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
it('★ unsent words are asked about before a new request takes the dock - never dropped without asking', () => {
|
|
189
|
-
assert.match(dock, /if \(this\.navigationState\.draft && !\(await this\.mayLeaveConversation\(\)\)\) \{\s*const waiting = takeAssistantAsk\(\)/)
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
it('a note is drawn without the line only the model reads', () => {
|
|
193
|
-
assert.match(chat, />\$\{noteForDisplay\(content\)\}<\/span/)
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
it('★ and nothing is sent into the previous conversation after it - the request depended on the context that failed', () => {
|
|
197
|
-
assert.match(dock, /this\.startCarried\(ask\)\.catch\([\s\S]*?return undefined\s*\}\)[\s\S]{0,200}?if \(!id\) return\n/)
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
describe('closing and opening the dock again (design/ai/shared-dock.md §2-1, §2-7)', () => {
|
|
202
|
-
const setup = code('../client/setup-assistant-dock.ts')
|
|
203
|
-
const between = (text: string, from: string, to: string) => text.slice(text.indexOf(from), text.indexOf(to, text.indexOf(from)))
|
|
204
|
-
|
|
205
|
-
it('★ the viewpart puts back one dock - a template that makes the element makes a new dock on every opening', () => {
|
|
206
|
-
assert.match(setup, /const dock = document\.createElement\('ox-assistant-dock'\)/)
|
|
207
|
-
assert.match(setup, /template: html`\$\{dock\}`/)
|
|
208
|
-
assert.doesNotMatch(setup, /<ox-assistant-dock[\s>]/)
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
it('★ closing keeps the conversation - no reset, no cancelled opening', () => {
|
|
212
|
-
const closing = between(dock, 'disconnectedCallback() {', 'super.disconnectedCallback()')
|
|
213
|
-
assert.doesNotMatch(closing, /controller\.clear\(\)/)
|
|
214
|
-
assert.doesNotMatch(closing, /this\.revision\+\+/)
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
it('★ opening again follows what moved, it does not open the conversation anew', () => {
|
|
218
|
-
const opening = between(dock, 'connectedCallback() {', 'disconnectedCallback() {')
|
|
219
|
-
assert.match(opening, /if \(!this\.openedIdentity\) return this\.follow\(true\)/)
|
|
220
|
-
assert.match(opening, /setOpenSession\(this\.sessionId\)\s*this\.follow\(\)/)
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
it('★ the chat put back reads its conversation again and starts its broadcast and presence again', () => {
|
|
224
|
-
const opening = between(chat, ' connectedCallback() {', ' private async onSubjectChanged()')
|
|
225
|
-
assert.match(opening, /if \(this\.hasUpdated && this\.sessionId\) \{\s*this\.loadHistory\(\)\s*this\._startPresence\(\)\s*this\._startMessageSubscription\(\)/)
|
|
226
|
-
})
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
/*
|
|
230
|
-
* A screen request (「AI와 작업」) - design/ai/shared-dock.md §2-11-1, the user (2026-10-24): 「"AI와 작업" 기능이 unstable
|
|
231
|
-
* 하다. 작동 방식을 신뢰할 수 있도록 새로운 세션을 여는지, 기존 세션을 활용하는지 등등을 명확하게 하라.」 One test per rule.
|
|
232
|
-
*/
|
|
233
|
-
describe('a screen request', () => {
|
|
234
|
-
const take = dock.slice(dock.indexOf('private async takeScreenRequest()'), dock.indexOf('\n }\n', dock.indexOf('private async takeScreenRequest()')))
|
|
235
|
-
const send = chat.slice(chat.indexOf('async sendScreenRequest('), chat.indexOf('\n }\n', chat.indexOf('async sendScreenRequest(')))
|
|
236
|
-
|
|
237
|
-
it('★ a request that reopens this screen\'s conversation is taken once the opening is done - never while it loads', () => {
|
|
238
|
-
const opening = dock.slice(dock.indexOf('private async open(): Promise<void> {'), dock.indexOf('private target('))
|
|
239
|
-
const [body, rest] = opening.split('} finally {')
|
|
240
|
-
/* takeAsk passes while loading: called inside the opening, the request stayed waiting and was never sent. */
|
|
241
|
-
assert.doesNotMatch(body, /this\.takeAsk\(\)/)
|
|
242
|
-
assert.match(rest, /this\.loading = false\s*if \(this\.anchor\) void this\.takeAsk\(\)/)
|
|
243
|
-
assert.match(dock, /private async takeAsk\(\) \{\s*if \(this\.loading \|\| !this\.anchor\) return/)
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
it('goes its own way - a request carrying a selection is a screen request', () => {
|
|
247
|
-
assert.match(dock, /if \(peekAssistantAsk\(\)\?\.selection\) return this\.takeScreenRequest\(\)/)
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
it('★ 1. to this screen\'s conversation - never a new one; another screen\'s conversation open comes back here', () => {
|
|
251
|
-
assert.doesNotMatch(take, /newConversation|startCarried|createAISession|controller\.reset|conversationView\+\+/)
|
|
252
|
-
assert.match(take, /if \(this\.scopeKey\(here\) !== this\.openedFor[^\n]*\) \{\s*(?:\/\*[^*]*\*\/\s*)?this\.keepDraft\(\)\s*this\.surface = here\s*await this\.open\(\)/)
|
|
253
|
-
assert.match(take, /this\.showingHistory = false/)
|
|
254
|
-
/* Someone else's open conversation the dock showed by default is not this person's - their own is started (draft along). */
|
|
255
|
-
assert.match(take, /if \(this\.sessions\.find\(one => one\.id === this\.sessionId\)\?\.participant === false\) await this\.goToOwnConversation\(\)/)
|
|
256
|
-
/* ...and that is their own most recent one here, a new one only when they have none. */
|
|
257
|
-
assert.match(dock, /const own = this\.sessions\.find\(one => one\.participant !== false && one\.id !== this\.sessionId\)/)
|
|
258
|
-
assert.match(dock, /if \(own\) \{\s*if \(this\.controller\.select\(own\.id\)\) this\.conversationView\+\+\s*\} else \{\s*await this\.controller\.reset\(\)/)
|
|
259
|
-
assert.match(transport, /participant\}\}/)
|
|
260
|
-
/* No conversation yet: the chat makes this screen's one on sending, through the controller - never a second. */
|
|
261
|
-
assert.match(send, /if \(!this\.sessionId && this\.prepareSession\) \{\s*await this\.prepareSession\(/)
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
it('★ 2. the selection is noted for that turn, before the request', () => {
|
|
265
|
-
assert.match(take, /chat\.sendScreenRequest\(request, selectionNote\(ask\.selection!, t\)\)/)
|
|
266
|
-
const noted = send.indexOf('APPEND_SESSION_NOTE_MUTATION')
|
|
267
|
-
assert.ok(noted > 0 && noted < send.indexOf('await this.send()'))
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
it('★ 3. sent, always - the request goes out, never as a draft', () => {
|
|
271
|
-
assert.match(send, /this\.input = text\s*await this\.send\(\)/)
|
|
272
|
-
assert.doesNotMatch(take, /asking|draft:/)
|
|
273
|
-
assert.match(take, /ask\.ask\?\.trim\(\) \|\| t\('screen-request-default'/)
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
it('★ 4. what the person was writing is set aside and put back', () => {
|
|
277
|
-
assert.match(send, /const kept = this\.takeDraft\(\)/)
|
|
278
|
-
assert.match(send, /finally \{[\s\S]*if \(kept && !this\.input\.trim\(\) && !this\.attachments\.length\) this\.restoreDraft\(kept\)/)
|
|
279
|
-
assert.match(send, /if \(this\.input\.trim\(\) === text\.trim\(\)\) this\.input = ''/)
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
it('★ 5. not sent: said, and the screen is told', () => {
|
|
283
|
-
assert.match(take, /const fail = \(reason: string\) => \{\s*notify\(\{ level: 'error', message: reason \}\)\s*settleAssistantAsk\(ask, \{ sent: false, reason \}\)/)
|
|
284
|
-
assert.match(take, /if \(!outcome\?\.sent\) return fail\(/)
|
|
285
|
-
assert.match(take, /settleAssistantAsk\(ask, \{ sent: true \}\)/)
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
it('★ 6. an answer being written: said once, and the request goes right after it', () => {
|
|
289
|
-
const busy = take.slice(take.indexOf('if (this.navigationState.busy)'), take.indexOf('const here'))
|
|
290
|
-
assert.match(busy, /notify\(\{ level: 'info', message: t\('screen-request-waits'/)
|
|
291
|
-
assert.match(busy, /this\.takeWhenIdle\(\)\s*return/)
|
|
292
|
-
assert.doesNotMatch(busy, /takeAssistantAsk\(\)/)
|
|
293
|
-
})
|
|
294
|
-
})
|