@columenlabs/lumen-ai 0.1.198 → 0.1.200
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/agent/models.d.ts +2 -2
- package/dist/agent/models.js +16 -6
- package/dist/workspaces/store.d.ts +12 -0
- package/dist/workspaces/store.js +21 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -280,6 +280,6 @@ Three more ways rows reach a tab, all on a free Workers plan (no Dynamic Workers
|
|
|
280
280
|
|
|
281
281
|
- **Fetch recipe** (`{kind: 'fetch', requests: [{url, method?, key?}], each?: {values}, rows?, pick?}`): declarative web reads the product runs on its server. `{field}` holes in a URL fill from each value of `each` (text fills `{value}`); `fetchCalls` expands them (at most `FETCH_CALLS`, 50 a run) and `fetchedRows` turns the answers into rows, the `each` value's fields first, then `pick`'s dotted paths (`current.temperature_2m`). A data key is named (`key`), never sent: the product adds it server side.
|
|
282
282
|
- **Browser script** (`{kind: 'script', runtime: 'browser', code, requests?}`): JavaScript that runs in the person's page. The kit's `runBrowserFrame` loads `<base>/sandbox` (this package's `SANDBOX_HTML`, served with `SANDBOX_CSP`: `connect-src 'none'`) in an iframe with `sandbox="allow-scripts"`, runs the code in a Web Worker there (stopped at `BROWSER_RUN_MS`, 30 s), and saves what it returns with `PUT /frames/:id/rows` (one write, the frame's caps checked). The code is the body of `async (fetched, hub) => rows`: `fetched` holds the answers to its `requests`, `hub.fetch(url, {key})` makes one more read through the product's proxy (`fetch` in `workspaceRoutes`, `POST <base>/fetch`). The server never runs it: `refresh` refuses it (409, open the tab), and `refreshAll` lists such tabs as `browser`.
|
|
283
|
-
- **Pushed dataset** (`store.pushFrame(owner, {name, rows, mode, by, key?})`): rows an outside agent wrangled (a CSV parsed by `parseCsv`, at most `CSV_BYTES` a call, the rest as `append` parts; with `key`, an appended row replaces the one with its key). Origin `harness`, no recipe; `by` names the agent and the tab's status bar reads "Pushed by Claude Code · 4 min ago". `removeFrame` deletes one with its tabs.
|
|
283
|
+
- **Pushed dataset** (`store.pushFrame(owner, {name, rows, mode, by, key?})`): rows an outside agent wrangled (a CSV parsed by `parseCsv`, at most `CSV_BYTES` a call, the rest as `append` parts; with `key`, an appended row replaces the one with its key). Origin `harness`, no recipe; `by` names the agent and the tab's status bar reads "Pushed by Claude Code · 4 min ago". `frameTab(owner, workspace, {name, frame})` shows one in a tab (no run); `removeFrame` deletes one with its tabs.
|
|
284
284
|
|
|
285
285
|
`workspaceRoutes` lets `call`, `fetch` and browser `script` recipes through to the product's `allow`; server `sql` and `script` are refused.
|
package/dist/agent/models.d.ts
CHANGED
|
@@ -24,14 +24,14 @@ export interface AiModelOptions {
|
|
|
24
24
|
export declare function planFetch(base?: typeof fetch, name?: string): typeof fetch;
|
|
25
25
|
/** The AI SDK model a tier runs: its provider's client on the payer's key. */
|
|
26
26
|
export declare function aiModel(model: ModelDef, key: ModelKey, o?: AiModelOptions): LanguageModel;
|
|
27
|
-
/** A tier's effort and output cap as a turn's settings
|
|
27
|
+
/** A tier's effort and output cap as a turn's settings, with Claude's prompt cache on. */
|
|
28
28
|
export declare function turnSettings(model: ModelDef, o: {
|
|
29
29
|
effort: AssistantEffort;
|
|
30
30
|
out?: number;
|
|
31
31
|
plan?: boolean;
|
|
32
32
|
}): {
|
|
33
33
|
maxOutputTokens?: number;
|
|
34
|
-
providerOptions
|
|
34
|
+
providerOptions: Record<string, Record<string, JSONValue>>;
|
|
35
35
|
};
|
|
36
36
|
/** A ChatGPT plan used up for now: a 429 or a usage code, thrown or sent before any output. */
|
|
37
37
|
export declare function planLimited(err: unknown): boolean;
|
package/dist/agent/models.js
CHANGED
|
@@ -87,19 +87,29 @@ export function aiModel(model, key, o = {}) {
|
|
|
87
87
|
const f = key.plan ? planFetch(o.fetch, o.name) : o.fetch;
|
|
88
88
|
return createOpenAI({ apiKey: key.apiKey, ...(f ? { fetch: f } : {}) }).responses(model.id);
|
|
89
89
|
}
|
|
90
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Claude's prompt cache: one breakpoint on the request, which Claude moves to the newest block on
|
|
92
|
+
* each call, so a turn's later steps and the next turn read the tools, instructions and chat so
|
|
93
|
+
* far from cache (a tenth of the input price) instead of paying for them again. Sent whatever the
|
|
94
|
+
* tier's provider, so a plan's fallback to Claude caches too; other providers ignore it.
|
|
95
|
+
*/
|
|
96
|
+
const CLAUDE_CACHE = { cacheControl: { type: 'ephemeral' } };
|
|
97
|
+
/** A tier's effort and output cap as a turn's settings, with Claude's prompt cache on. */
|
|
91
98
|
export function turnSettings(model, o) {
|
|
92
99
|
const out = o.plan || !o.out ? {} : { maxOutputTokens: o.out };
|
|
100
|
+
const anthropic = { ...CLAUDE_CACHE };
|
|
93
101
|
// A plan keeps nothing, so earlier turns go back as items, not references to stored ones.
|
|
94
102
|
const openai = o.plan ? { store: false } : {};
|
|
95
103
|
if (o.effort !== 'default') {
|
|
96
104
|
if (model.provider === 'anthropic')
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
anthropic.effort = o.effort;
|
|
106
|
+
else
|
|
107
|
+
openai.reasoningEffort = o.effort;
|
|
99
108
|
}
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
:
|
|
109
|
+
return {
|
|
110
|
+
...out,
|
|
111
|
+
providerOptions: { anthropic, ...(Object.keys(openai).length ? { openai } : {}) },
|
|
112
|
+
};
|
|
103
113
|
}
|
|
104
114
|
/** A ChatGPT plan used up for now: a 429 or a usage code, thrown or sent before any output. */
|
|
105
115
|
export function planLimited(err) {
|
|
@@ -92,6 +92,18 @@ export declare function createWorkspaces(opts: WorkspacesOptions): {
|
|
|
92
92
|
workspace: WorkspaceRead;
|
|
93
93
|
tab: string;
|
|
94
94
|
}>;
|
|
95
|
+
/**
|
|
96
|
+
* A new tab over a frame the person already has (a dataset an outside agent pushed): no run,
|
|
97
|
+
* the rows are the frame's. One tab per frame in a workspace; asking again gives that tab.
|
|
98
|
+
*/
|
|
99
|
+
frameTab(owner: string, id: string, p: {
|
|
100
|
+
name: string;
|
|
101
|
+
frame: string;
|
|
102
|
+
start?: WorkspaceTab['start'];
|
|
103
|
+
}): Promise<{
|
|
104
|
+
workspace: Workspace;
|
|
105
|
+
tab: string;
|
|
106
|
+
}>;
|
|
95
107
|
putTab(owner: string, id: string, tab: string, p: {
|
|
96
108
|
name?: string;
|
|
97
109
|
config?: CustomViewConfig | null;
|
package/dist/workspaces/store.js
CHANGED
|
@@ -326,6 +326,27 @@ export function createWorkspaces(opts) {
|
|
|
326
326
|
tab: tab.id,
|
|
327
327
|
};
|
|
328
328
|
},
|
|
329
|
+
/**
|
|
330
|
+
* A new tab over a frame the person already has (a dataset an outside agent pushed): no run,
|
|
331
|
+
* the rows are the frame's. One tab per frame in a workspace; asking again gives that tab.
|
|
332
|
+
*/
|
|
333
|
+
async frameTab(owner, id, p) {
|
|
334
|
+
const w = await getSpace(owner, id);
|
|
335
|
+
await getFrame(owner, p.frame);
|
|
336
|
+
const had = w.tabs.find((x) => 'frame' in x.source && x.source.frame === p.frame);
|
|
337
|
+
if (had)
|
|
338
|
+
return { workspace: w, tab: had.id };
|
|
339
|
+
if (w.tabs.length >= MAX_TABS)
|
|
340
|
+
throw new FrameError(`${w.name} has ${MAX_TABS} tabs, the most: delete one first.`, 409);
|
|
341
|
+
const tab = {
|
|
342
|
+
id: newId('tb'),
|
|
343
|
+
name: p.name,
|
|
344
|
+
source: { frame: p.frame },
|
|
345
|
+
config: null,
|
|
346
|
+
...(p.start?.formulas.length ? { start: p.start } : {}),
|
|
347
|
+
};
|
|
348
|
+
return { workspace: await saveSpace(owner, { ...w, tabs: [...w.tabs, tab] }), tab: tab.id };
|
|
349
|
+
},
|
|
329
350
|
async putTab(owner, id, tab, p) {
|
|
330
351
|
const w = await getSpace(owner, id);
|
|
331
352
|
if (!w.tabs.some((x) => x.id === tab))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.200",
|
|
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.200",
|
|
56
|
+
"@columenlabs/lumen-ui-types": "0.1.200",
|
|
57
57
|
"agents": "0.32.0",
|
|
58
58
|
"ai": "7.0.162",
|
|
59
59
|
"just-bash": "3.6.0",
|