@columenlabs/lumen-ai 0.1.136 → 0.1.138
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.
|
@@ -86,7 +86,7 @@ export async function bearings(input = {}) {
|
|
|
86
86
|
};
|
|
87
87
|
const utc = new Date(now).toISOString().slice(11, 16);
|
|
88
88
|
const lines = [
|
|
89
|
-
"
|
|
89
|
+
"<bearings> (the server's clock, for you only: use it for today, now and how long ago; never guess the date, and never repeat it in your answer)",
|
|
90
90
|
`Now: ${b.at(now)} (${timeZone}) · ${utc} UTC`,
|
|
91
91
|
];
|
|
92
92
|
if (input.lastAt && input.lastAt < now)
|
|
@@ -97,5 +97,6 @@ export async function bearings(input = {}) {
|
|
|
97
97
|
const more = await Promise.all(extras.map((e) => within(e, b, input.extrasMs ?? EXTRAS_MS)));
|
|
98
98
|
for (const l of more.flat())
|
|
99
99
|
lines.push(l.slice(0, 400));
|
|
100
|
+
lines.push('</bearings>');
|
|
100
101
|
return `${lines.join('\n')}\n\n`;
|
|
101
102
|
}
|
package/dist/assistant/engine.js
CHANGED
|
@@ -276,6 +276,8 @@ export class Assistant {
|
|
|
276
276
|
async status(caller) {
|
|
277
277
|
const main = await this.mainTier(caller);
|
|
278
278
|
const mainModel = (await this.pick(caller, main)).model;
|
|
279
|
+
// The binding's last test has no token doc to sit in; it is read beside the rest.
|
|
280
|
+
const linkTest = this.o.web?.scrapeql?.fetch ? this.state.scrapeqlLink() : null;
|
|
279
281
|
const [p, providers, scrapeql, spend, appCap, ownCap, { paying, wait }] = await Promise.all([
|
|
280
282
|
this.state.person(caller.id),
|
|
281
283
|
Promise.all(this.providers.map(async (id) => {
|
|
@@ -309,6 +311,7 @@ export class Assistant {
|
|
|
309
311
|
this.state.ownCap(caller.id),
|
|
310
312
|
this.state.paying(caller.id, mainModel.provider),
|
|
311
313
|
]);
|
|
314
|
+
const link = await linkTest;
|
|
312
315
|
const tiers = await Promise.all(this.tiers.map(async (t) => {
|
|
313
316
|
const { model, effort } = await this.pick(caller, t);
|
|
314
317
|
return {
|
|
@@ -359,7 +362,11 @@ export class Assistant {
|
|
|
359
362
|
fetch: p.web ?? true,
|
|
360
363
|
scrapeql: this.o.web?.scrapeql
|
|
361
364
|
? this.o.web.scrapeql.fetch
|
|
362
|
-
? {
|
|
365
|
+
? {
|
|
366
|
+
set: true,
|
|
367
|
+
bound: true,
|
|
368
|
+
...(link?.test ? { test: link.test } : {}),
|
|
369
|
+
}
|
|
363
370
|
: caller.admin
|
|
364
371
|
? keyState(scrapeql, (d) => d.client_id)
|
|
365
372
|
: { set: !!scrapeql }
|
|
@@ -843,7 +850,7 @@ export class Assistant {
|
|
|
843
850
|
/** What the kit adds to the app's instructions: tools, drafts, hand off, advice, limits. */
|
|
844
851
|
rules(main, policy, advisor, fns, failed) {
|
|
845
852
|
const lines = [
|
|
846
|
-
`You are ${this.name}. Each message starts with
|
|
853
|
+
`You are ${this.name}. Each message starts with <bearings>: the time now in the person's zone and where they are. Take today, now and how long ago from it; never guess the date. It is for you only: never quote it or start an answer with it.`,
|
|
847
854
|
'Answer in short plain sentences. Use the tools for facts; never guess a number a tool can give you. Call several tools at once when they do not depend on each other.',
|
|
848
855
|
'A tool marked DRAFT ONLY makes a card the person saves or dismisses; it changes nothing by itself. Say what the card will do; never claim it is done. The next message tells you how each card ended.',
|
|
849
856
|
'A tool marked WRITES AT ONCE makes its change when you call it; the person can undo it from the chat. Change only what they asked for, and say what you changed.',
|
package/dist/assistant/routes.js
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
import { ASSISTANT_ACCESS, ASSISTANT_EFFORTS, ASSISTANT_OWN_WAYS, ASSISTANT_PAYERS, HAND_OFF_POLICIES, } from '@columenlabs/lumen-ui-types/assistant';
|
|
34
34
|
import { AssistantError } from './engine.js';
|
|
35
35
|
import { PROVIDERS } from './models.js';
|
|
36
|
-
import { keyDocName, planDocName } from './state.js';
|
|
36
|
+
import { keyDocName, planDocName, } from './state.js';
|
|
37
37
|
import { APP_SCOPE } from './store.js';
|
|
38
38
|
const MUTATING = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
|
|
39
39
|
const MAX_MESSAGE = 20_000;
|
|
@@ -302,8 +302,11 @@ export function assistantRoutes(app, o) {
|
|
|
302
302
|
const no = admin();
|
|
303
303
|
if (no)
|
|
304
304
|
return no;
|
|
305
|
-
if (a.boundScrapeql)
|
|
306
|
-
|
|
305
|
+
if (a.boundScrapeql) {
|
|
306
|
+
const test = await a.testScrapeql(null);
|
|
307
|
+
await docs.write(APP_SCOPE, 'scrapeql:link', { test });
|
|
308
|
+
return json(test);
|
|
309
|
+
}
|
|
307
310
|
const d = await a.state.scrapeql();
|
|
308
311
|
if (!d)
|
|
309
312
|
return fail('No ScrapeQL token is set.', 404);
|
|
@@ -181,6 +181,10 @@ export declare class State {
|
|
|
181
181
|
/** USD a month on the person's own keys. */
|
|
182
182
|
ownCap(id: string): Promise<number>;
|
|
183
183
|
scrapeql(): Promise<TokenDoc | null>;
|
|
184
|
+
/** The last test of ScrapeQL over the app's service binding (no token to keep it beside). */
|
|
185
|
+
scrapeqlLink(): Promise<{
|
|
186
|
+
test: KeyTest;
|
|
187
|
+
} | null>;
|
|
184
188
|
appCap(): Promise<number>;
|
|
185
189
|
spend(id: string, month?: string): Promise<SpendDoc>;
|
|
186
190
|
/** Adds an answer's use to this month's spend, by label and payer. */
|
package/dist/assistant/state.js
CHANGED
|
@@ -183,6 +183,10 @@ export class State {
|
|
|
183
183
|
scrapeql() {
|
|
184
184
|
return this.docs.read(APP_SCOPE, 'scrapeql');
|
|
185
185
|
}
|
|
186
|
+
/** The last test of ScrapeQL over the app's service binding (no token to keep it beside). */
|
|
187
|
+
scrapeqlLink() {
|
|
188
|
+
return this.docs.read(APP_SCOPE, 'scrapeql:link');
|
|
189
|
+
}
|
|
186
190
|
async appCap() {
|
|
187
191
|
return (await this.app()).cap_usd ?? this.o.defaultCap;
|
|
188
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
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",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@anthropic-ai/sdk": "0.133.0",
|
|
44
|
-
"@columenlabs/lumen-ops": "0.1.
|
|
45
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
44
|
+
"@columenlabs/lumen-ops": "0.1.138",
|
|
45
|
+
"@columenlabs/lumen-ui-types": "0.1.138",
|
|
46
46
|
"openai": "7.32.0",
|
|
47
47
|
"zod": "^4.3.6"
|
|
48
48
|
},
|