@exellix/ai-tasks 10.0.10 → 10.0.12

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.
Files changed (166) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +28 -31
  3. package/RUNTASK_REQUEST.md +4 -4
  4. package/dist/activix/phaseTracking.d.ts +1 -1
  5. package/dist/activix/phaseTracking.d.ts.map +1 -1
  6. package/dist/activix/phaseTracking.js.map +1 -1
  7. package/dist/builders/task-request-builder.d.ts +1 -54
  8. package/dist/builders/task-request-builder.d.ts.map +1 -1
  9. package/dist/builders/task-request-builder.js +1 -180
  10. package/dist/builders/task-request-builder.js.map +1 -1
  11. package/dist/core/task-sdk.d.ts +4 -10
  12. package/dist/core/task-sdk.d.ts.map +1 -1
  13. package/dist/core/task-sdk.js +9 -105
  14. package/dist/core/task-sdk.js.map +1 -1
  15. package/dist/errors/runTaskExecutionError.d.ts +1 -1
  16. package/dist/errors/runTaskExecutionError.d.ts.map +1 -1
  17. package/dist/errors/runTaskExecutionError.js +0 -2
  18. package/dist/errors/runTaskExecutionError.js.map +1 -1
  19. package/dist/errors/smartInputValidationError.d.ts +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts +2 -5
  25. package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts.map +1 -1
  26. package/dist/internal/resolveRunTaskRuntimeKnobs.js +3 -36
  27. package/dist/internal/resolveRunTaskRuntimeKnobs.js.map +1 -1
  28. package/dist/localTasks/collectEvidence.js +1 -1
  29. package/dist/localTasks/collectEvidence.js.map +1 -1
  30. package/dist/localTasks/index.d.ts +0 -1
  31. package/dist/localTasks/index.d.ts.map +1 -1
  32. package/dist/localTasks/index.js +0 -4
  33. package/dist/localTasks/index.js.map +1 -1
  34. package/dist/logxer/aiTasksDiagnosticCodes.d.ts +1 -1
  35. package/dist/logxer/aiTasksDiagnosticCodes.js +1 -1
  36. package/dist/logxer/aiTasksDiagnosticCodes.js.map +1 -1
  37. package/dist/narrix/narrixUnitExecution.d.ts.map +1 -1
  38. package/dist/narrix/narrixUnitExecution.js +1 -13
  39. package/dist/narrix/narrixUnitExecution.js.map +1 -1
  40. package/dist/narrix/webContextMarkdown.d.ts +0 -2
  41. package/dist/narrix/webContextMarkdown.d.ts.map +1 -1
  42. package/dist/narrix/webContextMarkdown.js +0 -9
  43. package/dist/narrix/webContextMarkdown.js.map +1 -1
  44. package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
  45. package/dist/node-execution/buildRequestFromNodePlan.js +0 -12
  46. package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
  47. package/dist/node-execution/createNodeExecutionHost.d.ts.map +1 -1
  48. package/dist/node-execution/createNodeExecutionHost.js +0 -25
  49. package/dist/node-execution/createNodeExecutionHost.js.map +1 -1
  50. package/dist/node-execution/dispatchExecutionUnit.d.ts.map +1 -1
  51. package/dist/node-execution/dispatchExecutionUnit.js +0 -15
  52. package/dist/node-execution/dispatchExecutionUnit.js.map +1 -1
  53. package/dist/node-execution/executeNodeFromPlan.d.ts.map +1 -1
  54. package/dist/node-execution/executeNodeFromPlan.js +0 -15
  55. package/dist/node-execution/executeNodeFromPlan.js.map +1 -1
  56. package/dist/node-execution/types.d.ts +0 -2
  57. package/dist/node-execution/types.d.ts.map +1 -1
  58. package/dist/observability/classifyRunTaskFailure.d.ts +1 -1
  59. package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
  60. package/dist/observability/classifyRunTaskFailure.js +0 -3
  61. package/dist/observability/classifyRunTaskFailure.js.map +1 -1
  62. package/dist/observability/extractAiTasksObservability.d.ts.map +1 -1
  63. package/dist/observability/extractAiTasksObservability.js +0 -8
  64. package/dist/observability/extractAiTasksObservability.js.map +1 -1
  65. package/dist/planWebScopeQuestions/index.d.ts +1 -1
  66. package/dist/planWebScopeQuestions/index.js +1 -1
  67. package/dist/rendrixUpstreamExports.d.ts +1 -1
  68. package/dist/rendrixUpstreamExports.d.ts.map +1 -1
  69. package/dist/rendrixUpstreamExports.js +1 -1
  70. package/dist/rendrixUpstreamExports.js.map +1 -1
  71. package/dist/synthesis/index.d.ts +1 -1
  72. package/dist/synthesis/index.js +1 -1
  73. package/dist/synthesis/resolveSourceMaterial.d.ts +3 -7
  74. package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
  75. package/dist/synthesis/resolveSourceMaterial.js +15 -78
  76. package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
  77. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +0 -1
  78. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -1
  79. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +1 -9
  80. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -1
  81. package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +3 -4
  82. package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -1
  83. package/dist/task-strategies/canonicalInputExecutionStrategies.js +3 -4
  84. package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -1
  85. package/dist/task-strategies/canonicalTaskStrategies.d.ts +2 -2
  86. package/dist/task-strategies/canonicalTaskStrategies.js +1 -1
  87. package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -1
  88. package/dist/task-strategies/cataloxCatalogViews.d.ts +2 -5
  89. package/dist/task-strategies/cataloxCatalogViews.d.ts.map +1 -1
  90. package/dist/task-strategies/cataloxCatalogViews.js +3 -6
  91. package/dist/task-strategies/cataloxCatalogViews.js.map +1 -1
  92. package/dist/task-strategies/constants.d.ts +0 -4
  93. package/dist/task-strategies/constants.d.ts.map +1 -1
  94. package/dist/task-strategies/constants.js +0 -4
  95. package/dist/task-strategies/constants.js.map +1 -1
  96. package/dist/task-strategies/index.d.ts +4 -6
  97. package/dist/task-strategies/index.d.ts.map +1 -1
  98. package/dist/task-strategies/index.js +4 -5
  99. package/dist/task-strategies/index.js.map +1 -1
  100. package/dist/task-strategies/listAiTaskStrategies.d.ts +0 -2
  101. package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -1
  102. package/dist/task-strategies/listAiTaskStrategies.js +1 -5
  103. package/dist/task-strategies/listAiTaskStrategies.js.map +1 -1
  104. package/dist/types/index.d.ts +1 -4
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/types/index.js +0 -1
  107. package/dist/types/index.js.map +1 -1
  108. package/dist/types/task-types.d.ts +9 -116
  109. package/dist/types/task-types.d.ts.map +1 -1
  110. package/dist/types/task-types.js +0 -4
  111. package/dist/types/task-types.js.map +1 -1
  112. package/dist/types/web-scope-types.d.ts +9 -11
  113. package/dist/types/web-scope-types.d.ts.map +1 -1
  114. package/dist/utils/runTaskRequestShape.d.ts +1 -5
  115. package/dist/utils/runTaskRequestShape.d.ts.map +1 -1
  116. package/dist/utils/runTaskRequestShape.js +0 -26
  117. package/dist/utils/runTaskRequestShape.js.map +1 -1
  118. package/dist/utils/templateContext.d.ts +16 -0
  119. package/dist/utils/templateContext.d.ts.map +1 -0
  120. package/dist/utils/templateContext.js +35 -0
  121. package/dist/utils/templateContext.js.map +1 -0
  122. package/dist/validation/helpers.d.ts.map +1 -1
  123. package/dist/validation/helpers.js +3 -22
  124. package/dist/validation/helpers.js.map +1 -1
  125. package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
  126. package/dist/validation/validateRunTaskConfig.js +2 -0
  127. package/dist/validation/validateRunTaskConfig.js.map +1 -1
  128. package/dist/validation/validateRunTaskInvoke.d.ts.map +1 -1
  129. package/dist/validation/validateRunTaskInvoke.js +2 -0
  130. package/dist/validation/validateRunTaskInvoke.js.map +1 -1
  131. package/dist/validation/validateWebScopeUnit.d.ts +16 -0
  132. package/dist/validation/validateWebScopeUnit.d.ts.map +1 -0
  133. package/dist/validation/validateWebScopeUnit.js +107 -0
  134. package/dist/validation/validateWebScopeUnit.js.map +1 -0
  135. package/dist/web-scope/applyWebScopeToRequest.d.ts +1 -1
  136. package/dist/web-scope/applyWebScopeToRequest.d.ts.map +1 -1
  137. package/dist/web-scope/applyWebScopeToRequest.js +10 -43
  138. package/dist/web-scope/applyWebScopeToRequest.js.map +1 -1
  139. package/dist/web-scope/buildSearchInput.d.ts +10 -7
  140. package/dist/web-scope/buildSearchInput.d.ts.map +1 -1
  141. package/dist/web-scope/buildSearchInput.js +24 -94
  142. package/dist/web-scope/buildSearchInput.js.map +1 -1
  143. package/dist/web-scope/renderWebQueryTemplate.d.ts +14 -0
  144. package/dist/web-scope/renderWebQueryTemplate.d.ts.map +1 -0
  145. package/dist/web-scope/renderWebQueryTemplate.js +44 -0
  146. package/dist/web-scope/renderWebQueryTemplate.js.map +1 -0
  147. package/dist/web-scope/webContextMarkdown.d.ts +22 -0
  148. package/dist/web-scope/webContextMarkdown.d.ts.map +1 -0
  149. package/dist/web-scope/webContextMarkdown.js +163 -0
  150. package/dist/web-scope/webContextMarkdown.js.map +1 -0
  151. package/documenations/run-task-execution-flow.md +3 -7
  152. package/documenations/web-scoping-in-ai-tasks.md +37 -54
  153. package/package.json +16 -33
  154. package/dist/narrix/applyWebScopeToRequest.d.ts +0 -9
  155. package/dist/narrix/applyWebScopeToRequest.d.ts.map +0 -1
  156. package/dist/narrix/applyWebScopeToRequest.js +0 -156
  157. package/dist/narrix/applyWebScopeToRequest.js.map +0 -1
  158. package/dist/narrix/buildWebScopeScopeInput.d.ts +0 -39
  159. package/dist/narrix/buildWebScopeScopeInput.d.ts.map +0 -1
  160. package/dist/narrix/buildWebScopeScopeInput.js +0 -193
  161. package/dist/narrix/buildWebScopeScopeInput.js.map +0 -1
  162. package/dist/narrix/webScoper.d.ts +0 -43
  163. package/dist/narrix/webScoper.d.ts.map +0 -1
  164. package/dist/narrix/webScoper.js +0 -144
  165. package/dist/narrix/webScoper.js.map +0 -1
  166. package/documenations/activix.md +0 -187
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Serialize executionMemory.webContext (`@x12i/web-scoper` WebScopeResult / WebScopePackResult) into markdown.
3
+ */
4
+ export type BuildWebContextEvidenceMarkdownOptions = {
5
+ maxTotalChars?: number;
6
+ /** @deprecated No longer affects excerpt selection — snippet is used. */
7
+ preferCleanContent?: boolean;
8
+ maxSources?: number;
9
+ dedupeByUrl?: boolean;
10
+ };
11
+ export declare function isWebContextEvidenceAvailable(webContextEntry: unknown): boolean;
12
+ export declare function buildWebContextEvidenceMarkdown(webContextEntry: unknown, options?: BuildWebContextEvidenceMarkdownOptions): string;
13
+ export declare function omitWebContextFromMemoryBundle(bundle: {
14
+ jobMemory?: Record<string, unknown>;
15
+ taskMemory?: Record<string, unknown>;
16
+ executionMemory?: Record<string, unknown>;
17
+ }): {
18
+ jobMemory?: Record<string, unknown>;
19
+ taskMemory?: Record<string, unknown>;
20
+ executionMemory?: Record<string, unknown>;
21
+ };
22
+ //# sourceMappingURL=webContextMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webContextMarkdown.d.ts","sourceRoot":"","sources":["../../src/web-scope/webContextMarkdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuEH,MAAM,MAAM,sCAAsC,GAAG;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,OAAO,GAAG,OAAO,CAU/E;AAED,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,OAAO,EACxB,OAAO,CAAC,EAAE,sCAAsC,GAC/C,MAAM,CA0ER;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C,CAQA"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Serialize executionMemory.webContext (`@x12i/web-scoper` WebScopeResult / WebScopePackResult) into markdown.
3
+ */
4
+ import { isWebScopeSearchManyResult } from "./client.js";
5
+ function isRecord(v) {
6
+ return typeof v === "object" && v !== null && !Array.isArray(v);
7
+ }
8
+ function nonEmptyString(v) {
9
+ if (typeof v !== "string")
10
+ return undefined;
11
+ const t = v.trim();
12
+ return t ? t : undefined;
13
+ }
14
+ function normalizeUrlKey(url) {
15
+ try {
16
+ const u = new URL(url.trim());
17
+ u.hash = "";
18
+ return u.href;
19
+ }
20
+ catch {
21
+ return url.trim().split("#")[0] ?? url.trim();
22
+ }
23
+ }
24
+ function pickSourceUrl(src) {
25
+ return nonEmptyString(src.url) ?? nonEmptyString(src.link);
26
+ }
27
+ function pickSourceBody(src) {
28
+ return nonEmptyString(src.snippet) ?? nonEmptyString(src.title);
29
+ }
30
+ function resolveWebContext(entry) {
31
+ if (!isRecord(entry))
32
+ return undefined;
33
+ if (entry.ok === true && isRecord(entry.context))
34
+ return entry.context;
35
+ if (isWebScopeSearchManyResult(entry)) {
36
+ if (isRecord(entry.pack?.primary))
37
+ return entry.pack.primary;
38
+ for (const scope of Object.values(entry.pack?.scopes ?? {})) {
39
+ if (isRecord(scope) && scope.ok === true && isRecord(scope.context)) {
40
+ return scope.context;
41
+ }
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ function formatFindings(findings) {
47
+ if (findings == null)
48
+ return undefined;
49
+ if (typeof findings === "string") {
50
+ const t = findings.trim();
51
+ return t ? `**Findings:**\n\n${t}` : undefined;
52
+ }
53
+ if (!Array.isArray(findings) || findings.length === 0)
54
+ return undefined;
55
+ const lines = ["**Findings:**", ""];
56
+ for (const f of findings) {
57
+ if (typeof f === "string" && f.trim())
58
+ lines.push(`- ${f.trim()}`);
59
+ else if (isRecord(f)) {
60
+ const claim = nonEmptyString(f.claim);
61
+ lines.push(`- ${claim ?? JSON.stringify(f)}`);
62
+ }
63
+ }
64
+ return lines.join("\n");
65
+ }
66
+ function parseMaxTotalCharsEnv() {
67
+ const raw = process.env.WEB_CONTEXT_MARKDOWN_MAX_CHARS;
68
+ if (!raw)
69
+ return undefined;
70
+ const n = parseInt(raw, 10);
71
+ return !Number.isNaN(n) && n > 0 ? n : undefined;
72
+ }
73
+ export function isWebContextEvidenceAvailable(webContextEntry) {
74
+ const ctx = resolveWebContext(webContextEntry);
75
+ if (!ctx)
76
+ return false;
77
+ const sources = Array.isArray(ctx.sources) ? ctx.sources : [];
78
+ const hasSourceMaterial = sources.some((s) => isRecord(s) && (pickSourceBody(s) || pickSourceUrl(s)));
79
+ const summary = nonEmptyString(ctx.summary);
80
+ const findingsBlock = formatFindings(ctx.findings);
81
+ return hasSourceMaterial || !!summary || !!findingsBlock;
82
+ }
83
+ export function buildWebContextEvidenceMarkdown(webContextEntry, options) {
84
+ const ctx = resolveWebContext(webContextEntry);
85
+ if (!ctx)
86
+ return "";
87
+ let sources = Array.isArray(ctx.sources) ? [...ctx.sources] : [];
88
+ const dedupeByUrl = options?.dedupeByUrl !== false;
89
+ const maxSources = options?.maxSources ?? 5;
90
+ if (dedupeByUrl && sources.length > 0) {
91
+ const seen = new Set();
92
+ const out = [];
93
+ for (const s of sources) {
94
+ if (!isRecord(s)) {
95
+ out.push(s);
96
+ continue;
97
+ }
98
+ const url = pickSourceUrl(s);
99
+ const key = url ? normalizeUrlKey(url) : `__nourl_${out.length}`;
100
+ if (seen.has(key))
101
+ continue;
102
+ seen.add(key);
103
+ out.push(s);
104
+ }
105
+ sources = out;
106
+ }
107
+ if (maxSources > 0 && sources.length > maxSources) {
108
+ sources = sources.slice(0, maxSources);
109
+ }
110
+ const summary = nonEmptyString(ctx.summary);
111
+ const findingsBlock = formatFindings(ctx.findings);
112
+ const hasSourceMaterial = sources.some((s) => isRecord(s) && (pickSourceBody(s) || pickSourceUrl(s)));
113
+ if (!hasSourceMaterial && !summary && !findingsBlock)
114
+ return "";
115
+ const lines = [
116
+ "",
117
+ "## Web sources (primary evidence)",
118
+ "",
119
+ "Ground factual claims in the **source excerpts** below. **Summary** and **findings** (if present) are overview hints only—not authoritative on their own.",
120
+ "",
121
+ ];
122
+ if (summary || findingsBlock) {
123
+ lines.push("### Web overview (hints only)", "", "*Do not treat this subsection alone as sufficient evidence.*", "");
124
+ if (summary)
125
+ lines.push("**Summary:**", summary, "");
126
+ if (findingsBlock)
127
+ lines.push(findingsBlock, "");
128
+ }
129
+ lines.push("### Source excerpts (ground truth)", "");
130
+ for (let i = 0; i < sources.length; i++) {
131
+ const src = sources[i];
132
+ if (!isRecord(src))
133
+ continue;
134
+ const title = nonEmptyString(src.title) ?? nonEmptyString(src.name) ?? `Source ${i + 1}`;
135
+ const url = pickSourceUrl(src);
136
+ const body = pickSourceBody(src);
137
+ if (!body && !url)
138
+ continue;
139
+ lines.push(`#### ${title}`, "");
140
+ if (url)
141
+ lines.push(`- URL: ${url}`, "");
142
+ if (body)
143
+ lines.push(body, "");
144
+ }
145
+ let out = lines.join("\n");
146
+ const maxTotal = options?.maxTotalChars ?? parseMaxTotalCharsEnv();
147
+ if (maxTotal !== undefined && out.length > maxTotal) {
148
+ const marker = "\n\n[truncated — web source budget exceeded]";
149
+ const cut = Math.max(0, maxTotal - marker.length);
150
+ return out.slice(0, cut) + marker;
151
+ }
152
+ return out.endsWith("\n") ? out : `${out}\n`;
153
+ }
154
+ export function omitWebContextFromMemoryBundle(bundle) {
155
+ const ex = bundle.executionMemory;
156
+ if (!ex || typeof ex !== "object" || !("webContext" in ex)) {
157
+ return bundle;
158
+ }
159
+ const restExec = { ...ex };
160
+ delete restExec.webContext;
161
+ return { ...bundle, executionMemory: restExec };
162
+ }
163
+ //# sourceMappingURL=webContextMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webContextMarkdown.js","sourceRoot":"","sources":["../../src/web-scope/webContextMarkdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,cAAc,CAAC,CAAU;IAChC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3B,CAAC;AAED,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAA4B;IACjD,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,cAAc,CA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C,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IACpC,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,MAI9C;IAKC,MAAM,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC;IAClC,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IAC3B,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC3B,OAAO,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;AAClD,CAAC"}
@@ -13,11 +13,7 @@ flowchart TD
13
13
  B -- Yes --> N1[Resolve raw record]
14
14
  N1 --> N2[Run Narrix pre-processor]
15
15
  N2 --> N3[Attach _narrix to executionMemory and jobMemory]
16
- N3 --> N4{narrix.enableWebScope === true?}
17
- N4 -- Yes --> N5[Run web scoper]
18
- N5 --> N6[Set executionMemory.webContext]
19
- N4 -- No --> B2
20
- N6 --> B2
16
+ N3 --> B2
21
17
 
22
18
  B2 -- Yes --> H1[Resolve narrixInput]
23
19
  H1 --> H2[Run structured Narrix handler]
@@ -57,7 +53,7 @@ flowchart TD
57
53
  - Resolve the raw record from `executionMemory`, `jobMemory`, or `input`.
58
54
  - Run Narrix (ingest + runner).
59
55
  - Attach result to `executionMemory._narrix` (or configured field) and mirror to `jobMemory._narrix`.
60
- - If `narrix.enableWebScope` is `true`, run web scoping and store result in `executionMemory.webContext`.
56
+ - NARRIX does **not** trigger web scoping. Web context comes from a standalone `webScope` PRE unit (see [web-scoping-in-ai-tasks.md](./web-scoping-in-ai-tasks.md)).
61
57
  4. Else if **`narrixMode === "handler"`**, run structured Narrix from `narrixInput` (same behavior as legacy `narrix-then-direct` Narrix phase), **before** local tasks and pipeline PRE.
62
58
  5. Check local task registry for `skillKey`.
63
59
  6. If local handler exists, execute it and return immediately (skip enrichment/LLM path).
@@ -77,7 +73,7 @@ flowchart TD
77
73
 
78
74
  - Default execution is effectively direct when no pipeline is provided.
79
75
  - Local tasks are deterministic and bypass LLM execution.
80
- - Web scoping is non-fatal: Narrix attachment can still succeed when web scope misses/fails.
76
+ - Web scoping is a standalone `webScope` PRE unit (rendered `webQueryTemplate`); it is non-fatal at runtime and decoupled from NARRIX.
81
77
  - POST steps (`audit`, `polish`) run only when declared in `executionPipeline`.
82
78
  - For PRE `synthesized-context`, structured mode is additive and template-core-aware (`templateCores` + question), while markdown mode remains available for backward compatibility.
83
79
  - Structured core discovery is pre-render from raw instructions/prompt templates and expects core directives in `{{core:...}}` form.
@@ -6,21 +6,20 @@ This document explains how web scoping is wired into ai-tasks, how requests opt
6
6
 
7
7
  ## 1. High-level overview
8
8
 
9
- - **Goal**: Retrieve **external web context** for a natural-language question (optionally enriched with record facts) and expose it on `executionMemory.webContext`.
9
+ - **Goal**: Retrieve **external web context** for a search query (optionally enriched with record facts) and expose it on `executionMemory.webContext`.
10
10
  - **Package**: [`@x12i/web-scoper`](https://www.npmjs.com/package/@x12i/web-scoper) — planning, Tavily search via `@x12i/search-adapter`, normalized `WebContext`.
11
- - **Adapter layer**: `src/web-scope/` compiles graph/task fields into `{ question, record?, options? }` or a multi-question pack. No Graphenix, Activix, or NARRIX CNI fields are sent to the scoper.
12
- - **Triggers**:
13
- - **`RunTaskRequest.narrix.enableWebScope === true`** after a successful NARRIX preprocessor run.
14
- - **Standalone PRE unit** — `externalPreUtility` with `strategyKey: "webScope"` (Graphenix node plans, ai-tasks playground).
11
+ - **Adapter layer**: `src/web-scope/` renders the unit's `webQueryTemplate` into `{ question, record?, options? }` (or a pack), then calls the scoper. No Graphenix, Activix, or NARRIX CNI fields are sent.
12
+ - **Trigger** (single, explicit): an `externalPreUtility` execution unit with **`strategyKey: "webScope"`**. There is **no** NARRIX trigger and **no** implicit question fallback.
13
+ - **Search query**: the **rendered `unitParams.webQueryTemplate`** (a Rendrix string, e.g. `"How to solve {{input.vulnerability}}?"`). The template is **required** when the unit is enabled.
15
14
  - **Result**:
16
15
 
17
16
  ```ts
18
17
  ctx.executionMemory.webContext: WebScopeResult | WebScopePackResult
19
18
  ```
20
19
 
21
- Always set when web scoping is enabled for that hop, including miss/error shapes (`ok: false`).
20
+ Always set when the unit runs, including miss/error shapes (`ok: false`).
22
21
 
23
- - **Failure stance**: **Lenient.** Web scoping failures do not abort NARRIX or MAIN execution.
22
+ - **Failure stance**: **Lenient at runtime** (web scoping failures do not abort MAIN execution), but **loud and early at validation**: a missing/unresolvable `webQueryTemplate` is a config error.
24
23
 
25
24
  ---
26
25
 
@@ -57,35 +56,39 @@ await scoper.searchMany({
57
56
 
58
57
  ## 3. How ai-tasks compiles the payload
59
58
 
60
- Implementation: **`src/web-scope/buildSearchInput.ts`**, **`src/web-scope/applyWebScopeToRequest.ts`**, **`src/web-scope/client.ts`**.
59
+ Implementation: **`src/web-scope/buildSearchInput.ts`**, **`src/web-scope/renderWebQueryTemplate.ts`**, **`src/web-scope/applyWebScopeToRequest.ts`**, **`src/web-scope/client.ts`**.
61
60
 
62
- ### 3.1. Question resolution order
61
+ ### 3.1. Query resolution — rendered template only
63
62
 
64
- 1. `RunTaskRequest.input.question` or string `input`
65
- 2. `nodePlan.invokeContract.taskVariable.question`
66
- 3. `executionMemory.taskVariables.question`
63
+ The search query is the **rendered `unitParams.webQueryTemplate`**. There is **no** fallback to `input.question`, `taskVariable.question`, or `executionMemory.taskVariables.question`.
64
+
65
+ 1. `webScopeInvokeConfigFromUnitParams(unitParams)` reads `webQueryTemplate` (single) and/or `webQueryTemplates` (pack).
66
+ 2. `renderWebQueryTemplate(template, request)` renders it with `@x12i/rendrix` `render()` against `buildTemplateContext(request)` — the same roots used by validation (`input`, `jobVariables`, `taskVariables`, `executionMemory`, …).
67
+ 3. An empty render (e.g. a template that is only an unresolved token) yields no query → `{ ok: false, error: { reason: "no_queries" } }`.
67
68
 
68
69
  ### 3.2. Record resolution
69
70
 
70
71
  Merged from (when present):
71
72
 
72
- - `input.record` or non-question fields on object `input`
73
+ - `input.record` or fields on object `input`
73
74
  - `executionMemory.input` / `executionMemory.input.raw`
74
- - CNI `knownFacts` (when NARRIX ran first and CNI is passed into the web-scope hop)
75
+ - CNI `knownFacts` (when facts are passed into the web-scope hop)
76
+
77
+ The record carries **facts only** — the query comes from the template, which references those facts via `{{input.*}}`.
75
78
 
76
- ### 3.3. Options / legacy graphenix fields
79
+ ### 3.3. Options
77
80
 
78
81
  | Source | Maps to |
79
82
  |--------|---------|
80
- | `unitParams.options` | `WebScopeOptions` (preferred) |
81
- | `unitParams.webScopeOptions` | same |
82
- | `narrix.webScopeOptions` | same |
83
- | `narrix.webScoping` / `unitParams.webScoping` | `mapLegacyWebScopingToOptions()` — `maxQueries`, `freshnessDays`, domain filters, **`webScopeTemplates` → `options.queryTemplates`**, etc. |
84
- | `narrix.webScopeQuestions` / `unitParams.webScopeQuestions` / `unitParams.questions` | `searchMany` pack |
83
+ | `unitParams.options` | `WebScopeOptions` (`maxQueries`, `freshnessDays`, domain filters, `queryTemplates`, …) |
84
+
85
+ There are no legacy `webScoping` / `webScopeOptions` / `webScopeQuestions` mappings and no NARRIX option sources.
86
+
87
+ ### 3.4. Pack mode
85
88
 
86
- When a non-empty question list is configured, ai-tasks calls **`searchMany`**; otherwise **`search`** with a single `question`. If neither a question nor pack questions are available, web scoping stores `{ ok: false, error: { reason: "no_queries", … } }`.
89
+ When `unitParams.webQueryTemplates` is a non-empty `string[]`, each template is rendered independently (`renderWebQueryTemplates`) into a `searchMany` question pack (UUID ids assigned per question). Otherwise a single `search` runs with the rendered `webQueryTemplate`.
87
90
 
88
- ### 3.4. Standalone PRE web-scope unit
91
+ ### 3.5. The web-scope unit
89
92
 
90
93
  Graphenix / playground unit:
91
94
 
@@ -95,34 +98,28 @@ Graphenix / playground unit:
95
98
  "strategyKey": "webScope",
96
99
  "unitParams": {
97
100
  "enableWebScope": true,
101
+ "webQueryTemplate": "How to solve {{input.vulnerability}}?",
98
102
  "options": { "maxQueries": 3 }
99
103
  }
100
104
  }
101
105
  ```
102
106
 
103
- Playground input:
107
+ Playground input (record/facts only — referenced by the template):
104
108
 
105
109
  ```json
106
110
  {
107
- "question": "What is the patch status for CVE-2021-44228?",
108
- "record": { "cveId": "CVE-2021-44228", "vendor": "apache" }
111
+ "vulnerability": "CVE-2021-44228",
112
+ "vendor": "apache"
109
113
  }
110
114
  ```
111
115
 
112
- ---
113
-
114
- ## 4. NARRIX + web scope
115
-
116
- When **`narrix.enableWebScope === true`**, the NARRIX preprocessor runs first; on success, ai-tasks calls the same web-scope adapter with optional CNI facts merged into `record`.
116
+ `enableWebScope` (default `true`) is the on/off switch. When `false`, the unit is a no-op.
117
117
 
118
- Optional **`RunTaskRequest.narrix`** fields (backward compatible):
118
+ ---
119
119
 
120
- - **`webScopeQuestions`** explicit pack (see §3.3)
121
- - **`webScopeOptions`** — preferred options object
122
- - **`webScoping`**, **`webScopeTemplates`**, **`webScopeQuestionTemplate`**, **`webScopeObjects`** — legacy; mapped at invoke time where supported
123
- - **`skipWebScopeWhenExternalWebMarkdownPresent`** — skip when `executionMemory.webContextMarkdown` is already non-empty
120
+ ## 4. NARRIX (no longer triggers web scope)
124
121
 
125
- NARRIX attachment (`executionMemory._narrix` or `attachToField`) is independent of web scoping.
122
+ Web scoping is **fully decoupled from NARRIX**. The NARRIX preprocessor/handler still builds its CNI attachment (`executionMemory._narrix` or `attachToField`), but it does **not** trigger or configure web search. To web-scope after NARRIX, add an explicit `webScope` unit to the node plan with its own `webQueryTemplate`.
126
123
 
127
124
  ---
128
125
 
@@ -145,15 +142,14 @@ if (web && "ok" in web && web.ok === true && web.context) {
145
142
  }
146
143
  ```
147
144
 
148
- For **`includeContextInPrompt`** / synthesis PRE, ai-tasks builds **Web sources (primary evidence)** markdown when `ok === true`, preferring source `snippet` / `title`. Raw `webContext` JSON is omitted from synthesized memory slices when markdown is included (see `resolveSourceMaterial` tests).
149
-
150
- Legacy **`available`** field from `@exellix/narrix-web-scoper` is **not** used; check **`ok`**.
145
+ For **`includeContextInPrompt`** / synthesis PRE, ai-tasks builds **Web sources (primary evidence)** markdown when `ok === true`, preferring source `snippet` / `title`. Raw `webContext` JSON is omitted from synthesized memory slices when markdown is included (see `resolveSourceMaterial` tests). Always check **`ok`** on `WebScopeResult` / `WebScopePackResult`.
151
146
 
152
147
  ---
153
148
 
154
149
  ## 7. Testing
155
150
 
156
- - **`test/narrix/webScoper.test.ts`** — payload compilation, client error handling, `applyWebScopeToRequest`
151
+ - **`test/web-scope/buildSearchInput.test.ts`** — template rendering, payload compilation, client error handling, `applyWebScopeToRequest`
152
+ - **`test/validation/validateWebScopeUnit.test.ts`** — required `webQueryTemplate` and token resolution checks
157
153
  - **`test/narrix/webContextMarkdown.test.ts`** — markdown from `{ ok, context }`
158
154
  - **`test/synthesis/resolveSourceMaterial.test.ts`** — web evidence in source material
159
155
  - **`test/utils/collectEvidence.test.ts`** — local handler uses web scoper for query discovery
@@ -161,20 +157,7 @@ Legacy **`available`** field from `@exellix/narrix-web-scoper` is **not** used;
161
157
  Run targeted tests:
162
158
 
163
159
  ```bash
164
- cd ai-tasks && npm run build && npx tsc -p tsconfig.test.json && node --test dist-test/test/narrix/webScoper.test.js dist-test/test/narrix/webContextMarkdown.test.js
160
+ cd ai-tasks && npm run build && npx tsc -p tsconfig.test.json && node --test dist-test/test/web-scope/buildSearchInput.test.js dist-test/test/validation/validateWebScopeUnit.test.js
165
161
  ```
166
162
 
167
163
  Live Tavily: **`npm run test:e2e:webScope`** (requires `TAVILY_API_KEY`).
168
-
169
- ---
170
-
171
- ## 8. Migration from `@exellix/narrix-web-scoper`
172
-
173
- | Before (narrix-web-scoper) | After (`@x12i/web-scoper`) |
174
- |----------------------------|----------------------------|
175
- | `ScopeInput` with `datasetId`, `entity`, `cni` | `{ question, record?, options? }` only |
176
- | `WebScoperResult.available` | `WebScopeResult.ok` |
177
- | `runWebScope()` / `scopeQuestionPack()` | `search()` / `searchMany()` |
178
- | `src/narrix/webScoper.ts` | `src/web-scope/` |
179
-
180
- Graph/node authoring should pass **question + record** at the ai-tasks boundary; NARRIX/CNI enrichment stays in the adapter.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exellix/ai-tasks",
3
- "version": "10.0.10",
3
+ "version": "10.0.12",
4
4
  "description": "Task orchestration for the Exellix stack: runTask() with local handlers or LLM-backed execution, task-scoped memory/context enrichment, and executor dispatch via @exellix/ai-skills. ERC-compliant.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,21 +21,14 @@
21
21
  "scripts": {
22
22
  "build": "tsc",
23
23
  "dev": "ts-node src/index.ts",
24
- "prepublishOnly": "npm run build && node scripts/ensure-nx-content-md-variants.mjs",
24
+ "prepublishOnly": "node scripts/assert-publishable-deps.mjs && npm run build && node scripts/ensure-nx-content-md-variants.mjs",
25
25
  "deps:latest": "npx npm-check-updates -u && npm install",
26
- "test": "node scripts/ensure-xynthesis-dist.mjs && node scripts/ensure-ai-skills-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node scripts/copy-test-fixtures.mjs && node --test --test-force-exit --test-concurrency=1 dist-test/test/node-execution/**/*.js dist-test/test/narrix/*.js dist-test/test/narrix-then-execute/*.js dist-test/test/aiScoping/*.js dist-test/test/intermediateSteps/*.js dist-test/test/post-steps/**/*.js dist-test/test/planWebScopeQuestions/*.js dist-test/test/synthesis/*.js dist-test/test/fact-guard/*.js dist-test/test/utils/*.js dist-test/test/errors/*.js dist-test/test/validation/*.js dist-test/test/task-strategies/*.js dist-test/test/observability/*.js dist-test/test/run-task/*.js dist-test/test/internal/*.js dist-test/test/execution-strategies/*.js dist-test/test/invocation/*.js dist-test/test/e2e/*.js",
27
- "test:with-narrix-ingest": "node scripts/run-npm-test-with-narrix-ingest.mjs",
26
+ "test": "node scripts/ensure-xynthesis-dist.mjs && node scripts/ensure-ai-skills-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node scripts/copy-test-fixtures.mjs && node --test --test-force-exit --test-concurrency=1 dist-test/test/node-execution/**/*.js dist-test/test/aiScoping/*.js dist-test/test/intermediateSteps/*.js dist-test/test/post-steps/**/*.js dist-test/test/planWebScopeQuestions/*.js dist-test/test/synthesis/*.js dist-test/test/fact-guard/*.js dist-test/test/utils/*.js dist-test/test/errors/*.js dist-test/test/validation/*.js dist-test/test/web-scope/*.js dist-test/test/task-strategies/*.js dist-test/test/observability/*.js dist-test/test/run-task/*.js dist-test/test/internal/*.js dist-test/test/execution-strategies/*.js dist-test/test/invocation/*.js dist-test/test/e2e/*.js",
28
27
  "test:e2e:intermediateSteps": "node scripts/run-with-env.mjs RUN_INTERMEDIATE_STEPS_E2E=1 npm run test",
29
28
  "test:e2e:synthesis": "node scripts/run-synthesis-e2e.mjs",
30
29
  "test:e2e:webScope": "node scripts/run-web-scope-e2e.mjs",
31
30
  "test:fact-guard": "node scripts/ensure-xynthesis-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node --test --test-force-exit dist-test/test/fact-guard/*.js dist-test/test/post-steps/runPostStepLlmCall.factGuard.test.js",
32
31
  "test:live": "node scripts/run-live-ai-e2e.mjs",
33
- "test:narrix:live": "node scripts/check-narrix-archive.mjs && node scripts/run-npm-test-with-narrix-ingest.mjs",
34
- "local:narrix:subnets": "node dist/localTasks/narrixSubnetPlayground.js",
35
- "local:narrix:assets": "node dist/localTasks/narrixAssetPlayground.js",
36
- "local:narrix:vuln-groups": "node dist/localTasks/narrixVulnGroupPlayground.js",
37
- "local:narrix:vuln-instances": "node dist/localTasks/narrixVulnInstancePlayground.js",
38
- "local:narrix:all": "npm run local:narrix:subnets && npm run local:narrix:assets && npm run local:narrix:vuln-groups && npm run local:narrix:vuln-instances",
39
32
  "publish:task-strategies": "tsx scripts/publish-ai-task-strategies-catalog.ts"
40
33
  },
41
34
  "keywords": [
@@ -65,32 +58,22 @@
65
58
  "@x12i/catalox-contracts": "^5.9.7"
66
59
  },
67
60
  "dependencies": {
68
- "@exellix/ai-skills": "^6.12.3",
69
- "@exellix/fact-guard-adapters": "file:../fact-guard/packages/adapters",
70
- "@exellix/fact-guard-enrichment": "file:../fact-guard/packages/enrichment",
71
- "@exellix/fact-guard-policies": "file:../fact-guard/packages/policies",
72
- "@exellix/fact-guard-types": "file:../fact-guard/packages/types",
73
- "@exellix/fact-guard-validation": "file:../fact-guard/packages/validation",
74
- "@exellix/memorix-narrix-adapter": "^2.0.0",
75
- "@exellix/narrix-adapter-chat": "^2.0.0",
76
- "@exellix/narrix-adapter-docs": "^2.0.0",
77
- "@exellix/narrix-adapter-records": "^2.0.0",
78
- "@exellix/narrix-adapter-text": "^2.0.0",
79
- "@exellix/narrix-adapters-core": "^2.0.0",
80
- "@exellix/narrix-catalox": "^2.0.0",
81
- "@exellix/narrix-cni": "^2.0.0",
82
- "@exellix/narrix-ingest": "^2.0.0",
83
- "@exellix/narrix-runner": "^2.0.0",
61
+ "@exellix/ai-skills": "^6.12.4",
62
+ "@exellix/fact-guard-adapters": "^1.0.1",
63
+ "@exellix/fact-guard-enrichment": "^1.0.1",
64
+ "@exellix/fact-guard-policies": "^1.0.1",
65
+ "@exellix/fact-guard-types": "^1.0.1",
66
+ "@exellix/fact-guard-validation": "^1.0.1",
84
67
  "@exellix/xynthesis": "^4.8.4",
85
68
  "@x12i/activix": "^8.6.3",
86
69
  "@x12i/ai-profiles": "^3.4.0",
87
70
  "@x12i/catalox": "^5.9.7",
88
71
  "@x12i/execution-memory-manager": "^1.2.0",
89
72
  "@x12i/funcx": "^4.9.13",
90
- "@x12i/graphenix-core": "^2.7.0",
91
- "@x12i/graphenix-executable-contracts": "^2.7.0",
92
- "@x12i/graphenix-plan-format": "^2.7.0",
93
- "@x12i/graphenix-trace-format": "^2.7.0",
73
+ "@x12i/graphenix-core": "^2.7.3",
74
+ "@x12i/graphenix-executable-contracts": "^2.7.3",
75
+ "@x12i/graphenix-plan-format": "^2.7.3",
76
+ "@x12i/graphenix-trace-format": "^2.7.3",
94
77
  "@x12i/logxer": "^4.6.0",
95
78
  "@x12i/optimixer": "^3.5.2",
96
79
  "@x12i/rendrix": "^4.3.0",
@@ -102,9 +85,9 @@
102
85
  "devDependencies": {
103
86
  "@types/node": "^18.0.0 || ^20.0.0",
104
87
  "@x12i/catalox-contracts": "^5.9.7",
105
- "@x12i/graphenix-authoring-format": "^2.7.0",
106
- "@x12i/graphenix-plan-compiler": "^2.7.0",
107
- "@x12i/graphenix-task-node-format": "^2.7.0",
88
+ "@x12i/graphenix-authoring-format": "^2.7.3",
89
+ "@x12i/graphenix-plan-compiler": "^2.7.3",
90
+ "@x12i/graphenix-task-node-format": "^2.7.3",
108
91
  "dotenv": "^16.0.0",
109
92
  "ts-node": "^10.9.0",
110
93
  "tsx": "^4.0.0",
@@ -1,9 +0,0 @@
1
- import type { NarrixPreProcessorConfig, RunTaskRequest } from "../types/task-types.js";
2
- import type { NarrixRunOutputSuccess } from "./types.js";
3
- /**
4
- * Run web scoping and merge `executionMemory.webContext` (lenient — always sets webContext when enabled).
5
- */
6
- export declare function applyWebScopeToRequest(request: RunTaskRequest, narrix: NarrixPreProcessorConfig, narrixSuccess?: NarrixRunOutputSuccess): Promise<RunTaskRequest>;
7
- /** Standalone Layer-1 web-scope unit (no Narrix preprocessor required). */
8
- export declare function applyStandaloneWebScopeUnit(request: RunTaskRequest, unitParams?: Record<string, unknown>): Promise<RunTaskRequest>;
9
- //# sourceMappingURL=applyWebScopeToRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"applyWebScopeToRequest.d.ts","sourceRoot":"","sources":["../../src/narrix/applyWebScopeToRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAMvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA0FzD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,wBAAwB,EAChC,aAAa,CAAC,EAAE,sBAAsB,GACrC,OAAO,CAAC,cAAc,CAAC,CA4CzB;AAED,2EAA2E;AAC3E,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,cAAc,CAAC,CAiCzB"}