agenthub-multiagent-mcp 1.7.0 → 1.7.2
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/state.d.ts +2 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +46 -3
- package/dist/state.js.map +1 -1
- package/package.json +1 -1
- package/src/state.ts +49 -3
package/dist/state.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Encrypted state file management for agent reconnection.
|
|
3
3
|
*
|
|
4
|
-
* State file: .agenthub in working directory
|
|
4
|
+
* State file: .agenthub/state in working directory
|
|
5
5
|
* Encryption: AES-256-GCM with PBKDF2 key derivation
|
|
6
6
|
* Key source: hostname + username + "agenthub"
|
|
7
7
|
*/
|
|
@@ -24,6 +24,7 @@ export declare function saveState(workingDir: string, state: AgentState): void;
|
|
|
24
24
|
/**
|
|
25
25
|
* Load agent state from encrypted file
|
|
26
26
|
* Returns null if file doesn't exist or can't be decrypted
|
|
27
|
+
* Supports migration from legacy .agenthub file to .agenthub/state
|
|
27
28
|
*/
|
|
28
29
|
export declare function loadState(workingDir: string): AgentState | null;
|
|
29
30
|
/**
|
package/dist/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAqGD;;GAEG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAOrE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAmC/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
package/dist/state.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Encrypted state file management for agent reconnection.
|
|
3
3
|
*
|
|
4
|
-
* State file: .agenthub in working directory
|
|
4
|
+
* State file: .agenthub/state in working directory
|
|
5
5
|
* Encryption: AES-256-GCM with PBKDF2 key derivation
|
|
6
6
|
* Key source: hostname + username + "agenthub"
|
|
7
7
|
*/
|
|
@@ -9,7 +9,8 @@ import * as crypto from "crypto";
|
|
|
9
9
|
import * as fs from "fs";
|
|
10
10
|
import * as os from "os";
|
|
11
11
|
import * as path from "path";
|
|
12
|
-
const
|
|
12
|
+
const STATE_DIR = ".agenthub";
|
|
13
|
+
const STATE_FILE = "state";
|
|
13
14
|
const SALT_LENGTH = 16;
|
|
14
15
|
const IV_LENGTH = 12;
|
|
15
16
|
const AUTH_TAG_LENGTH = 16;
|
|
@@ -62,16 +63,38 @@ function decrypt(encoded) {
|
|
|
62
63
|
]);
|
|
63
64
|
return decrypted.toString("utf8");
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the state directory path for a working directory
|
|
68
|
+
*/
|
|
69
|
+
function getStateDir(workingDir) {
|
|
70
|
+
return path.join(workingDir, STATE_DIR);
|
|
71
|
+
}
|
|
65
72
|
/**
|
|
66
73
|
* Get the state file path for a working directory
|
|
67
74
|
*/
|
|
68
75
|
function getStatePath(workingDir) {
|
|
69
|
-
return path.join(workingDir, STATE_FILE);
|
|
76
|
+
return path.join(getStateDir(workingDir), STATE_FILE);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get the legacy state file path (for migration)
|
|
80
|
+
*/
|
|
81
|
+
function getLegacyStatePath(workingDir) {
|
|
82
|
+
return path.join(workingDir, ".agenthub");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Ensure the state directory exists
|
|
86
|
+
*/
|
|
87
|
+
function ensureStateDir(workingDir) {
|
|
88
|
+
const dir = getStateDir(workingDir);
|
|
89
|
+
if (!fs.existsSync(dir)) {
|
|
90
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
91
|
+
}
|
|
70
92
|
}
|
|
71
93
|
/**
|
|
72
94
|
* Save agent state to encrypted file
|
|
73
95
|
*/
|
|
74
96
|
export function saveState(workingDir, state) {
|
|
97
|
+
ensureStateDir(workingDir);
|
|
75
98
|
const statePath = getStatePath(workingDir);
|
|
76
99
|
const json = JSON.stringify(state);
|
|
77
100
|
const encrypted = encrypt(json);
|
|
@@ -80,9 +103,29 @@ export function saveState(workingDir, state) {
|
|
|
80
103
|
/**
|
|
81
104
|
* Load agent state from encrypted file
|
|
82
105
|
* Returns null if file doesn't exist or can't be decrypted
|
|
106
|
+
* Supports migration from legacy .agenthub file to .agenthub/state
|
|
83
107
|
*/
|
|
84
108
|
export function loadState(workingDir) {
|
|
85
109
|
const statePath = getStatePath(workingDir);
|
|
110
|
+
const legacyPath = getLegacyStatePath(workingDir);
|
|
111
|
+
// Check for legacy file and migrate if found
|
|
112
|
+
if (!fs.existsSync(statePath) && fs.existsSync(legacyPath)) {
|
|
113
|
+
const stats = fs.statSync(legacyPath);
|
|
114
|
+
if (stats.isFile()) {
|
|
115
|
+
// Migrate legacy file to new location
|
|
116
|
+
// Must delete legacy file BEFORE creating directory (same name)
|
|
117
|
+
try {
|
|
118
|
+
const encrypted = fs.readFileSync(legacyPath, "utf8");
|
|
119
|
+
fs.unlinkSync(legacyPath); // Remove legacy file first
|
|
120
|
+
ensureStateDir(workingDir); // Now create directory
|
|
121
|
+
fs.writeFileSync(statePath, encrypted, { mode: 0o600 });
|
|
122
|
+
console.log("Migrated state file from .agenthub to .agenthub/state");
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.warn("Failed to migrate legacy state file:", error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
86
129
|
if (!fs.existsSync(statePath)) {
|
|
87
130
|
return null;
|
|
88
131
|
}
|
package/dist/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAA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W,CAAC,UAAkB;IAC5C,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
package/src/state.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Encrypted state file management for agent reconnection.
|
|
3
3
|
*
|
|
4
|
-
* State file: .agenthub in working directory
|
|
4
|
+
* State file: .agenthub/state in working directory
|
|
5
5
|
* Encryption: AES-256-GCM with PBKDF2 key derivation
|
|
6
6
|
* Key source: hostname + username + "agenthub"
|
|
7
7
|
*/
|
|
@@ -11,7 +11,8 @@ import * as fs from "fs";
|
|
|
11
11
|
import * as os from "os";
|
|
12
12
|
import * as path from "path";
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const STATE_DIR = ".agenthub";
|
|
15
|
+
const STATE_FILE = "state";
|
|
15
16
|
const SALT_LENGTH = 16;
|
|
16
17
|
const IV_LENGTH = 12;
|
|
17
18
|
const AUTH_TAG_LENGTH = 16;
|
|
@@ -99,17 +100,42 @@ function decrypt(encoded: string): string {
|
|
|
99
100
|
return decrypted.toString("utf8");
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Get the state directory path for a working directory
|
|
105
|
+
*/
|
|
106
|
+
function getStateDir(workingDir: string): string {
|
|
107
|
+
return path.join(workingDir, STATE_DIR);
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
/**
|
|
103
111
|
* Get the state file path for a working directory
|
|
104
112
|
*/
|
|
105
113
|
function getStatePath(workingDir: string): string {
|
|
106
|
-
return path.join(workingDir, STATE_FILE);
|
|
114
|
+
return path.join(getStateDir(workingDir), STATE_FILE);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get the legacy state file path (for migration)
|
|
119
|
+
*/
|
|
120
|
+
function getLegacyStatePath(workingDir: string): string {
|
|
121
|
+
return path.join(workingDir, ".agenthub");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Ensure the state directory exists
|
|
126
|
+
*/
|
|
127
|
+
function ensureStateDir(workingDir: string): void {
|
|
128
|
+
const dir = getStateDir(workingDir);
|
|
129
|
+
if (!fs.existsSync(dir)) {
|
|
130
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
131
|
+
}
|
|
107
132
|
}
|
|
108
133
|
|
|
109
134
|
/**
|
|
110
135
|
* Save agent state to encrypted file
|
|
111
136
|
*/
|
|
112
137
|
export function saveState(workingDir: string, state: AgentState): void {
|
|
138
|
+
ensureStateDir(workingDir);
|
|
113
139
|
const statePath = getStatePath(workingDir);
|
|
114
140
|
const json = JSON.stringify(state);
|
|
115
141
|
const encrypted = encrypt(json);
|
|
@@ -120,9 +146,29 @@ export function saveState(workingDir: string, state: AgentState): void {
|
|
|
120
146
|
/**
|
|
121
147
|
* Load agent state from encrypted file
|
|
122
148
|
* Returns null if file doesn't exist or can't be decrypted
|
|
149
|
+
* Supports migration from legacy .agenthub file to .agenthub/state
|
|
123
150
|
*/
|
|
124
151
|
export function loadState(workingDir: string): AgentState | null {
|
|
125
152
|
const statePath = getStatePath(workingDir);
|
|
153
|
+
const legacyPath = getLegacyStatePath(workingDir);
|
|
154
|
+
|
|
155
|
+
// Check for legacy file and migrate if found
|
|
156
|
+
if (!fs.existsSync(statePath) && fs.existsSync(legacyPath)) {
|
|
157
|
+
const stats = fs.statSync(legacyPath);
|
|
158
|
+
if (stats.isFile()) {
|
|
159
|
+
// Migrate legacy file to new location
|
|
160
|
+
// Must delete legacy file BEFORE creating directory (same name)
|
|
161
|
+
try {
|
|
162
|
+
const encrypted = fs.readFileSync(legacyPath, "utf8");
|
|
163
|
+
fs.unlinkSync(legacyPath); // Remove legacy file first
|
|
164
|
+
ensureStateDir(workingDir); // Now create directory
|
|
165
|
+
fs.writeFileSync(statePath, encrypted, { mode: 0o600 });
|
|
166
|
+
console.log("Migrated state file from .agenthub to .agenthub/state");
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.warn("Failed to migrate legacy state file:", error);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
126
172
|
|
|
127
173
|
if (!fs.existsSync(statePath)) {
|
|
128
174
|
return null;
|