@lotics/app-sdk 0.123.5 → 0.123.7

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/index.js CHANGED
@@ -802,6 +802,7 @@ var MAX_STRING_LENGTH = 1e7;
802
802
  var MAX_RANDOM_LENGTH = 1e3;
803
803
  var MAX_RUN_BUILT_BYTES = 512 * 1024 * 1024;
804
804
  var MAX_IN_PLACE_BYTES = 1024 * 1024;
805
+ var MAX_IN_PLACE_HELPER_BYTES = 8 * 1024;
805
806
  var MAX_PERSISTED_JSON_LENGTH = 64 * 1024 * 1024;
806
807
  var ExpressionLimitError = class extends Error {
807
808
  constructor(message2) {
@@ -7385,7 +7386,7 @@ var WorkflowExpressionBudgetError = class extends Error {
7385
7386
  };
7386
7387
  var ExpressionNotCheapError = class extends Error {
7387
7388
  constructor() {
7388
- super(`The expression walks or builds more than ${MAX_IN_PLACE_BYTES / 1024 / 1024}MB at once, past what an evaluation in place may.`);
7389
+ super(`The expression walks or builds more than ${MAX_IN_PLACE_BYTES / 1024 / 1024}MB at once, or hands a helper more than ${MAX_IN_PLACE_HELPER_BYTES / 1024}KB, past what an evaluation in place may.`);
7389
7390
  this.name = "ExpressionNotCheapError";
7390
7391
  }
7391
7392
  };
@@ -7510,11 +7511,14 @@ function parsedSize(text2) {
7510
7511
  return text2.length * CHAR_BYTES + nodes * PARSED_NODE_BYTES;
7511
7512
  }
7512
7513
  function assertCheap(budget, ...values2) {
7514
+ assertWithin(budget, MAX_IN_PLACE_BYTES, values2);
7515
+ }
7516
+ function assertWithin(budget, limit, values2) {
7513
7517
  if (!budget.bounded) return;
7514
7518
  let bytes = 0;
7515
7519
  for (const value of values2) {
7516
- bytes += writtenSize(value, MAX_IN_PLACE_BYTES - bytes);
7517
- if (bytes > MAX_IN_PLACE_BYTES) throw new ExpressionNotCheapError();
7520
+ bytes += writtenSize(value, limit - bytes);
7521
+ if (bytes > limit) throw new ExpressionNotCheapError();
7518
7522
  }
7519
7523
  }
7520
7524
  function charge(ctx, bytes) {
@@ -8116,6 +8120,7 @@ async function callAfter(helper, pending, ctx) {
8116
8120
  return callHelper(helper, values2, ctx);
8117
8121
  }
8118
8122
  function callHelper({ call, cost }, values2, ctx) {
8123
+ assertWithin(ctx.evaluation_budget, MAX_IN_PLACE_HELPER_BYTES, values2);
8119
8124
  if (cost === "parses") charge(ctx, parsedSize(values2[0]));
8120
8125
  const answer = Reflect.apply(call, void 0, values2);
8121
8126
  return answer instanceof Promise ? chargeAnswerAfter(cost, answer, values2, ctx) : chargeAnswer(cost, answer, values2, ctx);
package/docs/ai.md CHANGED
@@ -336,11 +336,11 @@ This hook is a **one-way push of data the app already showed this member**. (Cha
336
336
 
337
337
  ### The chat can also USE the app, not just be told about it
338
338
 
339
- While a member has an app open, their chat agent can also **call that app's own
340
- declared aliases** — named queries via `run_app_query`, workflows via
339
+ A member's chat agent can also **call the declared aliases of any app that member
340
+ can use** (the open app when a call names none): named queries via `run_app_query`, workflows via
341
341
  `run_app_workflow`. This adds no exposure: every declared alias is already
342
342
  callable by that member ([the devtools test](./security.md#the-devtools-test)).
343
- It is gated per turn on `app:use`, and runs under the app's OWNER authority with
343
+ It is gated on `app:use` when the call is made, and runs under the app's OWNER authority with
344
344
  `is_current_member` bound to the MEMBER, exactly as the app's own UI does.
345
345
 
346
346
  The agent is handed a **catalog** of those aliases — each one's `description`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.123.5",
3
+ "version": "0.123.7",
4
4
  "description": "The SDK a Lotics custom-code app reads and writes through — typed hooks over the host bridge, cell readers, mount() and AppRouter",
5
5
  "type": "module",
6
6
  "exports": {