@myagentroam/protocol 0.11.41 → 0.11.43
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/index.d.ts +1140 -264
- package/dist/index.js +73 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -820,7 +820,6 @@ const marAgentModelSummaryShape = {
|
|
|
820
820
|
...marAgentModelShape,
|
|
821
821
|
baseUrl: z.string().url().max(2048),
|
|
822
822
|
sortOrder: z.number().int(),
|
|
823
|
-
apiKeyConfigured: z.boolean().optional(),
|
|
824
823
|
credentialType: z.enum(['INLINE_API_KEY', 'CREDENTIAL_REF']).optional(),
|
|
825
824
|
credentialConfigured: z.boolean().optional(),
|
|
826
825
|
lastTestedAt: z.number().int().nonnegative().nullable().optional(),
|
|
@@ -847,9 +846,8 @@ export const marAgentRuntimeModelConfigurationSchema = refineMarAgentModel(z
|
|
|
847
846
|
.object({
|
|
848
847
|
...marAgentModelShape,
|
|
849
848
|
baseUrl: z.string().url().max(2048),
|
|
850
|
-
apiKey: z.string().min(1).max(16_384).optional(),
|
|
851
849
|
useResourceUrl: z.boolean().default(false),
|
|
852
|
-
credential: marAgentRuntimeCredentialSchema
|
|
850
|
+
credential: marAgentRuntimeCredentialSchema,
|
|
853
851
|
responsesToolNamespace: z
|
|
854
852
|
.string()
|
|
855
853
|
.regex(/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/u)
|
|
@@ -875,11 +873,6 @@ export const marAgentRuntimeModelConfigurationSchema = refineMarAgentModel(z
|
|
|
875
873
|
path: ['responsesToolNamespace'],
|
|
876
874
|
message: 'Tool namespaces require Standard OpenAI Responses'
|
|
877
875
|
});
|
|
878
|
-
if ((configuration.apiKey === undefined) === (configuration.credential === undefined))
|
|
879
|
-
context.addIssue({
|
|
880
|
-
code: 'custom',
|
|
881
|
-
message: 'exactly one runtime model credential is required'
|
|
882
|
-
});
|
|
883
876
|
if (configuration.imageGeneration !== undefined &&
|
|
884
877
|
configuration.imageGeneration.credential !== undefined &&
|
|
885
878
|
(configuration.imageGeneration.provider === 'BYTED_ARK'
|
|
@@ -1934,6 +1927,18 @@ export const executionPresentationSchema = z
|
|
|
1934
1927
|
execution: z
|
|
1935
1928
|
.object({
|
|
1936
1929
|
kind: z.enum(['SHELL', 'CODE', 'CONTROL']),
|
|
1930
|
+
toolName: z.string().min(1).max(128).optional(),
|
|
1931
|
+
action: z.string().max(128).optional(),
|
|
1932
|
+
targetId: z.string().max(256).optional(),
|
|
1933
|
+
source: z
|
|
1934
|
+
.object({
|
|
1935
|
+
kind: z.enum(['SHELL', 'CODE']),
|
|
1936
|
+
text: z.string().max(10_000),
|
|
1937
|
+
cwd: z.string().max(10_000).optional(),
|
|
1938
|
+
truncated: z.boolean()
|
|
1939
|
+
})
|
|
1940
|
+
.strict()
|
|
1941
|
+
.optional(),
|
|
1937
1942
|
output: executionOutputSchema.optional(),
|
|
1938
1943
|
error: executionErrorSchema.optional(),
|
|
1939
1944
|
truncation: executionTruncationSchema.optional()
|
|
@@ -1942,6 +1947,65 @@ export const executionPresentationSchema = z
|
|
|
1942
1947
|
})
|
|
1943
1948
|
.strict()
|
|
1944
1949
|
.refine((value) => new TextEncoder().encode(JSON.stringify(value)).length <= 128 * 1024, 'Execution presentation exceeds 128 KiB');
|
|
1950
|
+
/** Append output channels of the same call; snapshots and terminal items replace normally. */
|
|
1951
|
+
export function appendExecutionPresentation(previous, incoming) {
|
|
1952
|
+
const before = executionPresentationSchema.safeParse(previous);
|
|
1953
|
+
const update = executionPresentationSchema.safeParse(incoming);
|
|
1954
|
+
if (!update.success || !update.data.execution.output)
|
|
1955
|
+
return incoming;
|
|
1956
|
+
const prior = before.success ? before.data.execution : undefined;
|
|
1957
|
+
const next = update.data.execution;
|
|
1958
|
+
const channels = new Map((prior?.output ?? []).map((block) => [block.channel, block.text]));
|
|
1959
|
+
let clipped = false;
|
|
1960
|
+
for (const block of next.output ?? []) {
|
|
1961
|
+
const text = (channels.get(block.channel) ?? '') + block.text;
|
|
1962
|
+
let tail = text.slice(-10_000);
|
|
1963
|
+
if (tail.length < text.length) {
|
|
1964
|
+
clipped = true;
|
|
1965
|
+
if (/^[\uDC00-\uDFFF]/u.test(tail))
|
|
1966
|
+
tail = tail.slice(1);
|
|
1967
|
+
}
|
|
1968
|
+
channels.set(block.channel, tail);
|
|
1969
|
+
}
|
|
1970
|
+
const output = [...channels].map(([channel, text]) => ({ channel, text }));
|
|
1971
|
+
let head = clipped || prior?.truncation?.output === 'HEAD' || next.truncation?.output === 'HEAD';
|
|
1972
|
+
const make = () => ({
|
|
1973
|
+
kind: 'EXECUTION',
|
|
1974
|
+
execution: {
|
|
1975
|
+
...prior,
|
|
1976
|
+
...next,
|
|
1977
|
+
output,
|
|
1978
|
+
...(head || prior?.truncation || next.truncation
|
|
1979
|
+
? {
|
|
1980
|
+
truncation: {
|
|
1981
|
+
...prior?.truncation,
|
|
1982
|
+
...next.truncation,
|
|
1983
|
+
...(head ? { output: 'HEAD' } : {})
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
: {})
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
const size = () => new TextEncoder().encode(JSON.stringify(make())).length;
|
|
1990
|
+
for (const block of output) {
|
|
1991
|
+
if (size() <= 128 * 1024)
|
|
1992
|
+
break;
|
|
1993
|
+
head = true;
|
|
1994
|
+
const original = block.text;
|
|
1995
|
+
let low = 0;
|
|
1996
|
+
let high = original.length;
|
|
1997
|
+
while (low < high) {
|
|
1998
|
+
const middle = Math.floor((low + high) / 2);
|
|
1999
|
+
block.text = original.slice(middle).replace(/^[\uDC00-\uDFFF]/u, '');
|
|
2000
|
+
if (size() <= 128 * 1024)
|
|
2001
|
+
high = middle;
|
|
2002
|
+
else
|
|
2003
|
+
low = middle + 1;
|
|
2004
|
+
}
|
|
2005
|
+
block.text = original.slice(low).replace(/^[\uDC00-\uDFFF]/u, '');
|
|
2006
|
+
}
|
|
2007
|
+
return make();
|
|
2008
|
+
}
|
|
1945
2009
|
const toolCallPresentationSchema = z.discriminatedUnion('kind', [
|
|
1946
2010
|
z.object({
|
|
1947
2011
|
kind: z.literal('READ'),
|
|
@@ -2018,11 +2082,11 @@ const toolCallItemSchema = conversationItemBaseSchema.extend({
|
|
|
2018
2082
|
const commandExecutionItemSchema = conversationItemBaseSchema.extend({
|
|
2019
2083
|
kind: z.literal('command_execution'),
|
|
2020
2084
|
payload: z.object({
|
|
2085
|
+
toolName: z.string().min(1).max(128).optional(),
|
|
2021
2086
|
title: z.string().min(1).max(128).optional(),
|
|
2022
2087
|
command: z.string().max(10000),
|
|
2023
2088
|
cwd: z.string().max(4096).nullable(),
|
|
2024
2089
|
outputPreview: z.string().max(10000),
|
|
2025
|
-
outputRef: z.string().min(1).max(128).nullable(),
|
|
2026
2090
|
exitCode: z.number().int().nullable(),
|
|
2027
2091
|
durationMs: z.number().int().nonnegative().nullable(),
|
|
2028
2092
|
truncated: z.boolean(),
|
|
@@ -2038,7 +2102,6 @@ const fileChangeItemSchema = conversationItemBaseSchema.extend({
|
|
|
2038
2102
|
change: z.enum(['ADDED', 'MODIFIED', 'DELETED', 'RENAMED', 'COPIED', 'TYPE_CHANGED']),
|
|
2039
2103
|
additions: z.number().int().nonnegative().nullable(),
|
|
2040
2104
|
deletions: z.number().int().nonnegative().nullable(),
|
|
2041
|
-
diffAvailable: z.boolean(),
|
|
2042
2105
|
changeId: z.string().uuid().optional(),
|
|
2043
2106
|
diff: fileChangeDiffSchema.optional()
|
|
2044
2107
|
}))
|