@objectstack/runtime 12.1.0 → 12.2.0

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.d.cts CHANGED
@@ -263,6 +263,24 @@ declare class AppPlugin implements Plugin {
263
263
  * bundle-agnostic (it only closes over the engine + logger).
264
264
  */
265
265
  private installDefaultHookBodyRunner;
266
+ /**
267
+ * Install the engine's DEFAULT action body runner (`engine.setDefaultActionRunner`).
268
+ *
269
+ * The exact action-path parallel of {@link installDefaultHookBodyRunner}
270
+ * (#2605 item 1): actions authored at runtime (Studio → `action` metadata →
271
+ * publish) are registered by ObjectQLPlugin's authored-action re-sync,
272
+ * which lives in `objectql` and therefore has no sandbox of its own. This
273
+ * boot point hands it the same QuickJS-sandboxed runner that
274
+ * `defineStack({ actions })` bundles already execute through, so an
275
+ * authored `body` becomes a real `executeAction` handler instead of a
276
+ * silent "Action not found".
277
+ *
278
+ * `OS_DISABLE_AUTHORED_ACTIONS=1` opts out for deployments that want
279
+ * runtime-authored (DB-stored, non-code-reviewed) action bodies to stay
280
+ * inert; code-shipped actions are unaffected (AppPlugin registers those
281
+ * itself with its own runner).
282
+ */
283
+ private installDefaultActionBodyRunner;
266
284
  start: (ctx: PluginContext) => Promise<void>;
267
285
  stop: (ctx: PluginContext) => Promise<void>;
268
286
  /**
package/dist/index.d.ts CHANGED
@@ -263,6 +263,24 @@ declare class AppPlugin implements Plugin {
263
263
  * bundle-agnostic (it only closes over the engine + logger).
264
264
  */
265
265
  private installDefaultHookBodyRunner;
266
+ /**
267
+ * Install the engine's DEFAULT action body runner (`engine.setDefaultActionRunner`).
268
+ *
269
+ * The exact action-path parallel of {@link installDefaultHookBodyRunner}
270
+ * (#2605 item 1): actions authored at runtime (Studio → `action` metadata →
271
+ * publish) are registered by ObjectQLPlugin's authored-action re-sync,
272
+ * which lives in `objectql` and therefore has no sandbox of its own. This
273
+ * boot point hands it the same QuickJS-sandboxed runner that
274
+ * `defineStack({ actions })` bundles already execute through, so an
275
+ * authored `body` becomes a real `executeAction` handler instead of a
276
+ * silent "Action not found".
277
+ *
278
+ * `OS_DISABLE_AUTHORED_ACTIONS=1` opts out for deployments that want
279
+ * runtime-authored (DB-stored, non-code-reviewed) action bodies to stay
280
+ * inert; code-shipped actions are unaffected (AppPlugin registers those
281
+ * itself with its own runner).
282
+ */
283
+ private installDefaultActionBodyRunner;
266
284
  start: (ctx: PluginContext) => Promise<void>;
267
285
  stop: (ctx: PluginContext) => Promise<void>;
268
286
  /**
package/dist/index.js CHANGED
@@ -818,6 +818,7 @@ __export(app_plugin_exports, {
818
818
  collectBundleFunctions: () => collectBundleFunctions,
819
819
  collectBundleHooks: () => collectBundleHooks
820
820
  });
821
+ import { wireAuthoredTranslationSync } from "@objectstack/core";
821
822
  import { resolveMultiOrgEnabled } from "@objectstack/types";
822
823
  function collectBundleHooks(bundle) {
823
824
  const out = [];
@@ -893,6 +894,8 @@ var init_app_plugin = __esm({
893
894
  this.empty = false;
894
895
  this.init = async (ctx) => {
895
896
  this.installDefaultHookBodyRunner(ctx);
897
+ this.installDefaultActionBodyRunner(ctx);
898
+ wireAuthoredTranslationSync(ctx);
896
899
  if (this.empty) {
897
900
  ctx.logger.debug("[AppPlugin] empty env \u2014 no app payload, skipping init", {
898
901
  pluginName: this.name
@@ -1455,6 +1458,43 @@ var init_app_plugin = __esm({
1455
1458
  }));
1456
1459
  ctx.logger.info("[AppPlugin] Installed default hook body runner (runtime-authored hooks can execute)");
1457
1460
  }
1461
+ /**
1462
+ * Install the engine's DEFAULT action body runner (`engine.setDefaultActionRunner`).
1463
+ *
1464
+ * The exact action-path parallel of {@link installDefaultHookBodyRunner}
1465
+ * (#2605 item 1): actions authored at runtime (Studio → `action` metadata →
1466
+ * publish) are registered by ObjectQLPlugin's authored-action re-sync,
1467
+ * which lives in `objectql` and therefore has no sandbox of its own. This
1468
+ * boot point hands it the same QuickJS-sandboxed runner that
1469
+ * `defineStack({ actions })` bundles already execute through, so an
1470
+ * authored `body` becomes a real `executeAction` handler instead of a
1471
+ * silent "Action not found".
1472
+ *
1473
+ * `OS_DISABLE_AUTHORED_ACTIONS=1` opts out for deployments that want
1474
+ * runtime-authored (DB-stored, non-code-reviewed) action bodies to stay
1475
+ * inert; code-shipped actions are unaffected (AppPlugin registers those
1476
+ * itself with its own runner).
1477
+ */
1478
+ installDefaultActionBodyRunner(ctx) {
1479
+ if (process.env.OS_DISABLE_AUTHORED_ACTIONS === "1") {
1480
+ ctx.logger.info("[AppPlugin] OS_DISABLE_AUTHORED_ACTIONS=1 \u2014 runtime-authored action bodies will not execute");
1481
+ return;
1482
+ }
1483
+ let ql;
1484
+ try {
1485
+ ql = ctx.getService("objectql");
1486
+ } catch {
1487
+ return;
1488
+ }
1489
+ if (!ql || typeof ql.setDefaultActionRunner !== "function") return;
1490
+ if (ql._defaultActionRunner) return;
1491
+ ql.setDefaultActionRunner(actionBodyRunnerFactory(new QuickJSScriptRunner(), {
1492
+ ql,
1493
+ logger: ctx.logger,
1494
+ appId: "runtime-authored"
1495
+ }));
1496
+ ctx.logger.info("[AppPlugin] Installed default action body runner (runtime-authored actions can execute)");
1497
+ }
1458
1498
  /**
1459
1499
  * Emit a kernel hook so the control-plane `AppCatalogService` can
1460
1500
  * upsert / delete the corresponding `sys_app` row. Silently no-ops
@@ -4605,6 +4645,9 @@ var _HttpDispatcher = class _HttpDispatcher {
4605
4645
  } catch {
4606
4646
  }
4607
4647
  if (!aiService) {
4648
+ if (method === "GET" && subPath === "/ai/agents") {
4649
+ return { handled: true, response: { status: 200, body: { agents: [] } } };
4650
+ }
4608
4651
  return {
4609
4652
  handled: true,
4610
4653
  response: {