@columenlabs/lumen-ai 0.1.136 → 0.1.137

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.
@@ -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
- ? { set: true, bound: true }
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 }
@@ -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
- return json(await a.testScrapeql(null));
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. */
@@ -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.136",
3
+ "version": "0.1.137",
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.136",
45
- "@columenlabs/lumen-ui-types": "0.1.136",
44
+ "@columenlabs/lumen-ops": "0.1.137",
45
+ "@columenlabs/lumen-ui-types": "0.1.137",
46
46
  "openai": "7.32.0",
47
47
  "zod": "^4.3.6"
48
48
  },