@agent-native/core 0.49.25 → 0.49.27
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/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +8 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +43 -11
- package/dist/cli/recap.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +2 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +7 -7
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
- package/dist/client/blocks/library/DiffBlock.js +3 -3
- package/dist/client/blocks/library/DiffBlock.js.map +1 -1
- package/dist/client/blocks/library/annotation-rail.d.ts +4 -3
- package/dist/client/blocks/library/annotation-rail.d.ts.map +1 -1
- package/dist/client/blocks/library/annotation-rail.js +16 -9
- package/dist/client/blocks/library/annotation-rail.js.map +1 -1
- package/dist/client/blocks/types.d.ts +2 -2
- package/dist/client/blocks/types.js.map +1 -1
- package/dist/coding-tools/run-code.d.ts.map +1 -1
- package/dist/coding-tools/run-code.js +198 -15
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/extensions/fetch-tool.js +1 -1
- package/dist/extensions/fetch-tool.js.map +1 -1
- package/dist/file-upload/builder.d.ts.map +1 -1
- package/dist/file-upload/builder.js +115 -56
- package/dist/file-upload/builder.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +1 -0
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/builtin-tools.d.ts +8 -4
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +247 -13
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.js +1 -0
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
- package/dist/provider-api/index.d.ts +9 -4
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +164 -33
- package/dist/provider-api/index.js.map +1 -1
- package/dist/provider-api/staged-datasets-store.d.ts.map +1 -1
- package/dist/provider-api/staged-datasets-store.js +29 -6
- package/dist/provider-api/staged-datasets-store.js.map +1 -1
- package/dist/provider-api/staging.d.ts +6 -1
- package/dist/provider-api/staging.d.ts.map +1 -1
- package/dist/provider-api/staging.js +35 -6
- package/dist/provider-api/staging.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +157 -80
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/prompts/shared-rules.d.ts +1 -1
- package/dist/server/prompts/shared-rules.d.ts.map +1 -1
- package/dist/server/prompts/shared-rules.js +5 -7
- package/dist/server/prompts/shared-rules.js.map +1 -1
- package/dist/server/schema-prompt.js +1 -1
- package/dist/server/schema-prompt.js.map +1 -1
- package/dist/templates/default/.agents/skills/actions/SKILL.md +16 -4
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +16 -4
- package/package.json +1 -1
- package/src/templates/default/.agents/skills/actions/SKILL.md +16 -4
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +16 -4
|
@@ -333,6 +333,24 @@ const PROVIDER_CONFIGS = {
|
|
|
333
333
|
path: "/calls/transcript",
|
|
334
334
|
body: { filter: { callIds: ["<call-id>"] } },
|
|
335
335
|
},
|
|
336
|
+
{
|
|
337
|
+
label: "Calls with parties/content",
|
|
338
|
+
method: "POST",
|
|
339
|
+
path: "/calls/extensive",
|
|
340
|
+
body: {
|
|
341
|
+
filter: { fromDateTime: "<iso-date-time>" },
|
|
342
|
+
contentSelector: {
|
|
343
|
+
exposedFields: {
|
|
344
|
+
parties: true,
|
|
345
|
+
content: { brief: true, keyPoints: true },
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
notes: [
|
|
352
|
+
"For broad corpus work, call /calls/extensive with provider-api-request and stageAs/saveToFile. Gong returns the next cursor at records.cursor and expects the next cursor in the POST body at cursor, so use pagination { nextCursorPath: 'records.cursor', cursorBodyPath: 'cursor' } for stageAs or fetchAllPages { cursorPath: 'records.cursor', cursorBodyPath: 'cursor' } for saveToFile.",
|
|
353
|
+
"Batch transcripts with POST /calls/transcript and body { filter: { callIds: [...] } } after narrowing or staging call ids.",
|
|
336
354
|
],
|
|
337
355
|
},
|
|
338
356
|
google_calendar: {
|
|
@@ -827,9 +845,9 @@ export async function executeProviderApiRequest(args, runtime) {
|
|
|
827
845
|
// --- fetchAllPages mode ---
|
|
828
846
|
if (args.fetchAllPages) {
|
|
829
847
|
const pageCfg = args.fetchAllPages;
|
|
830
|
-
const { items, pageCount, lastStatus, lastContentType } = await fetchAllPages(pageCfg, async (
|
|
831
|
-
const queryWithCursor =
|
|
832
|
-
? mergeQueryObjects(substituteUnknown(args.query, placeholders),
|
|
848
|
+
const { items, pageCount, lastStatus, lastContentType } = await fetchAllPages(pageCfg, async (extra) => {
|
|
849
|
+
const queryWithCursor = extra?.query
|
|
850
|
+
? mergeQueryObjects(substituteUnknown(args.query, placeholders), extra.query)
|
|
833
851
|
: substituteUnknown(args.query, placeholders);
|
|
834
852
|
const pageUrl = buildProviderUrl({
|
|
835
853
|
config,
|
|
@@ -837,7 +855,10 @@ export async function executeProviderApiRequest(args, runtime) {
|
|
|
837
855
|
rawPath: substituteString(args.path, placeholders),
|
|
838
856
|
query: queryWithCursor,
|
|
839
857
|
});
|
|
840
|
-
const
|
|
858
|
+
const bodyWithCursor = extra?.bodyCursor
|
|
859
|
+
? setValueAtPath(substituteUnknown(args.body, placeholders), extra.bodyCursor.path, extra.bodyCursor.value)
|
|
860
|
+
: substituteUnknown(args.body, placeholders);
|
|
861
|
+
const pageBody = prepareBody(bodyWithCursor, { ...headers });
|
|
841
862
|
const resp = await fetchWithTimeout(pageUrl.href, {
|
|
842
863
|
method,
|
|
843
864
|
headers,
|
|
@@ -960,9 +981,9 @@ async function executeCustomProviderApiRequest(args, customConfig, runtime) {
|
|
|
960
981
|
// --- fetchAllPages mode (same cursor pagination as built-in providers) ---
|
|
961
982
|
if (args.fetchAllPages) {
|
|
962
983
|
const pageCfg = args.fetchAllPages;
|
|
963
|
-
const { items, pageCount, lastStatus, lastContentType } = await fetchAllPages(pageCfg, async (
|
|
964
|
-
const queryWithCursor =
|
|
965
|
-
? mergeQueryObjects(args.query,
|
|
984
|
+
const { items, pageCount, lastStatus, lastContentType } = await fetchAllPages(pageCfg, async (extra) => {
|
|
985
|
+
const queryWithCursor = extra?.query
|
|
986
|
+
? mergeQueryObjects(args.query, extra.query)
|
|
966
987
|
: args.query;
|
|
967
988
|
const pageUrl = buildProviderUrl({
|
|
968
989
|
config: syntheticConfig,
|
|
@@ -970,7 +991,10 @@ async function executeCustomProviderApiRequest(args, customConfig, runtime) {
|
|
|
970
991
|
rawPath: args.path,
|
|
971
992
|
query: queryWithCursor,
|
|
972
993
|
});
|
|
973
|
-
const
|
|
994
|
+
const bodyWithCursor = extra?.bodyCursor
|
|
995
|
+
? setValueAtPath(args.body, extra.bodyCursor.path, extra.bodyCursor.value)
|
|
996
|
+
: args.body;
|
|
997
|
+
const pageBody = prepareBody(bodyWithCursor, { ...headers });
|
|
974
998
|
const resp = await fetchWithTimeout(pageUrl.href, {
|
|
975
999
|
method,
|
|
976
1000
|
headers,
|
|
@@ -1413,6 +1437,13 @@ function joinProviderUrlPath(base, rawPath) {
|
|
|
1413
1437
|
const providerPath = rawPath.replace(/^\/+/, "");
|
|
1414
1438
|
if (!providerPath)
|
|
1415
1439
|
return basePath || "/";
|
|
1440
|
+
const baseSegments = basePath.split("/").filter(Boolean);
|
|
1441
|
+
const providerSegments = providerPath.split("/").filter(Boolean);
|
|
1442
|
+
if (baseSegments.length > 0 &&
|
|
1443
|
+
providerSegments.length >= baseSegments.length &&
|
|
1444
|
+
baseSegments.every((segment, index) => segment === providerSegments[index])) {
|
|
1445
|
+
return `/${providerPath}`;
|
|
1446
|
+
}
|
|
1416
1447
|
return `${basePath}/${providerPath}`;
|
|
1417
1448
|
}
|
|
1418
1449
|
function isAllowedProviderUrl(url, base, config) {
|
|
@@ -1828,11 +1859,14 @@ function prepareBody(body, headers) {
|
|
|
1828
1859
|
}
|
|
1829
1860
|
async function fetchWithTimeout(optionsUrl, options) {
|
|
1830
1861
|
const controller = new AbortController();
|
|
1831
|
-
const
|
|
1862
|
+
const timeoutMs = clampTimeout(options.timeoutMs);
|
|
1863
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
1864
|
+
const method = options.method ?? "GET";
|
|
1865
|
+
const secretValues = options.secretValues ?? [];
|
|
1832
1866
|
try {
|
|
1833
1867
|
const dispatcher = (await createSsrfSafeDispatcher()) ?? undefined;
|
|
1834
1868
|
const fetchOptions = {
|
|
1835
|
-
method
|
|
1869
|
+
method,
|
|
1836
1870
|
headers: options.headers,
|
|
1837
1871
|
body: options.body,
|
|
1838
1872
|
signal: controller.signal,
|
|
@@ -1840,30 +1874,93 @@ async function fetchWithTimeout(optionsUrl, options) {
|
|
|
1840
1874
|
};
|
|
1841
1875
|
if (dispatcher)
|
|
1842
1876
|
fetchOptions.dispatcher = dispatcher;
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1877
|
+
try {
|
|
1878
|
+
return await fetchProviderResponse(optionsUrl, fetchOptions, {
|
|
1879
|
+
maxBytes: options.maxBytes,
|
|
1880
|
+
secretValues,
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
catch (error) {
|
|
1884
|
+
if (dispatcher && isDispatcherCompatibilityError(error)) {
|
|
1885
|
+
const fallbackOptions = { ...fetchOptions };
|
|
1886
|
+
delete fallbackOptions.dispatcher;
|
|
1887
|
+
return await fetchProviderResponse(optionsUrl, fallbackOptions, {
|
|
1888
|
+
maxBytes: options.maxBytes,
|
|
1889
|
+
secretValues,
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
throw error;
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
catch (error) {
|
|
1896
|
+
throw normalizeFetchError(error, {
|
|
1897
|
+
method,
|
|
1898
|
+
url: optionsUrl,
|
|
1899
|
+
timeoutMs,
|
|
1900
|
+
secretValues,
|
|
1901
|
+
});
|
|
1862
1902
|
}
|
|
1863
1903
|
finally {
|
|
1864
1904
|
clearTimeout(timeout);
|
|
1865
1905
|
}
|
|
1866
1906
|
}
|
|
1907
|
+
async function fetchProviderResponse(url, fetchOptions, options) {
|
|
1908
|
+
const startedAt = Date.now();
|
|
1909
|
+
const res = await fetch(url, fetchOptions);
|
|
1910
|
+
const elapsedMs = Date.now() - startedAt;
|
|
1911
|
+
const rawText = await readResponseTextWithLimit(res, clampMaxBytes(options.maxBytes));
|
|
1912
|
+
const redactedText = redactString(rawText.text, options.secretValues);
|
|
1913
|
+
const parsed = tryParseJson(redactedText);
|
|
1914
|
+
return {
|
|
1915
|
+
status: res.status,
|
|
1916
|
+
statusText: res.statusText,
|
|
1917
|
+
ok: res.ok,
|
|
1918
|
+
elapsedMs,
|
|
1919
|
+
headers: redactSecrets(headersToObject(res.headers), options.secretValues),
|
|
1920
|
+
contentType: res.headers.get("content-type") ?? null,
|
|
1921
|
+
size: rawText.size,
|
|
1922
|
+
truncated: rawText.truncated,
|
|
1923
|
+
text: parsed === undefined ? redactedText : undefined,
|
|
1924
|
+
json: parsed,
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
function isDispatcherCompatibilityError(error) {
|
|
1928
|
+
const err = error;
|
|
1929
|
+
const code = typeof err?.cause?.code === "string" ? err.cause.code : "";
|
|
1930
|
+
const detail = [
|
|
1931
|
+
typeof err?.message === "string" ? err.message : "",
|
|
1932
|
+
typeof err?.cause?.message === "string" ? err.cause.message : "",
|
|
1933
|
+
]
|
|
1934
|
+
.join(" ")
|
|
1935
|
+
.toLowerCase();
|
|
1936
|
+
return (code === "UND_ERR_INVALID_ARG" &&
|
|
1937
|
+
detail.includes("invalid onrequeststart method"));
|
|
1938
|
+
}
|
|
1939
|
+
function normalizeFetchError(error, options) {
|
|
1940
|
+
const target = describeProviderRequestTarget(options.url, options.secretValues);
|
|
1941
|
+
const err = error;
|
|
1942
|
+
if (err?.name === "AbortError") {
|
|
1943
|
+
return new Error(`Provider API request timed out after ${options.timeoutMs}ms: ${options.method} ${target}`, { cause: error });
|
|
1944
|
+
}
|
|
1945
|
+
const causeCode = typeof err?.cause?.code === "string" && err.cause.code
|
|
1946
|
+
? ` (${err.cause.code})`
|
|
1947
|
+
: "";
|
|
1948
|
+
const detail = typeof err?.cause?.message === "string" && err.cause.message
|
|
1949
|
+
? err.cause.message
|
|
1950
|
+
: typeof err?.message === "string" && err.message
|
|
1951
|
+
? err.message
|
|
1952
|
+
: String(error);
|
|
1953
|
+
return new Error(`Provider API request failed${causeCode}: ${options.method} ${target}: ${redactString(detail, options.secretValues)}`, { cause: error });
|
|
1954
|
+
}
|
|
1955
|
+
function describeProviderRequestTarget(rawUrl, secretValues) {
|
|
1956
|
+
try {
|
|
1957
|
+
const url = new URL(rawUrl);
|
|
1958
|
+
return redactString(`${url.host}${url.pathname}${url.search}`, secretValues);
|
|
1959
|
+
}
|
|
1960
|
+
catch {
|
|
1961
|
+
return redactString(rawUrl, secretValues);
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1867
1964
|
async function readResponseTextWithLimit(response, maxBytes) {
|
|
1868
1965
|
const contentLength = response.headers.get("content-length");
|
|
1869
1966
|
if (contentLength && Number(contentLength) > maxBytes) {
|
|
@@ -1945,6 +2042,25 @@ function mergeQueryObjects(base, extra) {
|
|
|
1945
2042
|
}
|
|
1946
2043
|
return extra;
|
|
1947
2044
|
}
|
|
2045
|
+
function setValueAtPath(base, path, value) {
|
|
2046
|
+
const root = base && typeof base === "object" && !Array.isArray(base)
|
|
2047
|
+
? { ...base }
|
|
2048
|
+
: {};
|
|
2049
|
+
const parts = path.split(".").filter(Boolean);
|
|
2050
|
+
if (!parts.length)
|
|
2051
|
+
return root;
|
|
2052
|
+
let current = root;
|
|
2053
|
+
for (const part of parts.slice(0, -1)) {
|
|
2054
|
+
const existing = current[part];
|
|
2055
|
+
const next = existing && typeof existing === "object" && !Array.isArray(existing)
|
|
2056
|
+
? { ...existing }
|
|
2057
|
+
: {};
|
|
2058
|
+
current[part] = next;
|
|
2059
|
+
current = next;
|
|
2060
|
+
}
|
|
2061
|
+
current[parts[parts.length - 1]] = value;
|
|
2062
|
+
return root;
|
|
2063
|
+
}
|
|
1948
2064
|
function clampTimeout(timeoutMs) {
|
|
1949
2065
|
if (!Number.isFinite(timeoutMs))
|
|
1950
2066
|
return DEFAULT_TIMEOUT_MS;
|
|
@@ -2012,14 +2128,29 @@ async function fetchAllPages(config, executeOnePage) {
|
|
|
2012
2128
|
let pageCount = 0;
|
|
2013
2129
|
let lastStatus = 0;
|
|
2014
2130
|
let lastContentType = null;
|
|
2131
|
+
if (!config.cursorParam && !config.cursorBodyPath) {
|
|
2132
|
+
throw new Error("fetchAllPages requires cursorParam or cursorBodyPath to send the next cursor.");
|
|
2133
|
+
}
|
|
2134
|
+
if (config.cursorParam && config.cursorBodyPath) {
|
|
2135
|
+
throw new Error("fetchAllPages accepts exactly one cursor method: cursorParam or cursorBodyPath.");
|
|
2136
|
+
}
|
|
2015
2137
|
while (pageCount < maxPages) {
|
|
2016
|
-
const
|
|
2017
|
-
if (cursor)
|
|
2018
|
-
|
|
2019
|
-
|
|
2138
|
+
const extra = {};
|
|
2139
|
+
if (cursor) {
|
|
2140
|
+
if (config.cursorParam)
|
|
2141
|
+
extra.query = { [config.cursorParam]: cursor };
|
|
2142
|
+
if (config.cursorBodyPath) {
|
|
2143
|
+
extra.bodyCursor = { path: config.cursorBodyPath, value: cursor };
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
const page = await executeOnePage(pageCount > 0 ? extra : undefined);
|
|
2020
2147
|
lastStatus = page.status;
|
|
2021
2148
|
lastContentType = page.contentType;
|
|
2022
2149
|
pageCount++;
|
|
2150
|
+
if (!page.ok) {
|
|
2151
|
+
const preview = page.text.replace(/\s+/g, " ").trim().slice(0, 500);
|
|
2152
|
+
throw new Error(`fetchAllPages request failed with HTTP ${page.status}${preview ? `: ${preview}` : ""}`);
|
|
2153
|
+
}
|
|
2023
2154
|
let body;
|
|
2024
2155
|
try {
|
|
2025
2156
|
body = JSON.parse(page.text);
|