@wrongstack/core 0.303.0 → 0.305.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.
Files changed (76) hide show
  1. package/dist/chronicle/project-server.js +18 -48
  2. package/dist/coordination/agents/index.js +530 -130
  3. package/dist/coordination/agents/project-agent-consolidation.d.ts +5 -0
  4. package/dist/coordination/agents/project-agent-directive-outcome.d.ts +57 -0
  5. package/dist/coordination/agents/project-agent-identity.d.ts +26 -12
  6. package/dist/coordination/agents/project-agent-learning-policy.d.ts +22 -1
  7. package/dist/coordination/agents/project-agent-learning-structured.d.ts +46 -1
  8. package/dist/coordination/agents/project-agent-quarantine.d.ts +63 -0
  9. package/dist/coordination/agents/project-agent-skill-layer.d.ts +55 -10
  10. package/dist/coordination/agents/types.d.ts +10 -2
  11. package/dist/coordination/director-prompts.d.ts +19 -6
  12. package/dist/coordination/director-tools.d.ts +2 -2
  13. package/dist/coordination/fleet.d.ts +0 -6
  14. package/dist/coordination/index.d.ts +2 -1
  15. package/dist/coordination/index.js +1581 -955
  16. package/dist/coordination/mailbox-project-server.js +28 -57
  17. package/dist/core/agent-types.d.ts +4 -2
  18. package/dist/core/agent.d.ts +1 -0
  19. package/dist/core/context.d.ts +15 -0
  20. package/dist/core/conversation-state.d.ts +14 -0
  21. package/dist/core/fallback-profile-manager.d.ts +70 -2
  22. package/dist/core/index.js +308 -108
  23. package/dist/core/system-prompt-blocks.d.ts +1 -1
  24. package/dist/core/system-prompt-builder.d.ts +13 -1
  25. package/dist/core/system-prompt-glossary.d.ts +73 -0
  26. package/dist/core/system-prompt-memory-skills.d.ts +2 -2
  27. package/dist/defaults/index.js +910 -693
  28. package/dist/execution/council-orchestrator.d.ts +3 -13
  29. package/dist/execution/index.js +211 -75
  30. package/dist/execution/one-shot-llm.d.ts +5 -0
  31. package/dist/hq/index.js +17 -7
  32. package/dist/hq/protocol/kanban.d.ts +21 -0
  33. package/dist/hq/protocol.js +5 -1
  34. package/dist/hq/redaction.d.ts +14 -0
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +3505 -2539
  37. package/dist/infrastructure/index.js +247 -122
  38. package/dist/plugin/index.js +101 -3
  39. package/dist/registry/index.js +11 -0
  40. package/dist/registry/tool-registry.d.ts +8 -0
  41. package/dist/replay/hash.d.ts +9 -0
  42. package/dist/replay/index.js +14 -4
  43. package/dist/replay/replay-provider-runner.d.ts +31 -1
  44. package/dist/security/index.js +25 -20
  45. package/dist/security/secret-vault.d.ts +2 -0
  46. package/dist/session-catalog/index.js +62 -8
  47. package/dist/session-catalog/project-server.js +109 -78
  48. package/dist/session-catalog/protocol.d.ts +11 -4
  49. package/dist/session-catalog/store.d.ts +2 -2
  50. package/dist/storage/index.js +224 -67
  51. package/dist/storage/memory-consolidator.d.ts +4 -2
  52. package/dist/storage/session-resume-validation.d.ts +24 -0
  53. package/dist/storage/session-store/directory-scan.d.ts +5 -1
  54. package/dist/storage/session-store/fork-session.d.ts +13 -1
  55. package/dist/storage/session-store/load-cache.d.ts +11 -0
  56. package/dist/storage/session-store/prune-helpers.d.ts +5 -0
  57. package/dist/storage/session-store.d.ts +18 -0
  58. package/dist/tools/index.js +174 -74
  59. package/dist/types/config/mcp-features.d.ts +31 -1
  60. package/dist/types/config/root.d.ts +12 -0
  61. package/dist/types/config/tools.d.ts +22 -0
  62. package/dist/types/config/ui.d.ts +7 -4
  63. package/dist/types/default-config.d.ts +1 -0
  64. package/dist/types/index.js +24 -1
  65. package/dist/types/session.d.ts +9 -1
  66. package/dist/utils/index.d.ts +1 -0
  67. package/dist/utils/index.js +214 -76
  68. package/dist/utils/project-state-guard.d.ts +21 -0
  69. package/dist/utils/session-scoped-path.d.ts +17 -0
  70. package/dist/utils/todos-format.d.ts +20 -0
  71. package/instructions/leader-after-task.md +3 -4
  72. package/instructions/system-lite.md +10 -13
  73. package/instructions/system-pro.md +18 -25
  74. package/instructions/system.md +18 -23
  75. package/package.json +3 -3
  76. package/skills/wrongstack-kanban/SKILL.md +95 -124
@@ -2,10 +2,10 @@
2
2
 
3
3
  // src/chronicle/project-server.ts
4
4
  import { randomBytes } from "node:crypto";
5
- import * as fs10 from "node:fs";
6
5
  import * as fsp4 from "node:fs/promises";
7
6
  import * as net from "node:net";
8
7
  import * as path15 from "node:path";
