@runappsai/agent 0.1.11 → 0.1.15

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/ui.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { renderChat, enhanceSelect, type ChatOptions, type ChatHandle, type ComposerAction, type SettingsField, type SettingsTab } from "./chat.js";
2
+ export type { FileDialog } from "./dom.js";
2
3
  export { selectBox, type SelectBox, type SelectOption as SelectBoxOption } from "./select.js";
3
4
  export { VirtualList, type VRow, type VListOptions } from "./vlist.js";
4
5
  export { CHAT_PALETTES, CHAT_COLOR_TOKENS, CHAT_SHARED_TOKENS, type ChatPalette, type ChatVars, type ChatToken, type ChatColorToken } from "./chat-theme.js";
package/docs/chat-ui.md CHANGED
@@ -27,9 +27,11 @@
27
27
  - **Tool calls** — one quiet line per chain of calls, worded from the tools ("read 2 files, edited 1 file"), opening to a card per call with arguments, result (pictures a tool returned shown under it), duration and status.
28
28
  - **Questions** — `ask_user` and confirmations appear inline above the composer; while one waits the composer folds to a line, and answering brings the view back to the latest output. A short chat (under 420 px) keeps its composer compact.
29
29
  - **The composer** — Enter sends (the ↵ button appears once there is something to send), Shift+Enter breaks a line. While the agent runs, the ↵ becomes a stop square, Enter **steers** (inserts into the current task) and ⌘↵ / Ctrl+↵ **queues** a follow-up (with typed text, *Steer* and *Follow-up* buttons appear too); queued messages sit in a card above the box with *send now*, *edit* and *remove*.
30
+ - **Auto-run** — each permission question offers *Always allow (this app)*: from then on every tool runs without asking, deleting, overwriting and publishing included (a note says so once). Turned off, or on, under *Tool permissions* in the settings. Kept per app in the browser; a user who never chose gets the app's `permissions` (`"ask"` by default, `"auto"` to start on). `ask_user` questions are not permissions and are always asked.
30
31
  - **Attachments** — paperclip, drag and drop, or paste. Files are saved under `/uploads/` in the conversation's directory and named in the message; pictures also go to the model as images — unless the model is known to be text-only: then they stay files and the user is told the model cannot see them. A video (25 MB at most) goes to the model as a video unless the model is known not to take one. Without a directory, a text file or a PDF's text goes into the message itself. 20 MB per file.
31
32
  - **Files** — the header's *Files* button opens the directory: a tree, an editor (⌘S, word wrap, Markdown preview), picture and PDF previews, upload, new file, download (folders as zip). File paths in replies open there. Live: changes by the agent show at once.
32
33
  - **Skills** — the *Skills* button lists the skills (with a count), uploads zips, removes the user's own.
