@aj-archipelago/cortex 1.4.21 → 1.4.23
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/FILE_SYSTEM_DOCUMENTATION.md +116 -48
- package/config.js +27 -0
- package/lib/fileUtils.js +226 -201
- package/lib/requestExecutor.js +3 -2
- package/lib/util.js +71 -1
- package/package.json +1 -1
- package/pathways/image_flux.js +8 -2
- package/pathways/image_qwen.js +1 -1
- package/pathways/system/entity/files/sys_read_file_collection.js +13 -11
- package/pathways/system/entity/files/sys_update_file_metadata.js +16 -7
- package/pathways/system/entity/sys_entity_agent.js +8 -6
- package/pathways/system/entity/tools/sys_tool_codingagent.js +4 -4
- package/pathways/system/entity/tools/sys_tool_editfile.js +27 -22
- package/pathways/system/entity/tools/sys_tool_file_collection.js +15 -10
- package/pathways/system/entity/tools/sys_tool_image.js +5 -5
- package/pathways/system/entity/tools/sys_tool_image_gemini.js +1 -1
- package/pathways/system/entity/tools/sys_tool_readfile.js +4 -4
- package/pathways/system/entity/tools/sys_tool_slides_gemini.js +1 -1
- package/pathways/system/entity/tools/sys_tool_video_veo.js +1 -1
- package/pathways/system/entity/tools/sys_tool_view_image.js +10 -5
- package/pathways/system/workspaces/run_workspace_agent.js +4 -1
- package/pathways/video_seedance.js +2 -0
- package/server/executeWorkspace.js +45 -2
- package/server/pathwayResolver.js +18 -0
- package/server/plugins/claude3VertexPlugin.js +2 -6
- package/server/plugins/claude4VertexPlugin.js +5 -10
- package/server/plugins/gemini3ReasoningVisionPlugin.js +0 -2
- package/server/plugins/grokResponsesPlugin.js +3 -19
- package/server/plugins/grokVisionPlugin.js +3 -18
- package/server/plugins/modelPlugin.js +3 -0
- package/server/plugins/openAiVisionPlugin.js +3 -18
- package/server/plugins/replicateApiPlugin.js +182 -101
- package/server/resolver.js +32 -3
- package/server/typeDef.js +10 -1
- package/test.log +39427 -0
- package/tests/integration/features/tools/fileCollection.test.js +254 -248
- package/tests/integration/features/tools/fileOperations.test.js +131 -81
- package/tests/integration/graphql/async/stream/agentic.test.js +1 -1
- package/tests/integration/graphql/async/stream/vendors/claude_streaming.test.js +3 -4
- package/tests/integration/graphql/async/stream/vendors/gemini_streaming.test.js +3 -4
- package/tests/integration/graphql/async/stream/vendors/grok_streaming.test.js +3 -4
- package/tests/integration/graphql/async/stream/vendors/openai_streaming.test.js +5 -5
- package/tests/unit/core/fileCollection.test.js +86 -25
- package/pathways/system/workspaces/run_workspace_research_agent.js +0 -27
package/server/resolver.js
CHANGED
|
@@ -2,6 +2,7 @@ import { fulfillWithTimeout } from '../lib/promiser.js';
|
|
|
2
2
|
import { PathwayResolver } from './pathwayResolver.js';
|
|
3
3
|
import CortexResponse from '../lib/cortexResponse.js';
|
|
4
4
|
import { withRequestLoggingDisabled } from '../lib/logger.js';
|
|
5
|
+
import { sanitizeBase64 } from '../lib/util.js';
|
|
5
6
|
|
|
6
7
|
// This resolver uses standard parameters required by Apollo server:
|
|
7
8
|
// (parent, args, contextValue, info)
|
|
@@ -41,9 +42,37 @@ const rootResolver = async (parent, args, contextValue, info) => {
|
|
|
41
42
|
let resultData = pathwayResolver.pathwayResultData ? JSON.stringify(pathwayResolver.pathwayResultData) : null;
|
|
42
43
|
|
|
43
44
|
const { warnings, errors, previousResult, savedContextId, tool } = pathwayResolver;
|
|
44
|
-
|
|
45
|
-
// Add request parameters back as debug
|
|
46
|
-
const debug = pathwayResolver.prompts.map(prompt =>
|
|
45
|
+
|
|
46
|
+
// Add request parameters back as debug - sanitize base64 data before returning
|
|
47
|
+
const debug = pathwayResolver.prompts.map(prompt => {
|
|
48
|
+
if (!prompt.debugInfo) return '';
|
|
49
|
+
try {
|
|
50
|
+
// Try to parse entire debugInfo as JSON first (for single JSON object)
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(prompt.debugInfo);
|
|
53
|
+
return JSON.stringify(sanitizeBase64(parsed));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
// Not a single JSON object, try line-by-line
|
|
56
|
+
const lines = prompt.debugInfo.split('\n');
|
|
57
|
+
return lines.map(line => {
|
|
58
|
+
const trimmed = line.trim();
|
|
59
|
+
if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(line);
|
|
62
|
+
return JSON.stringify(sanitizeBase64(parsed));
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// Not valid JSON on this line, return as-is
|
|
65
|
+
return line;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return line;
|
|
69
|
+
}).join('\n');
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
// If sanitization fails, return original
|
|
73
|
+
return prompt.debugInfo;
|
|
74
|
+
}
|
|
75
|
+
}).join('\n').trim();
|
|
47
76
|
|
|
48
77
|
return {
|
|
49
78
|
debug,
|
package/server/typeDef.js
CHANGED
|
@@ -58,6 +58,10 @@ const getGraphQlType = (value) => {
|
|
|
58
58
|
const items = schema.items || {};
|
|
59
59
|
const def = schema.default;
|
|
60
60
|
const defaultArray = Array.isArray(def) ? JSON.stringify(def) : '[]';
|
|
61
|
+
// Support explicit object type name (e.g., items: { objType: 'AgentContextInput' })
|
|
62
|
+
if (items.objType) {
|
|
63
|
+
return { type: `[${items.objType}]`, defaultValue: `"${defaultArray.replace(/"/g, '\\"')}"` };
|
|
64
|
+
}
|
|
61
65
|
if (items.type === 'string') {
|
|
62
66
|
return { type: '[String]', defaultValue: defaultArray };
|
|
63
67
|
}
|
|
@@ -103,6 +107,10 @@ const getGraphQlType = (value) => {
|
|
|
103
107
|
if (Array.isArray(value[0]?.content)) {
|
|
104
108
|
return {type: '[MultiMessage]', defaultValue: `"${JSON.stringify(value).replace(/"/g, '\\"')}"`};
|
|
105
109
|
}
|
|
110
|
+
// Check if it's AgentContextInput (has contextId and default properties)
|
|
111
|
+
else if (value[0] && typeof value[0] === 'object' && 'contextId' in value[0] && 'default' in value[0]) {
|
|
112
|
+
return {type: '[AgentContextInput]', defaultValue: `"${JSON.stringify(value).replace(/"/g, '\\"')}"`};
|
|
113
|
+
}
|
|
106
114
|
else {
|
|
107
115
|
return {type: '[Message]', defaultValue: `"${JSON.stringify(value).replace(/"/g, '\\"')}"`};
|
|
108
116
|
}
|
|
@@ -123,8 +131,9 @@ const getGraphQlType = (value) => {
|
|
|
123
131
|
const getMessageTypeDefs = () => {
|
|
124
132
|
const messageType = `input Message { role: String, content: String, name: String }`;
|
|
125
133
|
const multiMessageType = `input MultiMessage { role: String, content: [String], name: String, tool_calls: [String], tool_call_id: String }`;
|
|
134
|
+
const agentContextType = `input AgentContextInput { contextId: String, contextKey: String, default: Boolean }`;
|
|
126
135
|
|
|
127
|
-
return `${messageType}\n\n${multiMessageType}`;
|
|
136
|
+
return `${messageType}\n\n${multiMessageType}\n\n${agentContextType}`;
|
|
128
137
|
};
|
|
129
138
|
|
|
130
139
|
const getPathwayTypeDef = (name, returnType) => {
|