8
+ import { bindProjectEndpoint } from "@wrongstack/persistence";
9
9
 
10
10
  // src/utils/atomic-write.ts
11
11
  import {
@@ -2923,13 +2923,6 @@ import * as fs7 from "node:fs";
2923
2923
  import { createRequire } from "node:module";
2924
2924
  import * as path12 from "node:path";
2925
2925
 
2926
- // src/utils/socket-path.ts
2927
- import {
2928
- assertUnixSocketPathWithinLimit,
2929
- checkUnixSocketPath,
2930
- unixSocketPathLimit
2931
- } from "@wrongstack/persistence";
2932
-
2933
2926
  // src/chronicle/sqlite-query.ts
2934
2927
  var MAX_LIMIT = 1e4;
2935
2928
  function encodeCursor2(cursor) {
@@ -4766,7 +4759,6 @@ function normalizePathKey(value) {
4766
4759
 
4767
4760
  // src/chronicle/project-server-endpoint.ts
4768
4761
  import { createHash as createHash5 } from "node:crypto";
4769
- import * as fs9 from "node:fs";
4770
4762
  import * as os3 from "node:os";
4771
4763
  import * as path14 from "node:path";
4772
4764
 
@@ -4802,12 +4794,6 @@ function chronicleProjectServerEndpoint(projectDir) {
4802
4794
  function chronicleProjectServerMetadataPath(projectDir) {
4803
4795
  return path14.join(projectDir, "chronicle", CHRONICLE_PROJECT_SERVER_METADATA_FILE);
4804
4796
  }
4805
- function ensureChronicleProjectServerSocketDirectory(endpoint2) {
4806
- if (process.platform !== "win32") {
4807
- assertUnixSocketPathWithinLimit(endpoint2, "chronicle");
4808
- fs9.mkdirSync(path14.dirname(endpoint2), { recursive: true, mode: 448 });
4809
- }
4810
- }
4811
4797
 
4812
4798
  // src/chronicle/project-server.ts
4813
4799
  var DEFAULT_IDLE_MS = 5 * 6e4;
@@ -5264,7 +5250,6 @@ async function stop(_reason) {
5264
5250
  });
5265
5251
  await stopMemoryWatchdog();
5266
5252
  }
5267
- ensureChronicleProjectServerSocketDirectory(endpoint);
5268
5253
  var server = net.createServer((socket) => {
5269
5254
  if (stopping) {
5270
5255
  socket.destroy();
@@ -5284,42 +5269,28 @@ var server = net.createServer((socket) => {
5284
5269
  scheduleIdleStop();
5285
5270
  });
5286
5271
  });
5287
- var probingExistingEndpoint = false;
5288
- function listenForOwnership() {
5289
- server.listen(endpoint);
5290
- }
5291
- server.on("error", (error) => {
5292
- if (error.code === "EADDRINUSE" && process.platform === "win32") {
5272
+ void (async () => {
5273
+ const bind = await bindProjectEndpoint({ server, endpoint, service: "chronicle" });
5274
+ if (bind.outcome === "already-owned") {
5293
5275
  process.exitCode = 0;
5294
5276
  return;
5295
5277
  }
5296
- if (error.code === "EADDRINUSE" && !probingExistingEndpoint) {
5297
- probingExistingEndpoint = true;
5298
- const probe = net.createConnection(endpoint);
5299
- probe.once("connect", () => {
5300
- probe.destroy();
5301
- process.exitCode = 0;
5302
- });
5303
- probe.once("error", () => {
5304
- probe.destroy();
5305
- try {
5306
- fs10.rmSync(endpoint, { force: true });
5307
- } catch {
5308
- }
5309
- probingExistingEndpoint = false;
5310
- listenForOwnership();
5311
- });
5278
+ if (bind.outcome === "failed") {
5279
+ process.stderr.write(`chronicle project server failed: ${bind.error.message}
5280
+ `);
5281
+ process.exitCode = 1;
5312
5282
  return;
5313
5283
  }
5314
- process.exitCode = 1;
5315
- });
5316
- server.on("listening", () => {
5317
- if (process.platform !== "win32") {
5318
- try {
5319
- fs10.chmodSync(endpoint, 384);
5320
- } catch {
5321
- }
5284
+ if (bind.reclaimedStaleEndpoint) {
5285
+ process.stderr.write(`chronicle project server reclaimed stale endpoint ${endpoint}
5286
+ `);
5322
5287
  }
5288
+ server.on("error", (error) => {
5289
+ if (stopping) return;
5290
+ process.stderr.write(`chronicle project server error: ${error.message}
5291
+ `);
5292
+ process.exitCode = 1;
5293
+ });
5323
5294
  void writeMetadata().then(() => markMetadataWritten?.());
5324
5295
  void startChronicleFileObserver({
5325
5296
  projectRoot: parsed.projectRoot,
@@ -5337,8 +5308,7 @@ server.on("listening", () => {
5337
5308
  watcherLastError = error instanceof Error ? error.message : String(error);
5338
5309
  });
5339
5310
  scheduleIdleStop();
5340
- });
5311
+ })();
5341
5312
  process.once("SIGINT", () => void stop("SIGINT"));
5342
5313
  process.once("SIGTERM", () => void stop("SIGTERM"));
5343
- listenForOwnership();
5344
5314
  //# sourceMappingURL=project-server.js.map