veryfront 0.1.416 → 0.1.418
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/esm/deno.js +1 -1
- package/esm/src/agent/default-research-artifact-policy.d.ts +4 -0
- package/esm/src/agent/default-research-artifact-policy.d.ts.map +1 -1
- package/esm/src/agent/default-research-artifact-policy.js +19 -0
- package/esm/src/agent/default-research-artifact-support.d.ts +1 -0
- package/esm/src/agent/default-research-artifact-support.d.ts.map +1 -1
- package/esm/src/agent/default-research-artifact-support.js +20 -4
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/default-research-artifact-policy.ts +25 -0
- package/src/src/agent/default-research-artifact-support.ts +24 -3
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -20,6 +20,10 @@ export declare function buildDefaultResearchArtifactPaths(input: {
|
|
|
20
20
|
prompt: string;
|
|
21
21
|
runId?: string;
|
|
22
22
|
}): DefaultResearchArtifactPaths;
|
|
23
|
+
export declare function buildDefaultResearchArtifactPathsFromCurrentReportPath(input: {
|
|
24
|
+
currentReportPath: string;
|
|
25
|
+
runId?: string;
|
|
26
|
+
}): DefaultResearchArtifactPaths | null;
|
|
23
27
|
export declare function withDefaultResearchArtifactPath(input: {
|
|
24
28
|
description: string;
|
|
25
29
|
prompt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-research-artifact-policy.d.ts","sourceRoot":"","sources":["../../../src/src/agent/default-research-artifact-policy.ts"],"names":[],"mappings":"AAiEA,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAaV;AAED,wBAAgB,wCAAwC,CAAC,KAAK,EAAE;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,GAAG,IAAI,CAehB;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,4BAA4B,CAe/B;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAOT"}
|
|
1
|
+
{"version":3,"file":"default-research-artifact-policy.d.ts","sourceRoot":"","sources":["../../../src/src/agent/default-research-artifact-policy.ts"],"names":[],"mappings":"AAiEA,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAaV;AAED,wBAAgB,wCAAwC,CAAC,KAAK,EAAE;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,GAAG,IAAI,CAehB;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,4BAA4B,CAe/B;AAED,wBAAgB,sDAAsD,CAAC,KAAK,EAAE;IAC5E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,4BAA4B,GAAG,IAAI,CAoBtC;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAOT"}
|
|
@@ -90,6 +90,25 @@ export function buildDefaultResearchArtifactPaths(input) {
|
|
|
90
90
|
sourcesPath: `${topicRootPath}/sources.md`,
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
export function buildDefaultResearchArtifactPathsFromCurrentReportPath(input) {
|
|
94
|
+
const currentReportPath = input.currentReportPath.replace(/^\/+/, "");
|
|
95
|
+
const reportPathMatch = currentReportPath.match(/^research\/(.+)\/report\.md$/);
|
|
96
|
+
if (!reportPathMatch?.[1]) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const topicSlug = reportPathMatch[1];
|
|
100
|
+
const sanitizedRunId = slugifyRunArtifactSegment(input.runId ?? "");
|
|
101
|
+
const effectiveRunId = sanitizedRunId.length > 0 ? sanitizedRunId : "latest";
|
|
102
|
+
const topicRootPath = `/research/${topicSlug}`;
|
|
103
|
+
return {
|
|
104
|
+
topicSlug,
|
|
105
|
+
topicRootPath,
|
|
106
|
+
currentReportPath: `/${currentReportPath}`,
|
|
107
|
+
runReportPath: `${topicRootPath}/runs/${effectiveRunId}.report.md`,
|
|
108
|
+
findingsPath: `${topicRootPath}/findings.md`,
|
|
109
|
+
sourcesPath: `${topicRootPath}/sources.md`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
93
112
|
export function withDefaultResearchArtifactPath(input) {
|
|
94
113
|
const reminder = buildDefaultResearchArtifactPathReminder(input);
|
|
95
114
|
if (!reminder) {
|
|
@@ -31,6 +31,7 @@ export declare function shouldRetryCreateResearchArtifactAsUpdate(input: {
|
|
|
31
31
|
export declare function mirrorDefaultResearchRunArtifact(input: {
|
|
32
32
|
toolName: string;
|
|
33
33
|
toolInput: Record<string, unknown>;
|
|
34
|
+
toolResult?: unknown;
|
|
34
35
|
taskContext: DefaultResearchArtifactContext;
|
|
35
36
|
activeProjectId: string | null;
|
|
36
37
|
executeContext: Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-research-artifact-support.d.ts","sourceRoot":"","sources":["../../../src/src/agent/default-research-artifact-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,
|
|
1
|
+
{"version":3,"file":"default-research-artifact-support.d.ts","sourceRoot":"","sources":["../../../src/src/agent/default-research-artifact-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAIL,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAE/C,MAAM,MAAM,wBAAwB,GAAG,4BAA4B,CAAC;AAEpE,MAAM,WAAW,8BAA8B;IAC7C,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,6BAA6B;IAC5C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvE;AAcD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CAAC,GAAG,SAAS,CAAC;IACpD,WAAW,EAAE,CACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KACzC,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8ChB"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { isHostedChildCreateFileAlreadyExistsResult } from "./hosted-child-artifact-support.js";
|
|
2
|
-
import { buildDefaultResearchArtifactPathReminder, buildDefaultResearchArtifactPaths, } from "./default-research-artifact-policy.js";
|
|
2
|
+
import { buildDefaultResearchArtifactPathReminder, buildDefaultResearchArtifactPaths, buildDefaultResearchArtifactPathsFromCurrentReportPath, } from "./default-research-artifact-policy.js";
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
|
+
function extractToolResultPath(result) {
|
|
7
|
+
if (!isRecord(result) || typeof result.path !== "string") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return result.path.replace(/^\/+/, "");
|
|
11
|
+
}
|
|
6
12
|
export function extractLatestUserText(messages) {
|
|
7
13
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
8
14
|
const message = messages[index];
|
|
@@ -151,17 +157,27 @@ export function shouldRetryCreateResearchArtifactAsUpdate(input) {
|
|
|
151
157
|
return path === topicRootPath || path.startsWith(`${topicRootPath}/`);
|
|
152
158
|
}
|
|
153
159
|
export async function mirrorDefaultResearchRunArtifact(input) {
|
|
154
|
-
|
|
155
|
-
if (!defaultArtifacts || (input.toolName !== "create_file" && input.toolName !== "update_file")) {
|
|
160
|
+
if (input.toolName !== "create_file" && input.toolName !== "update_file") {
|
|
156
161
|
return;
|
|
157
162
|
}
|
|
158
163
|
const content = typeof input.toolInput.content === "string" ? input.toolInput.content : null;
|
|
159
164
|
const path = typeof input.toolInput.path === "string"
|
|
160
165
|
? input.toolInput.path.replace(/^\/+/, "")
|
|
161
166
|
: null;
|
|
167
|
+
const resultPath = extractToolResultPath(input.toolResult);
|
|
168
|
+
const defaultArtifacts = input.taskContext.defaultResearchArtifacts ??
|
|
169
|
+
(resultPath
|
|
170
|
+
? buildDefaultResearchArtifactPathsFromCurrentReportPath({
|
|
171
|
+
currentReportPath: resultPath,
|
|
172
|
+
runId: input.taskContext.parentRunId,
|
|
173
|
+
})
|
|
174
|
+
: null);
|
|
175
|
+
if (!defaultArtifacts) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
162
178
|
const canonicalCurrentPath = defaultArtifacts.currentReportPath.replace(/^\/+/, "");
|
|
163
179
|
const canonicalRunPath = defaultArtifacts.runReportPath.replace(/^\/+/, "");
|
|
164
|
-
if (!content || path !== canonicalCurrentPath) {
|
|
180
|
+
if (!content || (path !== canonicalCurrentPath && resultPath !== canonicalCurrentPath)) {
|
|
165
181
|
return;
|
|
166
182
|
}
|
|
167
183
|
const mirroredInput = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.418";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -132,6 +132,31 @@ export function buildDefaultResearchArtifactPaths(input: {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
export function buildDefaultResearchArtifactPathsFromCurrentReportPath(input: {
|
|
136
|
+
currentReportPath: string;
|
|
137
|
+
runId?: string;
|
|
138
|
+
}): DefaultResearchArtifactPaths | null {
|
|
139
|
+
const currentReportPath = input.currentReportPath.replace(/^\/+/, "");
|
|
140
|
+
const reportPathMatch = currentReportPath.match(/^research\/(.+)\/report\.md$/);
|
|
141
|
+
if (!reportPathMatch?.[1]) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const topicSlug = reportPathMatch[1];
|
|
146
|
+
const sanitizedRunId = slugifyRunArtifactSegment(input.runId ?? "");
|
|
147
|
+
const effectiveRunId = sanitizedRunId.length > 0 ? sanitizedRunId : "latest";
|
|
148
|
+
const topicRootPath = `/research/${topicSlug}`;
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
topicSlug,
|
|
152
|
+
topicRootPath,
|
|
153
|
+
currentReportPath: `/${currentReportPath}`,
|
|
154
|
+
runReportPath: `${topicRootPath}/runs/${effectiveRunId}.report.md`,
|
|
155
|
+
findingsPath: `${topicRootPath}/findings.md`,
|
|
156
|
+
sourcesPath: `${topicRootPath}/sources.md`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
135
160
|
export function withDefaultResearchArtifactPath(input: {
|
|
136
161
|
description: string;
|
|
137
162
|
prompt: string;
|
|
@@ -3,6 +3,7 @@ import { isHostedChildCreateFileAlreadyExistsResult } from "./hosted-child-artif
|
|
|
3
3
|
import {
|
|
4
4
|
buildDefaultResearchArtifactPathReminder,
|
|
5
5
|
buildDefaultResearchArtifactPaths,
|
|
6
|
+
buildDefaultResearchArtifactPathsFromCurrentReportPath,
|
|
6
7
|
type DefaultResearchArtifactPaths,
|
|
7
8
|
} from "./default-research-artifact-policy.js";
|
|
8
9
|
|
|
@@ -22,6 +23,14 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
22
23
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
function extractToolResultPath(result: unknown): string | null {
|
|
27
|
+
if (!isRecord(result) || typeof result.path !== "string") {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return result.path.replace(/^\/+/, "");
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
export function extractLatestUserText(messages: readonly unknown[]): string | null {
|
|
26
35
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
27
36
|
const message = messages[index];
|
|
@@ -243,6 +252,7 @@ export function shouldRetryCreateResearchArtifactAsUpdate(input: {
|
|
|
243
252
|
export async function mirrorDefaultResearchRunArtifact(input: {
|
|
244
253
|
toolName: string;
|
|
245
254
|
toolInput: Record<string, unknown>;
|
|
255
|
+
toolResult?: unknown;
|
|
246
256
|
taskContext: DefaultResearchArtifactContext;
|
|
247
257
|
activeProjectId: string | null;
|
|
248
258
|
executeContext: Record<string, unknown> | undefined;
|
|
@@ -252,8 +262,7 @@ export async function mirrorDefaultResearchRunArtifact(input: {
|
|
|
252
262
|
context: Record<string, unknown> | undefined,
|
|
253
263
|
) => Promise<unknown>;
|
|
254
264
|
}): Promise<void> {
|
|
255
|
-
|
|
256
|
-
if (!defaultArtifacts || (input.toolName !== "create_file" && input.toolName !== "update_file")) {
|
|
265
|
+
if (input.toolName !== "create_file" && input.toolName !== "update_file") {
|
|
257
266
|
return;
|
|
258
267
|
}
|
|
259
268
|
|
|
@@ -261,10 +270,22 @@ export async function mirrorDefaultResearchRunArtifact(input: {
|
|
|
261
270
|
const path = typeof input.toolInput.path === "string"
|
|
262
271
|
? input.toolInput.path.replace(/^\/+/, "")
|
|
263
272
|
: null;
|
|
273
|
+
const resultPath = extractToolResultPath(input.toolResult);
|
|
274
|
+
const defaultArtifacts = input.taskContext.defaultResearchArtifacts ??
|
|
275
|
+
(resultPath
|
|
276
|
+
? buildDefaultResearchArtifactPathsFromCurrentReportPath({
|
|
277
|
+
currentReportPath: resultPath,
|
|
278
|
+
runId: input.taskContext.parentRunId,
|
|
279
|
+
})
|
|
280
|
+
: null);
|
|
281
|
+
if (!defaultArtifacts) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
264
285
|
const canonicalCurrentPath = defaultArtifacts.currentReportPath.replace(/^\/+/, "");
|
|
265
286
|
const canonicalRunPath = defaultArtifacts.runReportPath.replace(/^\/+/, "");
|
|
266
287
|
|
|
267
|
-
if (!content || path !== canonicalCurrentPath) {
|
|
288
|
+
if (!content || (path !== canonicalCurrentPath && resultPath !== canonicalCurrentPath)) {
|
|
268
289
|
return;
|
|
269
290
|
}
|
|
270
291
|
|