@nexface/agent 0.1.14 → 0.1.15-alpha.1
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.js +330 -889
- package/dist/agent.js.map +1 -0
- package/dist/browser-policy/gpt.js +12 -36
- package/dist/browser-policy/gpt.js.map +1 -0
- package/dist/browser-policy/jev.js +9 -21
- package/dist/browser-policy/jev.js.map +1 -0
- package/dist/browser-policy/response-error.js +2 -4
- package/dist/browser-policy/response-error.js.map +1 -0
- package/dist/browser-policy/shared.js +21 -49
- package/dist/browser-policy/shared.js.map +1 -0
- package/dist/browser-prompt.generated.js +1 -0
- package/dist/browser-prompt.generated.js.map +1 -0
- package/dist/browser-prompt.js +1 -0
- package/dist/browser-prompt.js.map +1 -0
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +4 -3
- package/dist/errors.js.map +1 -0
- package/dist/history-compaction.js +26 -47
- package/dist/history-compaction.js.map +1 -0
- package/dist/history-version.js +4 -11
- package/dist/history-version.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/model/binding.js +1 -0
- package/dist/model/binding.js.map +1 -0
- package/dist/model/error.js +1 -0
- package/dist/model/error.js.map +1 -0
- package/dist/model/internal-adapter.js +2 -1
- package/dist/model/internal-adapter.js.map +1 -0
- package/dist/model/types.js +1 -0
- package/dist/model/types.js.map +1 -0
- package/dist/models/{k.js → 39.js} +336 -168
- package/dist/models/851.js +10 -0
- package/dist/models/_chunks/360-7e580bb2.js +1189 -0
- package/dist/models/_chunks/474-e1813138.js +8304 -0
- package/dist/models/_chunks/86-c0c5ac98.js +453 -0
- package/dist/models/_chunks/anthropic-messages~1-d35e3e7d.js +8057 -0
- package/dist/models/_chunks/deferred-tools-90f3c977.js +37 -0
- package/dist/models/_chunks/error-body-8bee35c2.js +134 -0
- package/dist/models/_chunks/google-generative-ai~1-2ba71457.js +22104 -0
- package/dist/models/_chunks/openai-completions~1-b340f0e0.js +1285 -0
- package/dist/models/_chunks/openai-responses~1-b53c65c2.js +958 -0
- package/dist/models/anthropic-messages.js +20 -5
- package/dist/models/google-generative-ai.js +19 -4
- package/dist/models/openai-completions.js +10 -3
- package/dist/models/openai-responses.js +10 -3
- package/dist/models/rslib-runtime.js +56 -32
- package/dist/page-decision.js +59 -197
- package/dist/page-decision.js.map +1 -0
- package/dist/page-decisions/gpt.js +1 -0
- package/dist/page-decisions/gpt.js.map +1 -0
- package/dist/page-decisions/jev.js +1 -0
- package/dist/page-decisions/jev.js.map +1 -0
- package/dist/page-decisions/shared.js +9 -26
- package/dist/page-decisions/shared.js.map +1 -0
- package/dist/page-diagnostics.js +3 -8
- package/dist/page-diagnostics.js.map +1 -0
- package/dist/page-observation.js +6 -11
- package/dist/page-observation.js.map +1 -0
- package/dist/request.js +41 -169
- package/dist/request.js.map +1 -0
- package/dist/shared/definition.js +1 -0
- package/dist/shared/definition.js.map +1 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +1 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/page-protocol.js +1 -0
- package/dist/shared/page-protocol.js.map +1 -0
- package/dist/shared/page-tools.js +1 -0
- package/dist/shared/page-tools.js.map +1 -0
- package/dist/shared/runtime-controller.d.ts +0 -1
- package/dist/shared/runtime-controller.js +1 -0
- package/dist/shared/runtime-controller.js.map +1 -0
- package/dist/shared/runtime-execution.js +1 -0
- package/dist/shared/runtime-execution.js.map +1 -0
- package/dist/shared/schema.js +19 -45
- package/dist/shared/schema.js.map +1 -0
- package/dist/tool-catalog.js +25 -23
- package/dist/tool-catalog.js.map +1 -0
- package/dist/tool-result.js +3 -7
- package/dist/tool-result.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -6
- package/dist/models/3.js +0 -5553
- package/dist/models/3e.js +0 -4
- package/dist/models/6.js +0 -506
- package/dist/models/anthropic-messages~1.js +0 -5629
- package/dist/models/deferred-tools.js +0 -28
- package/dist/models/error-body.js +0 -64
- package/dist/models/google-generative-ai~1.js +0 -18305
- package/dist/models/google-generative-ai~1.js.LICENSE.txt +0 -5
- package/dist/models/openai-completions~1.js +0 -987
- package/dist/models/openai-responses~1.js +0 -848
- package/dist/models/v.js +0 -346
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const identityToolName = (name)=>name;
|
|
2
|
-
function splitDeferredTools(context, enabled, normalizeName = identityToolName) {
|
|
3
|
-
const uniqueTools = new Map();
|
|
4
|
-
for (const tool of context.tools ?? [])uniqueTools.set(normalizeName(tool.name), tool);
|
|
5
|
-
if (!enabled) return {
|
|
6
|
-
immediate: [
|
|
7
|
-
...uniqueTools.values()
|
|
8
|
-
],
|
|
9
|
-
deferred: new Map()
|
|
10
|
-
};
|
|
11
|
-
const deferredNames = new Set();
|
|
12
|
-
const usedNames = new Set();
|
|
13
|
-
for (const message of context.messages)if ("assistant" === message.role) {
|
|
14
|
-
for (const block of message.content)if ("toolCall" === block.type) usedNames.add(normalizeName(block.name));
|
|
15
|
-
} else if ("toolResult" === message.role) for (const name of message.addedToolNames ?? []){
|
|
16
|
-
const normalizedName = normalizeName(name);
|
|
17
|
-
if (!usedNames.has(normalizedName)) deferredNames.add(normalizedName);
|
|
18
|
-
}
|
|
19
|
-
const immediate = [];
|
|
20
|
-
const deferred = new Map();
|
|
21
|
-
for (const [name, tool] of uniqueTools)if (deferredNames.has(name)) deferred.set(name, tool);
|
|
22
|
-
else immediate.push(tool);
|
|
23
|
-
return {
|
|
24
|
-
immediate,
|
|
25
|
-
deferred
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export { splitDeferredTools };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const MAX_PROVIDER_ERROR_BODY_CHARS = 4000;
|
|
2
|
-
function normalizeProviderError(error) {
|
|
3
|
-
if (!(error instanceof Error)) return {
|
|
4
|
-
message: safeJsonStringify(error),
|
|
5
|
-
messageCarriesBody: false
|
|
6
|
-
};
|
|
7
|
-
const sdkError = error;
|
|
8
|
-
const status = extractStatus(sdkError);
|
|
9
|
-
const body = extractBody(sdkError);
|
|
10
|
-
const messageCarriesBody = void 0 === body || error.message.includes(body);
|
|
11
|
-
return {
|
|
12
|
-
status,
|
|
13
|
-
body,
|
|
14
|
-
message: error.message,
|
|
15
|
-
messageCarriesBody
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function extractStatus(error) {
|
|
19
|
-
if ("number" == typeof error.statusCode) return error.statusCode;
|
|
20
|
-
if ("number" == typeof error.status) return error.status;
|
|
21
|
-
if ("number" == typeof error.$metadata?.httpStatusCode) return error.$metadata.httpStatusCode;
|
|
22
|
-
if ("number" == typeof error.$response?.statusCode) return error.$response.statusCode;
|
|
23
|
-
}
|
|
24
|
-
function extractBody(error) {
|
|
25
|
-
const bodyText = pickBodyText(error);
|
|
26
|
-
if (void 0 === bodyText) return;
|
|
27
|
-
const trimmed = bodyText.trim();
|
|
28
|
-
if (0 === trimmed.length) return;
|
|
29
|
-
return truncateErrorText(trimmed, MAX_PROVIDER_ERROR_BODY_CHARS);
|
|
30
|
-
}
|
|
31
|
-
function pickBodyText(error) {
|
|
32
|
-
if ("string" == typeof error.body) return error.body;
|
|
33
|
-
if (isPlainNonEmptyObject(error.error)) return safeJsonStringify(error.error);
|
|
34
|
-
const responseBody = error.$response?.body;
|
|
35
|
-
if ("string" == typeof responseBody) return responseBody;
|
|
36
|
-
if (isReadableStreamLike(responseBody)) return;
|
|
37
|
-
if (isPlainNonEmptyObject(responseBody)) return safeJsonStringify(responseBody);
|
|
38
|
-
}
|
|
39
|
-
function isReadableStreamLike(value) {
|
|
40
|
-
return "object" == typeof value && null !== value && "pipe" in value && "function" == typeof value.pipe;
|
|
41
|
-
}
|
|
42
|
-
function isPlainNonEmptyObject(value) {
|
|
43
|
-
if ("object" != typeof value || null === value) return false;
|
|
44
|
-
const proto = Object.getPrototypeOf(value);
|
|
45
|
-
if (proto !== Object.prototype && null !== proto) return false;
|
|
46
|
-
return Object.keys(value).length > 0;
|
|
47
|
-
}
|
|
48
|
-
function formatProviderError(norm, prefix) {
|
|
49
|
-
if (norm.messageCarriesBody || void 0 === norm.status || void 0 === norm.body) return void 0 !== prefix && void 0 !== norm.status ? `${prefix} (${norm.status}): ${norm.message}` : norm.message;
|
|
50
|
-
return void 0 !== prefix ? `${prefix} (${norm.status}): ${norm.body}` : `${norm.status}: ${norm.body}`;
|
|
51
|
-
}
|
|
52
|
-
function truncateErrorText(text, maxChars) {
|
|
53
|
-
if (text.length <= maxChars) return text;
|
|
54
|
-
return `${text.slice(0, maxChars)}... [truncated ${text.length - maxChars} chars]`;
|
|
55
|
-
}
|
|
56
|
-
function safeJsonStringify(value) {
|
|
57
|
-
try {
|
|
58
|
-
const serialized = JSON.stringify(value);
|
|
59
|
-
return void 0 === serialized ? String(value) : serialized;
|
|
60
|
-
} catch {
|
|
61
|
-
return String(value);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export { formatProviderError, normalizeProviderError };
|