@exulu/backend 5.11.1 → 5.12.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.
@@ -659,7 +659,7 @@ var ExuluTool = class _ExuluTool {
659
659
  if (!agent) {
660
660
  throw new Error("Agent not found.");
661
661
  }
662
- const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-FX6KTVPQ.js");
662
+ const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-WEC42QHZ.js");
663
663
  const tools = await convertExuluToolsToAiSdkTools2(
664
664
  [this],
665
665
  [],
@@ -6167,14 +6167,14 @@ function randomizedPCA(rows, dims, k, seed, iterations) {
6167
6167
  for (const row of rows) {
6168
6168
  const centered = new Float64Array(dims);
6169
6169
  for (let d = 0; d < dims; d += 1) centered[d] = (row[d] ?? 0) - (mean[d] ?? 0);
6170
- const z19 = new Float64Array(basis.length);
6170
+ const z20 = new Float64Array(basis.length);
6171
6171
  for (const [b, vec] of basis.entries()) {
6172
6172
  let dot = 0;
6173
6173
  for (let d = 0; d < dims; d += 1) dot += (centered[d] ?? 0) * (vec[d] ?? 0);
6174
- z19[b] = dot;
6174
+ z20[b] = dot;
6175
6175
  }
6176
6176
  for (const [b, target] of next.entries()) {
6177
- const scale = z19[b] ?? 0;
6177
+ const scale = z20[b] ?? 0;
6178
6178
  if (scale === 0) continue;
6179
6179
  for (let d = 0; d < dims; d += 1) target[d] = (target[d] ?? 0) + (centered[d] ?? 0) * scale;
6180
6180
  }
@@ -6272,12 +6272,12 @@ function ridgeFit(Z, Y, lambda) {
6272
6272
  });
6273
6273
  return { map, intercept };
6274
6274
  }
6275
- function applyMap(z19, map, intercept) {
6275
+ function applyMap(z20, map, intercept) {
6276
6276
  const out = [];
6277
6277
  for (let j = 0; j < 3; j += 1) {
6278
6278
  let v = intercept[j] ?? 0;
6279
6279
  const row = map[j] ?? [];
6280
- for (let d = 0; d < row.length; d += 1) v += (row[d] ?? 0) * (z19[d] ?? 0);
6280
+ for (let d = 0; d < row.length; d += 1) v += (row[d] ?? 0) * (z20[d] ?? 0);
6281
6281
  out.push(Number.isFinite(v) ? v : 0);
6282
6282
  }
6283
6283
  return [out[0] ?? 0, out[1] ?? 0, out[2] ?? 0];
@@ -6300,8 +6300,8 @@ function fitResidual(Z, Y, map, intercept) {
6300
6300
  for (let i = 0; i < Z.length; i += 1) {
6301
6301
  const zi = Z[i] ?? [];
6302
6302
  const yi = Y[i] ?? [];
6303
- const [x, y, z19] = applyMap(zi, map, intercept);
6304
- total += Math.hypot(x - finite(yi[0]), y - finite(yi[1]), z19 - finite(yi[2]));
6303
+ const [x, y, z20] = applyMap(zi, map, intercept);
6304
+ total += Math.hypot(x - finite(yi[0]), y - finite(yi[1]), z20 - finite(yi[2]));
6305
6305
  }
6306
6306
  return finite(total / Z.length);
6307
6307
  }
@@ -6441,8 +6441,8 @@ async function chunkCoordinates({
6441
6441
  }
6442
6442
  return null;
6443
6443
  }
6444
- const [x, y, z19] = applyMap(projectComponents(l2normalize(v), mean, basis), projection.map, projection.intercept);
6445
- return { x, y, z: z19 };
6444
+ const [x, y, z20] = applyMap(projectComponents(l2normalize(v), mean, basis), projection.map, projection.intercept);
6445
+ return { x, y, z: z20 };
6446
6446
  });
6447
6447
  } catch (e) {
6448
6448
  console.error("[EXULU] could not compute chunk coordinates", e instanceof Error ? e.message : String(e));
@@ -9457,6 +9457,23 @@ var jobResultsSchema = {
9457
9457
  {
9458
9458
  name: "workflow",
9459
9459
  type: "text"
9460
+ },
9461
+ // Work status of a routine run — the fachliche status people work
9462
+ // with (spec 2026-11-16-routine-work-status-design), separate from
9463
+ // the technical `state`. A key from the routine's work_statuses.
9464
+ {
9465
+ name: "work_status",
9466
+ type: "text",
9467
+ index: true
9468
+ },
9469
+ {
9470
+ name: "work_status_updated_at",
9471
+ type: "date"
9472
+ },
9473
+ // { kind: "user" | "tool" | "agent" | "default", id?, user? }
9474
+ {
9475
+ name: "work_status_updated_by",
9476
+ type: "json"
9460
9477
  }
9461
9478
  ]
9462
9479
  };
@@ -9593,6 +9610,12 @@ var workflowTemplatesSchema = {
9593
9610
  type: "boolean",
9594
9611
  default: false
9595
9612
  },
9613
+ // Per-routine work statuses: { statuses: [{ key, label, color?, done? }], default }.
9614
+ // null / empty list = feature off for this routine.
9615
+ {
9616
+ name: "work_statuses",
9617
+ type: "json"
9618
+ },
9596
9619
  {
9597
9620
  name: "queue",
9598
9621
  type: "text"
@@ -14343,6 +14366,37 @@ ${lines.join("\n")}`;
14343
14366
  return handle;
14344
14367
  }
14345
14368
 
14369
+ // src/templates/tools/routine-status-tool.ts
14370
+ import { z as z16 } from "zod";
14371
+ var SET_ROUTINE_STATUS_TOOL_ID = "set_routine_status";
14372
+ function createRoutineStatusTool(handle) {
14373
+ if (!handle || handle.statuses.length === 0) return void 0;
14374
+ const keys = handle.statuses.map((status) => status.key);
14375
+ const labelOf = (key) => handle.statuses.find((status) => status.key === key)?.label ?? key;
14376
+ return new ExuluTool({
14377
+ id: SET_ROUTINE_STATUS_TOOL_ID,
14378
+ name: "Set routine status",
14379
+ description: `Sets the work status of this run of the routine "${handle.name}" for the people working the run list. Use it when the step instructions tell you to, with exactly one of these values: ` + handle.statuses.map((status) => `${status.key} \u2014 ${status.label}`).join("; ") + ".",
14380
+ category: "routines",
14381
+ type: "function",
14382
+ needsApproval: false,
14383
+ inputSchema: z16.object({
14384
+ status: z16.enum(keys).describe("The work status key to set.")
14385
+ }),
14386
+ config: [],
14387
+ execute: async ({ status }) => {
14388
+ const decision = await handle.runs.current.updateWithResult({ status });
14389
+ if (decision?.action === "skip" && decision.reason === "human_set") {
14390
+ return {
14391
+ result: `A person already set the status to "${labelOf(handle.runs.current.status ?? "")}"; left unchanged.`
14392
+ };
14393
+ }
14394
+ if (decision?.action === "skip") return { result: `Status is already "${labelOf(status)}".` };
14395
+ return { result: `Status set to "${labelOf(status)}".` };
14396
+ }
14397
+ });
14398
+ }
14399
+
14346
14400
  // src/utils/truncate-tool-output.ts
14347
14401
  var truncateToolOutput = (output, maxContextLength, toolName, tailFraction = 0.1, charLimitOverride) => {
14348
14402
  const effectiveCtx = maxContextLength != null && maxContextLength > 0 ? maxContextLength : 128e3;
@@ -14539,7 +14593,7 @@ var buildAuthToolModelOutput = (tool3) => ({ output }) => {
14539
14593
  };
14540
14594
 
14541
14595
  // src/templates/tools/session-file-read-tool.ts
14542
- import { z as z16 } from "zod";
14596
+ import { z as z17 } from "zod";
14543
14597
  var DEFAULT_LIMIT = 250;
14544
14598
  var MAX_CONTENT_CHARS = 16e3;
14545
14599
  var SESSION_FILE_READ_TOOL_NAME = "read_session_file";
@@ -14592,10 +14646,10 @@ var createSessionFileReadTool = ({
14592
14646
  name: SESSION_FILE_READ_TOOL_NAME,
14593
14647
  needsApproval: false,
14594
14648
  description: "Read a line range from a file stored in this session's files \u2014 including offloaded tool outputs (tool-output-*.txt) and uploaded documents. Use offset (1-based line number) and limit to page through large files instead of reading everything at once.",
14595
- inputSchema: z16.object({
14596
- filename: z16.string().describe('Exact session file name as referenced in a truncation notice, e.g. "tool-output-web_search-a1b2c3d4.txt"'),
14597
- offset: z16.number().int().min(1).optional().describe("1-based first line to read (default 1)"),
14598
- limit: z16.number().int().min(1).max(1e3).optional().describe(`Number of lines to read (default ${DEFAULT_LIMIT})`)
14649
+ inputSchema: z17.object({
14650
+ filename: z17.string().describe('Exact session file name as referenced in a truncation notice, e.g. "tool-output-web_search-a1b2c3d4.txt"'),
14651
+ offset: z17.number().int().min(1).optional().describe("1-based first line to read (default 1)"),
14652
+ limit: z17.number().int().min(1).max(1e3).optional().describe(`Number of lines to read (default ${DEFAULT_LIMIT})`)
14599
14653
  }),
14600
14654
  type: "function",
14601
14655
  category: "session",
@@ -14608,7 +14662,7 @@ var createSessionFileReadTool = ({
14608
14662
  };
14609
14663
 
14610
14664
  // src/templates/tools/parse-document-tool.ts
14611
- import { z as z17 } from "zod";
14665
+ import { z as z18 } from "zod";
14612
14666
  import { extname } from "path";
14613
14667
  import { parseOfficeAsync as parseOfficeAsync2 } from "officeparser";
14614
14668
 
@@ -14977,11 +15031,11 @@ ${text.trim()}`).join("\n");
14977
15031
  name: PARSE_DOCUMENT_TOOL_NAME,
14978
15032
  needsApproval: false,
14979
15033
  description: `Extract the text of an uploaded PDF or Office document from this session's files, with "--- page N ---" markers for PDFs so you can locate content by page. Free and fast (no OCR): works only on documents with a real text layer. To SEE a page or an image inside a document, use view_document_page.`,
14980
- inputSchema: z17.object({
14981
- filename: z17.string().describe('Exact session file name, e.g. "report.pdf"'),
14982
- pages: z17.string().optional().describe('PDF page or range to extract, e.g. "2" or "1-5" (default: all pages) (PDF only)'),
14983
- offset: z17.number().int().min(1).optional().describe("1-based first output line to read (default 1)"),
14984
- limit: z17.number().int().min(1).max(1e3).optional().describe(`Number of lines to read (default ${DEFAULT_LIMIT2})`)
15034
+ inputSchema: z18.object({
15035
+ filename: z18.string().describe('Exact session file name, e.g. "report.pdf"'),
15036
+ pages: z18.string().optional().describe('PDF page or range to extract, e.g. "2" or "1-5" (default: all pages) (PDF only)'),
15037
+ offset: z18.number().int().min(1).optional().describe("1-based first output line to read (default 1)"),
15038
+ limit: z18.number().int().min(1).max(1e3).optional().describe(`Number of lines to read (default ${DEFAULT_LIMIT2})`)
14985
15039
  }),
14986
15040
  type: "function",
14987
15041
  category: "session",
@@ -14994,7 +15048,7 @@ ${text.trim()}`).join("\n");
14994
15048
  };
14995
15049
 
14996
15050
  // src/templates/tools/view-document-page-tool.ts
14997
- import { z as z18 } from "zod";
15051
+ import { z as z19 } from "zod";
14998
15052
  import { extname as extname3 } from "path";
14999
15053
 
15000
15054
  // src/sessions/pdf-preview-cache.ts
@@ -15265,9 +15319,9 @@ var createViewDocumentPageTool = ({
15265
15319
  name: VIEW_DOCUMENT_PAGE_TOOL_NAME,
15266
15320
  needsApproval: false,
15267
15321
  description: "LOOK at a page of an uploaded PDF/Office document, or at an uploaded image, from this session's files. The rendered image is attached as a user message directly after this tool result so you can visually analyze photos, charts, scans, and layouts. Use parse_document first to find which page you need. Requires a vision-capable model.",
15268
- inputSchema: z18.object({
15269
- filename: z18.string().describe('Exact session file name, e.g. "report.pdf" or "screenshot.png"'),
15270
- page: z18.number().int().min(1).optional().describe("Page number to render (default 1; ignored for image files)")
15322
+ inputSchema: z19.object({
15323
+ filename: z19.string().describe('Exact session file name, e.g. "report.pdf" or "screenshot.png"'),
15324
+ page: z19.number().int().min(1).optional().describe("Page number to render (default 1; ignored for image files)")
15271
15325
  }),
15272
15326
  type: "function",
15273
15327
  category: "session",
@@ -15409,7 +15463,7 @@ var hydrateVariables = async (tool3) => {
15409
15463
  await Promise.all(promises);
15410
15464
  return tool3;
15411
15465
  };
15412
- var convertExuluToolsToAiSdkTools = async (currentTools, currentSkills, approvedTools, allExuluTools, configs, contexts, user, exuluConfig, sessionID, req, project, sessionItems, model, agent, memoryItems, contextWindow, disabledTools, sessionOwnerId, memoryDecisions, skillDecisions) => {
15466
+ var convertExuluToolsToAiSdkTools = async (currentTools, currentSkills, approvedTools, allExuluTools, configs, contexts, user, exuluConfig, sessionID, req, project, sessionItems, model, agent, memoryItems, contextWindow, disabledTools, sessionOwnerId, memoryDecisions, skillDecisions, routineHandleFactory) => {
15413
15467
  if (!currentTools) return {};
15414
15468
  if (!allExuluTools) {
15415
15469
  allExuluTools = [];
@@ -15514,6 +15568,10 @@ var convertExuluToolsToAiSdkTools = async (currentTools, currentSkills, approved
15514
15568
  if (parseDocumentTool && !disabled.has(parseDocumentTool.id)) {
15515
15569
  currentTools.push(parseDocumentTool);
15516
15570
  }
15571
+ const routineStatusTool = createRoutineStatusTool(routineHandleFactory?.({ kind: "agent" }));
15572
+ if (routineStatusTool && !disabled.has(routineStatusTool.id)) {
15573
+ currentTools.push(routineStatusTool);
15574
+ }
15517
15575
  const viewDocumentPageTool = createViewDocumentPageTool({ sessionID, user, exuluConfig, ownerId: sessionOwnerId });
15518
15576
  if (viewDocumentPageTool && !disabled.has(viewDocumentPageTool.id)) {
15519
15577
  currentTools.push(viewDocumentPageTool);
@@ -15759,7 +15817,9 @@ var convertExuluToolsToAiSdkTools = async (currentTools, currentSkills, approved
15759
15817
  contexts: contextsMap,
15760
15818
  upload,
15761
15819
  exuluConfig,
15762
- toolVariablesConfig: toolVariablesConfigData
15820
+ toolVariablesConfig: toolVariablesConfigData,
15821
+ // Present only inside a routine run: routine.runs.current.update({ status }).
15822
+ routine: routineHandleFactory?.({ kind: "tool", id: cur.id })
15763
15823
  },
15764
15824
  options
15765
15825
  );
@@ -3,7 +3,7 @@ import {
3
3
  OUTPUT_OFFLOAD_EXEMPT_TOOL_IDS,
4
4
  convertExuluToolsToAiSdkTools,
5
5
  hydrateVariables
6
- } from "./chunk-3AEINUGF.js";
6
+ } from "./chunk-U4UIVZST.js";
7
7
  import "./chunk-4W3V7IHR.js";
8
8
  import "./chunk-F534XOQR.js";
9
9
  import "./chunk-6URU62NI.js";