snow-flow 4.1.2 → 4.2.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/README.md +186 -555
- package/cloudbuild-npm.yaml +132 -0
- package/cloudbuild-website.yaml +92 -0
- package/cloudbuild.yaml +141 -0
- package/dist/agent/interactive.d.ts +11 -0
- package/dist/agent/interactive.js +190 -0
- package/dist/agent/session.d.ts +12 -0
- package/dist/agent/session.js +106 -0
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.js +59 -0
- package/dist/cli/session.d.ts +3 -0
- package/dist/cli/session.js +46 -0
- package/dist/cli.js +81 -0
- package/dist/config/llm-config-loader.d.ts +45 -0
- package/dist/config/llm-config-loader.js +49 -0
- package/dist/index.js +1 -3
- package/dist/intelligence/performance-recommendations-engine.js +0 -1
- package/dist/llm/keys.d.ts +5 -0
- package/dist/llm/keys.js +29 -0
- package/dist/llm/providers.d.ts +11 -0
- package/dist/llm/providers.js +77 -0
- package/dist/mcp/advanced/servicenow-advanced-features-mcp.js +12 -12
- package/dist/mcp/bridge.d.ts +10 -0
- package/dist/mcp/bridge.js +31 -0
- package/dist/mcp/servicenow-development-assistant-mcp.js +1 -1
- package/dist/mcp/servicenow-itam-mcp.d.ts +29 -0
- package/dist/mcp/servicenow-itam-mcp.js +537 -0
- package/dist/mcp/servicenow-local-development-mcp.d.ts +0 -2
- package/dist/mcp/servicenow-local-development-mcp.js +0 -43
- package/dist/mcp/servicenow-machine-learning-mcp.js +2 -2
- package/dist/mcp/servicenow-notifications-mcp.d.ts +24 -0
- package/dist/mcp/servicenow-notifications-mcp.js +327 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +1 -1
- package/dist/mcp/servicenow-secops-mcp.d.ts +28 -0
- package/dist/mcp/servicenow-secops-mcp.js +560 -0
- package/dist/mcp/shared/mcp-types.d.ts +37 -0
- package/dist/mcp/shared/mcp-types.js +7 -0
- package/dist/mcp/shared/response-limiter.js +1 -1
- package/dist/memory/hierarchical-memory-system.d.ts +42 -0
- package/dist/memory/hierarchical-memory-system.js +60 -0
- package/dist/memory/memory-system.d.ts +34 -0
- package/dist/memory/memory-system.js +36 -0
- package/dist/memory/snow-flow-memory-patterns.d.ts +47 -28
- package/dist/memory/snow-flow-memory-patterns.js +46 -25
- package/dist/session/store.d.ts +47 -0
- package/dist/session/store.js +74 -0
- package/dist/snow-flow-system.js +0 -1
- package/dist/testing/integration-test-suite.js +0 -1
- package/dist/utils/artifact-local-sync.js +17 -0
- package/dist/utils/artifact-sync/artifact-registry.js +11 -11
- package/dist/utils/chunking-manager.d.ts +39 -0
- package/dist/utils/chunking-manager.js +143 -0
- package/dist/utils/memory-pool.d.ts +56 -0
- package/dist/utils/memory-pool.js +103 -0
- package/dist/utils/smart-field-fetcher.js +11 -9
- package/package.json +3 -3
- package/website/Dockerfile +3 -2
- package/website/cloudbuild.yaml +4 -3
- package/website/complete-mcp-reference.html +1040 -0
- package/website/components/hero/Hero.html +9 -9
- package/website/components/hero/Hero.jsx +3 -3
- package/website/css/button-contrast-fixes.css +133 -0
- package/website/css/button-fixes.css +49 -0
- package/website/css/enterprise-section-update.css +38 -0
- package/website/css/font-standardization.css +54 -0
- package/website/css/footer-hero-styling.css +73 -0
- package/website/css/hero-compact-spacing.css +60 -0
- package/website/css/hero-contrast-fixes.css +195 -0
- package/website/css/hero-inspired-design.css +135 -0
- package/website/css/hero-size-optimization.css +146 -0
- package/website/css/hero-spacing-improvements.css +139 -0
- package/website/css/hero-stats-visibility.css +98 -0
- package/website/css/mobile-hero-fix.css +215 -0
- package/website/css/navbar-hero-styling.css +70 -0
- package/website/css/reference-text-contrast.css +101 -0
- package/website/css/scroll-overlap-nuclear-fix.css +127 -0
- package/website/css/section-layering-fix.css +85 -0
- package/website/css/style.css +37 -10
- package/website/css/title-layout-fix.css +58 -0
- package/website/css/ultimate-overlap-fix.css +101 -0
- package/website/css/website-hero-consistency.css +101 -0
- package/website/enterprise-features.html +147 -0
- package/website/index.html +264 -39
- package/website/js/animations.js +20 -23
- package/website/js/main.js +73 -7
- package/website/mcp-reference-link.html +16 -0
- package/website/mcp-servers.html +2 -2
- package/website/tools.js +125 -6
- package/website/what-is-snow-flow-section.html +144 -0
- package/assets/logo.txt +0 -8
- package/assets/snow-flow-logo.svg +0 -51
- package/src/cli.ts.backup-20250809-125529 +0 -4773
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hierarchical Memory System
|
|
4
|
+
* Extended memory system with hierarchical organization
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DefaultHierarchicalMemorySystem = void 0;
|
|
8
|
+
class DefaultHierarchicalMemorySystem {
|
|
9
|
+
constructor(dbPath, namespace) {
|
|
10
|
+
this.memory = new Map();
|
|
11
|
+
this.dbPath = dbPath;
|
|
12
|
+
this.namespace = namespace || 'default';
|
|
13
|
+
}
|
|
14
|
+
getNamespaceMap(namespace) {
|
|
15
|
+
if (!this.memory.has(namespace)) {
|
|
16
|
+
this.memory.set(namespace, new Map());
|
|
17
|
+
}
|
|
18
|
+
return this.memory.get(namespace);
|
|
19
|
+
}
|
|
20
|
+
async store(key, value) {
|
|
21
|
+
await this.storeInNamespace(this.namespace || 'default', key, value);
|
|
22
|
+
}
|
|
23
|
+
async retrieve(key) {
|
|
24
|
+
return this.retrieveFromNamespace(this.namespace || 'default', key);
|
|
25
|
+
}
|
|
26
|
+
async get(key) {
|
|
27
|
+
return this.retrieve(key);
|
|
28
|
+
}
|
|
29
|
+
async delete(key) {
|
|
30
|
+
const nsMap = this.getNamespaceMap(this.namespace || 'default');
|
|
31
|
+
return nsMap.delete(key);
|
|
32
|
+
}
|
|
33
|
+
async clear() {
|
|
34
|
+
await this.clearNamespace(this.namespace || 'default');
|
|
35
|
+
}
|
|
36
|
+
async list() {
|
|
37
|
+
const nsMap = this.getNamespaceMap(this.namespace || 'default');
|
|
38
|
+
return Array.from(nsMap.keys());
|
|
39
|
+
}
|
|
40
|
+
async exists(key) {
|
|
41
|
+
const nsMap = this.getNamespaceMap(this.namespace || 'default');
|
|
42
|
+
return nsMap.has(key);
|
|
43
|
+
}
|
|
44
|
+
async storeInNamespace(namespace, key, value) {
|
|
45
|
+
const nsMap = this.getNamespaceMap(namespace);
|
|
46
|
+
nsMap.set(key, value);
|
|
47
|
+
}
|
|
48
|
+
async retrieveFromNamespace(namespace, key) {
|
|
49
|
+
const nsMap = this.getNamespaceMap(namespace);
|
|
50
|
+
return nsMap.get(key);
|
|
51
|
+
}
|
|
52
|
+
async listNamespaces() {
|
|
53
|
+
return Array.from(this.memory.keys());
|
|
54
|
+
}
|
|
55
|
+
async clearNamespace(namespace) {
|
|
56
|
+
this.memory.delete(namespace);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.DefaultHierarchicalMemorySystem = DefaultHierarchicalMemorySystem;
|
|
60
|
+
//# sourceMappingURL=hierarchical-memory-system.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic Memory System Interface
|
|
3
|
+
* Minimal implementation to satisfy missing imports
|
|
4
|
+
*/
|
|
5
|
+
export interface MemorySystem {
|
|
6
|
+
store(key: string, value: any, ttl?: number): Promise<void>;
|
|
7
|
+
retrieve(key: string): Promise<any>;
|
|
8
|
+
get(key: string): Promise<any>;
|
|
9
|
+
delete(key: string): Promise<boolean>;
|
|
10
|
+
clear(): Promise<void>;
|
|
11
|
+
list(): Promise<string[]>;
|
|
12
|
+
exists(key: string): Promise<boolean>;
|
|
13
|
+
query?(query: string): Promise<any[]>;
|
|
14
|
+
execute?(sql: string): Promise<any>;
|
|
15
|
+
insert?(table: string, data: any): Promise<any>;
|
|
16
|
+
getDatabaseStats?(): Promise<any>;
|
|
17
|
+
getCacheStats?(): Promise<any>;
|
|
18
|
+
initialize?(): Promise<void>;
|
|
19
|
+
close?(): Promise<void>;
|
|
20
|
+
invalidateCache?(key: string): Promise<void>;
|
|
21
|
+
createEmergencyBackup?(): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
export declare class BasicMemorySystem implements MemorySystem {
|
|
24
|
+
private memory;
|
|
25
|
+
store(key: string, value: any, ttl?: number): Promise<void>;
|
|
26
|
+
retrieve(key: string): Promise<any>;
|
|
27
|
+
get(key: string): Promise<any>;
|
|
28
|
+
delete(key: string): Promise<boolean>;
|
|
29
|
+
clear(): Promise<void>;
|
|
30
|
+
list(): Promise<string[]>;
|
|
31
|
+
exists(key: string): Promise<boolean>;
|
|
32
|
+
}
|
|
33
|
+
export declare const defaultMemorySystem: BasicMemorySystem;
|
|
34
|
+
//# sourceMappingURL=memory-system.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Basic Memory System Interface
|
|
4
|
+
* Minimal implementation to satisfy missing imports
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.defaultMemorySystem = exports.BasicMemorySystem = void 0;
|
|
8
|
+
class BasicMemorySystem {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.memory = new Map();
|
|
11
|
+
}
|
|
12
|
+
async store(key, value, ttl) {
|
|
13
|
+
this.memory.set(key, value);
|
|
14
|
+
}
|
|
15
|
+
async retrieve(key) {
|
|
16
|
+
return this.memory.get(key);
|
|
17
|
+
}
|
|
18
|
+
async get(key) {
|
|
19
|
+
return this.memory.get(key);
|
|
20
|
+
}
|
|
21
|
+
async delete(key) {
|
|
22
|
+
return this.memory.delete(key);
|
|
23
|
+
}
|
|
24
|
+
async clear() {
|
|
25
|
+
this.memory.clear();
|
|
26
|
+
}
|
|
27
|
+
async list() {
|
|
28
|
+
return Array.from(this.memory.keys());
|
|
29
|
+
}
|
|
30
|
+
async exists(key) {
|
|
31
|
+
return this.memory.has(key);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.BasicMemorySystem = BasicMemorySystem;
|
|
35
|
+
exports.defaultMemorySystem = new BasicMemorySystem();
|
|
36
|
+
//# sourceMappingURL=memory-system.js.map
|
|
@@ -1,33 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Snow-Flow Memory Patterns
|
|
3
|
-
*
|
|
2
|
+
* Snow-Flow Memory Patterns
|
|
3
|
+
* Common memory patterns and utilities for Snow-Flow
|
|
4
4
|
*/
|
|
5
|
+
export interface MemoryPattern {
|
|
6
|
+
pattern: string;
|
|
7
|
+
namespace: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const MEMORY_PATTERNS: {
|
|
11
|
+
readonly AGENT: "agent/*";
|
|
12
|
+
readonly TASK: "task/*";
|
|
13
|
+
readonly SESSION: "session/*";
|
|
14
|
+
readonly ARTIFACT: "artifact/*";
|
|
15
|
+
readonly CONFIG: "config/*";
|
|
16
|
+
readonly TEMP: "temp/*";
|
|
17
|
+
};
|
|
18
|
+
export declare const MEMORY_NAMESPACES: {
|
|
19
|
+
readonly QUEEN: "queen";
|
|
20
|
+
readonly AGENTS: "agents";
|
|
21
|
+
readonly TASKS: "tasks";
|
|
22
|
+
readonly SESSIONS: "sessions";
|
|
23
|
+
readonly ARTIFACTS: "artifacts";
|
|
24
|
+
readonly CONFIG: "config";
|
|
25
|
+
readonly TEMP: "temp";
|
|
26
|
+
};
|
|
27
|
+
export declare function createMemoryKey(namespace: string, type: string, id: string): string;
|
|
28
|
+
export declare function parseMemoryKey(key: string): {
|
|
29
|
+
namespace: string;
|
|
30
|
+
type: string;
|
|
31
|
+
id: string;
|
|
32
|
+
} | null;
|
|
33
|
+
export declare function matchesPattern(key: string, pattern: string): boolean;
|
|
5
34
|
export declare class SnowFlowMemoryOrganizer {
|
|
6
|
-
static
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
static getScriptMemoryStructure(name: string, scriptType?: string): {
|
|
23
|
-
key: string;
|
|
24
|
-
patterns: string[];
|
|
25
|
-
context: {
|
|
26
|
-
type: string;
|
|
27
|
-
name: string;
|
|
28
|
-
scriptType: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
static generateKey(category: string, type: string, name: string): string;
|
|
35
|
+
static organize(data: any): any;
|
|
36
|
+
}
|
|
37
|
+
export declare const SNOW_FLOW_AGENT_CAPABILITIES: {
|
|
38
|
+
RESEARCHER: string;
|
|
39
|
+
CODER: string;
|
|
40
|
+
ANALYST: string;
|
|
41
|
+
};
|
|
42
|
+
export interface HierarchicalMemoryEntry {
|
|
43
|
+
key: string;
|
|
44
|
+
value: any;
|
|
45
|
+
namespace: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MemorySearchOptions {
|
|
48
|
+
pattern?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
namespace?: string;
|
|
32
51
|
}
|
|
33
52
|
//# sourceMappingURL=snow-flow-memory-patterns.d.ts.map
|
|
@@ -1,35 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Snow-Flow Memory Patterns
|
|
4
|
-
*
|
|
3
|
+
* Snow-Flow Memory Patterns
|
|
4
|
+
* Common memory patterns and utilities for Snow-Flow
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SnowFlowMemoryOrganizer = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
exports.SNOW_FLOW_AGENT_CAPABILITIES = exports.SnowFlowMemoryOrganizer = exports.MEMORY_NAMESPACES = exports.MEMORY_PATTERNS = void 0;
|
|
8
|
+
exports.createMemoryKey = createMemoryKey;
|
|
9
|
+
exports.parseMemoryKey = parseMemoryKey;
|
|
10
|
+
exports.matchesPattern = matchesPattern;
|
|
11
|
+
exports.MEMORY_PATTERNS = {
|
|
12
|
+
AGENT: 'agent/*',
|
|
13
|
+
TASK: 'task/*',
|
|
14
|
+
SESSION: 'session/*',
|
|
15
|
+
ARTIFACT: 'artifact/*',
|
|
16
|
+
CONFIG: 'config/*',
|
|
17
|
+
TEMP: 'temp/*'
|
|
18
|
+
};
|
|
19
|
+
exports.MEMORY_NAMESPACES = {
|
|
20
|
+
QUEEN: 'queen',
|
|
21
|
+
AGENTS: 'agents',
|
|
22
|
+
TASKS: 'tasks',
|
|
23
|
+
SESSIONS: 'sessions',
|
|
24
|
+
ARTIFACTS: 'artifacts',
|
|
25
|
+
CONFIG: 'config',
|
|
26
|
+
TEMP: 'temp'
|
|
27
|
+
};
|
|
28
|
+
function createMemoryKey(namespace, type, id) {
|
|
29
|
+
return `${namespace}/${type}/${id}`;
|
|
30
|
+
}
|
|
31
|
+
function parseMemoryKey(key) {
|
|
32
|
+
const parts = key.split('/');
|
|
33
|
+
if (parts.length >= 3) {
|
|
24
34
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
namespace: parts[0],
|
|
36
|
+
type: parts[1],
|
|
37
|
+
id: parts.slice(2).join('/')
|
|
28
38
|
};
|
|
29
39
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function matchesPattern(key, pattern) {
|
|
43
|
+
const regex = new RegExp(pattern.replace('*', '.*'));
|
|
44
|
+
return regex.test(key);
|
|
45
|
+
}
|
|
46
|
+
// Export stub implementations for compatibility
|
|
47
|
+
class SnowFlowMemoryOrganizer {
|
|
48
|
+
static organize(data) { return data; }
|
|
33
49
|
}
|
|
34
50
|
exports.SnowFlowMemoryOrganizer = SnowFlowMemoryOrganizer;
|
|
51
|
+
exports.SNOW_FLOW_AGENT_CAPABILITIES = {
|
|
52
|
+
RESEARCHER: 'researcher',
|
|
53
|
+
CODER: 'coder',
|
|
54
|
+
ANALYST: 'analyst'
|
|
55
|
+
};
|
|
35
56
|
//# sourceMappingURL=snow-flow-memory-patterns.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface SessionMessage {
|
|
2
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
3
|
+
content: string;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
meta?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface SessionRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
startedAt: string;
|
|
10
|
+
endedAt?: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
provider: {
|
|
13
|
+
id: string;
|
|
14
|
+
model: string;
|
|
15
|
+
baseURL?: string;
|
|
16
|
+
};
|
|
17
|
+
mcp: {
|
|
18
|
+
cmd: string;
|
|
19
|
+
args?: string[];
|
|
20
|
+
};
|
|
21
|
+
messages: SessionMessage[];
|
|
22
|
+
toolEvents?: {
|
|
23
|
+
name: string;
|
|
24
|
+
when: string;
|
|
25
|
+
argsPreview?: string;
|
|
26
|
+
resultPreview?: string;
|
|
27
|
+
}[];
|
|
28
|
+
summary?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function createSessionId(): string;
|
|
31
|
+
export declare function startSession(rec: Omit<SessionRecord, 'messages' | 'toolEvents'> & {
|
|
32
|
+
messages?: SessionMessage[];
|
|
33
|
+
}): SessionRecord;
|
|
34
|
+
export declare function readSession(id: string): SessionRecord | undefined;
|
|
35
|
+
export declare function listSessions(): {
|
|
36
|
+
id: string;
|
|
37
|
+
startedAt: string;
|
|
38
|
+
objective: string;
|
|
39
|
+
}[];
|
|
40
|
+
export declare function appendMessage(id: string, msg: SessionMessage): void;
|
|
41
|
+
export declare function appendToolEvent(id: string, ev: {
|
|
42
|
+
name: string;
|
|
43
|
+
argsPreview?: string;
|
|
44
|
+
resultPreview?: string;
|
|
45
|
+
}): void;
|
|
46
|
+
export declare function endSession(id: string, summary?: string): void;
|
|
47
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createSessionId = createSessionId;
|
|
7
|
+
exports.startSession = startSession;
|
|
8
|
+
exports.readSession = readSession;
|
|
9
|
+
exports.listSessions = listSessions;
|
|
10
|
+
exports.appendMessage = appendMessage;
|
|
11
|
+
exports.appendToolEvent = appendToolEvent;
|
|
12
|
+
exports.endSession = endSession;
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const os_1 = __importDefault(require("os"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
function ensureDir(dir) {
|
|
17
|
+
if (!fs_1.default.existsSync(dir))
|
|
18
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
function sessionsDir() {
|
|
21
|
+
const dir = path_1.default.join(os_1.default.homedir(), '.snow-flow', 'sessions');
|
|
22
|
+
ensureDir(dir);
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
function createSessionId() {
|
|
26
|
+
return `sess_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
27
|
+
}
|
|
28
|
+
function sessionPath(id) {
|
|
29
|
+
return path_1.default.join(sessionsDir(), `${id}.json`);
|
|
30
|
+
}
|
|
31
|
+
function startSession(rec) {
|
|
32
|
+
const full = { ...rec, messages: rec.messages ?? [], toolEvents: [] };
|
|
33
|
+
fs_1.default.writeFileSync(sessionPath(rec.id), JSON.stringify(full, null, 2), 'utf8');
|
|
34
|
+
return full;
|
|
35
|
+
}
|
|
36
|
+
function readSession(id) {
|
|
37
|
+
const p = sessionPath(id);
|
|
38
|
+
if (!fs_1.default.existsSync(p))
|
|
39
|
+
return undefined;
|
|
40
|
+
return JSON.parse(fs_1.default.readFileSync(p, 'utf8'));
|
|
41
|
+
}
|
|
42
|
+
function listSessions() {
|
|
43
|
+
const dir = sessionsDir();
|
|
44
|
+
const files = fs_1.default.readdirSync(dir).filter(f => f.endsWith('.json'));
|
|
45
|
+
return files.map(f => {
|
|
46
|
+
const rec = JSON.parse(fs_1.default.readFileSync(path_1.default.join(dir, f), 'utf8'));
|
|
47
|
+
return { id: rec.id, startedAt: rec.startedAt, objective: rec.objective };
|
|
48
|
+
}).sort((a, b) => (a.startedAt < b.startedAt ? 1 : -1));
|
|
49
|
+
}
|
|
50
|
+
function appendMessage(id, msg) {
|
|
51
|
+
const rec = readSession(id);
|
|
52
|
+
if (!rec)
|
|
53
|
+
return;
|
|
54
|
+
rec.messages.push(msg);
|
|
55
|
+
fs_1.default.writeFileSync(sessionPath(id), JSON.stringify(rec, null, 2), 'utf8');
|
|
56
|
+
}
|
|
57
|
+
function appendToolEvent(id, ev) {
|
|
58
|
+
const rec = readSession(id);
|
|
59
|
+
if (!rec)
|
|
60
|
+
return;
|
|
61
|
+
const item = { name: ev.name, when: new Date().toISOString(), argsPreview: ev.argsPreview, resultPreview: ev.resultPreview };
|
|
62
|
+
(rec.toolEvents = rec.toolEvents || []).push(item);
|
|
63
|
+
fs_1.default.writeFileSync(sessionPath(id), JSON.stringify(rec, null, 2), 'utf8');
|
|
64
|
+
}
|
|
65
|
+
function endSession(id, summary) {
|
|
66
|
+
const rec = readSession(id);
|
|
67
|
+
if (!rec)
|
|
68
|
+
return;
|
|
69
|
+
rec.endedAt = new Date().toISOString();
|
|
70
|
+
if (summary)
|
|
71
|
+
rec.summary = summary;
|
|
72
|
+
fs_1.default.writeFileSync(sessionPath(id), JSON.stringify(rec, null, 2), 'utf8');
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=store.js.map
|
package/dist/snow-flow-system.js
CHANGED
|
@@ -11,7 +11,6 @@ exports.snowFlowSystem = exports.SnowFlowSystem = void 0;
|
|
|
11
11
|
const events_1 = require("events");
|
|
12
12
|
const snow_flow_config_1 = require("./config/snow-flow-config");
|
|
13
13
|
const servicenow_queen_1 = require("./queen/servicenow-queen");
|
|
14
|
-
const memory_system_1 = require("./memory/memory-system");
|
|
15
14
|
const mcp_server_manager_1 = require("./utils/mcp-server-manager");
|
|
16
15
|
const performance_tracker_1 = require("./monitoring/performance-tracker");
|
|
17
16
|
const system_health_1 = require("./health/system-health");
|
|
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.IntegrationTestSuite = void 0;
|
|
11
11
|
const logger_js_1 = require("../utils/logger.js");
|
|
12
12
|
const servicenow_client_js_1 = require("../utils/servicenow-client.js");
|
|
13
|
-
const memory_system_js_1 = require("../memory/memory-system.js");
|
|
14
13
|
class IntegrationTestSuite {
|
|
15
14
|
constructor() {
|
|
16
15
|
// Flow-related systems removed in v1.4.0
|
|
@@ -47,6 +47,7 @@ const fs = __importStar(require("fs"));
|
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
48
|
const smart_field_fetcher_js_1 = require("./smart-field-fetcher.js");
|
|
49
49
|
const mcp_timeout_config_js_1 = require("./mcp-timeout-config.js");
|
|
50
|
+
const chunking_manager_js_1 = require("./chunking-manager.js");
|
|
50
51
|
const artifact_registry_1 = require("./artifact-sync/artifact-registry");
|
|
51
52
|
class ArtifactLocalSync {
|
|
52
53
|
constructor(client, customBaseDir) {
|
|
@@ -285,6 +286,22 @@ class ArtifactLocalSync {
|
|
|
285
286
|
}
|
|
286
287
|
// Map back to ServiceNow field
|
|
287
288
|
if (file.field && file.field !== 'documentation' && file.field !== 'metadata') {
|
|
289
|
+
// Check if field needs chunking (large server scripts)
|
|
290
|
+
if (chunking_manager_js_1.ChunkingManager.needsChunking(processedContent)) {
|
|
291
|
+
console.log(` ⚠️ Large field detected: ${file.field} (${processedContent.length} chars)`);
|
|
292
|
+
// Attempt chunked update
|
|
293
|
+
const chunkResult = await chunking_manager_js_1.ChunkingManager.attemptChunkedUpdate(this.client, config.tableName, sys_id, file.field, processedContent);
|
|
294
|
+
if (!chunkResult.success) {
|
|
295
|
+
// Add to validation results as a manual instruction
|
|
296
|
+
validationResults.push({
|
|
297
|
+
valid: false,
|
|
298
|
+
errors: [],
|
|
299
|
+
warnings: [`Large ${file.field} requires manual update`],
|
|
300
|
+
hints: [chunkResult.message]
|
|
301
|
+
});
|
|
302
|
+
continue; // Skip adding to updates
|
|
303
|
+
}
|
|
304
|
+
}
|
|
288
305
|
updates[file.field] = processedContent;
|
|
289
306
|
console.log(` 📝 Changed: ${file.filename} (${file.field})`);
|
|
290
307
|
// Validate ES5 if required
|
|
@@ -33,7 +33,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
33
33
|
fileExtension: 'html',
|
|
34
34
|
description: 'HTML template with Angular bindings',
|
|
35
35
|
wrapperHeader: '<!-- ServiceNow Widget Template: {name} -->\n<!-- Angular bindings: {{data.x}}, ng-click="method()" -->\n\n',
|
|
36
|
-
maxTokens:
|
|
36
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
37
37
|
isRequired: true
|
|
38
38
|
},
|
|
39
39
|
{
|
|
@@ -43,7 +43,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
43
43
|
description: 'Server-side script (ES5 ONLY)',
|
|
44
44
|
wrapperHeader: '/**\n * Server Script for Widget: {name}\n * ES5 ONLY - No arrow functions, const/let, template literals\n * Available: data, input, options, gs, $sp\n */\n\n(function() {\n',
|
|
45
45
|
wrapperFooter: '\n})();',
|
|
46
|
-
maxTokens:
|
|
46
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
47
47
|
isRequired: false,
|
|
48
48
|
validateES5: true
|
|
49
49
|
},
|
|
@@ -54,7 +54,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
54
54
|
description: 'Client-side AngularJS controller',
|
|
55
55
|
wrapperHeader: '/**\n * Client Controller for Widget: {name}\n * AngularJS 1.x\n * Available: c (this), c.data, c.server, $scope\n */\n\nfunction(',
|
|
56
56
|
wrapperFooter: ')',
|
|
57
|
-
maxTokens:
|
|
57
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
58
58
|
isRequired: false
|
|
59
59
|
},
|
|
60
60
|
{
|
|
@@ -63,7 +63,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
63
63
|
fileExtension: 'css',
|
|
64
64
|
description: 'Widget-specific CSS styles',
|
|
65
65
|
wrapperHeader: '/* Styles for Widget: {name} */\n/* Prefix classes to avoid conflicts */\n\n',
|
|
66
|
-
maxTokens:
|
|
66
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
67
67
|
isRequired: false
|
|
68
68
|
},
|
|
69
69
|
{
|
|
@@ -153,7 +153,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
153
153
|
localFileName: '{name}.flow',
|
|
154
154
|
fileExtension: 'json',
|
|
155
155
|
description: 'Complete flow definition with all steps and actions',
|
|
156
|
-
maxTokens:
|
|
156
|
+
maxTokens: 200000, // Claude's context window is 200k tokens // Flows can be huge
|
|
157
157
|
isRequired: true,
|
|
158
158
|
preprocessor: (content) => {
|
|
159
159
|
try {
|
|
@@ -243,7 +243,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
243
243
|
description: 'Business rule script',
|
|
244
244
|
wrapperHeader: '/**\n * Business Rule: {name}\n * Table: {collection}\n * When: {when}\n * Order: {order}\n * Available: current, previous, gs, g_scratchpad\n */\n\n(function executeRule(current, previous /*null when async*/) {\n',
|
|
245
245
|
wrapperFooter: '\n})(current, previous);',
|
|
246
|
-
maxTokens:
|
|
246
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
247
247
|
isRequired: true,
|
|
248
248
|
validateES5: true
|
|
249
249
|
},
|
|
@@ -281,7 +281,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
281
281
|
localFileName: '{name}.client',
|
|
282
282
|
fileExtension: 'js',
|
|
283
283
|
description: 'Client-side JavaScript',
|
|
284
|
-
maxTokens:
|
|
284
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
285
285
|
isRequired: false
|
|
286
286
|
},
|
|
287
287
|
{
|
|
@@ -289,7 +289,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
289
289
|
localFileName: '{name}.server',
|
|
290
290
|
fileExtension: 'js',
|
|
291
291
|
description: 'Server-side processing script (ES5)',
|
|
292
|
-
maxTokens:
|
|
292
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
293
293
|
isRequired: false,
|
|
294
294
|
validateES5: true
|
|
295
295
|
}
|
|
@@ -310,7 +310,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
310
310
|
fileExtension: 'js',
|
|
311
311
|
description: 'Client-side form script',
|
|
312
312
|
wrapperHeader: '/**\n * Client Script: {name}\n * Table: {table}\n * Type: {type}\n * Available: g_form, g_user, g_list\n */\n\n',
|
|
313
|
-
maxTokens:
|
|
313
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
314
314
|
isRequired: true
|
|
315
315
|
}
|
|
316
316
|
]
|
|
@@ -375,7 +375,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
375
375
|
localFileName: '{name}',
|
|
376
376
|
fileExtension: 'js',
|
|
377
377
|
description: 'Transform map script',
|
|
378
|
-
maxTokens:
|
|
378
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
379
379
|
isRequired: false,
|
|
380
380
|
validateES5: true
|
|
381
381
|
}
|
|
@@ -396,7 +396,7 @@ exports.ARTIFACT_REGISTRY = {
|
|
|
396
396
|
fileExtension: 'js',
|
|
397
397
|
description: 'Scheduled job script (ES5)',
|
|
398
398
|
wrapperHeader: '/**\n * Scheduled Job: {name}\n * Run as: {run_as}\n * Time zone: {time_zone}\n */\n\n',
|
|
399
|
-
maxTokens:
|
|
399
|
+
maxTokens: 200000, // Claude's context window is 200k tokens
|
|
400
400
|
isRequired: true,
|
|
401
401
|
validateES5: true
|
|
402
402
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chunking Manager for Large ServiceNow Artifacts
|
|
3
|
+
* Handles scripts >30k characters that exceed API token limits
|
|
4
|
+
*/
|
|
5
|
+
export interface ChunkingStrategy {
|
|
6
|
+
maxChunkSize: number;
|
|
7
|
+
overlapSize: number;
|
|
8
|
+
chunkType: 'lines' | 'functions' | 'blocks';
|
|
9
|
+
}
|
|
10
|
+
export interface ScriptChunk {
|
|
11
|
+
index: number;
|
|
12
|
+
content: string;
|
|
13
|
+
startLine: number;
|
|
14
|
+
endLine: number;
|
|
15
|
+
type: 'complete' | 'partial_start' | 'partial_middle' | 'partial_end';
|
|
16
|
+
hasContext: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class ChunkingManager {
|
|
19
|
+
/**
|
|
20
|
+
* Determine if script needs chunking
|
|
21
|
+
*/
|
|
22
|
+
static needsChunking(script: string, maxSize?: number): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Split large script into manageable chunks
|
|
25
|
+
*/
|
|
26
|
+
static chunkScript(script: string, strategy?: ChunkingStrategy): ScriptChunk[];
|
|
27
|
+
/**
|
|
28
|
+
* Generate instructions for manual large script handling
|
|
29
|
+
*/
|
|
30
|
+
static generateManualInstructions(scriptName: string, scriptSize: number, chunks: ScriptChunk[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* Attempt smart chunked update for large scripts
|
|
33
|
+
*/
|
|
34
|
+
static attemptChunkedUpdate(client: any, table: string, sys_id: string, field: string, script: string): Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
message: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=chunking-manager.d.ts.map
|