@adhdev/daemon-core 0.9.77-rc.40 → 0.9.77-rc.41
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/cli-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +13 -4
- package/src/commands/router.ts +33 -1
package/package.json
CHANGED
|
@@ -225,7 +225,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
225
225
|
currentTurnScope: TurnParseScope | null;
|
|
226
226
|
recentOutputBuffer: string;
|
|
227
227
|
accumulatedBuffer: string;
|
|
228
|
-
|
|
228
|
+
accumulatedRawBufferKey: string;
|
|
229
229
|
screenText: string;
|
|
230
230
|
currentStatus: CliSessionStatus['status'];
|
|
231
231
|
activeModal: { message: string; buttons: string[] } | null;
|
|
@@ -300,15 +300,23 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
300
300
|
this.lastScreenSnapshotReadAt = Number.NEGATIVE_INFINITY;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
private getAccumulatedRawBufferCacheKey(): string {
|
|
304
|
+
return this.accumulatedRawBuffer
|
|
305
|
+
.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, '')
|
|
306
|
+
.replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, '')
|
|
307
|
+
.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');
|
|
308
|
+
}
|
|
309
|
+
|
|
303
310
|
private getFreshParsedStatusCache(): any | null {
|
|
304
311
|
const cached = this.parsedStatusCache;
|
|
312
|
+
const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
|
|
305
313
|
if (
|
|
306
314
|
cached
|
|
307
315
|
&& cached.responseBuffer === this.responseBuffer
|
|
308
316
|
&& cached.currentTurnScope === this.currentTurnScope
|
|
309
317
|
&& cached.recentOutputBuffer === this.recentOutputBuffer
|
|
310
318
|
&& cached.accumulatedBuffer === this.accumulatedBuffer
|
|
311
|
-
&& cached.
|
|
319
|
+
&& cached.accumulatedRawBufferKey === accumulatedRawBufferKey
|
|
312
320
|
&& cached.screenText === this.lastScreenText
|
|
313
321
|
&& cached.currentStatus === this.currentStatus
|
|
314
322
|
&& cached.activeModal === this.activeModal
|
|
@@ -1589,13 +1597,14 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1589
1597
|
const screenText = this.readTerminalScreenText();
|
|
1590
1598
|
const parseScreenText = this.getParseScreenText(screenText);
|
|
1591
1599
|
const cached = this.parsedStatusCache;
|
|
1600
|
+
const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
|
|
1592
1601
|
if (
|
|
1593
1602
|
cached
|
|
1594
1603
|
&& cached.responseBuffer === this.responseBuffer
|
|
1595
1604
|
&& cached.currentTurnScope === this.currentTurnScope
|
|
1596
1605
|
&& cached.recentOutputBuffer === this.recentOutputBuffer
|
|
1597
1606
|
&& cached.accumulatedBuffer === this.accumulatedBuffer
|
|
1598
|
-
&& cached.
|
|
1607
|
+
&& cached.accumulatedRawBufferKey === accumulatedRawBufferKey
|
|
1599
1608
|
&& cached.screenText === parseScreenText
|
|
1600
1609
|
&& cached.currentStatus === this.currentStatus
|
|
1601
1610
|
&& cached.activeModal === this.activeModal
|
|
@@ -1635,7 +1644,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1635
1644
|
currentTurnScope: this.currentTurnScope,
|
|
1636
1645
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
1637
1646
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
1638
|
-
|
|
1647
|
+
accumulatedRawBufferKey,
|
|
1639
1648
|
screenText: parseScreenText,
|
|
1640
1649
|
currentStatus: this.currentStatus,
|
|
1641
1650
|
activeModal: this.activeModal,
|
package/src/commands/router.ts
CHANGED
|
@@ -154,6 +154,35 @@ function loadHermesCoordinatorBaseConfig(targetConfigPath: string): { config: Re
|
|
|
154
154
|
return { config: baseConfig, sourceHome, sourceConfigPath };
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
function stripHermesCoordinatorTempModelProviderOverrides(config: Record<string, any>): Record<string, any> {
|
|
158
|
+
const {
|
|
159
|
+
model: _model,
|
|
160
|
+
provider: _provider,
|
|
161
|
+
default_model: _defaultModel,
|
|
162
|
+
defaultProvider: _defaultProvider,
|
|
163
|
+
default_provider: _defaultProviderSnake,
|
|
164
|
+
modelProvider: _modelProvider,
|
|
165
|
+
model_provider: _modelProviderSnake,
|
|
166
|
+
...sanitized
|
|
167
|
+
} = config;
|
|
168
|
+
const delegation = sanitized.delegation;
|
|
169
|
+
if (delegation && typeof delegation === 'object' && !Array.isArray(delegation)) {
|
|
170
|
+
const {
|
|
171
|
+
model: _delegationModel,
|
|
172
|
+
provider: _delegationProvider,
|
|
173
|
+
modelProvider: _delegationModelProvider,
|
|
174
|
+
model_provider: _delegationModelProviderSnake,
|
|
175
|
+
...delegationRest
|
|
176
|
+
} = delegation;
|
|
177
|
+
if (Object.keys(delegationRest).length > 0) {
|
|
178
|
+
sanitized.delegation = delegationRest;
|
|
179
|
+
} else {
|
|
180
|
+
delete sanitized.delegation;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return sanitized;
|
|
184
|
+
}
|
|
185
|
+
|
|
157
186
|
function copyHermesCoordinatorCredentialFiles(sourceHome: string, targetHome: string) {
|
|
158
187
|
if (pathResolve(sourceHome) === pathResolve(targetHome)) return;
|
|
159
188
|
for (const fileName of ['.env', 'auth.json']) {
|
|
@@ -1958,7 +1987,10 @@ export class DaemonCommandRouter {
|
|
|
1958
1987
|
if (hadExistingMcpConfig) {
|
|
1959
1988
|
try {
|
|
1960
1989
|
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync(mcpConfigPath, 'utf-8'), configFormat);
|
|
1961
|
-
|
|
1990
|
+
const existingCoordinatorConfig = hermesManualFallback
|
|
1991
|
+
? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig)
|
|
1992
|
+
: parsedExistingMcpConfig;
|
|
1993
|
+
existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
|
|
1962
1994
|
copyFileSync(mcpConfigPath, mcpConfigPath + '.backup');
|
|
1963
1995
|
} catch (error: any) {
|
|
1964
1996
|
LOG.error('MeshCoordinator', `Failed to parse existing MCP config ${mcpConfigPath}: ${error?.message || error}`);
|