pagegraph 0.8.2 → 0.8.3

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/cli.js CHANGED
@@ -35710,7 +35710,7 @@ const runWith = (command, config) => {
35710
35710
  };
35711
35711
  //#endregion
35712
35712
  //#region package.json
35713
- var version = "0.8.2";
35713
+ var version = "0.8.3";
35714
35714
  //#endregion
35715
35715
  //#region src/core/projections.ts
35716
35716
  const escapeXml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
@@ -43498,6 +43498,31 @@ const toolText = (value) => {
43498
43498
  return Object.values(record).map(toolText).join("\n");
43499
43499
  };
43500
43500
  const pathsIn = (value) => [...toolText(value).matchAll(/tools\.([A-Za-z0-9_.-]+)/g)].map((match) => match[1] ?? "").filter(Boolean);
43501
+ const toolPathPattern = /^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)+$/;
43502
+ const pathsInSearchOutput = (value) => {
43503
+ const found = /* @__PURE__ */ new Set();
43504
+ const visit = (current, pathField = false) => {
43505
+ if (typeof current === "string") {
43506
+ if (pathField) {
43507
+ const candidate = current.startsWith("tools.") ? current.slice(6) : current;
43508
+ if (toolPathPattern.test(candidate)) found.add(candidate);
43509
+ }
43510
+ try {
43511
+ visit(JSON.parse(current));
43512
+ } catch {}
43513
+ return;
43514
+ }
43515
+ if (Array.isArray(current)) {
43516
+ for (const item of current) visit(item);
43517
+ return;
43518
+ }
43519
+ if (current === null || typeof current !== "object") return;
43520
+ const record = current;
43521
+ for (const [key, nested] of Object.entries(record)) visit(nested, key === "path");
43522
+ };
43523
+ visit(value);
43524
+ return [...found];
43525
+ };
43501
43526
  const evidenceRecord = (part) => ({
43502
43527
  tool: part.name,
43503
43528
  input: part.state.input ?? null,
@@ -43511,7 +43536,7 @@ const collectExecutorEvidence = (transcript) => {
43511
43536
  const inputPaths = pathsIn(part.state.input);
43512
43537
  const inputText = toolText(part.state.input);
43513
43538
  if (part.name === "executor_search" || part.name === "executor.search" || inputPaths.some((path) => path === "executor.search")) {
43514
- for (const path of pathsIn(part.state.content)) if (path !== "executor.search") discovered.add(path);
43539
+ for (const path of pathsInSearchOutput(part.state.content)) if (path !== "executor.search") discovered.add(path);
43515
43540
  searches.push(evidenceRecord(part));
43516
43541
  continue;
43517
43542
  }
@@ -43650,7 +43675,7 @@ const acquireWorkflowHost = async (options) => {
43650
43675
  permissions: workflowOptions.permissions === void 0 ? void 0 : [...workflowOptions.permissions]
43651
43676
  });
43652
43677
  const result = await complete(session.id, prompt, workflowOptions);
43653
- if (result.executor.searches.length === 0 || result.executor.calls.length === 0) throw new Error("The SEO agent returned without searching Executor and calling a discovered tool.");
43678
+ if (result.executor.searches.length === 0 || result.executor.calls.length === 0) throw new Error(`The SEO agent returned without the required Executor evidence (searches: ${result.executor.searches.length}, calls: ${result.executor.calls.length}).`);
43654
43679
  return result;
43655
43680
  },
43656
43681
  continue: (sessionId, prompt, workflowOptions) => complete(sessionId, prompt, workflowOptions),