@sparkelf/dsh-knowledge-base 0.6.11 → 0.6.12

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.
Files changed (3) hide show
  1. package/lib/client.js +645 -645
  2. package/lib/index.js +15 -12
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -28445,28 +28445,30 @@ function apply(ctx, deploymentConfig) {
28445
28445
  })]),
28446
28446
  source: Object.freeze({ kind: "user" })
28447
28447
  });
28448
- const guardianWorkspaceRegistry = ctx.workspaceRegistry;
28449
- const guardianCwd = guardianWorkspaceRegistry?.list()[0]?.path ?? process.cwd();
28450
- const guardianPersistence = ctx.sessionPersistence;
28448
+ const getGuardianWorkspaceRegistry = () => ctx.get("workspaceRegistry");
28449
+ const resolveGuardianCwd = () => getGuardianWorkspaceRegistry()?.list()[0]?.path ?? process.cwd();
28450
+ const guardianPersistence = ctx.get("sessionPersistence");
28451
28451
  const attachGuardianToWorkspace = async (agent) => {
28452
- if (guardianWorkspaceRegistry === void 0) return;
28452
+ const registry = getGuardianWorkspaceRegistry();
28453
+ if (registry === void 0) return;
28453
28454
  const sessionId = agent.session?.id ?? agent.id;
28455
+ const cwd = resolveGuardianCwd();
28454
28456
  try {
28455
- await (await guardianWorkspaceRegistry.resolveByPath(guardianCwd))?.attachSession(sessionId);
28457
+ await (await registry.resolveByPath(cwd))?.attachSession(sessionId);
28456
28458
  } catch (error) {
28457
- ctx.logger.warn(`knowledge-base: guardian ${sessionId} did not join workspace at ${guardianCwd}: ${String(error)}`);
28459
+ ctx.logger.warn(`knowledge-base: guardian ${sessionId} did not join workspace at ${cwd}: ${String(error)}`);
28458
28460
  }
28459
28461
  };
28460
28462
  const guardianSessionHost = {
28461
28463
  usersRoot: memoryUsersRoot,
28462
- cwd: guardianCwd,
28464
+ cwd: process.cwd(),
28463
28465
  timeoutMs: DEFAULT_GUARDIAN_TIMEOUT_MS,
28464
28466
  getAgent: (sessionId) => guardianRegistry?.get(sessionId),
28465
28467
  createAgent: async ({ sessionId, title }) => {
28466
28468
  if (guardianLoop === void 0) throw new Error("the DSH agent loop is not available");
28467
28469
  const handle = await guardianLoop.createAgent(ctx, {
28468
28470
  sessionId,
28469
- meta: { cwd: guardianCwd },
28471
+ meta: { cwd: resolveGuardianCwd() },
28470
28472
  ...guardianAgentOptions === void 0 ? {} : { agentOptions: guardianAgentOptions }
28471
28473
  });
28472
28474
  try {
@@ -28490,7 +28492,8 @@ function apply(ctx, deploymentConfig) {
28490
28492
  } catch {
28491
28493
  persistedCwd = void 0;
28492
28494
  }
28493
- if (persistedCwd !== void 0 && persistedCwd !== guardianCwd) throw new Error(`guardian ${sessionId} cwd ${persistedCwd} differs from workspace ${guardianCwd}; recreating`);
28495
+ const targetCwd = resolveGuardianCwd();
28496
+ if (persistedCwd !== void 0 && persistedCwd !== targetCwd) throw new Error(`guardian ${sessionId} cwd ${persistedCwd} differs from workspace ${targetCwd}; recreating`);
28494
28497
  }
28495
28498
  const handle = await guardianLoop.resume(ctx, {
28496
28499
  resumeSessionId: sessionId,
@@ -28517,15 +28520,15 @@ function apply(ctx, deploymentConfig) {
28517
28520
  if (!await memorySettings.isEnabled("local")) return;
28518
28521
  await resolveOrCreateGuardian(guardianSessionHost, LOCAL_USER_ID);
28519
28522
  } catch (error) {
28520
- if (attempt < 6) setTimeout(() => {
28523
+ if (attempt < 15) setTimeout(() => {
28521
28524
  eagerGuardian(attempt + 1);
28522
- }, 3e3);
28525
+ }, 2e3);
28523
28526
  else host.logger?.warn?.(`knowledge-base: eager guardian creation failed after retries: ${String(error)}`);
28524
28527
  }
28525
28528
  };
28526
28529
  setTimeout(() => {
28527
28530
  eagerGuardian(0);
28528
- }, 2e3);
28531
+ }, 3e3);
28529
28532
  }
28530
28533
  const memoryGuardianToolHost = {
28531
28534
  resolveCaller: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkelf/dsh-knowledge-base",
3
- "version": "0.6.11",
3
+ "version": "0.6.12",
4
4
  "description": "DataOps-backed knowledge base for DeepSeek Harness: a left-sidebar destination, Settings configuration, and index tooling over a mounted NAS view.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",