@things-factory/ai-assistant 10.1.278 → 10.1.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/bootstrap.d.ts +4 -4
- package/dist-client/bootstrap.js +4 -8
- package/dist-client/components/ai-model-price-table.d.ts +32 -0
- package/dist-client/components/ai-model-price-table.js +311 -0
- package/dist-client/components/ai-usage-table.d.ts +17 -0
- package/dist-client/components/ai-usage-table.js +151 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/pages/ai-model-price-page.d.ts +37 -0
- package/dist-client/pages/ai-model-price-page.js +312 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +4 -0
- package/dist-client/settings/ai-agent-setting-let.js +11 -0
- package/dist-client/utils/model-price-model.d.ts +31 -0
- package/dist-client/utils/model-price-model.js +30 -0
- package/dist-client/utils/usage-charts.d.ts +21 -0
- package/dist-client/utils/usage-charts.js +45 -0
- package/dist-client/utils/usage-model.d.ts +44 -0
- package/dist-client/utils/usage-model.js +44 -0
- package/dist-server/service/ai-agent-resolver.d.ts +46 -0
- package/dist-server/service/ai-agent-resolver.js +252 -0
- package/package.json +25 -10
- package/things-factory.config.js +4 -1
- package/translations/en.json +46 -4
- package/translations/es.json +43 -1
- package/translations/ja.json +43 -1
- package/translations/ko.json +46 -4
- package/translations/ms.json +43 -1
- package/translations/zh.json +43 -1
- package/client/bootstrap.ts +0 -27
- package/client/components/assistant-chat.test.ts +0 -149
- package/client/components/assistant-chat.ts +0 -5599
- package/client/components/assistant-dock.ts +0 -1036
- package/client/components/assistant-invite.ts +0 -138
- package/client/components/assistant-mode.test.ts +0 -119
- package/client/components/assistant-mode.ts +0 -174
- package/client/components/assistant-selection-bar.test.ts +0 -167
- package/client/components/assistant-selection-bar.ts +0 -178
- package/client/components/assistant-session-manager.ts +0 -915
- package/client/components/assistant-session-toolbar.ts +0 -80
- package/client/components/chat-defaults.ts +0 -64
- package/client/components/chat-echo-dedup.test.ts +0 -253
- package/client/components/chat-echo-dedup.ts +0 -190
- package/client/components/chat-input-builder.test.ts +0 -86
- package/client/components/chat-input-builder.ts +0 -133
- package/client/components/chat-proposal-survival.test.ts +0 -73
- package/client/components/entry-review.ts +0 -346
- package/client/components/markdown.test.ts +0 -518
- package/client/components/markdown.ts +0 -508
- package/client/components/mention-popup-helpers.ts +0 -433
- package/client/components/mention-popup.test.ts +0 -588
- package/client/components/mention-popup.ts +0 -261
- package/client/components/panel-aria.test.ts +0 -59
- package/client/components/proposal-outcome-line.ts +0 -74
- package/client/components/proposal-request.test.ts +0 -73
- package/client/components/reply-message.test.ts +0 -15
- package/client/components/reply-message.ts +0 -11
- package/client/components/roster-identity.test.ts +0 -8
- package/client/components/roster-identity.ts +0 -4
- package/client/components/workspace-view.ts +0 -486
- package/client/index.ts +0 -36
- package/client/pages/assistant-workspace-page.ts +0 -317
- package/client/route.ts +0 -9
- package/client/settings/agent-settings-model.ts +0 -164
- package/client/settings/ai-agent-setting-let.ts +0 -667
- package/client/settings/ai-usage-setting-let.ts +0 -240
- package/client/settings/usage-model.ts +0 -46
- package/client/setup-assistant-dock.ts +0 -177
- package/client/tsconfig.json +0 -13
- package/client/utils/addressed-draft.test.ts +0 -31
- package/client/utils/agent-choice.ts +0 -56
- package/client/utils/applied-screens.ts +0 -36
- package/client/utils/assistant-activity.ts +0 -122
- package/client/utils/assistant-ask.test.ts +0 -38
- package/client/utils/assistant-ask.ts +0 -93
- package/client/utils/assistant-capability-read.ts +0 -24
- package/client/utils/assistant-capability.test.ts +0 -17
- package/client/utils/assistant-capability.ts +0 -19
- package/client/utils/assistant-navigation.test.ts +0 -66
- package/client/utils/assistant-navigation.ts +0 -11
- package/client/utils/assistant-proposals.ts +0 -85
- package/client/utils/assistant-request-context.ts +0 -63
- package/client/utils/assistant-selection.test.ts +0 -54
- package/client/utils/assistant-selection.ts +0 -75
- package/client/utils/assistant-session-actions.ts +0 -32
- package/client/utils/assistant-session-admin.ts +0 -239
- package/client/utils/assistant-session-controller.test.ts +0 -75
- package/client/utils/assistant-session-controller.ts +0 -208
- package/client/utils/assistant-session-transport.ts +0 -46
- package/client/utils/assistant-surface.ts +0 -178
- package/client/utils/assistant-typing.test.ts +0 -33
- package/client/utils/assistant-typing.ts +0 -53
- package/client/utils/attachment-policy.ts +0 -106
- package/client/utils/composer-frame.ts +0 -77
- package/client/utils/document-text.ts +0 -332
- package/client/utils/entry-hash.ts +0 -35
- package/client/utils/entry-proposal.ts +0 -215
- package/client/utils/entry-workspace.ts +0 -70
- package/client/utils/invite-proposal-register.ts +0 -31
- package/client/utils/invite-proposal.test.ts +0 -40
- package/client/utils/invite-proposal.ts +0 -54
- package/client/utils/menu-room.ts +0 -33
- package/client/utils/open-page.ts +0 -21
- package/client/utils/pasted-table.ts +0 -145
- package/client/utils/pdf-pages.ts +0 -25
- package/client/utils/spreadsheet-text.ts +0 -125
- package/client/utils/workspace.ts +0 -89
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/components/assistant-chat.js.map +0 -1
- package/dist-client/components/assistant-chat.test.d.ts +0 -1
- package/dist-client/components/assistant-chat.test.js +0 -138
- package/dist-client/components/assistant-chat.test.js.map +0 -1
- package/dist-client/components/assistant-dock.js.map +0 -1
- package/dist-client/components/assistant-invite.js.map +0 -1
- package/dist-client/components/assistant-mode.js.map +0 -1
- package/dist-client/components/assistant-mode.test.d.ts +0 -1
- package/dist-client/components/assistant-mode.test.js +0 -100
- package/dist-client/components/assistant-mode.test.js.map +0 -1
- package/dist-client/components/assistant-selection-bar.js.map +0 -1
- package/dist-client/components/assistant-selection-bar.test.d.ts +0 -1
- package/dist-client/components/assistant-selection-bar.test.js +0 -148
- package/dist-client/components/assistant-selection-bar.test.js.map +0 -1
- package/dist-client/components/assistant-session-manager.js.map +0 -1
- package/dist-client/components/assistant-session-toolbar.js.map +0 -1
- package/dist-client/components/chat-defaults.js.map +0 -1
- package/dist-client/components/chat-echo-dedup.js.map +0 -1
- package/dist-client/components/chat-echo-dedup.test.d.ts +0 -1
- package/dist-client/components/chat-echo-dedup.test.js +0 -223
- package/dist-client/components/chat-echo-dedup.test.js.map +0 -1
- package/dist-client/components/chat-input-builder.js.map +0 -1
- package/dist-client/components/chat-input-builder.test.d.ts +0 -1
- package/dist-client/components/chat-input-builder.test.js +0 -70
- package/dist-client/components/chat-input-builder.test.js.map +0 -1
- package/dist-client/components/chat-proposal-survival.test.d.ts +0 -1
- package/dist-client/components/chat-proposal-survival.test.js +0 -61
- package/dist-client/components/chat-proposal-survival.test.js.map +0 -1
- package/dist-client/components/entry-review.js.map +0 -1
- package/dist-client/components/markdown.js.map +0 -1
- package/dist-client/components/markdown.test.d.ts +0 -1
- package/dist-client/components/markdown.test.js +0 -418
- package/dist-client/components/markdown.test.js.map +0 -1
- package/dist-client/components/mention-popup-helpers.js.map +0 -1
- package/dist-client/components/mention-popup.js.map +0 -1
- package/dist-client/components/mention-popup.test.d.ts +0 -1
- package/dist-client/components/mention-popup.test.js +0 -474
- package/dist-client/components/mention-popup.test.js.map +0 -1
- package/dist-client/components/panel-aria.test.d.ts +0 -1
- package/dist-client/components/panel-aria.test.js +0 -53
- package/dist-client/components/panel-aria.test.js.map +0 -1
- package/dist-client/components/proposal-outcome-line.js.map +0 -1
- package/dist-client/components/proposal-request.test.d.ts +0 -1
- package/dist-client/components/proposal-request.test.js +0 -63
- package/dist-client/components/proposal-request.test.js.map +0 -1
- package/dist-client/components/reply-message.js.map +0 -1
- package/dist-client/components/reply-message.test.d.ts +0 -1
- package/dist-client/components/reply-message.test.js +0 -16
- package/dist-client/components/reply-message.test.js.map +0 -1
- package/dist-client/components/roster-identity.js.map +0 -1
- package/dist-client/components/roster-identity.test.d.ts +0 -1
- package/dist-client/components/roster-identity.test.js +0 -9
- package/dist-client/components/roster-identity.test.js.map +0 -1
- package/dist-client/components/workspace-view.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/pages/assistant-workspace-page.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/settings/agent-settings-model.js.map +0 -1
- package/dist-client/settings/ai-agent-setting-let.js.map +0 -1
- package/dist-client/settings/ai-usage-setting-let.d.ts +0 -25
- package/dist-client/settings/ai-usage-setting-let.js +0 -258
- package/dist-client/settings/ai-usage-setting-let.js.map +0 -1
- package/dist-client/settings/usage-model.d.ts +0 -32
- package/dist-client/settings/usage-model.js +0 -25
- package/dist-client/settings/usage-model.js.map +0 -1
- package/dist-client/setup-assistant-dock.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/utils/addressed-draft.test.d.ts +0 -1
- package/dist-client/utils/addressed-draft.test.js +0 -27
- package/dist-client/utils/addressed-draft.test.js.map +0 -1
- package/dist-client/utils/agent-choice.js.map +0 -1
- package/dist-client/utils/applied-screens.js.map +0 -1
- package/dist-client/utils/assistant-activity.js.map +0 -1
- package/dist-client/utils/assistant-ask.js.map +0 -1
- package/dist-client/utils/assistant-ask.test.d.ts +0 -1
- package/dist-client/utils/assistant-ask.test.js +0 -40
- package/dist-client/utils/assistant-ask.test.js.map +0 -1
- package/dist-client/utils/assistant-capability-read.js.map +0 -1
- package/dist-client/utils/assistant-capability.js.map +0 -1
- package/dist-client/utils/assistant-capability.test.d.ts +0 -1
- package/dist-client/utils/assistant-capability.test.js +0 -16
- package/dist-client/utils/assistant-capability.test.js.map +0 -1
- package/dist-client/utils/assistant-navigation.js.map +0 -1
- package/dist-client/utils/assistant-navigation.test.d.ts +0 -1
- package/dist-client/utils/assistant-navigation.test.js +0 -63
- package/dist-client/utils/assistant-navigation.test.js.map +0 -1
- package/dist-client/utils/assistant-proposals.js.map +0 -1
- package/dist-client/utils/assistant-request-context.js.map +0 -1
- package/dist-client/utils/assistant-selection.js.map +0 -1
- package/dist-client/utils/assistant-selection.test.d.ts +0 -1
- package/dist-client/utils/assistant-selection.test.js +0 -46
- package/dist-client/utils/assistant-selection.test.js.map +0 -1
- package/dist-client/utils/assistant-session-actions.js.map +0 -1
- package/dist-client/utils/assistant-session-admin.js.map +0 -1
- package/dist-client/utils/assistant-session-controller.js.map +0 -1
- package/dist-client/utils/assistant-session-controller.test.d.ts +0 -1
- package/dist-client/utils/assistant-session-controller.test.js +0 -56
- package/dist-client/utils/assistant-session-controller.test.js.map +0 -1
- package/dist-client/utils/assistant-session-transport.js.map +0 -1
- package/dist-client/utils/assistant-surface.js.map +0 -1
- package/dist-client/utils/assistant-typing.js.map +0 -1
- package/dist-client/utils/assistant-typing.test.d.ts +0 -1
- package/dist-client/utils/assistant-typing.test.js +0 -30
- package/dist-client/utils/assistant-typing.test.js.map +0 -1
- package/dist-client/utils/attachment-policy.js.map +0 -1
- package/dist-client/utils/composer-frame.js.map +0 -1
- package/dist-client/utils/document-text.js.map +0 -1
- package/dist-client/utils/entry-hash.js.map +0 -1
- package/dist-client/utils/entry-proposal.js.map +0 -1
- package/dist-client/utils/entry-workspace.js.map +0 -1
- package/dist-client/utils/invite-proposal-register.js.map +0 -1
- package/dist-client/utils/invite-proposal.js.map +0 -1
- package/dist-client/utils/invite-proposal.test.d.ts +0 -1
- package/dist-client/utils/invite-proposal.test.js +0 -35
- package/dist-client/utils/invite-proposal.test.js.map +0 -1
- package/dist-client/utils/menu-room.js.map +0 -1
- package/dist-client/utils/open-page.js.map +0 -1
- package/dist-client/utils/pasted-table.js.map +0 -1
- package/dist-client/utils/pdf-pages.js.map +0 -1
- package/dist-client/utils/spreadsheet-text.js.map +0 -1
- package/dist-client/utils/workspace.js.map +0 -1
- package/dist-server/door-declaration-report.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/service/ai-agent-resolver.js.map +0 -1
- package/dist-server/service/assistant-capability-resolver.js.map +0 -1
- package/dist-server/service/assistant-chat-resolver.js.map +0 -1
- package/dist-server/service/assistant-mode/assistant-mode-resolver.js.map +0 -1
- package/dist-server/service/assistant-mode/fallback-subjects.js.map +0 -1
- package/dist-server/service/assistant-mode/index.js.map +0 -1
- package/dist-server/service/assistant-mode/mode-categories.js.map +0 -1
- package/dist-server/service/assistant-mode/record-subject.js.map +0 -1
- package/dist-server/service/assistant-mode/registry.js.map +0 -1
- package/dist-server/service/assistant-mode/resolve.js.map +0 -1
- package/dist-server/service/assistant-mode/screen-rules.js.map +0 -1
- package/dist-server/service/assistant-mode/turn-lines.js.map +0 -1
- package/dist-server/service/assistant-mode/types.js.map +0 -1
- package/dist-server/service/chat-message/carried-turns.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-broadcast.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-publish.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-room.js.map +0 -1
- package/dist-server/service/chat-message/chat-message-subscription.js.map +0 -1
- package/dist-server/service/chat-message/chat-message.js.map +0 -1
- package/dist-server/service/chat-message/chat-typing-subscription.js.map +0 -1
- package/dist-server/service/chat-message/chat-typing.js.map +0 -1
- package/dist-server/service/chat-message/door-access.js.map +0 -1
- package/dist-server/service/chat-message/fold-history.js.map +0 -1
- package/dist-server/service/chat-message/fold-session-history.js.map +0 -1
- package/dist-server/service/chat-message/history-summary.js.map +0 -1
- package/dist-server/service/chat-message/index.js.map +0 -1
- package/dist-server/service/chat-message/llm-history.js.map +0 -1
- package/dist-server/service/chat-message/message-doors.js.map +0 -1
- package/dist-server/service/chat-message/proposal-outcome.js.map +0 -1
- package/dist-server/service/chat-message/reader-gate.js.map +0 -1
- package/dist-server/service/chat-message/room-message.js.map +0 -1
- package/dist-server/service/chat-message/room-turn.js.map +0 -1
- package/dist-server/service/chat-message/used-tools.js.map +0 -1
- package/dist-server/service/chat-session/attachment-policy.js.map +0 -1
- package/dist-server/service/chat-session/attachment-route.js.map +0 -1
- package/dist-server/service/chat-session/attachment-tool-result.js.map +0 -1
- package/dist-server/service/chat-session/attachment-tools.js.map +0 -1
- package/dist-server/service/chat-session/chat-session.js.map +0 -1
- package/dist-server/service/chat-session/index.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-broadcast.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-publish.js.map +0 -1
- package/dist-server/service/chat-session/session-activity-subscription.js.map +0 -1
- package/dist-server/service/chat-session/session-anchor.js.map +0 -1
- package/dist-server/service/chat-session/session-attachments.js.map +0 -1
- package/dist-server/service/chat-session/session-cleanup.js.map +0 -1
- package/dist-server/service/chat-session/session-inbox.js.map +0 -1
- package/dist-server/service/chat-session/session-kind.js.map +0 -1
- package/dist-server/service/chat-session/session-name.js.map +0 -1
- package/dist-server/service/chat-session/session-purge.js.map +0 -1
- package/dist-server/service/chat-session/session-retention.js.map +0 -1
- package/dist-server/service/chat-session/session-visibility.js.map +0 -1
- package/dist-server/service/chat-session/session-write-gate.js.map +0 -1
- package/dist-server/service/chat-session/station-session-guard.js.map +0 -1
- package/dist-server/service/chat-session/turn-attachments.js.map +0 -1
- package/dist-server/service/chat-session-participant/chat-session-participant.js.map +0 -1
- package/dist-server/service/chat-session-participant/index.js.map +0 -1
- package/dist-server/service/chat-session-participant/invite-notification.js.map +0 -1
- package/dist-server/service/chat-session-participant/mention-invite.js.map +0 -1
- package/dist-server/service/chat-session-participant/participant-lookup-roles.js.map +0 -1
- package/dist-server/service/chat-session-participant/participant-lookup.js.map +0 -1
- package/dist-server/service/chat-session-participant/presence.js.map +0 -1
- package/dist-server/service/chat-session-participant/read-roster.js.map +0 -1
- package/dist-server/service/chat-session-resolver.js.map +0 -1
- package/dist-server/service/data-entry/entry-apply.js.map +0 -1
- package/dist-server/service/data-entry/entry-hash.js.map +0 -1
- package/dist-server/service/data-entry/entry-refusal.js.map +0 -1
- package/dist-server/service/data-entry/entry-resolver.js.map +0 -1
- package/dist-server/service/data-entry/entry-screen.js.map +0 -1
- package/dist-server/service/data-entry/entry-sources.js.map +0 -1
- package/dist-server/service/data-entry/entry-target.js.map +0 -1
- package/dist-server/service/data-entry/entry-tools.js.map +0 -1
- package/dist-server/service/data-entry/entry-update.js.map +0 -1
- package/dist-server/service/data-read/list-read.js.map +0 -1
- package/dist-server/service/data-read/read-target.js.map +0 -1
- package/dist-server/service/data-read/read-tools.js.map +0 -1
- package/dist-server/service/grounding-sources.js.map +0 -1
- package/dist-server/service/help-documents/help-keys.js.map +0 -1
- package/dist-server/service/help-documents/help-tools.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/service/people/index.js.map +0 -1
- package/dist-server/service/people/invite-tools.js.map +0 -1
- package/dist-server/service/people/people-keys.js.map +0 -1
- package/dist-server/service/people/people-read.js.map +0 -1
- package/dist-server/service/people/person-subject.js.map +0 -1
- package/dist-server/service/request-translator.js.map +0 -1
- package/dist-server/service/testing/conversation-script.js.map +0 -1
- package/dist-server/service/testing/mode-conformance.js.map +0 -1
- package/dist-server/service/tool-access.js.map +0 -1
- package/dist-server/service/types.js.map +0 -1
- package/dist-server/service/unattended-run/assistant-run.js.map +0 -1
- package/dist-server/service/unattended-run/index.js.map +0 -1
- package/dist-server/service/unattended-run/limits.js.map +0 -1
- package/dist-server/service/unattended-run/run-as.js.map +0 -1
- package/dist-server/service/unattended-run/run-budget.js.map +0 -1
- package/dist-server/service/unattended-run/run-ledger.js.map +0 -1
- package/dist-server/service/unattended-run/run-outcome.js.map +0 -1
- package/dist-server/service/unattended-run/run-store.js.map +0 -1
- package/dist-server/service/unattended-run/run-unattended.js.map +0 -1
- package/dist-server/service/unattended-run/unattended-prompt.js.map +0 -1
- package/dist-server/service/workspace/workspace-blocks.js.map +0 -1
- package/dist-server/service/workspace/workspace-tools.js.map +0 -1
- package/dist-server/tool-registry-boot-report.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/docs/session-controller.md +0 -52
- package/server/door-declaration-report.test.ts +0 -53
- package/server/door-declaration-report.ts +0 -61
- package/server/explicit-graphql-types.test.ts +0 -56
- package/server/index.ts +0 -36
- package/server/role-tasks.ts +0 -14
- package/server/service/ai-agent-resolver.ts +0 -330
- package/server/service/assistant-capability-resolver.ts +0 -66
- package/server/service/assistant-chat-resolver.ts +0 -640
- package/server/service/assistant-mode/assistant-mode-resolver.ts +0 -101
- package/server/service/assistant-mode/conversation-category.test.ts +0 -48
- package/server/service/assistant-mode/fallback-subjects.ts +0 -36
- package/server/service/assistant-mode/index.ts +0 -22
- package/server/service/assistant-mode/mode-categories.ts +0 -178
- package/server/service/assistant-mode/mode-front.test.ts +0 -183
- package/server/service/assistant-mode/one-conversation-per-subject.test.ts +0 -37
- package/server/service/assistant-mode/open-subject-door.test.ts +0 -52
- package/server/service/assistant-mode/record-subject.test.ts +0 -41
- package/server/service/assistant-mode/record-subject.ts +0 -44
- package/server/service/assistant-mode/registry.test.ts +0 -171
- package/server/service/assistant-mode/registry.ts +0 -139
- package/server/service/assistant-mode/resolve.test.ts +0 -129
- package/server/service/assistant-mode/resolve.ts +0 -113
- package/server/service/assistant-mode/screen-rules.test.ts +0 -99
- package/server/service/assistant-mode/screen-rules.ts +0 -103
- package/server/service/assistant-mode/turn-lines.ts +0 -43
- package/server/service/assistant-mode/types.ts +0 -138
- package/server/service/chat-message/carried-turns.test.ts +0 -80
- package/server/service/chat-message/carried-turns.ts +0 -112
- package/server/service/chat-message/chat-message-broadcast.integration.test.ts +0 -73
- package/server/service/chat-message/chat-message-broadcast.test.ts +0 -40
- package/server/service/chat-message/chat-message-broadcast.ts +0 -70
- package/server/service/chat-message/chat-message-publish.ts +0 -22
- package/server/service/chat-message/chat-message-room.test.ts +0 -145
- package/server/service/chat-message/chat-message-room.ts +0 -50
- package/server/service/chat-message/chat-message-subscription.ts +0 -77
- package/server/service/chat-message/chat-message.ts +0 -289
- package/server/service/chat-message/chat-typing-subscription.ts +0 -52
- package/server/service/chat-message/chat-typing.test.ts +0 -45
- package/server/service/chat-message/chat-typing.ts +0 -48
- package/server/service/chat-message/door-access.test.ts +0 -72
- package/server/service/chat-message/door-access.ts +0 -65
- package/server/service/chat-message/fold-history-window.test.ts +0 -184
- package/server/service/chat-message/fold-history.test.ts +0 -98
- package/server/service/chat-message/fold-history.ts +0 -77
- package/server/service/chat-message/fold-session-history.test.ts +0 -116
- package/server/service/chat-message/fold-session-history.ts +0 -115
- package/server/service/chat-message/history-summary.test.ts +0 -127
- package/server/service/chat-message/history-summary.ts +0 -100
- package/server/service/chat-message/index.ts +0 -13
- package/server/service/chat-message/llm-history.test.ts +0 -245
- package/server/service/chat-message/llm-history.ts +0 -182
- package/server/service/chat-message/message-doors.test.ts +0 -124
- package/server/service/chat-message/message-doors.ts +0 -132
- package/server/service/chat-message/proposal-outcome.test.ts +0 -111
- package/server/service/chat-message/proposal-outcome.ts +0 -99
- package/server/service/chat-message/reader-gate.ts +0 -44
- package/server/service/chat-message/room-message.test.ts +0 -21
- package/server/service/chat-message/room-message.ts +0 -22
- package/server/service/chat-message/room-turn.ts +0 -42
- package/server/service/chat-message/used-tools.test.ts +0 -19
- package/server/service/chat-message/used-tools.ts +0 -25
- package/server/service/chat-session/attachment-policy.test.ts +0 -42
- package/server/service/chat-session/attachment-policy.ts +0 -91
- package/server/service/chat-session/attachment-route.ts +0 -45
- package/server/service/chat-session/attachment-tool-result.test.ts +0 -63
- package/server/service/chat-session/attachment-tool-result.ts +0 -37
- package/server/service/chat-session/attachment-tools.ts +0 -66
- package/server/service/chat-session/chat-session.ts +0 -244
- package/server/service/chat-session/group-room.test.ts +0 -233
- package/server/service/chat-session/index.ts +0 -5
- package/server/service/chat-session/session-activity-broadcast.ts +0 -77
- package/server/service/chat-session/session-activity-publish.ts +0 -49
- package/server/service/chat-session/session-activity-receivers.test.ts +0 -26
- package/server/service/chat-session/session-activity-subscription.ts +0 -66
- package/server/service/chat-session/session-anchor.ts +0 -142
- package/server/service/chat-session/session-attachments.ts +0 -90
- package/server/service/chat-session/session-cleanup.test.ts +0 -83
- package/server/service/chat-session/session-cleanup.ts +0 -69
- package/server/service/chat-session/session-inbox.test.ts +0 -273
- package/server/service/chat-session/session-inbox.ts +0 -240
- package/server/service/chat-session/session-kind.test.ts +0 -24
- package/server/service/chat-session/session-kind.ts +0 -32
- package/server/service/chat-session/session-name.ts +0 -32
- package/server/service/chat-session/session-purge.test.ts +0 -24
- package/server/service/chat-session/session-purge.ts +0 -117
- package/server/service/chat-session/session-retention.ts +0 -17
- package/server/service/chat-session/session-visibility.test.ts +0 -130
- package/server/service/chat-session/session-visibility.ts +0 -68
- package/server/service/chat-session/session-write-gate.test.ts +0 -59
- package/server/service/chat-session/session-write-gate.ts +0 -31
- package/server/service/chat-session/station-session-guard.ts +0 -25
- package/server/service/chat-session/turn-attachments.test.ts +0 -106
- package/server/service/chat-session/turn-attachments.ts +0 -45
- package/server/service/chat-session-participant/chat-session-participant.ts +0 -135
- package/server/service/chat-session-participant/index.ts +0 -8
- package/server/service/chat-session-participant/invite-notification.test.ts +0 -80
- package/server/service/chat-session-participant/invite-notification.ts +0 -118
- package/server/service/chat-session-participant/mention-invite.test.ts +0 -173
- package/server/service/chat-session-participant/mention-invite.ts +0 -180
- package/server/service/chat-session-participant/participant-lookup-roles.ts +0 -6
- package/server/service/chat-session-participant/participant-lookup.ts +0 -22
- package/server/service/chat-session-participant/presence.test.ts +0 -39
- package/server/service/chat-session-participant/presence.ts +0 -21
- package/server/service/chat-session-participant/read-roster.test.ts +0 -27
- package/server/service/chat-session-participant/read-roster.ts +0 -17
- package/server/service/chat-session-resolver.ts +0 -1455
- package/server/service/data-entry/data-entry-update.test.ts +0 -378
- package/server/service/data-entry/data-entry.test.ts +0 -494
- package/server/service/data-entry/entry-apply.ts +0 -247
- package/server/service/data-entry/entry-hash.ts +0 -35
- package/server/service/data-entry/entry-refusal.test.ts +0 -73
- package/server/service/data-entry/entry-refusal.ts +0 -20
- package/server/service/data-entry/entry-resolver.ts +0 -74
- package/server/service/data-entry/entry-screen.ts +0 -14
- package/server/service/data-entry/entry-sources.ts +0 -39
- package/server/service/data-entry/entry-target.ts +0 -774
- package/server/service/data-entry/entry-tools.ts +0 -282
- package/server/service/data-entry/entry-update.ts +0 -238
- package/server/service/data-read/data-read.test.ts +0 -395
- package/server/service/data-read/detail-lists.test.ts +0 -61
- package/server/service/data-read/list-missing.test.ts +0 -49
- package/server/service/data-read/list-read.ts +0 -146
- package/server/service/data-read/list-status.test.ts +0 -46
- package/server/service/data-read/read-target.ts +0 -509
- package/server/service/data-read/read-tools.ts +0 -334
- package/server/service/data-read/read-words.test.ts +0 -99
- package/server/service/data-read/record-keys.test.ts +0 -42
- package/server/service/grounding-sources.test.ts +0 -55
- package/server/service/grounding-sources.ts +0 -46
- package/server/service/help-documents/help-keys.ts +0 -2
- package/server/service/help-documents/help-tools.test.ts +0 -40
- package/server/service/help-documents/help-tools.ts +0 -88
- package/server/service/index.ts +0 -99
- package/server/service/people/index.ts +0 -15
- package/server/service/people/invite-tools.ts +0 -159
- package/server/service/people/invite.test.ts +0 -159
- package/server/service/people/people-keys.ts +0 -16
- package/server/service/people/people-read.test.ts +0 -82
- package/server/service/people/people-read.ts +0 -56
- package/server/service/people/person-subject.test.ts +0 -161
- package/server/service/people/person-subject.ts +0 -83
- package/server/service/request-translator.test.ts +0 -45
- package/server/service/request-translator.ts +0 -33
- package/server/service/session-anchor.test.ts +0 -198
- package/server/service/station-session-guard.test.ts +0 -31
- package/server/service/testing/conversation-scenario.test.ts +0 -164
- package/server/service/testing/conversation-script.test.ts +0 -133
- package/server/service/testing/conversation-script.ts +0 -296
- package/server/service/testing/mode-conformance.test.ts +0 -61
- package/server/service/testing/mode-conformance.ts +0 -165
- package/server/service/tool-access.test.ts +0 -96
- package/server/service/tool-access.ts +0 -36
- package/server/service/types.ts +0 -15
- package/server/service/unattended-run/assistant-run.ts +0 -199
- package/server/service/unattended-run/index.ts +0 -10
- package/server/service/unattended-run/limits.ts +0 -24
- package/server/service/unattended-run/run-as.ts +0 -38
- package/server/service/unattended-run/run-budget.ts +0 -58
- package/server/service/unattended-run/run-ledger.ts +0 -31
- package/server/service/unattended-run/run-outcome.ts +0 -43
- package/server/service/unattended-run/run-store-race.pg.test.ts +0 -83
- package/server/service/unattended-run/run-store.ts +0 -162
- package/server/service/unattended-run/run-unattended.test.ts +0 -478
- package/server/service/unattended-run/run-unattended.ts +0 -248
- package/server/service/unattended-run/unattended-prompt.ts +0 -24
- package/server/service/workspace/workspace-blocks.ts +0 -134
- package/server/service/workspace/workspace-tools.ts +0 -108
- package/server/service/workspace/workspace.test.ts +0 -74
- package/server/tool-registry-boot-report.test.ts +0 -41
- package/server/tool-registry-boot-report.ts +0 -63
- package/test/ai-agent-settings.test.ts +0 -123
- package/test/applied-screens.test.ts +0 -65
- package/test/assistant-chat-call-sites.test.ts +0 -92
- package/test/assistant-dock.test.ts +0 -294
- package/test/assistant-request-context.test.ts +0 -72
- package/test/assistant-session-controller.test.ts +0 -87
- package/test/assistant-session-manager.test.ts +0 -186
- package/test/assistant-session-toolbar.test.ts +0 -43
- package/test/attachment-one-rule.test.ts +0 -46
- package/test/attachment-policy-agree.test.ts +0 -38
- package/test/composer-frame.test.ts +0 -173
- package/test/document-text.test.ts +0 -175
- package/test/entry-card-styles.test.ts +0 -18
- package/test/entry-proposal.test.ts +0 -186
- package/test/entry-workspace.test.ts +0 -89
- package/test/menu-room.test.ts +0 -33
- package/test/open-doors.test.ts +0 -164
- package/test/open-page.test.ts +0 -31
- package/test/pasted-table.test.ts +0 -147
- package/test/refusals-in-korean.test.ts +0 -80
- package/test/session-discovery.test.ts +0 -43
- package/test/spreadsheet-text.test.ts +0 -92
- package/test/translations.test.ts +0 -80
- package/test/workspace.test.ts +0 -54
- package/tsconfig.json +0 -9
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Pressing an invite card seats the person through the invite door, as the one who pressed (ADR-0073 decision 3).
|
|
3
|
-
* The card is ai-assistant's own tool (server: people/invite-tools.ts), so its handler is registered here, by the
|
|
4
|
-
* package that declared it - the dock knows no proposal kind (design/ai/shared-dock.md §4).
|
|
5
|
-
*/
|
|
6
|
-
import gql from 'graphql-tag'
|
|
7
|
-
|
|
8
|
-
import { i18next } from '@operato/i18n'
|
|
9
|
-
import { client } from '@operato/graphql'
|
|
10
|
-
|
|
11
|
-
import { registerProposalHandler } from './assistant-proposals.js'
|
|
12
|
-
import { inviteProposalHandler } from './invite-proposal.js'
|
|
13
|
-
|
|
14
|
-
registerProposalHandler(
|
|
15
|
-
'proposeInvite',
|
|
16
|
-
inviteProposalHandler(
|
|
17
|
-
async (sessionId, userIds) => {
|
|
18
|
-
const result = await client.mutate({
|
|
19
|
-
mutation: gql`
|
|
20
|
-
mutation ($id: String!, $users: [String!]!) {
|
|
21
|
-
inviteToAISession(sessionId: $id, userIds: $users)
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
variables: { id: sessionId, users: userIds }
|
|
25
|
-
})
|
|
26
|
-
if (result.errors?.length) throw new Error(result.errors[0].message)
|
|
27
|
-
return result.data?.inviteToAISession ?? []
|
|
28
|
-
},
|
|
29
|
-
(key, options) => String(i18next.t(key, options))
|
|
30
|
-
)
|
|
31
|
-
)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { inviteProposalHandler, invitedBy, isInviteProposal } from './invite-proposal'
|
|
2
|
-
|
|
3
|
-
const card = (people: any[], extra: any = {}) => ({ tool: 'proposeInvite', kind: 'invite', people, ...extra })
|
|
4
|
-
const kim = { userId: 'u-1', name: '정연희', department: 'Sales' }
|
|
5
|
-
const lee = { userId: 'u-2', name: '정연희', department: 'Finance' }
|
|
6
|
-
const t = (_key: string, options: any) => String(options.defaultValue).replace('{names}', options.names)
|
|
7
|
-
const context = (sessionId?: string) => ({ sessionId, confirm: async () => true, notify: () => {} }) as any
|
|
8
|
-
|
|
9
|
-
describe('the invite card', () => {
|
|
10
|
-
it('is the invite tool\'s card with someone on it', () => {
|
|
11
|
-
expect(isInviteProposal(card([kim]))).toBe(true)
|
|
12
|
-
expect(isInviteProposal(card([]))).toBe(false)
|
|
13
|
-
expect(isInviteProposal({ ...card([kim]), tool: 'proposeAction' })).toBe(false)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('★ one person: pressing invites them; several: only the one picked - nothing is guessed', () => {
|
|
17
|
-
expect(invitedBy(card([kim]))).toEqual([kim])
|
|
18
|
-
expect(invitedBy(card([kim, lee]))).toEqual([])
|
|
19
|
-
expect(invitedBy(card([kim, lee], { chosen: 'u-2' }))).toEqual([lee])
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('★ pressing calls the invite door with the conversation and the person picked', async () => {
|
|
23
|
-
const calls: any[] = []
|
|
24
|
-
const handler = inviteProposalHandler(async (sessionId, userIds) => (calls.push([sessionId, userIds]), userIds), t)
|
|
25
|
-
expect(await handler(card([kim, lee], { chosen: 'u-2' }), context('s1'))).toMatchObject({ verdict: 'accepted', applied: 1, note: '정연희 joined this conversation and was told.' })
|
|
26
|
-
expect(calls).toEqual([['s1', ['u-2']]])
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('no pick, no conversation, or nobody seated - said, never accepted', async () => {
|
|
30
|
-
const handler = inviteProposalHandler(async (_s, userIds) => userIds, t)
|
|
31
|
-
expect(await handler(card([kim, lee]), context('s1'))).toEqual({ verdict: 'refused', errorCode: 'no-person-chosen' })
|
|
32
|
-
expect(await handler(card([kim]), context())).toEqual({ verdict: 'unavailable', errorCode: 'no-conversation' })
|
|
33
|
-
expect(await inviteProposalHandler(async () => [], t)(card([kim]), context('s1'))).toEqual({ verdict: 'refused', errorCode: 'already-here' })
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it("the door's refusal is not swallowed - it is thrown to the dock, which reports it", async () => {
|
|
37
|
-
const handler = inviteProposalHandler(async () => { throw new Error('only the person who started this group conversation can bring people in.') }, t)
|
|
38
|
-
await expect(handler(card([kim]), context('s1'))).rejects.toThrow(/only the person who started/)
|
|
39
|
-
})
|
|
40
|
-
})
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The invite card (server: people/invite-tools.ts) - who it offers, and what pressing it does.
|
|
3
|
-
*
|
|
4
|
-
* Pressing is the person's act: the dock calls `inviteToAISession` with their own request, and the door decides
|
|
5
|
-
* whether they may seat anyone here (`maySeat`). The model's card seats nobody by itself. A card with several people
|
|
6
|
-
* of one name is pressed on one of them - the press carries `chosen`; nothing is guessed.
|
|
7
|
-
*/
|
|
8
|
-
import type { ProposalHandler } from './assistant-proposals.js'
|
|
9
|
-
|
|
10
|
-
export interface InvitePerson {
|
|
11
|
-
userId: string
|
|
12
|
-
name: string
|
|
13
|
-
department?: string
|
|
14
|
-
position?: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function isInviteProposal(proposal: any): boolean {
|
|
18
|
-
return proposal?.kind === 'invite' && proposal?.tool === 'proposeInvite' && Array.isArray(proposal?.people) && proposal.people.length > 0
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** The people a press brings in: the one picked, or the only one on the card. */
|
|
22
|
-
export function invitedBy(proposal: any): InvitePerson[] {
|
|
23
|
-
const people: InvitePerson[] = Array.isArray(proposal?.people) ? proposal.people.filter((one: any) => one?.userId) : []
|
|
24
|
-
if (proposal?.chosen) return people.filter(one => one.userId === proposal.chosen)
|
|
25
|
-
return people.length === 1 ? people : []
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** One line under a person's name - where they work. */
|
|
29
|
-
export function personLine(person: InvitePerson): string {
|
|
30
|
-
return [person.department, person.position].filter(Boolean).join(' · ')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Presses the card through the invite door. `invite` is the door - `inviteToAISession(sessionId, userIds)`, answering the
|
|
35
|
-
* ids seated now; it throws the door's refusal, which the dock reports as `refused` with that message.
|
|
36
|
-
*/
|
|
37
|
-
export function inviteProposalHandler(
|
|
38
|
-
invite: (sessionId: string, userIds: string[]) => Promise<string[]>,
|
|
39
|
-
t: (key: string, options: Record<string, unknown>) => string
|
|
40
|
-
): ProposalHandler {
|
|
41
|
-
return async (proposal, context) => {
|
|
42
|
-
const people = invitedBy(proposal)
|
|
43
|
-
if (!people.length) return { verdict: 'refused', errorCode: 'no-person-chosen' }
|
|
44
|
-
if (!context.sessionId) return { verdict: 'unavailable', errorCode: 'no-conversation' }
|
|
45
|
-
const seated = await invite(context.sessionId, people.map(one => one.userId))
|
|
46
|
-
if (!seated.length) return { verdict: 'refused', errorCode: 'already-here' }
|
|
47
|
-
const names = people.filter(one => seated.includes(one.userId)).map(one => one.name).join(', ')
|
|
48
|
-
return {
|
|
49
|
-
verdict: 'accepted',
|
|
50
|
-
applied: seated.length,
|
|
51
|
-
note: t('ai-assistant.people.invited', { names, defaultValue: '{names} joined this conversation and was told.' })
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The page's menu gives the dock its room (2026-10-12). When the dock opens beside the page, the left menu folds to its
|
|
3
|
-
* icons; when the dock closes, the menu opens again - only if it is still folded the way the dock left it. A menu the
|
|
4
|
-
* person folded themselves stays folded, and the dock's fold is never saved as the person's choice: it sets the menu's
|
|
5
|
-
* state without the menu's own `setCollapsed`, which stores it.
|
|
6
|
-
*/
|
|
7
|
-
export interface MenuLike {
|
|
8
|
-
collapsed: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function foldForDock(menu: MenuLike | undefined): boolean {
|
|
12
|
-
if (!menu || menu.collapsed) return false
|
|
13
|
-
menu.collapsed = true
|
|
14
|
-
return true
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function unfoldAfterDock(menu: MenuLike | undefined, foldedByDock: boolean): void {
|
|
18
|
-
if (!menu || !foldedByDock || !menu.collapsed) return
|
|
19
|
-
menu.collapsed = false
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** The framework's menu (`ox-menu-part` of @operato/menu), wherever the layout put it. */
|
|
23
|
-
export function findMenu(root: Document | ShadowRoot = document): (HTMLElement & MenuLike) | undefined {
|
|
24
|
-
const found = root.querySelector('ox-menu-part') as (HTMLElement & MenuLike) | null
|
|
25
|
-
if (found) return found
|
|
26
|
-
for (const element of root.querySelectorAll('*')) {
|
|
27
|
-
if (element.shadowRoot) {
|
|
28
|
-
const inner = findMenu(element.shadowRoot)
|
|
29
|
-
if (inner) return inner
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return undefined
|
|
33
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The card that opens an application's list screen with the conditions of a question (design/ai/read-targets.md §5).
|
|
3
|
-
* It reads nothing and runs nothing - the person presses it and the page opens beside the dock.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** An address inside the application - never another origin, never a script. */
|
|
7
|
-
export function isAppAddress(href: unknown): href is string {
|
|
8
|
-
return typeof href === 'string' && !!href.trim() && !/^[a-z][a-z0-9+.-]*:/i.test(href.trim()) && !href.trim().startsWith('//')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function isOpenPageProposal(proposal: any): boolean {
|
|
12
|
-
return proposal?.kind === 'open-page' && isAppAddress(proposal?.href)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** The line under the card's title - the conditions the screen does not take, said, never dropped quietly. */
|
|
16
|
-
export function openPageNote(proposal: any, t: (key: string, options?: any) => string): string {
|
|
17
|
-
const missing: string[] = Array.isArray(proposal?.notAppliedLabels) ? proposal.notAppliedLabels : []
|
|
18
|
-
return missing.length
|
|
19
|
-
? t('ai-assistant.screen.not-applied', { defaultValue: 'the screen does not take: {conditions}', conditions: missing.join(', ') })
|
|
20
|
-
: ''
|
|
21
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A table pasted into the composer, carried as a file (design/ai/data-entry.md §4-1, design/ai/shared-dock.md §9-5).
|
|
3
|
-
*
|
|
4
|
-
* Rows copied from a spreadsheet or a web page are what an AI 입력 is made from most often. Pasted as words they
|
|
5
|
-
* reach the model as something the person said, and the entry card cannot check a row against them nor read a
|
|
6
|
-
* printed total. Carried as a CSV file they are a source like an attached sheet: each row is found on its line.
|
|
7
|
-
*
|
|
8
|
-
* - The HTML of the clipboard is read first when it holds a table - a spreadsheet and a browser both put one there,
|
|
9
|
-
* and it keeps a cell that holds a line break or a tab whole. A web page whose words lie mostly outside the table
|
|
10
|
-
* is not a table paste; it is left as words.
|
|
11
|
-
* - Otherwise the plain text is a table when its lines are tab-separated (a spreadsheet's own text).
|
|
12
|
-
* - The file has the shape of a read sheet: a line naming it, then every row led by its own number.
|
|
13
|
-
* - The limit is on the text, as for a sheet - a table over it is refused, never cut.
|
|
14
|
-
*
|
|
15
|
-
* Pure: the screen hands in the clipboard's strings.
|
|
16
|
-
*/
|
|
17
|
-
import { textCharsOf, type AttachmentPolicy } from './attachment-policy.js'
|
|
18
|
-
import { csvField } from './spreadsheet-text.js'
|
|
19
|
-
|
|
20
|
-
export interface PastedTable {
|
|
21
|
-
rows: string[][]
|
|
22
|
-
columns: number
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Words outside the table beyond this are a page that holds a table, not a table. */
|
|
26
|
-
const WORDS_OUTSIDE_A_TABLE = 20
|
|
27
|
-
|
|
28
|
-
const ENTITIES: Record<string, string> = { nbsp: ' ', amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", '#39': "'" }
|
|
29
|
-
|
|
30
|
-
function decodeEntities(text: string): string {
|
|
31
|
-
return text.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+\d*|#39);/gi, (whole, name: string) => {
|
|
32
|
-
const lower = name.toLowerCase()
|
|
33
|
-
if (lower in ENTITIES) return ENTITIES[lower]
|
|
34
|
-
if (lower.startsWith('#x')) return String.fromCodePoint(parseInt(lower.slice(2), 16))
|
|
35
|
-
if (lower.startsWith('#')) return String.fromCodePoint(parseInt(lower.slice(1), 10))
|
|
36
|
-
return whole
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** What a piece of HTML shows as words - a line break and a cell's own breaks become one space. */
|
|
41
|
-
function wordsOf(html: string): string {
|
|
42
|
-
return decodeEntities(html.replace(/<br\s*\/?>/gi, ' ').replace(/<[^>]*>/g, ''))
|
|
43
|
-
.replace(/\s+/g, ' ')
|
|
44
|
-
.trim()
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** What the clipboard's HTML shows, without what is never shown - comments, styles, scripts, the head. */
|
|
48
|
-
function shownHtml(html: string): string {
|
|
49
|
-
return html
|
|
50
|
-
.replace(/<!--[\s\S]*?-->/g, '')
|
|
51
|
-
.replace(/<(style|script|head)\b[\s\S]*?<\/\1\s*>/gi, '')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** The rows of the tables in the clipboard's HTML, or null when it holds none or is mostly not a table. */
|
|
55
|
-
export function tableOfHtml(html: string | null | undefined): string[][] | null {
|
|
56
|
-
if (!html || !/<table\b/i.test(html)) return null
|
|
57
|
-
const shown = shownHtml(html)
|
|
58
|
-
const outside = wordsOf(shown.replace(/<table\b[\s\S]*?<\/table\s*>/gi, ' '))
|
|
59
|
-
if (outside.replace(/\s/g, '').length > WORDS_OUTSIDE_A_TABLE) return null
|
|
60
|
-
|
|
61
|
-
const rows: string[][] = []
|
|
62
|
-
for (const part of shown.split(/<tr\b[^>]*>/i).slice(1)) {
|
|
63
|
-
const body = part.split(/<\/table\s*>/i)[0]
|
|
64
|
-
const row: string[] = []
|
|
65
|
-
for (const cell of body.matchAll(/<(td|th)\b([^>]*)>([\s\S]*?)(?=<\/?(?:td|th|tr)\b|$)/gi)) {
|
|
66
|
-
row.push(wordsOf(cell[3]))
|
|
67
|
-
const span = Number(/\bcolspan\s*=\s*["']?(\d+)/i.exec(cell[2])?.[1] ?? 1)
|
|
68
|
-
for (let more = 1; more < Math.min(span, 100); more++) row.push('')
|
|
69
|
-
}
|
|
70
|
-
if (row.some(text => text !== '')) rows.push(row)
|
|
71
|
-
}
|
|
72
|
-
return rows.length ? rows : null
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** The rows of a spreadsheet's plain text - tab-separated lines, a cell with a break or a tab in quotes. */
|
|
76
|
-
export function tableOfText(text: string | null | undefined): string[][] | null {
|
|
77
|
-
if (!text || !text.includes('\t')) return null
|
|
78
|
-
const rows: string[][] = []
|
|
79
|
-
let row: string[] = []
|
|
80
|
-
let cell = ''
|
|
81
|
-
let quoted = false
|
|
82
|
-
for (let at = 0; at < text.length; at++) {
|
|
83
|
-
const c = text[at]
|
|
84
|
-
if (quoted) {
|
|
85
|
-
if (c === '"' && text[at + 1] === '"') (cell += '"'), at++
|
|
86
|
-
else if (c === '"') quoted = false
|
|
87
|
-
else cell += c
|
|
88
|
-
} else if (c === '"' && cell === '') quoted = true
|
|
89
|
-
else if (c === '\t') row.push(cell), (cell = '')
|
|
90
|
-
else if (c === '\n' || c === '\r') {
|
|
91
|
-
if (c === '\r' && text[at + 1] === '\n') at++
|
|
92
|
-
row.push(cell), rows.push(row), (row = []), (cell = '')
|
|
93
|
-
} else cell += c
|
|
94
|
-
}
|
|
95
|
-
if (cell !== '' || row.length) row.push(cell), rows.push(row)
|
|
96
|
-
const kept = rows.map(one => one.map(text => text.replace(/\s+/g, ' ').trim())).filter(one => one.some(text => text !== ''))
|
|
97
|
-
/* One tab in a sentence is not a table - most lines must be split into columns. */
|
|
98
|
-
if (kept.filter(one => one.length > 1).length < Math.max(2, Math.ceil(kept.length / 2))) return null
|
|
99
|
-
return kept
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** The table a paste holds, or null for words - at least two rows of at least two columns. */
|
|
103
|
-
export function pastedTable(clipboard: { html?: string | null; text?: string | null }): PastedTable | null {
|
|
104
|
-
const fromHtml = tableOfHtml(clipboard.html)
|
|
105
|
-
/* A page the HTML shows to be mostly words stays words - its plain text would read the table out of it anyway. */
|
|
106
|
-
if (!fromHtml && clipboard.html && /<table\b/i.test(clipboard.html)) return null
|
|
107
|
-
for (const rows of [fromHtml, tableOfText(clipboard.text)]) {
|
|
108
|
-
if (!rows) continue
|
|
109
|
-
const trimmed = rows.map(row => {
|
|
110
|
-
let cells = row
|
|
111
|
-
while (cells.length && cells[cells.length - 1] === '') cells = cells.slice(0, -1)
|
|
112
|
-
return cells
|
|
113
|
-
})
|
|
114
|
-
const columns = Math.max(...trimmed.map(row => row.length))
|
|
115
|
-
if (trimmed.length >= 2 && columns >= 2) return { rows: trimmed, columns }
|
|
116
|
-
}
|
|
117
|
-
return null
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** The table as the text of its file: a line naming it, then every row led by its own number. */
|
|
121
|
-
export function pastedTableText(table: PastedTable, name: string): string {
|
|
122
|
-
const lines = table.rows.map((row, i) => [String(i + 1), ...row].map(csvField).join(','))
|
|
123
|
-
return [`# ${name} · a table the person pasted · the first column is the row number in the pasted table`, ...lines].join('\n') + '\n'
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export type PasteRefusal = { code: 'attachment-paste-too-long'; rows: number; maxChars: number }
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* What a paste becomes in a conversation under this policy: a table file, a refusal, or null - the paste stays words
|
|
130
|
-
* (no table in it, or a conversation that takes no text files).
|
|
131
|
-
*/
|
|
132
|
-
export function pastedTableFile(
|
|
133
|
-
clipboard: { html?: string | null; text?: string | null },
|
|
134
|
-
policy: AttachmentPolicy | null | undefined,
|
|
135
|
-
nameOf: (rows: number) => string
|
|
136
|
-
): { name: string; text: string; table: PastedTable } | { refusal: PasteRefusal } | null {
|
|
137
|
-
if (!policy?.kinds?.some(kind => kind === 'text' || kind === 'spreadsheet')) return null
|
|
138
|
-
const table = pastedTable(clipboard)
|
|
139
|
-
if (!table) return null
|
|
140
|
-
const name = nameOf(table.rows.length)
|
|
141
|
-
const text = pastedTableText(table, name)
|
|
142
|
-
const maxChars = textCharsOf(policy)
|
|
143
|
-
if (text.length > maxChars) return { refusal: { code: 'attachment-paste-too-long', rows: table.rows.length, maxChars } }
|
|
144
|
-
return { name: `${name.replace(/[\\/:*?"<>|]/g, '_')}.csv`, text, table }
|
|
145
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A PDF page drawn into an image - for a scanned page, whose text has to be read from its picture. The PDF is opened
|
|
3
|
-
* through @operato/utils pdf-loader (document-text.ts reads the pages' text).
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** The longest side of a drawn page, in pixels - enough for a model to read print, small enough to send. */
|
|
7
|
-
export const PAGE_IMAGE_SIDE = 1600
|
|
8
|
-
|
|
9
|
-
/** One page drawn into a JPEG. */
|
|
10
|
-
export async function drawPdfPage(pdf: any, number: number): Promise<Blob> {
|
|
11
|
-
const page = await pdf.getPage(number)
|
|
12
|
-
const base = page.getViewport({ scale: 1 })
|
|
13
|
-
const viewport = page.getViewport({ scale: Math.min(2, PAGE_IMAGE_SIDE / Math.max(base.width, base.height)) })
|
|
14
|
-
const canvas = document.createElement('canvas')
|
|
15
|
-
canvas.width = Math.ceil(viewport.width)
|
|
16
|
-
canvas.height = Math.ceil(viewport.height)
|
|
17
|
-
const context = canvas.getContext('2d')!
|
|
18
|
-
/* A page draws on transparent pixels; a JPEG would turn them black. */
|
|
19
|
-
context.fillStyle = '#ffffff'
|
|
20
|
-
context.fillRect(0, 0, canvas.width, canvas.height)
|
|
21
|
-
await page.render({ canvas, canvasContext: context, viewport }).promise
|
|
22
|
-
return await new Promise<Blob>((resolve, reject) =>
|
|
23
|
-
canvas.toBlob(blob => (blob ? resolve(blob) : reject(new Error('the page could not be drawn'))), 'image/jpeg', 0.85)
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A spreadsheet read into text the conversation can carry (design/ai/shared-dock.md §9-5).
|
|
3
|
-
*
|
|
4
|
-
* The door takes images and text only; a mode that opens 'spreadsheet' has the screen read each .xlsx sheet into
|
|
5
|
-
* CSV before sending, so the model reads the sheet and the entry card can name where a row came from.
|
|
6
|
-
*
|
|
7
|
-
* - Read with exceljs. The old binary .xls is not read - it is refused by name (exceljs cannot open it, and the
|
|
8
|
-
* npm SheetJS that can has unfixed flaws; a file a person uploads is not opened with it).
|
|
9
|
-
* - A cell is its value - a formula as its computed result, a date as ISO, rich text as its text.
|
|
10
|
-
* - Every line carries the sheet's own row number. Empty rows are left out, never renumbered, so "sheet · row" on a
|
|
11
|
-
* card is the row the person sees in Excel.
|
|
12
|
-
* - The limit is on the text after reading - a small .xlsx can be a long text. A sheet over it is refused, never cut:
|
|
13
|
-
* a cut ledger is read as the whole ledger.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export type SpreadsheetKind = 'xlsx' | 'xls'
|
|
17
|
-
|
|
18
|
-
const XLSX_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
19
|
-
const XLS_TYPE = 'application/vnd.ms-excel'
|
|
20
|
-
|
|
21
|
-
/** A spreadsheet by its type, or by its name when the browser did not know the type. */
|
|
22
|
-
export function spreadsheetKindOf(file: { type?: string; name?: string }): SpreadsheetKind | null {
|
|
23
|
-
const type = (file.type || '').toLowerCase()
|
|
24
|
-
const name = (file.name || '').toLowerCase()
|
|
25
|
-
if (type === XLSX_TYPE || name.endsWith('.xlsx')) return 'xlsx'
|
|
26
|
-
if (type === XLS_TYPE || name.endsWith('.xls')) return 'xls'
|
|
27
|
-
return null
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** The picker's `accept` for spreadsheets. */
|
|
31
|
-
export const SPREADSHEET_ACCEPT = ['.xlsx', XLSX_TYPE]
|
|
32
|
-
|
|
33
|
-
const pad = (n: number) => String(n).padStart(2, '0')
|
|
34
|
-
|
|
35
|
-
/** One cell as text - what Excel shows as the value, not how it is stored. */
|
|
36
|
-
export function cellText(value: unknown): string {
|
|
37
|
-
if (value === null || value === undefined) return ''
|
|
38
|
-
if (value instanceof Date) {
|
|
39
|
-
if (isNaN(value.getTime())) return ''
|
|
40
|
-
const day = `${value.getUTCFullYear()}-${pad(value.getUTCMonth() + 1)}-${pad(value.getUTCDate())}`
|
|
41
|
-
const h = value.getUTCHours()
|
|
42
|
-
const m = value.getUTCMinutes()
|
|
43
|
-
const s = value.getUTCSeconds()
|
|
44
|
-
return h || m || s ? `${day}T${pad(h)}:${pad(m)}:${pad(s)}` : day
|
|
45
|
-
}
|
|
46
|
-
if (typeof value === 'object') {
|
|
47
|
-
const v = value as any
|
|
48
|
-
if ('result' in v) return cellText(v.result)
|
|
49
|
-
if ('formula' in v || 'sharedFormula' in v) return ''
|
|
50
|
-
if (Array.isArray(v.richText)) return v.richText.map((part: any) => part?.text ?? '').join('')
|
|
51
|
-
if ('text' in v) return cellText(v.text)
|
|
52
|
-
if ('error' in v) return String(v.error)
|
|
53
|
-
return ''
|
|
54
|
-
}
|
|
55
|
-
return String(value)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** One CSV field - quoted when it holds a comma, a quote or a line break. */
|
|
59
|
-
export const csvField = (text: string) => (/[",\n\r]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text)
|
|
60
|
-
|
|
61
|
-
export interface SheetRow {
|
|
62
|
-
/** The row number in the sheet - 1 for Excel's first row. */
|
|
63
|
-
number: number
|
|
64
|
-
cells: unknown[]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** One sheet as CSV: a line naming the file and sheet, then every non-empty row led by its own row number. */
|
|
68
|
-
export function sheetText(fileName: string, sheetName: string, rows: SheetRow[]): string {
|
|
69
|
-
const lines = rows
|
|
70
|
-
.map(row => ({ number: row.number, cells: row.cells.map(cellText) }))
|
|
71
|
-
.filter(row => row.cells.some(cell => cell.trim() !== ''))
|
|
72
|
-
.map(row => {
|
|
73
|
-
let cells = row.cells
|
|
74
|
-
while (cells.length && cells[cells.length - 1] === '') cells = cells.slice(0, -1)
|
|
75
|
-
return [String(row.number), ...cells].map(csvField).join(',')
|
|
76
|
-
})
|
|
77
|
-
return [`# ${fileName} · sheet "${sheetName}" · the first column is the sheet's own row number`, ...lines].join('\n') + '\n'
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface SheetFile {
|
|
81
|
-
name: string
|
|
82
|
-
text: string
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type SpreadsheetRefusal = { code: 'attachment-xls-not-read'; name: string } | { code: 'attachment-sheet-too-long'; name: string; maxChars: number } | { code: 'attachment-sheet-unreadable'; name: string }
|
|
86
|
-
| { code: 'attachment-sheet-empty'; name: string }
|
|
87
|
-
|
|
88
|
-
/** The file name a sheet travels under - "거래내역.xlsx" sheet "9월" → "거래내역 - 9월.csv". */
|
|
89
|
-
export function sheetFileName(fileName: string, sheetName: string): string {
|
|
90
|
-
return `${fileName.replace(/\.xlsx?$/i, '')} - ${sheetName.replace(/[\\/:*?"<>|]/g, '_')}.csv`
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Every non-empty sheet of an .xlsx as text, or why not. `load` is exceljs's Workbook - passed in so the screen
|
|
95
|
-
* loads the library only when a spreadsheet is attached.
|
|
96
|
-
*/
|
|
97
|
-
export async function readSpreadsheet(
|
|
98
|
-
data: ArrayBuffer | Uint8Array,
|
|
99
|
-
fileName: string,
|
|
100
|
-
maxChars: number,
|
|
101
|
-
Workbook: new () => any
|
|
102
|
-
): Promise<{ files: SheetFile[] } | { refusal: SpreadsheetRefusal }> {
|
|
103
|
-
const workbook = new Workbook()
|
|
104
|
-
try {
|
|
105
|
-
await workbook.xlsx.load(data)
|
|
106
|
-
} catch {
|
|
107
|
-
return { refusal: { code: 'attachment-sheet-unreadable', name: fileName } }
|
|
108
|
-
}
|
|
109
|
-
const files: SheetFile[] = []
|
|
110
|
-
for (const sheet of workbook.worksheets) {
|
|
111
|
-
const rows: SheetRow[] = []
|
|
112
|
-
sheet.eachRow({ includeEmpty: false }, (row: any, number: number) => {
|
|
113
|
-
const values = Array.isArray(row.values) ? row.values.slice(1) : []
|
|
114
|
-
rows.push({ number, cells: values })
|
|
115
|
-
})
|
|
116
|
-
if (!rows.length) continue
|
|
117
|
-
const text = sheetText(fileName, sheet.name, rows)
|
|
118
|
-
const name = sheetFileName(fileName, sheet.name)
|
|
119
|
-
if (text.length > maxChars) return { refusal: { code: 'attachment-sheet-too-long', name: `${fileName} · ${sheet.name}`, maxChars } }
|
|
120
|
-
files.push({ name, text })
|
|
121
|
-
}
|
|
122
|
-
/* A workbook with nothing in it is said, not dropped: the person would think it was sent. */
|
|
123
|
-
if (!files.length) return { refusal: { code: 'attachment-sheet-empty', name: fileName } }
|
|
124
|
-
return { files }
|
|
125
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The AI 작업 패널 on the screen - which versions a workspace has, and the table's sort and CSV
|
|
3
|
-
* (operato-application/design/ai/workspace.md). Pure - tested without a browser.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface WorkspaceBlockView {
|
|
7
|
-
kind: string
|
|
8
|
-
[key: string]: any
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface WorkspaceView {
|
|
12
|
-
name: string
|
|
13
|
-
title: string
|
|
14
|
-
summary?: string
|
|
15
|
-
blocks: WorkspaceBlockView[]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface WorkspaceVersion {
|
|
19
|
-
/** 1-based, in the order the conversation made them. */
|
|
20
|
-
version: number
|
|
21
|
-
messageId: string
|
|
22
|
-
createdAt?: string
|
|
23
|
-
workspace: WorkspaceView
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isWorkspaceProposal(proposal: any): boolean {
|
|
27
|
-
return proposal?.kind === 'workspace' && !!proposal?.workspace?.name
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Every version of the named workspace in a conversation, oldest first. A message the reader may not see
|
|
32
|
-
* comes back redacted without its proposals, so a version behind a door is simply not among them.
|
|
33
|
-
*/
|
|
34
|
-
export function workspaceVersions(messages: { id: string; createdAt?: string; proposalsJson?: any[] | null }[], name: string): WorkspaceVersion[] {
|
|
35
|
-
const versions: WorkspaceVersion[] = []
|
|
36
|
-
for (const message of messages) {
|
|
37
|
-
for (const proposal of message.proposalsJson ?? []) {
|
|
38
|
-
if (isWorkspaceProposal(proposal) && proposal.workspace.name === name) {
|
|
39
|
-
versions.push({ version: versions.length + 1, messageId: message.id, createdAt: message.createdAt, workspace: proposal.workspace })
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return versions
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** The version of a card within its conversation - "2 of 3" on the card and on the page. */
|
|
47
|
-
export function versionOfCard(proposalsInOrder: any[][], name: string, key: string): { version: number; of: number } {
|
|
48
|
-
let version = 0
|
|
49
|
-
let of = 0
|
|
50
|
-
for (const list of proposalsInOrder)
|
|
51
|
-
for (const one of list ?? []) {
|
|
52
|
-
if (!isWorkspaceProposal(one) || one.workspace.name !== name) continue
|
|
53
|
-
of += 1
|
|
54
|
-
if (one.key === key) version = of
|
|
55
|
-
}
|
|
56
|
-
return { version, of }
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function workspaceAddress(sessionId: string, name: string, version?: number): string {
|
|
60
|
-
const query = new URLSearchParams({ session: sessionId, name })
|
|
61
|
-
if (version) query.set('version', String(version))
|
|
62
|
-
return `assistant-workspace?${query.toString()}`
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Sorts by one column - numbers as numbers, empty last, the rest by the reader's collation. */
|
|
66
|
-
export function sortRows(rows: Record<string, any>[], column: string, direction: 'asc' | 'desc', locale?: string): Record<string, any>[] {
|
|
67
|
-
const factor = direction === 'asc' ? 1 : -1
|
|
68
|
-
const collator = new Intl.Collator(locale, { numeric: true })
|
|
69
|
-
return [...rows].sort((a, b) => {
|
|
70
|
-
const x = a[column]
|
|
71
|
-
const y = b[column]
|
|
72
|
-
const emptyX = x === null || x === undefined || x === ''
|
|
73
|
-
const emptyY = y === null || y === undefined || y === ''
|
|
74
|
-
if (emptyX || emptyY) return emptyX === emptyY ? 0 : emptyX ? 1 : -1
|
|
75
|
-
if (typeof x === 'number' && typeof y === 'number') return (x - y) * factor
|
|
76
|
-
return collator.compare(String(x), String(y)) * factor
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const csvCell = (value: unknown) => {
|
|
81
|
-
const text = value === null || value === undefined ? '' : String(value)
|
|
82
|
-
return /[",\n\r]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** The table as CSV - the heading row in the column labels, a BOM so a spreadsheet reads Korean. */
|
|
86
|
-
export function tableCsv(columns: { name: string; label?: string }[], rows: Record<string, any>[]): string {
|
|
87
|
-
const lines = [columns.map(column => csvCell(column.label || column.name)).join(','), ...rows.map(row => columns.map(column => csvCell(row[column.name])).join(','))]
|
|
88
|
-
return '' + lines.join('\r\n')
|
|
89
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAA;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AAE/E,OAAO,oCAAoC,CAAA;AAC3C,OAAO,oCAAoC,CAAA;AAE3C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC5B,IAAI,CAAC,CAAC,MAAM,YAAY,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;YAAE,OAAM;QAE3G,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAA,+CAA+C,EAAE;SACrG,CAAC,CAAA;QACF,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAA,+CAA+C,EAAE;SACrG,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { html } from 'lit'\nimport { store } from '@operato/shell'\nimport { auth, hasPrivilege } from '@things-factory/auth-base/dist-client/index.js'\nimport { ADD_SETTING } from '@things-factory/setting-base/dist-client/index.js'\n\nimport './settings/ai-agent-setting-let.js'\nimport './settings/ai-usage-setting-let.js'\n\n/**\n * Every application that carries the AI assistant gets its domain's AI agents and AI usage in Settings ›\n * {domain} settings (design/ai/agent-settings.md §7). They are the domain's, not the person's, so they go on the\n * tenant tab - and only for someone who may change the domain's settings, as the doors behind them require.\n */\nexport default function bootstrap() {\n auth.on('profile', async () => {\n if (!(await hasPrivilege({ privilege: 'mutation', category: 'setting', domainOwnerGranted: true }))) return\n\n store.dispatch({\n type: ADD_SETTING,\n setting: { seq: 60, scope: 'tenant', template: html`<ai-agent-setting-let></ai-agent-setting-let>` }\n })\n store.dispatch({\n type: ADD_SETTING,\n setting: { seq: 61, scope: 'tenant', template: html`<ai-usage-setting-let></ai-usage-setting-let>` }\n })\n })\n}\n"]}
|