@columenlabs/lumen-ai 0.1.223 → 0.1.224
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.md +1 -1
- package/dist/assistant/engine.d.ts +7 -1
- package/dist/assistant/engine.js +5 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ app.all('/api/assistant/*', (c) => routes(c.req.raw));
|
|
|
103
103
|
- **Hand off and advice.** The `escalate` tool hands one task to a higher tier (the person sets next, any or only when asked); Anthropic's advisor tool lets a higher tier send a plan, at most two an answer.
|
|
104
104
|
- **Chats** run on the agent (`./agent`, `LumenAgent`, below): the app routes `POST /chat` and each chat's reads, cards and Undo to its own agent, and `assistantRoutes` answers `POST /chat` with 410 `moved`. Chats saved by the old turn loop stay readable (`GET /chats`, `GET|DELETE /chats/:id`) until `assistant.purge()` drops them 30 days after their last message.
|
|
105
105
|
- **Screen moves**: while the person's Settings ▸ Screen is Move (the default), the panel sends its page map (`AssistantMessage.screen`: routes, nav pages, Settings sections, cards on screen, rows to open) and `LumenAgent` gives the model a `screen` tool (`./agent` `screen.ts`). Each call's moves (go, settings, chart, open, point) are checked against the map, kept in the chat and streamed as a `screen` event; the panel runs them through `AssistantScreenProvider` (mounted by `LumenShell`) with an Undo chip, and their outcomes go back with the next message (`outcomes`). Nothing is saved by a move.
|
|
106
|
-
- **Background work** an app runs for a person (a score, a summary) is `assistant.complete(caller, { task, system, prompt, images?, maxTokens })`: one answer on the task's tier (`tasks`, so the person picks its model in Settings ▸ Models), no chat and no tools (`images`, base64 with their media type, are read with the prompt: a scanned page, a screenshot), billed to their payer and counted in their spend and allowance like a chat turn. `maxTokens` (default 1,000) goes up to `COMPLETE_MAX_TOKENS` (32,000, thinking included); the answer is streamed, so a long one keeps its connection, and `cut: true` says it stopped at the cap before it ended (the app can ask again, shorter, or continue). It throws `AssistantError` `not_connected`, `app_cap` or `own_cap` when nobody can pay, so the caller waits and tries later. It returns the answer's `usd`, `model` and `usage` (tokens in, cache reads, out, per model). `run: { id, title }` makes the calls that share an `id` one line of the person's usage history (every round of one rebuild); without it a task's calls that day share a line.
|
|
106
|
+
- **Background work** an app runs for a person (a score, a summary) is `assistant.complete(caller, { task, system, prompt, images?, maxTokens })`: one answer on the task's tier (`tasks`, so the person picks its model in Settings ▸ Models), no chat and no tools (`images`, base64 with their media type, are read with the prompt: a scanned page, a screenshot), billed to their payer and counted in their spend and allowance like a chat turn. `maxTokens` (default 1,000) goes up to `COMPLETE_MAX_TOKENS` (32,000, thinking included); the answer is streamed, so a long one keeps its connection, and `cut: true` says it stopped at the cap before it ended (the app can ask again, shorter, or continue). It throws `AssistantError` `not_connected`, `app_cap` or `own_cap` when nobody can pay, so the caller waits and tries later. It returns the answer's `usd`, `model` and `usage` (tokens in, cache reads, out, per model). `effort` sets how hard the model thinks on that one call (`low` to `max`; on an OpenAI or xAI model it is the request's reasoning effort), over what the person saved for the tier. `run: { id, title }` makes the calls that share an `id` one line of the person's usage history (every round of one rebuild); without it a task's calls that day share a line.
|
|
107
107
|
- **Usage history.** Each chat (`agentTurn` with `chat`) and each run of background work is one line of the person's month (`usage:YYYY-MM`, the newest 300): its title, first and last use, tokens, cost and its parts per tier and model. `GET /usage?month=YYYY-MM` returns it beside that month's spend and the months that have any; `LumenAssistant`'s footer shows this month's total and opens it (`UsageHistoryView`).
|
|
108
108
|
|
|
109
109
|
### Commands, `@` and `#`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllowanceRequest, AllowanceState, AllowanceUnit, AssistantAccess, AssistantChat, AssistantChatRow, AssistantMessage, AssistantOwnWay, AssistantProvider, AssistantStatus, UsagePart } from '@columenlabs/lumen-ui-types/assistant';
|
|
1
|
+
import type { AllowanceRequest, AllowanceState, AllowanceUnit, AssistantAccess, AssistantChat, AssistantChatRow, AssistantEffort, AssistantMessage, AssistantOwnWay, AssistantProvider, AssistantStatus, UsagePart } from '@columenlabs/lumen-ui-types/assistant';
|
|
2
2
|
import type { AgentTurnEnd, AgentTurnPlan } from '../agent/agent.js';
|
|
3
3
|
import { type BearingsExtra, type BearingsNow } from './bearings.js';
|
|
4
4
|
import { type ModelDef, type TaskDef, type TierDef } from './models.js';
|
|
@@ -306,6 +306,12 @@ export declare class Assistant {
|
|
|
306
306
|
images?: CompleteImage[];
|
|
307
307
|
/** The answer's token cap, thinking included (default 1,000, at most COMPLETE_MAX_TOKENS). */
|
|
308
308
|
maxTokens?: number;
|
|
309
|
+
/**
|
|
310
|
+
* How hard the model thinks on this one call, whatever the person saved for the tier. On an
|
|
311
|
+
* OpenAI or xAI model it is the request's reasoning effort (`max` asks for `high`); left out,
|
|
312
|
+
* those models run at their own default.
|
|
313
|
+
*/
|
|
314
|
+
effort?: AssistantEffort;
|
|
309
315
|
signal?: AbortSignal;
|
|
310
316
|
/**
|
|
311
317
|
* The run this call belongs to, as one line of the person's usage history (`GET /usage`):
|
package/dist/assistant/engine.js
CHANGED
|
@@ -831,7 +831,7 @@ export class Assistant {
|
|
|
831
831
|
* events like the chat loop, because a ChatGPT plan sign-in answers only streamed calls, takes no
|
|
832
832
|
* output cap and may send its words only as deltas.
|
|
833
833
|
*/
|
|
834
|
-
async openaiOnce(clients, s, instructions, input, max, signal, images) {
|
|
834
|
+
async openaiOnce(clients, s, instructions, input, max, signal, images, effort) {
|
|
835
835
|
// xAI's API is OpenAI's Responses API at another address.
|
|
836
836
|
const xai = s.model.provider === 'xai';
|
|
837
837
|
const client = (xai ? clients.xai : clients.openai);
|
|
@@ -861,6 +861,8 @@ export class Assistant {
|
|
|
861
861
|
store: false,
|
|
862
862
|
stream: true,
|
|
863
863
|
...(plan ? {} : { max_output_tokens: max }),
|
|
864
|
+
...(effort &&
|
|
865
|
+
effort !== 'default' && { reasoning: { effort: effort === 'max' ? 'high' : effort } }),
|
|
864
866
|
}, signal ? { signal } : {});
|
|
865
867
|
for await (const e of stream) {
|
|
866
868
|
if (e.type === 'response.output_text.delta' && typeof e.delta === 'string')
|
|
@@ -921,7 +923,7 @@ export class Assistant {
|
|
|
921
923
|
try {
|
|
922
924
|
if ((s.model.provider === 'openai' && clients.openai) ||
|
|
923
925
|
(s.model.provider === 'xai' && clients.xai)) {
|
|
924
|
-
({ text, cut } = await this.openaiOnce(clients, s, o.system, o.prompt, max, o.signal, o.images));
|
|
926
|
+
({ text, cut } = await this.openaiOnce(clients, s, o.system, o.prompt, max, o.signal, o.images, o.effort));
|
|
925
927
|
}
|
|
926
928
|
else if (clients.anthropic) {
|
|
927
929
|
// Streamed and read whole: a long answer (minutes at a high cap) keeps its connection alive,
|
|
@@ -949,7 +951,7 @@ export class Assistant {
|
|
|
949
951
|
: o.prompt,
|
|
950
952
|
},
|
|
951
953
|
],
|
|
952
|
-
...effortParams(s.effort),
|
|
954
|
+
...effortParams(o.effort ?? s.effort),
|
|
953
955
|
}, o.signal ? { signal: o.signal } : undefined)
|
|
954
956
|
.finalMessage();
|
|
955
957
|
s.meter.add(msg.usage);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.224",
|
|
4
4
|
"description": "Lumen's assistant and agent parts: a chat assistant's server (Claude tiers, tools over MCP, the web, hand off, spend caps), serving an MCP server from a Worker, read-only tool sets and metered tool calls.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@ai-sdk/openai": "4.0.108",
|
|
53
53
|
"@anthropic-ai/sdk": "0.133.0",
|
|
54
54
|
"@cloudflare/think": "0.23.0",
|
|
55
|
-
"@columenlabs/lumen-ops": "0.1.
|
|
56
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
55
|
+
"@columenlabs/lumen-ops": "0.1.224",
|
|
56
|
+
"@columenlabs/lumen-ui-types": "0.1.224",
|
|
57
57
|
"agents": "0.32.0",
|
|
58
58
|
"ai": "7.0.162",
|
|
59
59
|
"just-bash": "3.6.0",
|