@celljs/ta-web 4.13.1 → 4.15.0
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/README.en.md +3 -3
- package/README.md +3 -3
- package/esm/browser/assistant/assistant-extension.js +3 -2
- package/esm/browser/assistant/assistant-initiative.js +1 -1
- package/esm/browser/assistant/assistant-state.js +2 -2
- package/esm/browser/components/access-view.js +3 -2
- package/esm/browser/components/account-menu.js +2 -2
- package/esm/browser/components/app-view.js +4 -0
- package/esm/browser/components/auth-view.d.ts +1 -1
- package/esm/browser/components/auth-view.js +38 -10
- package/esm/browser/components/chat-asks.d.ts +8 -0
- package/esm/browser/components/chat-asks.js +10 -0
- package/esm/browser/components/chat-list.js +11 -1
- package/esm/browser/components/composer-box.d.ts +2 -0
- package/esm/browser/components/composer-box.js +2 -1
- package/esm/browser/components/composer.d.ts +3 -1
- package/esm/browser/components/composer.js +16 -4
- package/esm/browser/components/custom-provider-advanced.d.ts +14 -0
- package/esm/browser/components/custom-provider-advanced.js +50 -0
- package/esm/browser/components/custom-provider-util.d.ts +38 -0
- package/esm/browser/components/custom-provider-util.js +103 -0
- package/esm/browser/components/custom-provider-view.d.ts +11 -0
- package/esm/browser/components/custom-provider-view.js +181 -0
- package/esm/browser/components/face.d.ts +13 -1
- package/esm/browser/components/face.js +16 -1
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +20 -1
- package/esm/browser/components/people.d.ts +32 -0
- package/esm/browser/components/people.js +71 -0
- package/esm/browser/components/session-view.d.ts +1 -1
- package/esm/browser/components/session-view.js +56 -36
- package/esm/browser/components/settings-choices.js +2 -3
- package/esm/browser/components/settings-controls.d.ts +7 -1
- package/esm/browser/components/settings-controls.js +8 -0
- package/esm/browser/components/settings-parts.js +25 -8
- package/esm/browser/components/sign-in-setup.d.ts +16 -0
- package/esm/browser/components/sign-in-setup.js +118 -0
- package/esm/browser/components/use-seen-chats.d.ts +2 -0
- package/esm/browser/components/use-seen-chats.js +2 -2
- package/esm/browser/editor/monaco-loader.js +7 -1
- package/esm/browser/extension/web-api-components.d.ts +12 -0
- package/esm/browser/extension/web-api-contributions.d.ts +3 -0
- package/esm/browser/extension/web-extension-api.d.ts +9 -2
- package/esm/browser/extension/web-extension-context.d.ts +2 -0
- package/esm/browser/extension/web-extension-context.js +19 -0
- package/esm/browser/game/game-loader.js +22 -2
- package/esm/browser/game/game3d-protocol.d.ts +13 -4
- package/esm/browser/i18n/locales.d.ts +90 -1
- package/esm/browser/i18n/locales.js +25 -1
- package/esm/browser/i18n/messages-ja.d.ts +2 -0
- package/esm/browser/i18n/messages-ja.js +972 -0
- package/esm/browser/i18n/messages-zh-tw.d.ts +3 -0
- package/esm/browser/i18n/messages-zh-tw.js +973 -0
- package/esm/browser/i18n/messages.d.ts +85 -0
- package/esm/browser/i18n/messages.js +171 -1
- package/esm/browser/i18n/use-t.js +3 -2
- package/esm/browser/presence/presence-reporter.d.ts +32 -0
- package/esm/browser/presence/presence-reporter.js +71 -0
- package/esm/browser/settings/settings-protocol.d.ts +3 -2
- package/esm/browser/settings/settings-protocol.js +4 -3
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +24 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +8 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +53 -1
- package/esm/browser/util/desktop.d.ts +12 -1
- package/esm/browser/util/desktop.js +14 -0
- package/esm/browser/util/voice.d.ts +20 -1
- package/esm/browser/util/voice.js +27 -11
- package/esm/browser/workbench-protocol.d.ts +9 -0
- package/esm/browser/workbench-util.d.ts +4 -0
- package/esm/browser/workbench-util.js +24 -1
- package/esm/browser/workbench.d.ts +3 -0
- package/esm/browser/workbench.js +14 -4
- package/lib/browser/assistant/assistant-extension.js +3 -2
- package/lib/browser/assistant/assistant-initiative.js +1 -1
- package/lib/browser/assistant/assistant-state.js +1 -1
- package/lib/browser/components/access-view.js +3 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/app-view.js +4 -0
- package/lib/browser/components/auth-view.d.ts +1 -1
- package/lib/browser/components/auth-view.js +37 -9
- package/lib/browser/components/chat-asks.d.ts +8 -0
- package/lib/browser/components/chat-asks.js +10 -0
- package/lib/browser/components/chat-list.js +11 -1
- package/lib/browser/components/composer-box.d.ts +2 -0
- package/lib/browser/components/composer-box.js +2 -1
- package/lib/browser/components/composer.d.ts +3 -1
- package/lib/browser/components/composer.js +16 -4
- package/lib/browser/components/custom-provider-advanced.d.ts +15 -0
- package/lib/browser/components/custom-provider-advanced.js +86 -0
- package/lib/browser/components/custom-provider-util.d.ts +39 -0
- package/lib/browser/components/custom-provider-util.js +106 -0
- package/lib/browser/components/custom-provider-view.d.ts +12 -0
- package/lib/browser/components/custom-provider-view.js +217 -0
- package/lib/browser/components/face.d.ts +13 -1
- package/lib/browser/components/face.js +16 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +19 -0
- package/lib/browser/components/people.d.ts +33 -0
- package/lib/browser/components/people.js +109 -0
- package/lib/browser/components/session-view.d.ts +1 -1
- package/lib/browser/components/session-view.js +56 -36
- package/lib/browser/components/settings-choices.js +1 -2
- package/lib/browser/components/settings-controls.d.ts +7 -1
- package/lib/browser/components/settings-controls.js +9 -0
- package/lib/browser/components/settings-parts.js +24 -7
- package/lib/browser/components/sign-in-setup.d.ts +17 -0
- package/lib/browser/components/sign-in-setup.js +155 -0
- package/lib/browser/components/use-seen-chats.d.ts +2 -0
- package/lib/browser/components/use-seen-chats.js +3 -2
- package/lib/browser/editor/monaco-loader.js +7 -1
- package/lib/browser/extension/web-api-components.d.ts +12 -0
- package/lib/browser/extension/web-api-contributions.d.ts +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +9 -2
- package/lib/browser/extension/web-extension-context.d.ts +2 -0
- package/lib/browser/extension/web-extension-context.js +19 -0
- package/lib/browser/game/game-loader.js +22 -2
- package/lib/browser/game/game3d-protocol.d.ts +13 -4
- package/lib/browser/i18n/locales.d.ts +90 -1
- package/lib/browser/i18n/locales.js +25 -1
- package/lib/browser/i18n/messages-ja.d.ts +3 -0
- package/lib/browser/i18n/messages-ja.js +975 -0
- package/lib/browser/i18n/messages-zh-tw.d.ts +4 -0
- package/lib/browser/i18n/messages-zh-tw.js +976 -0
- package/lib/browser/i18n/messages.d.ts +85 -0
- package/lib/browser/i18n/messages.js +174 -2
- package/lib/browser/i18n/use-t.js +2 -1
- package/lib/browser/presence/presence-reporter.d.ts +33 -0
- package/lib/browser/presence/presence-reporter.js +75 -0
- package/lib/browser/settings/settings-protocol.d.ts +3 -2
- package/lib/browser/settings/settings-protocol.js +4 -3
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +24 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +8 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +53 -1
- package/lib/browser/util/desktop.d.ts +12 -1
- package/lib/browser/util/desktop.js +14 -0
- package/lib/browser/util/voice.d.ts +20 -1
- package/lib/browser/util/voice.js +27 -11
- package/lib/browser/workbench-protocol.d.ts +9 -0
- package/lib/browser/workbench-util.d.ts +4 -0
- package/lib/browser/workbench-util.js +24 -1
- package/lib/browser/workbench.d.ts +3 -0
- package/lib/browser/workbench.js +14 -4
- package/package.json +10 -10
package/README.en.md
CHANGED
|
@@ -23,7 +23,7 @@ Initially, the interface shows only conversations. You tell Ta what you want thi
|
|
|
23
23
|
Everything new in the interface comes from **web extensions** within packages, using the same mechanism and terminology as pi extensions:
|
|
24
24
|
|
|
25
25
|
- **Packages** are pi packages. In the `pi` field of `package.json`, `extensions` are extensions for Ta (terminal and server), and `web` are extensions for this page; when not declared, modules in the `web/` directory are used. Packages can be placed in `~/.ta/agent/extensions/<name>/` or the project's `.ta/extensions/` to take effect, or installed with `ta install`.
|
|
26
|
-
- **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerCodeRenderer` (draws the fenced blocks of a language in replies and in `ui.Markdown` as a card of the extension's own; the component gets `{ code, language, closed, send, answer }`, `closed` false while the block streams, `send` sending words as the user to the conversation the block is in (none in a page's `ui.Markdown`; older Ta apps pass none, use `sendUserMessage` there), `answer` what the user said after the reply, once they did (a choice the block offers is made, tapped or typed, on every device; older Ta apps pass no such key), and a renderer that throws shows the block as code, as the `ta-glance` cards of `@celljs/ta-glance`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerToolRenderer` (as pi's, a resolver `(toolName, next) => renderer` that chooses how calls of any tool read in conversations: `renderCall(args)` gives a verb, a target and a small icon in the language of the page, in place of the tool's name; `next()` is what the resolvers after it would use), `registerSettings` (a section of the settings, after those of Ta: rows of a label, a description and a control the extension draws, the values kept with `storage`; a row with an empty label is a panel that says what it is itself, found by `search`), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md. A task with `remove` and `removeHint` can be swiped away in the lists, or selected with others and deleted at once; `ui.removeTasks` asks the user), `ui.SelectCheck` / `ui.SelectBar` (the round mark at the start of a row and the bar under a list while it selects several, as the lists of the page), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` are entries of the + menu, each a tile of its grid (four by two a page, more a page to swipe to): `setting: true` shows its value (`detail`) under its label, `toggle: true` is a switch (`checked` is on, its icon lit; turning it leaves the menu open), and entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.Game3D` (a 3D game on Three.js: `setup(context)` gets a renderer, a scene, a camera and OrbitControls, fills the scene and returns what to do each frame; loaded, asleep and ended as `ui.Game`, its scene and WebGL context given back at the end), `ui.FullScreen` (covers all of the page: the shell, its head and side columns under it, under the notch and the home bar, below the title bar of the desktop app and above the keyboard; its touches are all its own, an edge brings out no panel of Ta; for a game held sideways or a world to walk in, `??` back to its place in an app older than it), `data-own-gestures` (an attribute of an element whose touches are its own: the slides of Ta start there only from an edge of the screen, a held finger opens no menu; games carry it), `ui.Game` (a game on Phaser 4, the game engine of the page, loaded when the first game starts; it fills its parent, sleeps while out of sight and ends when it unmounts, takes the keyboard only while it has the focus, and finds the colors of the theme in its registry; see docs/design/ta-games.md), `ui.QrCode` (a QR code of a text, black on white whatever the theme), `ui.ImageViewer` (a picture to look at closely: all of it at first and never larger than its own pixels, pinched with two fingers or a trackpad, zoomed with Ctrl/⌘ and the wheel or a double click or tap, dragged or scrolled once zoomed, with − / the scale / + / fit to window / actual size below it, and given `onPrevious` / `onNext` the pictures beside it by buttons at its sides and, unless zoomed, ← →; the previews of pictures in the workbench and the large pictures of a conversation are this), `on` (events of the current conversation), `sendUserMessage` (sends to the current conversation; a `/command` runs a command of a pi extension. What an extension sends as the user, by `sendUserMessage`, `server.prompt`, the `send` of a block or `prompt` of its host, says where it came from in the last line of its `<context>`, `[ta:from <package>]` (`TaMessageSource`), and the conversation shows the name and icon of the package above the bubble), `switchSession` (shows another session open in ta serve as the current conversation; given a Promise of the session id it switches at once and shows "Opening", `opening` giving the title meanwhile), `openChat` (opens the conversation of a session file as the lists do: at once from what the page or the device has, opened again in one round trip when it closed; false when no conversation has it), `callHost` (calls a method of the package's `pi.host`, through `callPackageHost`), `reloadExtensions` (after an extension installed, imported or removed packages itself, reloads the web extensions and the pi extensions of the current conversation as at the end of a reply), `ui.showView` / `ui.useView` (shows and reads any extension's view), `ui.Composer` / `ui.Markdown` (the message box and the Markdown of the conversations, the microphone and the hold to talk too; with `commands`, `/` lists the commands a new conversation in `cwd` will have; `voiceSends`, `onTalkSent`, `onListening`, `working` / `onStop` and `after` are those of the double's box: what is heard is sent at once, the page knows what was said by voice to read its answer aloud, that the user talks now, the send button stops what answers, buttons of its own on the right), `ui.HoldToTalk` (a button held to talk, as the bar of the message box: the page dims and listens with its recognizer, 取消 and 编辑 to slide onto, the words given as the finger lets go; nothing where the page cannot listen), `ui.voice` (`canListen` / `canSpeak` / `speak` / `hush`: read aloud in the voice of the settings), the `send` of a view (a page that is a conversation takes a message from another extension as if typed in its box; the double's page has it, its answer comes as its `preview`), `ui.useChatScroll` (scrolls as the conversations: at the bottom it follows new messages, scrolled up it is never pulled back and what is read does not jump, a part opened by a click stays where it was; `sent` is how many messages the user sent, one more of which goes to the bottom), `ui.Empty` (what a list or a view shows while empty: a title and at most one line of hint, centred in its space; `compact` in menus, pickers and dialogs; `picture` puts a picture above), `ui.Picture` / `ui.PictureCards` (small pictures as those of Ta: the shapes of an SVG take the classes `ta-pic-*` and follow the theme; a row of picture cards to click, with a label and a line of description), `ui.Dialog` (a dialog over the page), `preview` of `ui.openEditor` (a preview tab opened by a click, its title in italics, replaced by the next preview, kept by a double click or `ui.pinEditor`), `ui.setEditorDirty` (the tab shows an unsaved dot and asks before closing), `ui.useActiveEditor` (the current tab of the workbench), `ui.DiffEditor` (Monaco's diff editor, side by side or inline, the right side editable), `confirmLabel` / `danger` of `ui.confirm`, `head` of a view (a top bar of its own), `ui.input` / `ui.editor` (asks the user for a line or lines of text, `undefined` when cancelled), the page's `menu` (floating … menu when the page is listed in sidebar) and `pages` (pages listed in sidebar, navigation bar no longer lists them separately), `ui.notify` (notifications in bottom right of page), `ui.notifySession` (tells the user what a conversation said, as a messenger does: nothing while they look at it, nothing of a task the double follows unless it asks; nothing that pops up on a phone or a tablet, the unread dots of the list and of the Chats tab telling; on a computer in front, a banner with the face and name of the conversation, a tap opening it, its `options` buttons that send that answer once from whichever page; a notice of the system while it is not, silent for an answer; without those, a banner that waits for the user when it asks or failed), `ui.confirm` (confirm before continuing, returns whether user agreed), `ui.theme`, `ui.language`, `ui.supportsWebview` (whether a view can show a site in a `<webview>`, as in Ta Desktop, rather than an iframe), `ui.debugWebview` (Ta Desktop: a command of the Chrome DevTools Protocol to the page of such a webview, limited to the page itself), `ui.desktop.browserData` (Ta Desktop on macOS and Windows: the cookies of a profile of the user's browser taken into the browser of Ta once the user says yes in a dialog of the app, and clearing that browser's data), `registerChatIcon` (an icon for conversations of the extension that are no agent, such as a brief it writes or a question it asks, in the lists and on their notices in place of the letter of their directory), `registerHomeItems` / `ui.useHomeItems` (rows of the double's home under the double, for what the user looks at each day, such as a daily brief), `ui.pinChat` (pins a conversation by its session file, or unpins it, as the user does with Pin), `registerSessionMenu` (a section of entries of its own in the menu of a conversation of a list, a right click or a held finger on its row), `ui.custom` (a component of the extension over the page wherever the user is, as pi's `ctx.ui.custom`, closed when the extension stops), `ui.useSessions` / `ui.useSavedSessions` (the open sessions of ta serve and the conversations saved lately, as the lists of the page have them, without a poll of its own), `ui.useAsks` (the conversations that wait for the user to decide, as the top of the list of chats shows them: their last turn asked (`TaSessionInfo.asking`) and the user neither answered nor let it go, or a dialog waits; the latest first), `ui.Face` / `ui.GroupFace` (the face of one who is not Ta, as the agents of channels have, the same for the same `seed` on every device; a group of them), `ui.Stack` (a level pushed over the page as a list pushes what was tapped in it, closed on a phone by the swipe from the left edge and the back of the system too), `ui.useBusy` (what waits on ta serve shows it is busy, so that the user sees the click took), `ui.Switch` (the switch of the settings: an `onChange` that returns a promise shows the new state at once, and the old one again if it fails), and page services: `server` (session, pi's RPC commands), `workspace` (files and commands in directory), `terminals` (terminals), `packages` (packages), and `rooms`, rooms shared with other Ta through the relay (what happens in them comes by `onRoomEvent`, no more once the extension stops) (types see `WebExtensionAPI`).
|
|
26
|
+
- **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerCodeRenderer` (draws the fenced blocks of a language in replies and in `ui.Markdown` as a card of the extension's own; the component gets `{ code, language, closed, send, answer }`, `closed` false while the block streams, `send` sending words as the user to the conversation the block is in (none in a page's `ui.Markdown`; older Ta apps pass none, use `sendUserMessage` there), `answer` what the user said after the reply, once they did (a choice the block offers is made, tapped or typed, on every device; older Ta apps pass no such key), and a renderer that throws shows the block as code, as the `ta-glance` cards of `@celljs/ta-glance`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerToolRenderer` (as pi's, a resolver `(toolName, next) => renderer` that chooses how calls of any tool read in conversations: `renderCall(args)` gives a verb, a target and a small icon in the language of the page, in place of the tool's name; `next()` is what the resolvers after it would use), `registerSettings` (a section of the settings, after those of Ta: rows of a label, a description and a control the extension draws, the values kept with `storage`; a row with an empty label is a panel that says what it is itself, found by `search`), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md. A task with `remove` and `removeHint` can be swiped away in the lists, or selected with others and deleted at once; `ui.removeTasks` asks the user), `ui.SelectCheck` / `ui.SelectBar` (the round mark at the start of a row and the bar under a list while it selects several, as the lists of the page), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` are entries of the + menu, each a tile of its grid (four by two a page, more a page to swipe to): `setting: true` shows its value (`detail`) under its label, `toggle: true` is a switch (`checked` is on, its icon lit; turning it leaves the menu open), and entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.Game3D` (a 3D game on Three.js: `setup(context)` gets a renderer, a scene, a camera and OrbitControls, fills the scene and returns what to do each frame; loaded, asleep and ended as `ui.Game`, its scene and WebGL context given back at the end), `ui.FullScreen` (covers all of the page: the shell, its head and side columns under it, under the notch and the home bar, below the title bar of the desktop app and above the keyboard; its touches are all its own, an edge brings out no panel of Ta; for a game held sideways or a world to walk in, `??` back to its place in an app older than it), `data-own-gestures` (an attribute of an element whose touches are its own: the slides of Ta start there only from an edge of the screen, a held finger opens no menu; games carry it), `ui.Game` (a game on Phaser 4, the game engine of the page, loaded when the first game starts; it fills its parent, sleeps while out of sight and ends when it unmounts, takes the keyboard only while it has the focus, and finds the colors of the theme in its registry; see docs/design/ta-games.md), `ui.QrCode` (a QR code of a text, black on white whatever the theme), `ui.ImageViewer` (a picture to look at closely: all of it at first and never larger than its own pixels, pinched with two fingers or a trackpad, zoomed with Ctrl/⌘ and the wheel or a double click or tap, dragged or scrolled once zoomed, with − / the scale / + / fit to window / actual size below it, and given `onPrevious` / `onNext` the pictures beside it by buttons at its sides and, unless zoomed, ← →; the previews of pictures in the workbench and the large pictures of a conversation are this), `on` (events of the current conversation), `sendUserMessage` (sends to the current conversation; a `/command` runs a command of a pi extension. What an extension sends as the user, by `sendUserMessage`, `server.prompt`, the `send` of a block or `prompt` of its host, says where it came from in the last line of its `<context>`, `[ta:from <package>]` (`TaMessageSource`), and the conversation shows the name and icon of the package above the bubble), `switchSession` (shows another session open in ta serve as the current conversation; given a Promise of the session id it switches at once and shows "Opening", `opening` giving the title meanwhile), `openChat` (opens the conversation of a session file as the lists do: at once from what the page or the device has, opened again in one round trip when it closed; false when no conversation has it), `openLink` (opens a link as a click on a link of a reply does: the openers of extensions first, as of a share or an agent's card, else the browser of the workbench), `callHost` (calls a method of the package's `pi.host`, through `callPackageHost`), `reloadExtensions` (after an extension installed, imported or removed packages itself, reloads the web extensions and the pi extensions of the current conversation as at the end of a reply), `ui.showView` / `ui.useView` (shows and reads any extension's view), `ui.Composer` / `ui.Markdown` (the message box and the Markdown of the conversations, the microphone and the hold to talk too; with `commands`, `/` lists the commands a new conversation in `cwd` will have; `voiceSends`, `onTalkSent`, `onListening`, `working` / `onStop` and `after` are those of the double's box: what is heard is sent at once, the page knows what was said by voice to read its answer aloud, that the user talks now, the send button stops what answers, buttons of its own on the right), `ui.HoldToTalk` (a button held to talk, as the bar of the message box: the page dims and listens with its recognizer, 取消 and 编辑 to slide onto, the words given as the finger lets go; nothing where the page cannot listen), `ui.voice` (`canListen` / `canSpeak` / `speak` / `hush`: read aloud in the voice of the settings), the `send` of a view (a page that is a conversation takes a message from another extension as if typed in its box; the double's page has it, its answer comes as its `preview`), `ui.useChatScroll` (scrolls as the conversations: at the bottom it follows new messages, scrolled up it is never pulled back and what is read does not jump, a part opened by a click stays where it was; `sent` is how many messages the user sent, one more of which goes to the bottom), `ui.Empty` (what a list or a view shows while empty: a title and at most one line of hint, centred in its space; `compact` in menus, pickers and dialogs; `picture` puts a picture above), `ui.Picture` / `ui.PictureCards` (small pictures as those of Ta: the shapes of an SVG take the classes `ta-pic-*` and follow the theme; a row of picture cards to click, with a label and a line of description), `ui.Dialog` (a dialog over the page), `preview` of `ui.openEditor` (a preview tab opened by a click, its title in italics, replaced by the next preview, kept by a double click or `ui.pinEditor`), `ui.setEditorDirty` (the tab shows an unsaved dot and asks before closing), `ui.useActiveEditor` (the current tab of the workbench), `ui.DiffEditor` (Monaco's diff editor, side by side or inline, the right side editable), `confirmLabel` / `danger` of `ui.confirm`, `head` of a view (a top bar of its own), `ui.input` / `ui.editor` (asks the user for a line or lines of text, `undefined` when cancelled), the page's `menu` (floating … menu when the page is listed in sidebar) and `pages` (pages listed in sidebar, navigation bar no longer lists them separately), `ui.notify` (notifications in bottom right of page), `ui.notifySession` (tells the user what a conversation said, as a messenger does: nothing while they look at it, nothing of a task the double follows unless it asks; nothing that pops up on a phone or a tablet, the unread dots of the list and of the Chats tab telling; on a computer in front, a banner with the face and name of the conversation, a tap opening it, its `options` buttons that send that answer once from whichever page; a notice of the system while it is not, silent for an answer; without those, a banner that waits for the user when it asks or failed), `ui.confirm` (confirm before continuing, returns whether user agreed), `ui.theme`, `ui.language`, `ui.supportsWebview` (whether a view can show a site in a `<webview>`, as in Ta Desktop, rather than an iframe), `ui.debugWebview` (Ta Desktop: a command of the Chrome DevTools Protocol to the page of such a webview, limited to the page itself), `ui.desktop.browserData` (Ta Desktop on macOS and Windows: the cookies of a profile of the user's browser taken into the browser of Ta once the user says yes in a dialog of the app, and clearing that browser's data), `registerChatIcon` (an icon for conversations of the extension that are no agent, such as a brief it writes or a question it asks, in the lists and on their notices in place of the letter of their directory), `registerHomeItems` / `ui.useHomeItems` (rows of the double's home under the double, for what the user looks at each day, such as a daily brief), `registerInitiative` (how far the page goes on its own with what it does for the user, as the double starting a task: the extension that keeps the user's trust answers, the first registered; ta-initiative does), `ui.pinChat` (pins a conversation by its session file, or unpins it, as the user does with Pin), `registerSessionMenu` (a section of entries of its own in the menu of a conversation of a list, a right click or a held finger on its row), `ui.custom` (a component of the extension over the page wherever the user is, as pi's `ctx.ui.custom`, closed when the extension stops), `ui.useSessions` / `ui.useSavedSessions` (the open sessions of ta serve and the conversations saved lately, as the lists of the page have them, without a poll of its own), `ui.useAsks` (the conversations that wait for the user to decide, as the top of the list of chats shows them: their last turn asked (`TaSessionInfo.asking`) and the user neither answered nor let it go, or a dialog waits; the latest first), `ui.Face` / `ui.GroupFace` (the face of one who is not Ta, as the agents of channels have, the same for the same `seed` on every device; a group of them), `ui.Stack` (a level pushed over the page as a list pushes what was tapped in it, closed on a phone by the swipe from the left edge and the back of the system too), `ui.useBusy` (what waits on ta serve shows it is busy, so that the user sees the click took), `ui.Switch` (the switch of the settings: an `onChange` that returns a promise shows the new state at once, and the old one again if it fails), and page services: `server` (session, pi's RPC commands), `workspace` (files and commands in directory), `terminals` (terminals), `packages` (packages), and `rooms`, rooms shared with other Ta through the relay (what happens in them comes by `onRoomEvent`, no more once the extension stops) (types see `WebExtensionAPI`).
|
|
27
27
|
- **The bytes of files**: `pi.files` gives the bytes of a file of the workspace. When the page is served by ta serve itself, `byUrl` is true and the URL of `workspace.fileUrl` loads as it is; in the app on a phone, or when the page is opened through a relay, that URL is not there to load, `byUrl` is false, and `pi.files.read(url)` gives `{ type, size, data }` over the WebSocket (sealed end to end: the relay reads none of it). The previews of @celljs/ta-workspace are built on it: pictures, videos, sounds and PDFs as `blob:` URLs, an HTML report from the text of the file in a sandboxed frame.
|
|
28
28
|
- **Make packages with natural language**: the built-in extension [@celljs/ta-extensions](../ta-extensions/README.md) includes the skill `ta-package` (also available in the Ta terminal) and adds an "Extensions" page in the navigation bar (create an extension in one sentence, export or import). It documents package format, the web extension interface, and validation steps. At the end of each reply in the current conversation, the page reloads web extensions: new ones load, changed ones reload, and deleted ones unload; when tools change, the conversation reopens that part in the same session file (only for conversations opened on this page); when packages change, the session reloads pi extensions. The page checks again when redisplayed (packages might change in the terminal too).
|
|
29
29
|
- **Stable**: each extension owns what it registers and removes it all on unload; if one extension fails to load or render, only that extension's area shows an error, without affecting the page or other extensions.
|
|
@@ -51,7 +51,7 @@ The gear above the avatar (`ManageMenu`) is a two-level menu: Settings (⌘/Ctrl
|
|
|
51
51
|
|
|
52
52
|
### Sign In to Model Service, Working Directory and Phone
|
|
53
53
|
|
|
54
|
-
- **Model accounts**: similar to pi's `/login` in the terminal, you can sign in with an account (OAuth, Claude, ChatGPT subscriptions) or API Key. Sign-in occurs on ta serve (`TaAuthServer`): the login page to open, device code, and key to fill are sent only to the requesting page; credentials are stored in `auth.json` on the ta serve machine, not in the browser. When no model is available (`CELL_TA_NOT_SIGNED_IN`), the page opens the login page directly instead of pi's `/login` prompt; the same applies to the desktop app on first launch.
|
|
54
|
+
- **Model accounts**: similar to pi's `/login` in the terminal, you can sign in with an account (OAuth, Claude, ChatGPT subscriptions) or API Key. Sign-in occurs on ta serve (`TaAuthServer`): the login page to open, device code, and key to fill are sent only to the requesting page; credentials are stored in `auth.json` on the ta serve machine, not in the browser. Add a custom model service, at the top of API key, takes the API it speaks (OpenAI Chat Completions / Responses, Anthropic Messages, Google Gemini), its address, a key (not needed for a local server) and its models, which can be read from the service and picked; Advanced, folded, applies to every model of the service: context window, max output (200k, 1m are taken), thinks before answering, takes pictures, and the headers it sends (their values stay on ta serve; left blank, kept); a field the models had apart stays so unless changed. Once saved they are in the + menu, and its row changes or deletes it. When no model is available (`CELL_TA_NOT_SIGNED_IN`), the page opens the login page directly instead of pi's `/login` prompt; the same applies to the desktop app on first launch.
|
|
55
55
|
- **Working directory**: when no directory is specified, new conversations and doubles open in ta serve's working directory. "Open working directory…" (`TaServer.setWorkingDirectory`) affects all clients and persists across restarts; already open conversations are not changed.
|
|
56
56
|
- **Sign-in page**: when ta serve takes accounts (GitHub, Google, WeChat, OpenID Connect), the sign-in page lists them first (`GET /sign-in`), the token can still be pasted below; an account not let in comes back to a note that the owner has to let it in. When ta serve is not on this computer (an address of the network, through a relay, the phone app), the OAuth sign-in of model accounts asks for the `localhost` address the browser ended on.
|
|
57
57
|
- **Use on your phone**: pair a device via Relay ([@celljs/ta-relay](../ta-relay/README.md)); the pairing link is displayed as a QR code (drawn by `QrCode` of ta-relay, with no dependencies) and shown only once. Below, it lists paired devices and whether ta serve is connected to Relay. The default Relay is `https://relay.cellbang.com`.
|
|
@@ -65,7 +65,7 @@ As WeChat pulls its mini programs down over its chats (design record docs/design
|
|
|
65
65
|
- **Widgets** (views at `location: 'board'`): on a phone, a swipe to the right over the first tab brings the board in from the left (from the left edge over a row swiped open); elsewhere a button of the rail. Edit takes cards off, puts them back and orders them by their handles, kept for the user (`board`). Built in: the double's tasks, Quick open, and Next up of the scheduled tasks.
|
|
66
66
|
- **Started on open**: a package with `pi.webActivation: 'open'`, or one opened without installing (`origin: 'temporary'`), loads when one of its pages opens; left, it keeps running in the background with its page as it was (`KeptPages`), shown again at once; it stops after the time of Settings, Extensions (5 minutes by default) in the background, or when more than three are there. Its pages are not in the navigation: Quick open lists them.
|
|
67
67
|
- **Sharing**: `ui.shareExtension` opens the dialog that hands an extension on (QR code, copy, the share of the system): the source of a published one, else end to end through the relay and kept nowhere (`TaRelayServer.sharePackage`); `ui.openShared` opens a link of an extension, asked first.
|
|
68
|
-
- For web extensions: `ui.usePages()` (every page, with its state, place, last use and temporary package), `ui.showView` (starts one started on open first; its name opens its first page), `ui.stopExtension`, `ui.forgetPage`, `pi.openTemporary(source, from)`, `ui.useContextMenu()` (the menu of the page, right click or long press), `ui.QrCode`, `ui.scanCode` and `ui.scan` (in the Ta app only; `ui.scan` is the Scan of the page, which opens what the code carries).
|
|
68
|
+
- For web extensions: `ui.usePages()` (every page, with its state, place, last use and temporary package), `ui.showView` (starts one started on open first; its name opens its first page), `ui.stopExtension`, `ui.forgetPage`, `pi.openTemporary(source, from)`, `ui.useContextMenu()` (the menu of the page, right click or long press), `ui.QrCode`, `ui.scanCode` and `ui.scan` (in the Ta app only; `ui.scan` is the Scan of the page, which opens what the code carries), `ui.connect(link)` (connects to another Ta by a pairing link, of `ta pair` or the device a Ta that let the user in gave them, and switches to it once it answered, the page loading again; false, said in a notice, when it did not answer or refused).
|
|
69
69
|
|
|
70
70
|
## Phones and tablets
|
|
71
71
|
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
|
|
|
23
23
|
界面上新增的一切都来自包里的 **Web 扩展**,和 pi 的扩展同一套机制、同一套叫法:
|
|
24
24
|
|
|
25
25
|
- **包**就是 pi 的包。`package.json` 的 `pi` 里,`extensions` 是给 Ta(终端和服务端)的扩展,`web` 是给这个页面的扩展;没有声明时取 `web/` 目录下的模块。包放在 `~/.ta/agent/extensions/<名字>/`(项目的 `.ta/extensions/`)即可生效,也可以用 `ta install` 安装。
|
|
26
|
-
- **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerCodeRenderer`(把回复和 `ui.Markdown` 里某种语言的代码块画成扩展自己的卡片,组件拿到 `{ code, language, closed, send, answer }`,流式时 `closed` 为假,`send` 把文字作为用户消息发到代码块所在的对话(页面的 `ui.Markdown` 里没有;旧版 App 不传,用 `sendUserMessage`),`answer` 是用户在这条回复之后说的话(点选或打字回答后才有,各设备一致,代码块给的选择就算做了;旧版 App 没有这个键);抛错时显示为代码,如 `@celljs/ta-glance` 的 `ta-glance` 卡片)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerToolRenderer`(照 pi 的同名接口传一个 resolver `(toolName, next) => renderer`,决定任意工具的调用在对话里怎么读:`renderCall(args)` 给出页面语言的动词、对象和可选的小图标,代替工具名;`next()` 是后面的 resolver 的结果)、`registerSettings`(设置里的一个分区,排在 Ta 自己的分区之后:每行是标签、说明和扩展自己画的控件,值用 `storage` 保存;标签为空的行是自带说明的整块面板,靠 `search` 被搜到)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md;任务带 `remove` 和 `removeHint` 时,列表里可以左滑删除、多选后批量删除,询问统一由 `ui.removeTasks` 做)、`ui.SelectCheck` / `ui.SelectBar`(列表多选时行首的圆形勾选和列表底部的操作栏,样式与页面一致)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里的条目,每个都是一个图标方块(每页 4×2,多了左右滑动翻页):`setting: true` 在名字下显示当前值(`detail`),`toggle: true` 是开关(`checked` 表示开着,图标点亮,点了不关菜单),条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.Game3D`(Three.js 3D 游戏:`setup(context)` 拿到渲染器、场景、相机和 OrbitControls,往场景里放东西并返回每帧要做的事;同样懒加载、休眠、卸载时释放场景和 WebGL 上下文)、`ui.FullScreen`(盖住整个页面:外壳、它的顶栏和侧栏都在下面,铺到刘海和底部横条下,在桌面版标题栏之下、键盘之上;触摸全归它,屏幕边缘也不会拉出 Ta 的面板;给横屏游戏、能走进去的世界用,旧版 App 没有它时用 `??` 退回原处显示)、`data-own-gestures`(元素上的属性:从它开始的触摸归它,Ta 的滑动只从屏幕边缘开始,长按不出菜单;游戏自动带上)、`ui.Game`(Phaser 4 游戏:页面自带的游戏引擎,第一次开始游戏时才加载;填满父元素,看不见时休眠,卸载时销毁,键盘只在游戏获得焦点时归它,主题颜色放在游戏的 registry 里,见 docs/design/ta-games.md)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`ui.ImageViewer`(看图:先完整显示且不超过原始像素,双指或触控板捏合、Ctrl/⌘ 加滚轮、双击或双点缩放,放大后拖动或滚动,底部是 − / 比例 / + / 适应窗口 / 实际大小;给了 `onPrevious` / `onNext` 时两侧有上一张、下一张按钮,未放大时 ← → 也能切换;工作台的图片预览和对话里的大图用的都是它)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令。扩展以用户身份发的消息,经 `sendUserMessage`、`server.prompt`、代码块的 `send` 或宿主的 `prompt`,都在 `<context>` 末行带上来源 `[ta:from 包名]`(`TaMessageSource`),对话里在气泡上方显示包的名字和图标)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`openChat`(按会话文件打开对话,和对话列表一样:先显示页面或设备上已有的内容,已关闭的一次往返重新打开;没有这个对话时返回 false)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown,麦克风和按住说话也一样;输入框的 `commands` 让 `/` 列出在 `cwd` 新开对话时会有的命令,`voiceSends`、`onTalkSent`、`onListening`、`working` / `onStop`、`after` 和分身的输入框一样:听到的话直接发出、知道哪句是说的以便朗读回答、正在听、正在回答时发送键变成停止、右侧放自己的按钮)、`ui.HoldToTalk`(按住说话的按钮,和输入框的“按住 说话”条一样:页面变暗、用页面的识别器听,可滑到“取消”“编辑”,松手交出文字;页面不能识别语音时不显示)、`ui.voice`(`canListen` / `canSpeak` / `speak` / `hush`:用设置里的声音朗读)、视图的 `send`(对话式页面接收别的扩展发来的一条消息,就像在它的输入框里输入;分身页面有它,回答经 `preview` 读到)、`ui.useChatScroll`(和对话一样的滚动:停在底部时跟随新消息,往上翻看时不会被拉回、正在看的内容不跳,点开的部分留在原处;`sent` 是用户发出的消息数,多一条就回到底部)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.notifySession`(像聊天软件那样告诉用户某个对话说了什么:用户正在看它时不提醒,分身跟进的任务交给分身,除非它在提问;手机和平板上不弹窗,由列表和“对话”标签上的未读黄点告诉;电脑上页面在前台时是带对话头像和名字的横幅,点一下打开对话,`options` 是可点的回答,同一个回答从各个页面只发一次;页面不在前台时是系统通知,回复是静音的;没有系统通知时,提问和失败留一条横幅等用户回来)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个人资料的 Cookie 导入内置浏览器;也可清除内置浏览器数据)、`registerChatIcon`(扩展自己的、不是智能体的对话(如它写的简报、它问的问题)在列表和通知里的图标,代替目录的字母)、`registerHomeItems` / `ui.useHomeItems`(分身主页里分身下方的行,放用户每天要看的东西,如每日简报)、`ui.pinChat`(按会话文件把对话置顶或取消,和用户点置顶一样)、`registerSessionMenu`(列表里对话的菜单(右键或长按一行)中扩展自己的一组条目)、`ui.custom`(像 pi 的 `ctx.ui.custom` 那样,不论用户在哪,把扩展的组件盖在页面上,扩展停止时一并关闭)、`ui.useSessions` / `ui.useSavedSessions`(ta serve 打开的会话和最近保存的对话,和页面的列表是同一份,不必自己轮询)、`ui.useAsks`(等用户决定的对话,和对话列表顶部“待你决定”是同一份:上一轮在问(`TaSessionInfo.asking`)而用户还没回答也没点“不用决定了”,或有对话框在等;最新的在前)、`ui.Face` / `ui.GroupFace`(不是 Ta 的成员的脸,和频道里的智能体一样,同一个 `seed` 在各设备上相同;群组的叠放头像)、`ui.Stack`(像列表推入点开的内容那样压在页面上的一层,手机上从左边缘滑动和系统返回也能关闭)、`ui.useBusy`(等待 ta serve 的操作显示忙碌,点了就知道生效了)、`ui.Switch`(设置里的开关,`onChange` 返回 Promise 时先显示新状态,失败再退回),以及页面的 `React` 和 ta serve 的服务:`server`(会话,pi 的 RPC 命令)、`workspace`(目录里的文件与命令)、`terminals`(终端)、`packages`(包),以及经中继与其他 Ta 共享的房间 `rooms`(发生的事经 `onRoomEvent` 收到,扩展停止时不再收到)(类型见 `WebExtensionAPI`)。
|
|
26
|
+
- **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerCodeRenderer`(把回复和 `ui.Markdown` 里某种语言的代码块画成扩展自己的卡片,组件拿到 `{ code, language, closed, send, answer }`,流式时 `closed` 为假,`send` 把文字作为用户消息发到代码块所在的对话(页面的 `ui.Markdown` 里没有;旧版 App 不传,用 `sendUserMessage`),`answer` 是用户在这条回复之后说的话(点选或打字回答后才有,各设备一致,代码块给的选择就算做了;旧版 App 没有这个键);抛错时显示为代码,如 `@celljs/ta-glance` 的 `ta-glance` 卡片)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerToolRenderer`(照 pi 的同名接口传一个 resolver `(toolName, next) => renderer`,决定任意工具的调用在对话里怎么读:`renderCall(args)` 给出页面语言的动词、对象和可选的小图标,代替工具名;`next()` 是后面的 resolver 的结果)、`registerSettings`(设置里的一个分区,排在 Ta 自己的分区之后:每行是标签、说明和扩展自己画的控件,值用 `storage` 保存;标签为空的行是自带说明的整块面板,靠 `search` 被搜到)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md;任务带 `remove` 和 `removeHint` 时,列表里可以左滑删除、多选后批量删除,询问统一由 `ui.removeTasks` 做)、`ui.SelectCheck` / `ui.SelectBar`(列表多选时行首的圆形勾选和列表底部的操作栏,样式与页面一致)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里的条目,每个都是一个图标方块(每页 4×2,多了左右滑动翻页):`setting: true` 在名字下显示当前值(`detail`),`toggle: true` 是开关(`checked` 表示开着,图标点亮,点了不关菜单),条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.Game3D`(Three.js 3D 游戏:`setup(context)` 拿到渲染器、场景、相机和 OrbitControls,往场景里放东西并返回每帧要做的事;同样懒加载、休眠、卸载时释放场景和 WebGL 上下文)、`ui.FullScreen`(盖住整个页面:外壳、它的顶栏和侧栏都在下面,铺到刘海和底部横条下,在桌面版标题栏之下、键盘之上;触摸全归它,屏幕边缘也不会拉出 Ta 的面板;给横屏游戏、能走进去的世界用,旧版 App 没有它时用 `??` 退回原处显示)、`data-own-gestures`(元素上的属性:从它开始的触摸归它,Ta 的滑动只从屏幕边缘开始,长按不出菜单;游戏自动带上)、`ui.Game`(Phaser 4 游戏:页面自带的游戏引擎,第一次开始游戏时才加载;填满父元素,看不见时休眠,卸载时销毁,键盘只在游戏获得焦点时归它,主题颜色放在游戏的 registry 里,见 docs/design/ta-games.md)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`ui.ImageViewer`(看图:先完整显示且不超过原始像素,双指或触控板捏合、Ctrl/⌘ 加滚轮、双击或双点缩放,放大后拖动或滚动,底部是 − / 比例 / + / 适应窗口 / 实际大小;给了 `onPrevious` / `onNext` 时两侧有上一张、下一张按钮,未放大时 ← → 也能切换;工作台的图片预览和对话里的大图用的都是它)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令。扩展以用户身份发的消息,经 `sendUserMessage`、`server.prompt`、代码块的 `send` 或宿主的 `prompt`,都在 `<context>` 末行带上来源 `[ta:from 包名]`(`TaMessageSource`),对话里在气泡上方显示包的名字和图标)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`openChat`(按会话文件打开对话,和对话列表一样:先显示页面或设备上已有的内容,已关闭的一次往返重新打开;没有这个对话时返回 false)、`openLink`(像点回复里的链接一样打开:先问扩展的打开方式,比如分享和智能体卡片的链接,没有就在工作台的浏览器里打开)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown,麦克风和按住说话也一样;输入框的 `commands` 让 `/` 列出在 `cwd` 新开对话时会有的命令,`voiceSends`、`onTalkSent`、`onListening`、`working` / `onStop`、`after` 和分身的输入框一样:听到的话直接发出、知道哪句是说的以便朗读回答、正在听、正在回答时发送键变成停止、右侧放自己的按钮)、`ui.HoldToTalk`(按住说话的按钮,和输入框的“按住 说话”条一样:页面变暗、用页面的识别器听,可滑到“取消”“编辑”,松手交出文字;页面不能识别语音时不显示)、`ui.voice`(`canListen` / `canSpeak` / `speak` / `hush`:用设置里的声音朗读)、视图的 `send`(对话式页面接收别的扩展发来的一条消息,就像在它的输入框里输入;分身页面有它,回答经 `preview` 读到)、`ui.useChatScroll`(和对话一样的滚动:停在底部时跟随新消息,往上翻看时不会被拉回、正在看的内容不跳,点开的部分留在原处;`sent` 是用户发出的消息数,多一条就回到底部)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.notifySession`(像聊天软件那样告诉用户某个对话说了什么:用户正在看它时不提醒,分身跟进的任务交给分身,除非它在提问;手机和平板上不弹窗,由列表和“对话”标签上的未读黄点告诉;电脑上页面在前台时是带对话头像和名字的横幅,点一下打开对话,`options` 是可点的回答,同一个回答从各个页面只发一次;页面不在前台时是系统通知,回复是静音的;没有系统通知时,提问和失败留一条横幅等用户回来)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个人资料的 Cookie 导入内置浏览器;也可清除内置浏览器数据)、`registerChatIcon`(扩展自己的、不是智能体的对话(如它写的简报、它问的问题)在列表和通知里的图标,代替目录的字母)、`registerHomeItems` / `ui.useHomeItems`(分身主页里分身下方的行,放用户每天要看的东西,如每日简报)、`registerInitiative`(页面自己替用户做事(如分身开始一项任务)时走多远,由管用户信任的扩展回答,只问第一个注册的;ta-initiative 用它)、`ui.pinChat`(按会话文件把对话置顶或取消,和用户点置顶一样)、`registerSessionMenu`(列表里对话的菜单(右键或长按一行)中扩展自己的一组条目)、`ui.custom`(像 pi 的 `ctx.ui.custom` 那样,不论用户在哪,把扩展的组件盖在页面上,扩展停止时一并关闭)、`ui.useSessions` / `ui.useSavedSessions`(ta serve 打开的会话和最近保存的对话,和页面的列表是同一份,不必自己轮询)、`ui.useAsks`(等用户决定的对话,和对话列表顶部“待你决定”是同一份:上一轮在问(`TaSessionInfo.asking`)而用户还没回答也没点“不用决定了”,或有对话框在等;最新的在前)、`ui.Face` / `ui.GroupFace`(不是 Ta 的成员的脸,和频道里的智能体一样,同一个 `seed` 在各设备上相同;群组的叠放头像)、`ui.Stack`(像列表推入点开的内容那样压在页面上的一层,手机上从左边缘滑动和系统返回也能关闭)、`ui.useBusy`(等待 ta serve 的操作显示忙碌,点了就知道生效了)、`ui.Switch`(设置里的开关,`onChange` 返回 Promise 时先显示新状态,失败再退回),以及页面的 `React` 和 ta serve 的服务:`server`(会话,pi 的 RPC 命令)、`workspace`(目录里的文件与命令)、`terminals`(终端)、`packages`(包),以及经中继与其他 Ta 共享的房间 `rooms`(发生的事经 `onRoomEvent` 收到,扩展停止时不再收到)(类型见 `WebExtensionAPI`)。
|
|
27
27
|
- **文件的字节**:`pi.files` 给出工作区的文件字节。页面由 ta serve 自己提供时 `byUrl` 为真,直接用 `workspace.fileUrl` 的地址加载就行;手机应用里、或页面经中继打开时,那个地址在页面里加载不到,`byUrl` 为假,`pi.files.read(url)` 经 WebSocket 取回 `{ type, size, data }`(端到端加密,中继读不到)。`@celljs/ta-workspace` 的预览就靠它:图片、视频、声音、PDF 做成 `blob:`,HTML 报告按文件文本放进沙框。
|
|
28
28
|
- **用自然语言做包**:内置扩展 [@celljs/ta-extensions](../ta-extensions/README.md) 带技能 `ta-package`(终端里的 Ta 也有),并在导航栏加了"扩展"页(一句话做扩展、导出导入),写明了包的格式、Web 扩展接口和验证步骤。当前对话每次回复结束,页面重新读取 Web 扩展:新的加载、改过的重新加载、删掉的卸载;工具有变化时,用同一个会话文件重新打开这段对话(只限本页打开的对话),包有改动时让会话重新加载 pi 扩展。页面重新显示时也会检查一次(包也可能在终端里改)。
|
|
29
29
|
- **稳定**:每个扩展注册的东西归它自己,卸载时一并撤掉;一个扩展加载失败或渲染出错,只在它自己的位置显示错误,不影响页面和其他扩展。
|
|
@@ -51,7 +51,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
|
|
|
51
51
|
|
|
52
52
|
### 登录模型服务、工作目录与手机
|
|
53
53
|
|
|
54
|
-
- **模型账号**:和终端里 pi 的 `/login` 一样,可以用账号(OAuth,Claude、ChatGPT 这类订阅)或 API Key 登录模型服务。登录在 ta serve 上进行(`TaAuthServer`):要打开的登录页、设备码、要填的 Key 只发给发起登录的页面;凭据存在 ta serve 所在电脑的 `auth.json
|
|
54
|
+
- **模型账号**:和终端里 pi 的 `/login` 一样,可以用账号(OAuth,Claude、ChatGPT 这类订阅)或 API Key 登录模型服务。登录在 ta serve 上进行(`TaAuthServer`):要打开的登录页、设备码、要填的 Key 只发给发起登录的页面;凭据存在 ta serve 所在电脑的 `auth.json`,不回到浏览器。API Key 一组最上面的“添加自定义模型服务”填接口格式(OpenAI Chat Completions / Responses、Anthropic Messages、Google Gemini)、服务地址、Key(本机服务可不填)和模型,模型可以从服务读取后点选;折叠的“高级设置”对这个服务的所有模型生效:上下文窗口、最大输出(可写 200k、1m)、会先思考、能看图片,以及请求头(值只保存在 ta serve,不改就留空);各模型原本不同的字段不改就各自保留。保存后在 + 菜单里就能选,点这一行可修改或删除。没有可用的模型时(`CELL_TA_NOT_SIGNED_IN`),页面直接打开登录页,而不是显示 pi 关于 `/login` 的提示;桌面应用第一次启动时也一样。
|
|
55
55
|
- **工作目录**:没指定目录时,新对话和分身在 ta serve 的工作目录里打开。"打开工作目录…"(`TaServer.setWorkingDirectory`)对所有客户端生效,跨重启保留;已经打开的对话不动。
|
|
56
56
|
- **登录页**:ta serve 配了账号登录(GitHub、Google、微信、OpenID Connect)时,登录页先列出这些按钮(`GET /sign-in`),下面仍可以粘贴 token;没被允许的账号回来后显示要等主人允许。ta serve 不在这台电脑上时(远程地址、经 Relay、手机应用),模型账号的 OAuth 登录提示把浏览器最后打开的 `localhost` 地址粘贴回来。
|
|
57
57
|
- **在手机上使用**:经 Relay 配对一台设备([@celljs/ta-relay](../ta-relay/README.md)),配对链接显示成二维码(ta-relay 的 `QrCode` 自己画,没有依赖),只显示一次;下面列出已配对的设备和 ta serve 是否连着 Relay,可以取消配对。默认 Relay 是 `https://relay.cellbang.com`。
|
|
@@ -65,7 +65,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
|
|
|
65
65
|
- **小组件**(`location: 'board'` 的视图):手机上在第一个标签上从左往右划,小组件面板从左侧滑入(已经划开的列表行上从左边缘开始);电脑和平板上是导轨底部的按钮。"编辑"里可以移除、加回卡片,拖动右侧把手排序,排列存在用户数据里(`board`)。内置的卡片有分身的任务、快捷打开和定时任务的"接下来"。
|
|
66
66
|
- **按需启动**:包的 `pi.webActivation: 'open'`,或免安装打开的临时扩展(`origin: 'temporary'`),在打开它的页面时才加载;离开后在后台继续运行、页面原样保留(`KeptPages`),再次打开没有等待;在后台超过保留时间(设置 → 扩展,默认 5 分钟)或后台超过 3 个时停止。这类扩展的页面不进导航栏,在快捷打开里找到。
|
|
67
67
|
- **分享**:`ui.shareExtension` 打开分享弹窗(二维码、复制、系统分享),已发布的扩展给来源,本机的经中继端到端发送、不存储(`TaRelayServer.sharePackage`);`ui.openShared` 打开扩展链接,先确认。
|
|
68
|
-
- 扩展接口:`ui.usePages()`(所有页面及其状态、位置、最近使用时间、临时扩展信息)、`ui.showView`(按需启动的先启动,扩展名打开它的第一个页面)、`ui.stopExtension`、`ui.forgetPage`、`pi.openTemporary(source, from)`、`ui.useContextMenu()`(和页面一样的右键/长按菜单)、`ui.QrCode`、`ui.scanCode` 和 `ui.scan`(只在 Ta 手机应用里;`ui.scan`
|
|
68
|
+
- 扩展接口:`ui.usePages()`(所有页面及其状态、位置、最近使用时间、临时扩展信息)、`ui.showView`(按需启动的先启动,扩展名打开它的第一个页面)、`ui.stopExtension`、`ui.forgetPage`、`pi.openTemporary(source, from)`、`ui.useContextMenu()`(和页面一样的右键/长按菜单)、`ui.QrCode`、`ui.scanCode` 和 `ui.scan`(只在 Ta 手机应用里;`ui.scan` 就是页面自己的“扫一扫”,扫完打开二维码里的内容)、`ui.connect(link)`(按配对链接连到另一个 Ta,`ta pair` 或让你进入的 Ta 给的设备,对方回答后切过去、页面重新加载;没回答或被拒绝时返回 false 并提示原因)。
|
|
69
69
|
|
|
70
70
|
## 手机与平板
|
|
71
71
|
|
|
@@ -99,8 +99,9 @@ let AssistantWebExtension = class AssistantWebExtension {
|
|
|
99
99
|
remove,
|
|
100
100
|
asking: task => {
|
|
101
101
|
var _a;
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const { sessions, saved } = this.workbench.state;
|
|
103
|
+
const entry = ChatAskUtil.entryOf(sessions, saved, task);
|
|
104
|
+
return entry && ((_a = ChatAskUtil.asking(entry, this.persisted.get(LET_GO_ASKS))) === null || _a === void 0 ? void 0 : _a.question);
|
|
104
105
|
},
|
|
105
106
|
watchAsking: listener => {
|
|
106
107
|
const stops = [this.workbench.subscribe(() => listener()), this.persisted.subscribe(() => listener())];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The double starting a task it hands out: by default without asking, as pi asks nothing (Settings.confirmTasks). */
|
|
2
2
|
export const START_TASK = {
|
|
3
3
|
id: 'double.start-task',
|
|
4
|
-
title: { en: 'The double starts the tasks it hands out', zh: '分身开始它交出的任务' },
|
|
4
|
+
title: { en: 'The double starts the tasks it hands out', zh: '分身开始它交出的任务', tw: '分身開始它交出的任務', ja: '分身が割り当てたタスクを開始' },
|
|
5
5
|
reversible: true,
|
|
6
6
|
level: 'act',
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TA_DOUBLE_FILE } from '@celljs/ta-protocol';
|
|
1
|
+
import { TA_DOUBLE_FILE, TA_DOUBLE_LOOK } from '@celljs/ta-protocol';
|
|
2
2
|
import { GAITS } from '../avatar/dino-motion.js';
|
|
3
3
|
import { DinoSpecies } from '../avatar/dino-species.js';
|
|
4
4
|
import { StateUtil } from '../state/state-protocol.js';
|
|
@@ -6,7 +6,7 @@ import { StateUtil } from '../state/state-protocol.js';
|
|
|
6
6
|
export const ASSISTANT_NAME_STATE = { key: 'assistant.name', tier: 'user', initial: '', parse: StateUtil.string };
|
|
7
7
|
/** The kind of dinosaur the double is and how it walks: the figure of the account follows it, in every browser. */
|
|
8
8
|
export const ASSISTANT_SPECIES_STATE = {
|
|
9
|
-
key:
|
|
9
|
+
key: TA_DOUBLE_LOOK.key,
|
|
10
10
|
tier: 'user',
|
|
11
11
|
initial: DinoSpecies.DEFAULT,
|
|
12
12
|
parse: value => DinoSpecies.IDS.find(id => id === value),
|
|
@@ -59,8 +59,9 @@ export function AccessSettings({ info, onChange }) {
|
|
|
59
59
|
await onChange().catch(() => undefined);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
// The sign-in goes through the page's own ta serve: not from the app, nor for another computer
|
|
63
|
-
|
|
62
|
+
// The sign-in goes through the page's own ta serve: not from the app, nor for another computer, nor at an address of
|
|
63
|
+
// this machine alone (the desktop app's), which the provider sends no one back to and where the token lets in anyway.
|
|
64
|
+
const here = !WorkbenchUtil.isApp() && !WorkbenchUtil.loopback() && workbench.host === WorkbenchUtil.serverOf({ token: '' }, location.host);
|
|
64
65
|
// Behind a gateway, only its administrators let accounts in; everyone sees the browsers of their own.
|
|
65
66
|
const manage = info.canManage !== false;
|
|
66
67
|
const bind = (provider) => run(async () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TaLanguageUtil } from '@celljs/ta-protocol';
|
|
1
2
|
import { Check, ChevronRight, Download, FolderOpen, Info, Keyboard, KeyRound, Languages, LogOut, Monitor, Palette, Puzzle, Settings2, Smartphone, Sparkles, } from 'lucide-react';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { useDevice } from '../device/device.js';
|
|
@@ -21,8 +22,7 @@ const THEMES = [
|
|
|
21
22
|
];
|
|
22
23
|
const LANGUAGES = [
|
|
23
24
|
['system', 'ta.settings.language.system'],
|
|
24
|
-
[
|
|
25
|
-
['en-US', 'English'],
|
|
25
|
+
...TaLanguageUtil.ALL.map(language => [language, TaLanguageUtil.NAMES[language]]),
|
|
26
26
|
];
|
|
27
27
|
/**
|
|
28
28
|
* The entries of the account and of the settings, in groups: the settings, the packages and the keys; the model
|
|
@@ -50,6 +50,7 @@ import { ShareHost } from './share-dialog.js';
|
|
|
50
50
|
import { DOUBLE_PAGE, SideListUtil } from './side-lists.js';
|
|
51
51
|
import { paneStyle, Sash, usePane } from './split-pane.js';
|
|
52
52
|
import { SurfaceFlyout } from './surface-flyout.js';
|
|
53
|
+
import { usePageVisible } from './use-seen-chats.js';
|
|
53
54
|
import { WorkbenchToggleContext } from './workbench-toggle.js';
|
|
54
55
|
import { SignIn, useDocument } from './workbench-view.js';
|
|
55
56
|
/**
|
|
@@ -267,6 +268,9 @@ function AppShell() {
|
|
|
267
268
|
React.useEffect(() => host.setConversationShown(conversationShown), [host, conversationShown]);
|
|
268
269
|
// What the user has seen is kept here, whichever list or tab is out: one read from the agents' list is seen too.
|
|
269
270
|
const { seen: seenChats, looking } = useSeenConversations(workbench.sessions, conversationShown ? store === null || store === void 0 ? void 0 : store.sessionId : undefined, (view === null || view === void 0 ? void 0 : view.id) === DOUBLE_PAGE && settings === undefined && (!phone || screenOpen || view === tabView));
|
|
271
|
+
// The others in the same Ta see who looks at a conversation with them (TaSessionInfo.people), while the page is seen.
|
|
272
|
+
const pageVisible = usePageVisible();
|
|
273
|
+
React.useEffect(() => bench.presence.look(pageVisible ? looking : undefined), [bench, pageVisible, looking]);
|
|
270
274
|
const state = useInject(TaState);
|
|
271
275
|
const { pageShown } = extensions;
|
|
272
276
|
// biome-ignore lint/correctness/useExhaustiveDependencies: follows the pages shown
|
|
@@ -4,7 +4,7 @@ export declare namespace AuthUtil {
|
|
|
4
4
|
function key(provider: TaAuthProvider): string;
|
|
5
5
|
/** Some provider is signed in, one way or another: Ta has models. */
|
|
6
6
|
function signedIn(providers: TaAuthProvider[]): boolean;
|
|
7
|
-
/** What can be signed in to from here, matching `words`: accounts
|
|
7
|
+
/** What can be signed in to from here, matching `words`: accounts, then keys; in each those the user added, then subscriptions, then by name. */
|
|
8
8
|
function offered(providers: TaAuthProvider[], words?: string): {
|
|
9
9
|
accounts: TaAuthProvider[];
|
|
10
10
|
keys: TaAuthProvider[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowLeft, Check, ChevronRight, Copy, ExternalLink, KeyRound, LogOut, Search, X } from 'lucide-react';
|
|
1
|
+
import { ArrowLeft, Check, ChevronRight, Copy, ExternalLink, KeyRound, LogOut, Plus, Search, X } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useNotices, useWorkbench } from '../hooks.js';
|
|
@@ -6,6 +6,7 @@ import { useT } from '../i18n/use-t.js';
|
|
|
6
6
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
7
7
|
import { AuthPicture } from './auth-pictures.js';
|
|
8
8
|
import { Callout } from './callout.js';
|
|
9
|
+
import { CustomProviderForm } from './custom-provider-view.js';
|
|
9
10
|
import { EmptyState } from './empty-state.js';
|
|
10
11
|
import { Icon, IconButton } from './icon.js';
|
|
11
12
|
import { PictureCards } from './picture.js';
|
|
@@ -21,11 +22,11 @@ export var AuthUtil;
|
|
|
21
22
|
return providers.some(provider => provider.configured);
|
|
22
23
|
}
|
|
23
24
|
AuthUtil.signedIn = signedIn;
|
|
24
|
-
/** What can be signed in to from here, matching `words`: accounts
|
|
25
|
+
/** What can be signed in to from here, matching `words`: accounts, then keys; in each those the user added, then subscriptions, then by name. */
|
|
25
26
|
function offered(providers, words = '') {
|
|
26
27
|
const query = words.trim().toLowerCase();
|
|
27
28
|
const shown = providers.filter(provider => provider.interactive && (!query || `${provider.name} ${provider.id}`.toLowerCase().includes(query)));
|
|
28
|
-
const byName = (a, b) => Number(b.subscription) - Number(a.subscription) || a.name.localeCompare(b.name);
|
|
29
|
+
const byName = (a, b) => Number(!!b.custom) - Number(!!a.custom) || Number(b.subscription) - Number(a.subscription) || a.name.localeCompare(b.name);
|
|
29
30
|
return {
|
|
30
31
|
accounts: shown.filter(provider => provider.type === 'oauth').sort(byName),
|
|
31
32
|
keys: shown.filter(provider => provider.type === 'api_key').sort(byName),
|
|
@@ -201,17 +202,23 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
201
202
|
function ProviderRow({ provider, onPick, onSignOut, plain }) {
|
|
202
203
|
var _a, _b;
|
|
203
204
|
const t = useT();
|
|
204
|
-
const kind = provider.
|
|
205
|
+
const kind = provider.custom
|
|
206
|
+
? t('ta.auth.custom.kind')
|
|
207
|
+
: provider.type === 'api_key'
|
|
208
|
+
? t('ta.auth.apiKey')
|
|
209
|
+
: provider.subscription
|
|
210
|
+
? t('ta.auth.subscription')
|
|
211
|
+
: t('ta.auth.account');
|
|
205
212
|
const signedIn = ((_a = provider.configured) === null || _a === void 0 ? void 0 : _a.type) === provider.type;
|
|
206
213
|
const source = (_b = provider.configured) === null || _b === void 0 ? void 0 : _b.source;
|
|
207
214
|
return (React.createElement("div", { className: "ta-auth-row" },
|
|
208
215
|
React.createElement("button", { type: "button", className: "ta-auth-item", onClick: onPick },
|
|
209
216
|
React.createElement("span", { className: "ta-auth-name" }, provider.name),
|
|
210
|
-
(!plain || provider.subscription) && React.createElement("span", { className: "ta-auth-kind" }, kind),
|
|
217
|
+
(!plain || provider.subscription || provider.custom) && React.createElement("span", { className: "ta-auth-kind" }, kind),
|
|
211
218
|
signedIn && (React.createElement("span", { className: "ta-auth-on", title: source },
|
|
212
219
|
React.createElement(Icon, { icon: Check, size: 13 }),
|
|
213
220
|
" ",
|
|
214
|
-
source && !/credential|OAuth/i.test(source) ? source : t('ta.auth.signedIn'))),
|
|
221
|
+
source && !provider.custom && !/credential|OAuth/i.test(source) ? source : t('ta.auth.signedIn'))),
|
|
215
222
|
React.createElement(Icon, { icon: ChevronRight, size: 15 })),
|
|
216
223
|
onSignOut && provider.stored && signedIn && React.createElement(IconButton, { icon: LogOut, label: t('ta.auth.signOut'), onClick: onSignOut })));
|
|
217
224
|
}
|
|
@@ -225,6 +232,8 @@ export function AuthPanel({ onSignedIn, kinds }) {
|
|
|
225
232
|
const [words, setWords] = React.useState('');
|
|
226
233
|
/** On the first page: which way the user chose, before the providers of that way. */
|
|
227
234
|
const [kind, setKind] = React.useState();
|
|
235
|
+
/** A provider the user adds by its address (`new`), or one added so, being changed. */
|
|
236
|
+
const [editing, setEditing] = React.useState();
|
|
228
237
|
const back = React.useCallback(() => setPicked(undefined), []);
|
|
229
238
|
const done = React.useCallback(() => {
|
|
230
239
|
if (picked) {
|
|
@@ -234,6 +243,17 @@ export function AuthPanel({ onSignedIn, kinds }) {
|
|
|
234
243
|
reload();
|
|
235
244
|
onSignedIn === null || onSignedIn === void 0 ? void 0 : onSignedIn();
|
|
236
245
|
}, [picked, notices, t, reload, onSignedIn]);
|
|
246
|
+
if (editing) {
|
|
247
|
+
return (React.createElement(CustomProviderForm, { provider: editing === 'new' ? undefined : editing, onBack: () => {
|
|
248
|
+
setEditing(undefined);
|
|
249
|
+
reload();
|
|
250
|
+
}, onSaved: saved => {
|
|
251
|
+
notices.notify(t('ta.auth.custom.saved', { name: saved.name }), { level: 'success' });
|
|
252
|
+
setEditing(undefined);
|
|
253
|
+
reload();
|
|
254
|
+
onSignedIn === null || onSignedIn === void 0 ? void 0 : onSignedIn();
|
|
255
|
+
} }));
|
|
256
|
+
}
|
|
237
257
|
if (picked) {
|
|
238
258
|
return React.createElement(AuthFlow, { provider: picked, onDone: done, onBack: back });
|
|
239
259
|
}
|
|
@@ -257,12 +277,20 @@ export function AuthPanel({ onSignedIn, kinds }) {
|
|
|
257
277
|
});
|
|
258
278
|
return (React.createElement(PictureCards, { cards: [card('oauth', t('ta.auth.accounts'), t('ta.auth.accountsExample')), card('api_key', t('ta.auth.keys'), t('ta.auth.keysExample'))] }));
|
|
259
279
|
}
|
|
280
|
+
const edit = (provider) => void bench.auth.listCustomProviders().then(list => { var _a; return setEditing((_a = list.find(each => each.id === provider.id)) !== null && _a !== void 0 ? _a : 'new'); }, error => notices.error(error));
|
|
260
281
|
const offered = AuthUtil.offered(providers, words);
|
|
261
282
|
const accounts = kind === 'api_key' ? [] : offered.accounts;
|
|
262
283
|
const keys = kind === 'oauth' ? [] : offered.keys;
|
|
263
|
-
const group = (title, list) => list.length > 0 && (React.createElement("section", { className: "ta-auth-group" },
|
|
284
|
+
const group = (title, list, first) => (list.length > 0 || first) && (React.createElement("section", { className: "ta-auth-group" },
|
|
264
285
|
title && React.createElement("h3", null, title),
|
|
265
|
-
|
|
286
|
+
first,
|
|
287
|
+
list.map(provider => (React.createElement(ProviderRow, { key: AuthUtil.key(provider), provider: provider, plain: kind !== undefined, onPick: () => (provider.custom ? edit(provider) : setPicked(provider)), onSignOut: () => void signOut(provider) })))));
|
|
288
|
+
// Whatever is searched: a service not in the list is one to add.
|
|
289
|
+
const add = kind !== 'oauth' && (React.createElement("button", { type: "button", className: "ta-auth-item ta-custom-add", onClick: () => setEditing('new') },
|
|
290
|
+
React.createElement(Icon, { icon: Plus, size: 15 }),
|
|
291
|
+
React.createElement("span", { className: "ta-auth-name" }, t('ta.auth.custom.add')),
|
|
292
|
+
React.createElement("span", { className: "ta-auth-note" }, t('ta.auth.custom.addHint')),
|
|
293
|
+
React.createElement(Icon, { icon: ChevronRight, size: 15 })));
|
|
266
294
|
return (React.createElement("div", { className: "ta-auth-panel" },
|
|
267
295
|
kind && (React.createElement("div", { className: "ta-auth-flow-head" },
|
|
268
296
|
React.createElement(IconButton, { icon: ArrowLeft, label: t('ta.auth.back'), onClick: () => setKind(undefined) }),
|
|
@@ -272,8 +300,8 @@ export function AuthPanel({ onSignedIn, kinds }) {
|
|
|
272
300
|
React.createElement("input", { placeholder: t('ta.auth.search'), value: words, onChange: event => setWords(event.target.value) })),
|
|
273
301
|
React.createElement("div", { className: "ta-auth-list" },
|
|
274
302
|
group(kind ? '' : t('ta.auth.accounts'), accounts),
|
|
275
|
-
group(kind ? '' : t('ta.auth.keys'), keys),
|
|
276
|
-
accounts.length + keys.length === 0 && React.createElement(EmptyState, { compact: true, title: t('ta.auth.none') }))));
|
|
303
|
+
group(kind ? '' : t('ta.auth.keys'), keys, add),
|
|
304
|
+
accounts.length + keys.length === 0 && !add && React.createElement(EmptyState, { compact: true, title: t('ta.auth.none') }))));
|
|
277
305
|
}
|
|
278
306
|
/** The model accounts, over the page (the gear menu). */
|
|
279
307
|
export function AuthDialog({ onClose }) {
|
|
@@ -29,6 +29,14 @@ export declare namespace ChatAskUtil {
|
|
|
29
29
|
function letGo(before: LetGoAsks, file: string, at: number): LetGoAsks;
|
|
30
30
|
/** What it still asks the user: none once answered or let go. */
|
|
31
31
|
function asking(entry: AskingEntry, letGo: LetGoAsks): TaAsking | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* What the lists know of the conversation of a session: as the server tells it while open, by its id or its file;
|
|
34
|
+
* from its file once closed (closed while idle, what it asked stays there, as the saved ones of the chats show).
|
|
35
|
+
*/
|
|
36
|
+
function entryOf(sessions: readonly TaSessionInfo[], saved: readonly TaSavedSessionInfo[], session: {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
sessionFile?: string;
|
|
39
|
+
}): AskingEntry | undefined;
|
|
32
40
|
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
33
41
|
function waits(entry: AskingEntry, letGo: LetGoAsks): boolean;
|
|
34
42
|
/** How many of the conversations the list shows wait for the user: the count on the tab of the chats. */
|
|
@@ -53,6 +53,16 @@ export var ChatAskUtil;
|
|
|
53
53
|
return asking && asking.at > ((_a = letGo[fileOf(entry)]) !== null && _a !== void 0 ? _a : -1) ? asking : undefined;
|
|
54
54
|
}
|
|
55
55
|
ChatAskUtil.asking = asking;
|
|
56
|
+
/**
|
|
57
|
+
* What the lists know of the conversation of a session: as the server tells it while open, by its id or its file;
|
|
58
|
+
* from its file once closed (closed while idle, what it asked stays there, as the saved ones of the chats show).
|
|
59
|
+
*/
|
|
60
|
+
function entryOf(sessions, saved, session) {
|
|
61
|
+
const { sessionId, sessionFile } = session;
|
|
62
|
+
const open = sessions.find(each => each.sessionId === sessionId || (!!sessionFile && each.sessionFile === sessionFile));
|
|
63
|
+
return open !== null && open !== void 0 ? open : (sessionFile ? saved.find(each => each.sessionFile === sessionFile) : undefined);
|
|
64
|
+
}
|
|
65
|
+
ChatAskUtil.entryOf = entryOf;
|
|
56
66
|
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
57
67
|
function waits(entry, letGo) {
|
|
58
68
|
return !!entry.waiting || !!asking(entry, letGo);
|
|
@@ -15,6 +15,7 @@ import { useContextMenu } from './context-menu.js';
|
|
|
15
15
|
import { EmptyState } from './empty-state.js';
|
|
16
16
|
import { HostTag } from './host-tag.js';
|
|
17
17
|
import { Icon, IconButton } from './icon.js';
|
|
18
|
+
import { PeopleFaces, PresenceUtil } from './people.js';
|
|
18
19
|
import { SwipeRow } from './swipe-row.js';
|
|
19
20
|
import { DinoFace } from './ta-avatar.js';
|
|
20
21
|
/** The list by directory or package, else by day; in any browser. */
|
|
@@ -262,7 +263,8 @@ export var ChatListUtil;
|
|
|
262
263
|
a.cwd === b.cwd &&
|
|
263
264
|
a.group === b.group &&
|
|
264
265
|
(isOpen(a) && a.isStreaming) === (isOpen(b) && b.isStreaming) &&
|
|
265
|
-
(isOpen(a) && !!a.waiting) === (isOpen(b) && !!b.waiting)
|
|
266
|
+
(isOpen(a) && !!a.waiting) === (isOpen(b) && !!b.waiting) &&
|
|
267
|
+
PresenceUtil.same(isOpen(a) ? a.people : undefined, isOpen(b) ? b.people : undefined));
|
|
266
268
|
const x = before.source;
|
|
267
269
|
const y = after.source;
|
|
268
270
|
const sameSource = x === y || (x.key === y.key && x.label === y.label && x.title === y.title && x.host === y.host && x.initial === y.initial && x.tone === y.tone);
|
|
@@ -393,6 +395,11 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
393
395
|
const asks = waiting || (!!asking && !streaming);
|
|
394
396
|
const mood = asks ? 'attention' : streaming ? 'working' : 'idle';
|
|
395
397
|
const state = React.createElement(ChatState, { streaming: streaming, waiting: waiting, task: task });
|
|
398
|
+
// Others in the same Ta: their faces while they look at it, and whose message it answers.
|
|
399
|
+
const people = ChatListUtil.isOpen(session) ? session.people : undefined;
|
|
400
|
+
const viewers = React.createElement(PeopleFaces, { people: PresenceUtil.viewing(people), size: 14, max: 3 });
|
|
401
|
+
const askers = streaming ? PresenceUtil.asked(people) : [];
|
|
402
|
+
const replying = askers.length > 0 && (React.createElement("span", { className: "ta-chat-flag ta-replying" }, t('ta.chat.replyingFor', { names: PresenceUtil.names(askers, t('ta.presence.separator'), count => t('ta.presence.more', { count })) })));
|
|
396
403
|
// As in a messaging app, the last thing said; its directory before the first, and on hover in place of its time.
|
|
397
404
|
const said = ChatListUtil.preview(session, title);
|
|
398
405
|
const place = who ? MessageUtil.basename(session.cwd) : source.label;
|
|
@@ -403,6 +410,7 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
403
410
|
who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
|
|
404
411
|
tag,
|
|
405
412
|
React.createElement("span", { className: "ta-chat-title" }, title),
|
|
413
|
+
viewers,
|
|
406
414
|
state,
|
|
407
415
|
React.createElement(ChatDot, { unseen: !!unseen, asks: asks }),
|
|
408
416
|
React.createElement("span", { className: "ta-chat-time" }, removing && handheld ? React.createElement("span", { className: "ta-spinner ta-later" }) : time)))) : (React.createElement(React.Fragment, null,
|
|
@@ -428,12 +436,14 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
428
436
|
"[",
|
|
429
437
|
t('ta.chat.asking'),
|
|
430
438
|
"]"),
|
|
439
|
+
replying,
|
|
431
440
|
ended && !streaming && !asks && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
|
|
432
441
|
"[",
|
|
433
442
|
t(ended === 'failed' ? 'ta.task.failed' : 'ta.task.stopped'),
|
|
434
443
|
"]")), (_a = (asks && !waiting ? asking : said)) !== null && _a !== void 0 ? _a : (React.createElement("span", { className: "ta-chat-dir" },
|
|
435
444
|
React.createElement(Icon, { icon: Folder, size: 12 }),
|
|
436
445
|
place))),
|
|
446
|
+
viewers,
|
|
437
447
|
streaming && React.createElement("span", { className: "ta-chat-state ta-spinner" })))))),
|
|
438
448
|
handheld ? null : onRestore ? (React.createElement(IconButton, { className: "ta-chat-delete", icon: Undo2, label: t('ta.chat.restore'), onClick: onRestore })) : (React.createElement(IconButton, { className: "ta-chat-delete", icon: Trash2, label: t('ta.sidebar.closeTitle'), busy: removing, onClick: onRemove }))));
|
|
439
449
|
}, ChatListUtil.sameRow);
|
|
@@ -80,6 +80,8 @@ export interface ComposerBoxProps {
|
|
|
80
80
|
onTalkSent?(): void;
|
|
81
81
|
onListening?(listening: boolean): void;
|
|
82
82
|
autoFocus?: boolean;
|
|
83
|
+
/** What the user typed changed: the text now. */
|
|
84
|
+
onTextChange?(text: string): void;
|
|
83
85
|
/** The directory of the conversation: files dragged in from it become `@` references relative to it. */
|
|
84
86
|
cwd?: string;
|
|
85
87
|
onError(error: unknown): void;
|
|
@@ -50,7 +50,7 @@ function talkTarget(target) {
|
|
|
50
50
|
}
|
|
51
51
|
export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
52
52
|
var _a;
|
|
53
|
-
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, cwd, onError, } = props;
|
|
53
|
+
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, onTextChange, cwd, onError, } = props;
|
|
54
54
|
const t = useT();
|
|
55
55
|
const [text, setText] = React.useState('');
|
|
56
56
|
const [caret, setCaret] = React.useState(0);
|
|
@@ -493,6 +493,7 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
493
493
|
talkMode && React.createElement(TalkBar, { talk: talk }),
|
|
494
494
|
React.createElement("textarea", { ref: input, hidden: talkMode, rows: 1, value: text, autoFocus: autoFocus, enterKeyHint: "send", "aria-label": t('ta.composer.label'), "aria-controls": items.length ? menuId : undefined, "aria-activedescendant": items.length ? `${menuId}-${selected}` : undefined, placeholder: listening ? t('ta.composer.listening') : placeholder, onChange: event => {
|
|
495
495
|
setText(event.target.value);
|
|
496
|
+
onTextChange === null || onTextChange === void 0 ? void 0 : onTextChange(event.target.value);
|
|
496
497
|
setCaret(event.target.selectionStart);
|
|
497
498
|
setSelected(0);
|
|
498
499
|
}, onSelect: event => setCaret(event.currentTarget.selectionStart), onKeyDown: onKeyDown, onPaste: onPaste, onFocus: () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SessionStore } from '@celljs/ta-client';
|
|
2
|
-
import type
|
|
2
|
+
import { type TaServer, type TaSlashCommand, type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { type ComposerImage, type ComposerQueued } from '../util/composer.js';
|
|
5
5
|
import { type ComposerAction, type ComposerBoxHandle } from './composer-box.js';
|
|
@@ -41,6 +41,8 @@ export interface ComposerProps {
|
|
|
41
41
|
onStop?(): void;
|
|
42
42
|
/** A stop of the session's run pressed here ended (or failed): how long it took (useStopTimes). */
|
|
43
43
|
onStopTimed?(timing: StopTiming): void;
|
|
44
|
+
/** The user types (the box holds something and a key came), or no longer (it is empty, or sent). */
|
|
45
|
+
onTyping?(typing: boolean): void;
|
|
44
46
|
onError(error: unknown): void;
|
|
45
47
|
}
|
|
46
48
|
/**
|