conductor-bridge 1.0.0
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 +69 -0
- package/dist/bridge/index.d.ts +8 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +8 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/json-interchange.d.ts +94 -0
- package/dist/bridge/json-interchange.d.ts.map +1 -0
- package/dist/bridge/json-interchange.js +301 -0
- package/dist/bridge/json-interchange.js.map +1 -0
- package/dist/cli/commands/amend.d.ts +12 -0
- package/dist/cli/commands/amend.d.ts.map +1 -0
- package/dist/cli/commands/amend.js +205 -0
- package/dist/cli/commands/amend.js.map +1 -0
- package/dist/cli/commands/daemon.d.ts +12 -0
- package/dist/cli/commands/daemon.d.ts.map +1 -0
- package/dist/cli/commands/daemon.js +60 -0
- package/dist/cli/commands/daemon.js.map +1 -0
- package/dist/cli/commands/dispatch.d.ts +12 -0
- package/dist/cli/commands/dispatch.d.ts.map +1 -0
- package/dist/cli/commands/dispatch.js +207 -0
- package/dist/cli/commands/dispatch.js.map +1 -0
- package/dist/cli/commands/handoff.d.ts +31 -0
- package/dist/cli/commands/handoff.d.ts.map +1 -0
- package/dist/cli/commands/handoff.js +273 -0
- package/dist/cli/commands/handoff.js.map +1 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +301 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/status.d.ts +12 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +206 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +148 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/handoff/encryption.d.ts +85 -0
- package/dist/handoff/encryption.d.ts.map +1 -0
- package/dist/handoff/encryption.js +308 -0
- package/dist/handoff/encryption.js.map +1 -0
- package/dist/handoff/index.d.ts +8 -0
- package/dist/handoff/index.d.ts.map +1 -0
- package/dist/handoff/index.js +10 -0
- package/dist/handoff/index.js.map +1 -0
- package/dist/handoff/mycelium-arc.d.ts +116 -0
- package/dist/handoff/mycelium-arc.d.ts.map +1 -0
- package/dist/handoff/mycelium-arc.js +410 -0
- package/dist/handoff/mycelium-arc.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/index.d.ts +10 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +12 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/plan-parser.d.ts +29 -0
- package/dist/parsers/plan-parser.d.ts.map +1 -0
- package/dist/parsers/plan-parser.js +503 -0
- package/dist/parsers/plan-parser.js.map +1 -0
- package/dist/parsers/spec-parser.d.ts +10 -0
- package/dist/parsers/spec-parser.d.ts.map +1 -0
- package/dist/parsers/spec-parser.js +382 -0
- package/dist/parsers/spec-parser.js.map +1 -0
- package/dist/parsers/state-parser.d.ts +21 -0
- package/dist/parsers/state-parser.d.ts.map +1 -0
- package/dist/parsers/state-parser.js +378 -0
- package/dist/parsers/state-parser.js.map +1 -0
- package/dist/parsers/types.d.ts +190 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/parsers/types.js +7 -0
- package/dist/parsers/types.js.map +1 -0
- package/dist/schemas/cognitive-state.d.ts +1523 -0
- package/dist/schemas/cognitive-state.d.ts.map +1 -0
- package/dist/schemas/cognitive-state.js +328 -0
- package/dist/schemas/cognitive-state.js.map +1 -0
- package/dist/schemas/enums.d.ts +124 -0
- package/dist/schemas/enums.d.ts.map +1 -0
- package/dist/schemas/enums.js +108 -0
- package/dist/schemas/enums.js.map +1 -0
- package/dist/schemas/index.d.ts +9 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/sync/adhd-continuity.d.ts +91 -0
- package/dist/sync/adhd-continuity.d.ts.map +1 -0
- package/dist/sync/adhd-continuity.js +302 -0
- package/dist/sync/adhd-continuity.js.map +1 -0
- package/dist/sync/convergence-tracker.d.ts +111 -0
- package/dist/sync/convergence-tracker.d.ts.map +1 -0
- package/dist/sync/convergence-tracker.js +299 -0
- package/dist/sync/convergence-tracker.js.map +1 -0
- package/dist/sync/index.d.ts +11 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +15 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/state-sync.d.ts +105 -0
- package/dist/sync/state-sync.d.ts.map +1 -0
- package/dist/sync/state-sync.js +403 -0
- package/dist/sync/state-sync.js.map +1 -0
- package/dist/sync/watcher.d.ts +90 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +281 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/utils/atomic-write.d.ts +31 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +69 -0
- package/dist/utils/atomic-write.js.map +1 -0
- package/dist/utils/error-handling.d.ts +70 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/error-handling.js +109 -0
- package/dist/utils/error-handling.js.map +1 -0
- package/dist/utils/file-lock.d.ts +46 -0
- package/dist/utils/file-lock.d.ts.map +1 -0
- package/dist/utils/file-lock.js +117 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rlm-navigator.d.ts +160 -0
- package/dist/utils/rlm-navigator.d.ts.map +1 -0
- package/dist/utils/rlm-navigator.js +368 -0
- package/dist/utils/rlm-navigator.js.map +1 -0
- package/dist/utils/safe-path.d.ts +44 -0
- package/dist/utils/safe-path.d.ts.map +1 -0
- package/dist/utils/safe-path.js +96 -0
- package/dist/utils/safe-path.js.map +1 -0
- package/dist/utils/timed-io.d.ts +51 -0
- package/dist/utils/timed-io.d.ts.map +1 -0
- package/dist/utils/timed-io.js +128 -0
- package/dist/utils/timed-io.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handoff Encryption Module
|
|
3
|
+
*
|
|
4
|
+
* Provides encryption for cross-agent handoffs using:
|
|
5
|
+
* - AES-256-GCM for symmetric encryption
|
|
6
|
+
* - Machine-bound keys derived from hardware identifiers
|
|
7
|
+
*
|
|
8
|
+
* Security model:
|
|
9
|
+
* - Handoffs are encrypted at rest
|
|
10
|
+
* - Machine-bound option prevents transfer to other machines
|
|
11
|
+
* - Keys are derived, not stored (stateless)
|
|
12
|
+
*/
|
|
13
|
+
import { createCipheriv, createDecipheriv, randomBytes, createHash, scryptSync, } from 'crypto';
|
|
14
|
+
import { hostname, cpus, networkInterfaces } from 'os';
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Machine Identification
|
|
17
|
+
// ============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Generate a machine-specific identifier.
|
|
20
|
+
*
|
|
21
|
+
* Combines:
|
|
22
|
+
* - Hostname
|
|
23
|
+
* - CPU model
|
|
24
|
+
* - Smallest valid MAC address (lexicographically)
|
|
25
|
+
*
|
|
26
|
+
* DETERMINISM GUARANTEES (ThinkingMachines [He2025] compliance):
|
|
27
|
+
* - MAC addresses are sorted lexicographically, smallest is selected
|
|
28
|
+
* - Adding new interfaces (Docker, VPN, etc.) won't change ID unless
|
|
29
|
+
* the new MAC is smaller than all existing MACs
|
|
30
|
+
* - This ensures batch-invariance: same hardware → same ID
|
|
31
|
+
*
|
|
32
|
+
* This is NOT cryptographically secure for authentication,
|
|
33
|
+
* but provides reasonable binding for local handoffs.
|
|
34
|
+
*/
|
|
35
|
+
export function getMachineId() {
|
|
36
|
+
const parts = [];
|
|
37
|
+
// Hostname (deterministic - OS provides consistent value)
|
|
38
|
+
parts.push(hostname());
|
|
39
|
+
// CPU model (deterministic - first CPU in fixed array order)
|
|
40
|
+
const cpuList = cpus();
|
|
41
|
+
if (cpuList.length > 0) {
|
|
42
|
+
parts.push(cpuList[0].model);
|
|
43
|
+
}
|
|
44
|
+
// Collect ALL valid MAC addresses, then sort and pick smallest
|
|
45
|
+
// ThinkingMachines [He2025] compliance: Fixed evaluation order
|
|
46
|
+
// Sorting by MAC (not interface name) ensures stability when
|
|
47
|
+
// virtual interfaces are added/removed
|
|
48
|
+
const validMacs = [];
|
|
49
|
+
const interfaces = networkInterfaces();
|
|
50
|
+
for (const name of Object.keys(interfaces)) {
|
|
51
|
+
const iface = interfaces[name];
|
|
52
|
+
if (iface) {
|
|
53
|
+
for (const info of iface) {
|
|
54
|
+
if (!info.internal && info.mac !== '00:00:00:00:00:00') {
|
|
55
|
+
// Only add unique MACs (an interface may have multiple addresses)
|
|
56
|
+
if (!validMacs.includes(info.mac)) {
|
|
57
|
+
validMacs.push(info.mac);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Sort MACs lexicographically and use the smallest (most stable choice)
|
|
64
|
+
if (validMacs.length > 0) {
|
|
65
|
+
validMacs.sort();
|
|
66
|
+
parts.push(validMacs[0]);
|
|
67
|
+
}
|
|
68
|
+
// Hash the combined parts with deterministic separator
|
|
69
|
+
return createHash('sha256').update(parts.join('|')).digest('hex').slice(0, 16);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Verify machine ID matches current machine.
|
|
73
|
+
*/
|
|
74
|
+
export function verifyMachineId(expectedId) {
|
|
75
|
+
return getMachineId() === expectedId;
|
|
76
|
+
}
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Key Derivation
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Derive encryption key from passphrase and salt.
|
|
82
|
+
*
|
|
83
|
+
* Uses scrypt for key derivation (memory-hard, resistant to GPU attacks).
|
|
84
|
+
*/
|
|
85
|
+
function deriveKey(passphrase, salt) {
|
|
86
|
+
return scryptSync(passphrase, salt, 32, {
|
|
87
|
+
N: 16384, // CPU/memory cost
|
|
88
|
+
r: 8, // Block size
|
|
89
|
+
p: 1, // Parallelism
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get default passphrase for machine-bound encryption.
|
|
94
|
+
*
|
|
95
|
+
* For machine-bound encryption, we use the machine ID as part of the key.
|
|
96
|
+
* This means the data can only be decrypted on the same machine.
|
|
97
|
+
*/
|
|
98
|
+
function getMachineBoundPassphrase() {
|
|
99
|
+
return `conductor-handoff-${getMachineId()}`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Environment variable name for custom encryption key.
|
|
103
|
+
* When set, this key is used instead of the default.
|
|
104
|
+
*/
|
|
105
|
+
const ENV_KEY_NAME = 'CONDUCTOR_HANDOFF_KEY';
|
|
106
|
+
/**
|
|
107
|
+
* Minimum length for environment-provided keys.
|
|
108
|
+
*/
|
|
109
|
+
const MIN_KEY_LENGTH = 16;
|
|
110
|
+
/**
|
|
111
|
+
* Track whether we've warned about default key usage (once per session).
|
|
112
|
+
*/
|
|
113
|
+
let warnedAboutDefaultKey = false;
|
|
114
|
+
/**
|
|
115
|
+
* Get passphrase for encryption.
|
|
116
|
+
*
|
|
117
|
+
* Priority order:
|
|
118
|
+
* 1. Custom passphrase (explicitly provided)
|
|
119
|
+
* 2. Machine-bound passphrase (if machineBound=true)
|
|
120
|
+
* 3. Environment variable CONDUCTOR_HANDOFF_KEY
|
|
121
|
+
* 4. Default key (with security warning)
|
|
122
|
+
*
|
|
123
|
+
* @param machineBound If true, use machine-specific passphrase
|
|
124
|
+
* @param customPassphrase Optional custom passphrase
|
|
125
|
+
*/
|
|
126
|
+
function getPassphrase(machineBound, customPassphrase) {
|
|
127
|
+
// 1. Explicit custom passphrase takes priority
|
|
128
|
+
if (customPassphrase) {
|
|
129
|
+
return customPassphrase;
|
|
130
|
+
}
|
|
131
|
+
// 2. Machine-bound uses hardware-derived key
|
|
132
|
+
if (machineBound) {
|
|
133
|
+
return getMachineBoundPassphrase();
|
|
134
|
+
}
|
|
135
|
+
// 3. Check environment variable
|
|
136
|
+
const envKey = process.env[ENV_KEY_NAME];
|
|
137
|
+
if (envKey && envKey.length >= MIN_KEY_LENGTH) {
|
|
138
|
+
return envKey;
|
|
139
|
+
}
|
|
140
|
+
// 4. Fall back to default key with warning
|
|
141
|
+
if (!warnedAboutDefaultKey) {
|
|
142
|
+
console.warn(`[SECURITY WARNING] Using default encryption key for handoffs. ` +
|
|
143
|
+
`For production use, set the ${ENV_KEY_NAME} environment variable ` +
|
|
144
|
+
`to a secure key (minimum ${MIN_KEY_LENGTH} characters).`);
|
|
145
|
+
warnedAboutDefaultKey = true;
|
|
146
|
+
}
|
|
147
|
+
return 'conductor-handoff-default-key-v1';
|
|
148
|
+
}
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// Encryption
|
|
151
|
+
// ============================================================================
|
|
152
|
+
/**
|
|
153
|
+
* Encrypt data using AES-256-GCM.
|
|
154
|
+
*/
|
|
155
|
+
export function encrypt(data, config, expiresInHours = 24, customPassphrase) {
|
|
156
|
+
if (config.algorithm === 'none') {
|
|
157
|
+
// No encryption - just base64 encode
|
|
158
|
+
return {
|
|
159
|
+
algorithm: 'none',
|
|
160
|
+
machineBound: false,
|
|
161
|
+
ciphertext: Buffer.from(data).toString('base64'),
|
|
162
|
+
iv: '',
|
|
163
|
+
authTag: '',
|
|
164
|
+
createdAt: new Date().toISOString(),
|
|
165
|
+
expiresAt: new Date(Date.now() + expiresInHours * 60 * 60 * 1000).toISOString(),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// Generate random IV (12 bytes for GCM)
|
|
169
|
+
const iv = randomBytes(12);
|
|
170
|
+
// Generate random salt for key derivation
|
|
171
|
+
const salt = randomBytes(16);
|
|
172
|
+
// Derive key
|
|
173
|
+
const passphrase = getPassphrase(config.machineBound, customPassphrase);
|
|
174
|
+
const key = deriveKey(passphrase, salt);
|
|
175
|
+
// Create cipher
|
|
176
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
177
|
+
// Encrypt
|
|
178
|
+
const encrypted = Buffer.concat([
|
|
179
|
+
cipher.update(data, 'utf8'),
|
|
180
|
+
cipher.final(),
|
|
181
|
+
]);
|
|
182
|
+
// Get auth tag
|
|
183
|
+
const authTag = cipher.getAuthTag();
|
|
184
|
+
// Combine salt + ciphertext
|
|
185
|
+
const combined = Buffer.concat([salt, encrypted]);
|
|
186
|
+
const now = new Date();
|
|
187
|
+
const expiresAt = new Date(now.getTime() + expiresInHours * 60 * 60 * 1000);
|
|
188
|
+
return {
|
|
189
|
+
algorithm: 'aes-256-gcm',
|
|
190
|
+
machineBound: config.machineBound,
|
|
191
|
+
machineId: config.machineBound ? getMachineId() : undefined,
|
|
192
|
+
iv: iv.toString('base64'),
|
|
193
|
+
authTag: authTag.toString('base64'),
|
|
194
|
+
ciphertext: combined.toString('base64'),
|
|
195
|
+
createdAt: now.toISOString(),
|
|
196
|
+
expiresAt: expiresAt.toISOString(),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// ============================================================================
|
|
200
|
+
// Decryption
|
|
201
|
+
// ============================================================================
|
|
202
|
+
/**
|
|
203
|
+
* Decrypt an encrypted payload.
|
|
204
|
+
*/
|
|
205
|
+
export function decrypt(payload, customPassphrase) {
|
|
206
|
+
// Check expiry
|
|
207
|
+
const expiresAt = new Date(payload.expiresAt);
|
|
208
|
+
if (expiresAt < new Date()) {
|
|
209
|
+
return {
|
|
210
|
+
success: false,
|
|
211
|
+
expired: true,
|
|
212
|
+
error: 'Handoff has expired',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Check machine binding
|
|
216
|
+
if (payload.machineBound && payload.machineId) {
|
|
217
|
+
if (!verifyMachineId(payload.machineId)) {
|
|
218
|
+
return {
|
|
219
|
+
success: false,
|
|
220
|
+
machineMismatch: true,
|
|
221
|
+
error: 'Handoff is bound to a different machine',
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (payload.algorithm === 'none') {
|
|
226
|
+
// No encryption - just base64 decode
|
|
227
|
+
try {
|
|
228
|
+
const data = Buffer.from(payload.ciphertext, 'base64').toString('utf8');
|
|
229
|
+
return { success: true, data };
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
return {
|
|
233
|
+
success: false,
|
|
234
|
+
error: `Failed to decode: ${error instanceof Error ? error.message : String(error)}`,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
// Decode components
|
|
240
|
+
const iv = Buffer.from(payload.iv, 'base64');
|
|
241
|
+
const authTag = Buffer.from(payload.authTag, 'base64');
|
|
242
|
+
const combined = Buffer.from(payload.ciphertext, 'base64');
|
|
243
|
+
// Extract salt and ciphertext
|
|
244
|
+
const salt = combined.subarray(0, 16);
|
|
245
|
+
const ciphertext = combined.subarray(16);
|
|
246
|
+
// Derive key
|
|
247
|
+
const passphrase = getPassphrase(payload.machineBound, customPassphrase);
|
|
248
|
+
const key = deriveKey(passphrase, salt);
|
|
249
|
+
// Create decipher
|
|
250
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
251
|
+
decipher.setAuthTag(authTag);
|
|
252
|
+
// Decrypt
|
|
253
|
+
const decrypted = Buffer.concat([
|
|
254
|
+
decipher.update(ciphertext),
|
|
255
|
+
decipher.final(),
|
|
256
|
+
]);
|
|
257
|
+
return {
|
|
258
|
+
success: true,
|
|
259
|
+
data: decrypted.toString('utf8'),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
success: false,
|
|
265
|
+
error: `Decryption failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// ============================================================================
|
|
270
|
+
// Utility Functions
|
|
271
|
+
// ============================================================================
|
|
272
|
+
/**
|
|
273
|
+
* Check if a payload is expired.
|
|
274
|
+
*/
|
|
275
|
+
export function isExpired(payload) {
|
|
276
|
+
return new Date(payload.expiresAt) < new Date();
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get time until expiry.
|
|
280
|
+
*/
|
|
281
|
+
export function getTimeUntilExpiry(payload) {
|
|
282
|
+
const expiresAt = new Date(payload.expiresAt);
|
|
283
|
+
const now = new Date();
|
|
284
|
+
const diffMs = expiresAt.getTime() - now.getTime();
|
|
285
|
+
if (diffMs <= 0) {
|
|
286
|
+
return { expired: true, hours: 0, minutes: 0, formatted: 'Expired' };
|
|
287
|
+
}
|
|
288
|
+
const hours = Math.floor(diffMs / (1000 * 60 * 60));
|
|
289
|
+
const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
|
|
290
|
+
let formatted;
|
|
291
|
+
if (hours > 0) {
|
|
292
|
+
formatted = `${hours}h ${minutes}m`;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
formatted = `${minutes}m`;
|
|
296
|
+
}
|
|
297
|
+
return { expired: false, hours, minutes, formatted };
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Create encryption config from options.
|
|
301
|
+
*/
|
|
302
|
+
export function createEncryptionConfig(options = {}) {
|
|
303
|
+
return {
|
|
304
|
+
algorithm: options.encrypt !== false ? 'aes-256-gcm' : 'none',
|
|
305
|
+
machineBound: options.machineBound ?? false,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.js","sourceRoot":"","sources":["../../src/handoff/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc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,CAAC,CAAC,MAAM;QAC7D,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,KAAK;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handoff Module Exports
|
|
3
|
+
*
|
|
4
|
+
* Cross-agent handoff functionality for the Mycelium Arc pattern.
|
|
5
|
+
*/
|
|
6
|
+
export { encrypt, decrypt, getMachineId, verifyMachineId, isExpired, getTimeUntilExpiry, createEncryptionConfig, type EncryptionAlgorithm, type EncryptionConfig, type EncryptedPayload, type DecryptionResult, } from './encryption.js';
|
|
7
|
+
export { createHandoff, receiveHandoff, getHandoffStatus, createMinimalSnapshot, calculateMomentumPenalty, applyMomentumPenalty, type AgentType, type MomentumPhase, type BurnoutLevel, type EnergyLevel, type TaskContext, type CognitiveSnapshot, type HandoffMetadata, type MyceliumArc, type HandoffOptions, type CreateHandoffResult, type ReceiveHandoffResult, } from './mycelium-arc.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handoff/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handoff Module Exports
|
|
3
|
+
*
|
|
4
|
+
* Cross-agent handoff functionality for the Mycelium Arc pattern.
|
|
5
|
+
*/
|
|
6
|
+
// Encryption
|
|
7
|
+
export { encrypt, decrypt, getMachineId, verifyMachineId, isExpired, getTimeUntilExpiry, createEncryptionConfig, } from './encryption.js';
|
|
8
|
+
// Mycelium Arc
|
|
9
|
+
export { createHandoff, receiveHandoff, getHandoffStatus, createMinimalSnapshot, calculateMomentumPenalty, applyMomentumPenalty, } from './mycelium-arc.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handoff/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,aAAa;AACb,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,sBAAsB,GAKvB,MAAM,iBAAiB,CAAC;AAEzB,eAAe;AACf,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GAYrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mycelium Arc - Cross-Agent Handoff Module
|
|
3
|
+
*
|
|
4
|
+
* Packages cognitive state for transfer between AI agents (Claude ↔ Gemini).
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Momentum preservation with break penalty calculation
|
|
8
|
+
* - ADHD-friendly resume summaries
|
|
9
|
+
* - Safety constraints (never persist RED burnout)
|
|
10
|
+
* - 24h auto-expiry
|
|
11
|
+
* - Optional machine-bound encryption
|
|
12
|
+
*/
|
|
13
|
+
export type AgentType = 'claude-code' | 'gemini-cli' | 'claude-desktop' | 'other';
|
|
14
|
+
export type MomentumPhase = 'cold_start' | 'building' | 'rolling' | 'peak' | 'declining' | 'crashed';
|
|
15
|
+
export type BurnoutLevel = 'GREEN' | 'YELLOW' | 'ORANGE' | 'RED';
|
|
16
|
+
export type EnergyLevel = 'high' | 'medium' | 'low' | 'depleted';
|
|
17
|
+
export interface TaskContext {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
status: 'pending' | 'in_progress' | 'completed' | 'blocked';
|
|
21
|
+
priority?: number;
|
|
22
|
+
notes?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CognitiveSnapshot {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
activeMode: string;
|
|
28
|
+
activeParadigm: 'Cortex' | 'Mycelium';
|
|
29
|
+
energyLevel: EnergyLevel;
|
|
30
|
+
burnoutLevel: BurnoutLevel;
|
|
31
|
+
momentumPhase: MomentumPhase;
|
|
32
|
+
currentGoal?: string;
|
|
33
|
+
activeTasks: TaskContext[];
|
|
34
|
+
completedTasks: TaskContext[];
|
|
35
|
+
convergenceAttractor?: string;
|
|
36
|
+
epistemicTension?: number;
|
|
37
|
+
keyInsights?: string[];
|
|
38
|
+
blockers?: string[];
|
|
39
|
+
decisions?: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface HandoffMetadata {
|
|
42
|
+
handoffId: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
expiresAt: string;
|
|
45
|
+
sourceAgent: AgentType;
|
|
46
|
+
targetAgent?: AgentType;
|
|
47
|
+
sourceMachineId?: string;
|
|
48
|
+
version: string;
|
|
49
|
+
}
|
|
50
|
+
export interface MyceliumArc {
|
|
51
|
+
metadata: HandoffMetadata;
|
|
52
|
+
cognitive: CognitiveSnapshot;
|
|
53
|
+
resumeSummary: string;
|
|
54
|
+
momentumPenalty: number;
|
|
55
|
+
adjustedMomentum: MomentumPhase;
|
|
56
|
+
}
|
|
57
|
+
export interface HandoffOptions {
|
|
58
|
+
targetAgent?: AgentType;
|
|
59
|
+
encrypt?: boolean;
|
|
60
|
+
machineBound?: boolean;
|
|
61
|
+
expiresInHours?: number;
|
|
62
|
+
customPassphrase?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface CreateHandoffResult {
|
|
65
|
+
success: boolean;
|
|
66
|
+
handoffId: string;
|
|
67
|
+
encrypted: boolean;
|
|
68
|
+
expiresAt: string;
|
|
69
|
+
payload: string;
|
|
70
|
+
error?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ReceiveHandoffResult {
|
|
73
|
+
success: boolean;
|
|
74
|
+
arc?: MyceliumArc;
|
|
75
|
+
error?: string;
|
|
76
|
+
expired?: boolean;
|
|
77
|
+
machineMismatch?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Calculate momentum penalty based on break duration.
|
|
81
|
+
*/
|
|
82
|
+
export declare function calculateMomentumPenalty(breakDurationMs: number): number;
|
|
83
|
+
/**
|
|
84
|
+
* Apply momentum penalty and return adjusted phase.
|
|
85
|
+
*/
|
|
86
|
+
export declare function applyMomentumPenalty(currentPhase: MomentumPhase, penalty: number): MomentumPhase;
|
|
87
|
+
/**
|
|
88
|
+
* Create a handoff package from cognitive state.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createHandoff(cognitive: CognitiveSnapshot, sourceAgent: AgentType, options?: HandoffOptions): CreateHandoffResult;
|
|
91
|
+
/**
|
|
92
|
+
* Receive and unpack a handoff.
|
|
93
|
+
*/
|
|
94
|
+
export declare function receiveHandoff(payload: string, customPassphrase?: string): ReceiveHandoffResult;
|
|
95
|
+
/**
|
|
96
|
+
* Get handoff status for display.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getHandoffStatus(payload: string): {
|
|
99
|
+
valid: boolean;
|
|
100
|
+
encrypted: boolean;
|
|
101
|
+
expired: boolean;
|
|
102
|
+
timeRemaining?: string;
|
|
103
|
+
handoffId?: string;
|
|
104
|
+
sourceAgent?: string;
|
|
105
|
+
error?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Create a minimal cognitive snapshot for quick handoffs.
|
|
109
|
+
*/
|
|
110
|
+
export declare function createMinimalSnapshot(goal: string, options?: {
|
|
111
|
+
energyLevel?: EnergyLevel;
|
|
112
|
+
burnoutLevel?: BurnoutLevel;
|
|
113
|
+
momentumPhase?: MomentumPhase;
|
|
114
|
+
insights?: string[];
|
|
115
|
+
}): CognitiveSnapshot;
|
|
116
|
+
//# sourceMappingURL=mycelium-arc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mycelium-arc.d.ts","sourceRoot":"","sources":["../../src/handoff/mycelium-arc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,YAAY,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAElF,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,UAAU,GACV,SAAS,GACT,MAAM,GACN,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAGlB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,QAAQ,GAAG,UAAU,CAAC;IACtC,WAAW,EAAE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