34
+ - **Scheduled tasks** (`schedule: true`) — the *Scheduled* button: the tasks, each with its schedule, next and last run; add, edit, pause, run now, delete, open its conversation. The agent can add, change and remove them itself. See [Scheduled tasks](#scheduled-tasks).
33
35
  - **Chats** — the conversation list (the open one first), new chat, delete. Conversations keep running when you switch away (up to three in the background).
34
36
  - **Settings** — the gear: model (with context and output limits, and which models see pictures), thinking level when the model has one, max turns, max output, tool permissions; and a *Context* tab for compaction — summarise older turns or only trim, how many tokens left starts it, how much of the newest stays word for word (each "Default" or a number, with what that comes to for the chosen model). Kept per app in the browser and applied to every conversation; only what differs from the app's defaults is kept, and a saved model the catalogue no longer lists is dropped (the default applies again).
35
37
  - **Reply actions** — hover a reply: copy its answer, *answer again* (rewinds to its question, with the same restore choices, and sends it again), delete the question and its answer; on the right what the reply cost (its `runUsage`, in the model's `price.currency`), the tokens and calls in its tooltip.
@@ -91,6 +93,8 @@ Typing `/` lists the built-in commands, then the directory's prompt templates an
91
93
  | `settings` | on | The settings gear. |
92
94
  | `attachments` | on | Paperclip, drop and paste. |
93
95
  | `webSearch` | shown when the provider has web tools | The globe beside the paperclip: turns the platform's web search and page reading on and off (`webTools`), kept per app. Hidden when `webTools` is a function of yours; `false` hides it. |
96
+ | `schedule` | off | Scheduled tasks: `true`, or `{ minMinutes, maxTasks, store, tools }`. See [Scheduled tasks](#scheduled-tasks). |
97
+ | `fileDialog` | the page's platform dialog | How the paperclip, the skills upload and the files panel pick files, and how downloads are saved: `{ openFiles({accept, multiple}) → File[], saveFile(blob, name) }`. Without it the chat uses `puter.ui.openFiles` / `saveFile` when the page has the RunApps file dialog (the user's files or this device), else the browser's chooser and downloads; `false` always uses the browser's. |
94
98
  | `uploadsDir` | `/uploads` | Where attachments are saved (with a workspace and file tools; with `fileTools: false` a text file goes into the message itself, so the model can read it). |
95
99
  | `showUsage` | on | The context ring in the header and its panel (context use, spending, *Compact now*). |
96
100
  | `locale` | the document's | `"en"` or `"zh"`. |
@@ -108,7 +112,7 @@ Typing `/` lists the built-in commands, then the directory's prompt templates an
108
112
  | `headerEnd` | | Buttons of your own after the settings gear (a close button). |
109
113
  | `composerActions` | | Buttons of your own in the composer's toolbar (see below). |
110
114
  | `settingsTabs` | | Tabs of your own in the settings panel (see below). |
111
- | `permissionsSetting` | on | The *Tool permissions* choice in the settings; `false` for an app that decides when to ask itself. |
115
+ | `permissionsSetting` | on | *Always allow (this app)* on permission questions and the *Tool permissions* choice in the settings; `false` for an app that decides when to ask itself. Not shown when `permissions` is a function or `agent` is given. |
112
116
  | `rewindState` | | `{ label, take(), restore(value) }`: your app's own state (an editor's text, a form) snapshotted as each message is sent; rewinding offers `label` as a checkbox and calls `restore` with that snapshot. Needs a workspace. |
113
117
  | `onSession(agent)` | | Called with each conversation's agent as it opens. |
114
118
 
@@ -245,6 +249,24 @@ remove(); // take it out again
245
249
 
246
250
  The user can remove it with its ×; sending takes it, and a message may be only context. The model gets one text part per item after the typed words, `[context] <label>` on the first line and `text` below; the user's bubble shows the chip, not the text. Rewinding to the message puts the items back into the composer. Mark page content as untrusted in `text` yourself when it is.
247
251
 
252
+ ## Scheduled tasks
253
+
254
+ `schedule: true` gives the chat scheduled tasks: a prompt the agent runs on its own at set times.
255
+
256
+ ```js
257
+ renderChat(el, { client, workspace, schedule: true }); // defaults
258
+ renderChat(el, { client, workspace, schedule: { minMinutes: 15, maxTasks: 10 } });
259
+ ```
260
+
261
+ - **When**: once (a date and time), every N minutes / hours / days, daily at a time on chosen weekdays, or a five-field cron expression — all in the user's local time.
262
+ - **Who sets them up**: the user, in the *Scheduled* panel (header), and the agent, through four tools it gets — `schedule_list`, `schedule_add`, `schedule_update`, `schedule_remove` — which run without asking (the user sees every task in the panel, marked *by AI*). "Every weekday at 9, summarise the news" in the chat is enough. `tools: false` keeps the agent out of it.
263
+ - **When they run**: only while the app is open in a browser — there is no server behind them. A task that is due waits until the chat is idle: nothing running in any conversation, no question open, and the user not typing in the composer. A run missed while the page was closed happens once when it is next opened (not once per missed time); a one-off then turns itself off. With the app open in several tabs, one of them runs it (a Web Lock per task).
264
+ - **Where they run**: each task has a conversation of its own, titled "⏰ <task name>", which every run adds to; it runs in the background (a notice when it starts and ends) and *Open its conversation* goes there. The message the agent gets starts with the task's name and time and says the user may not be watching; questions it asks (and permission questions) wait until the user opens that conversation. Without a conversation list (`sessions: false`, or your own `agent`) runs go into the one conversation.
265
+ - **Limits**: `minMinutes` (default 5) is the shortest repeat, so a task cannot spend the user's balance every minute; `maxTasks` (default 20).
266
+ - **Storage**: localStorage, per app (`__runapps_agent_chat:<app>:schedules`); `store` takes your own (`ScheduleStore`: `list`, `get`, `put`, `delete`, optional `subscribe`).
267
+
268
+ Without the chat UI, the same parts are exported: `scheduleTools(store, limits)` for an agent's tools, `new Scheduler({ store, run, idle, lockPrefix })` to fire due tasks (`start()`, `stop()`, `runNow(id)`), `localSchedules(key)` / `memorySchedules()`, and `nextRun`, `describeSchedule`, `parseCron` for the times.
269
+
248
270
  ## One conversation: `sessions: false`
249
271
 
250
272
  An app with one conversation per document or project turns the list off:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runappsai/agent",
3
- "version": "0.1.11",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "description": "Agent harness: the model ↔ tool loop with a workspace, skills, sessions, compaction, a sandbox and a chat UI. Bring any OpenAI-compatible model provider (RunApps included); no runtime dependencies.",
6
6
  "license": "MIT",