@wrongstack/core 0.301.0 → 0.302.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.
Files changed (44) hide show
  1. package/dist/agent-status-tracker.d.ts +6 -2
  2. package/dist/chronicle/index.js +1836 -1645
  3. package/dist/chronicle/metrics-store.d.ts +14 -0
  4. package/dist/chronicle/project-server-protocol.d.ts +13 -0
  5. package/dist/chronicle/project-server.js +1759 -1583
  6. package/dist/chronicle/rollup-adapter.d.ts +2 -0
  7. package/dist/chronicle/sqlite-journal.d.ts +59 -0
  8. package/dist/coordination/index.js +791 -249
  9. package/dist/coordination/mail-tools.d.ts +2 -2
  10. package/dist/core/continue-intent.d.ts +2 -0
  11. package/dist/core/conversation-state.d.ts +5 -0
  12. package/dist/core/index.js +120 -19
  13. package/dist/defaults/index.js +928 -374
  14. package/dist/execution/index.js +28 -11
  15. package/dist/index.d.ts +3 -1
  16. package/dist/index.js +8763 -6781
  17. package/dist/infrastructure/index.js +722 -672
  18. package/dist/kernel/events/memory-events.d.ts +62 -0
  19. package/dist/plugin/index.js +2154 -1979
  20. package/dist/session-catalog/client.d.ts +62 -0
  21. package/dist/session-catalog/endpoint.d.ts +6 -0
  22. package/dist/session-catalog/index.d.ts +6 -0
  23. package/dist/session-catalog/index.js +1978 -0
  24. package/dist/session-catalog/project-server.d.ts +3 -0
  25. package/dist/session-catalog/project-server.js +1838 -0
  26. package/dist/session-catalog/protocol.d.ts +275 -0
  27. package/dist/session-catalog/registry.d.ts +59 -0
  28. package/dist/session-catalog/store.d.ts +55 -0
  29. package/dist/session-registry-types.d.ts +17 -0
  30. package/dist/session-registry.d.ts +1 -1
  31. package/dist/storage/index.d.ts +42 -38
  32. package/dist/storage/index.js +14279 -13393
  33. package/dist/storage/session-event-bridge.d.ts +2 -2
  34. package/dist/storage/session-store.d.ts +6 -0
  35. package/dist/tools/index.js +8 -2
  36. package/dist/types/context-evidence.d.ts +2 -0
  37. package/dist/types/messages.d.ts +8 -0
  38. package/dist/types/session.d.ts +19 -0
  39. package/dist/utils/context-evidence.d.ts +13 -1
  40. package/dist/utils/index.js +26 -2
  41. package/instructions/system-lite.md +11 -2
  42. package/instructions/system-pro.md +14 -0
  43. package/instructions/system.md +14 -0
  44. package/package.json +7 -3
@@ -1,10 +1,16 @@
1
1
  // src/core/context.ts
2
2
  import * as path from "node:path";
3
3
 
4
+ // src/types/blocks.ts
5
+ function isTextBlock(b) {
6
+ return b.type === "text";
7
+ }
8
+
4
9
  // src/utils/context-evidence.ts
5
10
  var MAX_DIGEST_CHARS = 4e3;
6
11
  function createContextEvidenceState() {
7
12
  return {
13
+ recentUserTurns: [],
8
14
  sessionGoals: [],
9
15
  implicitFacts: [],
10
16
  activeErrors: [],
@@ -21,6 +27,11 @@ function buildContextEvidenceDigest(ctx) {
21
27
  if (state.currentIntent?.text) {
22
28
  lines.push(`intent: ${state.currentIntent.text}`);
23
29
  }
30
+ const priorTurns = (state.recentUserTurns ?? []).slice(-6, -1);
31
+ if (priorTurns.length > 0) {
32
+ lines.push("recent_human_instructions:");
33
+ for (const turn of priorTurns) lines.push(`- ${turn.text}`);
34
+ }
24
35
  const goals = state.sessionGoals.slice(-3);
25
36
  if (goals.length > 0) {
26
37
  lines.push("session_goals:");
@@ -110,6 +121,7 @@ function ensureEvidence(ctx) {
110
121
  ctx.contextEvidence = createContextEvidenceState();
111
122
  }
112
123
  ctx.contextEvidence.completedWork ??= [];
124
+ ctx.contextEvidence.recentUserTurns ??= [];
113
125
  return ctx.contextEvidence;
114
126
  }
115
127
 
@@ -515,12 +527,11 @@ var ConversationState = class {
515
527
  }
516
528
  this.ctx.messages.splice(this.ctx.messages.length, 0, message);
517
529
  const overflow = this.overflowCount(this.ctx.messages);
530
+ this.emit({ kind: "message_appended", message });
518
531
  if (overflow > 0) {
519
532
  this.ctx.messages.splice(0, overflow);
520
533
  this.ctx.toolAdjacencyDirty = true;
521
- this.emit({ kind: "messages_replaced", messages: [...this.ctx.messages] });
522
- } else {
523
- this.emit({ kind: "message_appended", message });
534
+ this.emit({ kind: "messages_dropped", count: overflow });
524
535
  }
525
536
  }
526
537
  /**
@@ -1018,6 +1029,11 @@ var Context = class _Context {
1018
1029
  ts,
1019
1030
  version: 1,
1020
1031
  messages: [...change.messages]
1032
+ } : change.kind === "messages_dropped" ? {
1033
+ type: "messages_dropped",
1034
+ ts,
1035
+ version: 1,
1036
+ count: change.count
1021
1037
  } : null;
1022
1038
  if (!event) return;
1023
1039
  this.enqueueConversationJournal(event, this.session);
@@ -1522,11 +1538,6 @@ function isWrongStackError(err) {
1522
1538
  return err instanceof WrongStackError;
1523
1539
  }
1524
1540
 
1525
- // src/types/blocks.ts
1526
- function isTextBlock(b) {
1527
- return b.type === "text";
1528
- }
1529
-
1530
1541
  // src/utils/expect-defined.ts
1531
1542
  function expectDefined(value, label) {
1532
1543
  if (value === null || value === void 0) {
@@ -11633,22 +11644,27 @@ var OneShotOrchestrator = class {
11633
11644
  */
11634
11645
  resolveFallbackChain(input, config, target) {
11635
11646
  const mgr = this.opts.fallbackProfileManager;
11647
+ let fromExplicitSource = false;
11636
11648
  let selected = mgr.resolveEffective({
11637
11649
  fallbackAuto: false,
11638
11650
  exclude: target
11639
11651
  });
11640
11652
  if (input.fallbackModels && input.fallbackModels.length > 0) {
11641
- selected = mgr.resolveEffective({
11653
+ const resolved = mgr.resolveEffective({
11642
11654
  fallbackModels: input.fallbackModels,
11643
11655
  fallbackAuto: false,
11644
11656
  exclude: target
11645
11657
  });
11658
+ selected = resolved;
11659
+ fromExplicitSource = resolved.length > 0;
11646
11660
  } else if (config.fallbackModels && config.fallbackModels.length > 0) {
11647
- selected = mgr.resolveEffective({
11661
+ const resolved = mgr.resolveEffective({
11648
11662
  fallbackModels: config.fallbackModels,
11649
11663
  fallbackAuto: false,
11650
11664
  exclude: target
11651
11665
  });
11666
+ selected = resolved;
11667
+ fromExplicitSource = resolved.length > 0;
11652
11668
  } else if (config.fallbackAuto !== false) {
11653
11669
  selected = mgr.resolveEffective({
11654
11670
  fallbackAuto: true,
@@ -11656,6 +11672,7 @@ var OneShotOrchestrator = class {
11656
11672
  });
11657
11673
  }
11658
11674
  if (config.fallbackAuto === false) return selected;
11675
+ if (fromExplicitSource) return selected;
11659
11676
  const combined = [...selected, ...mgr.resolveAllConfigured(target)];
11660
11677
  const seen = /* @__PURE__ */ new Set();
11661
11678
  return Object.freeze(
@@ -16772,7 +16789,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
16772
16789
  pendingTasks = [];
16773
16790
  completedResults = [];
16774
16791
  /** Prevents completedResults from growing unbounded in long-running coordinators. */
16775
- static MAX_COMPLETED_RESULTS = 1e4;
16792
+ static MAX_COMPLETED_RESULTS = 2e5;
16776
16793
  /** Caps each subagent's retained task history (see assign()); bounds RAM + the recordCompletion lookup. */
16777
16794
  static MAX_SUBAGENT_TASK_HISTORY = 64;
16778
16795
  totalIterations = 0;
package/dist/index.d.ts CHANGED
@@ -118,7 +118,9 @@ export { DANGEROUS_FOR_SUBAGENTS, getDangerousCapabilities, hasCapability, hasDa
118
118
  export { evaluateToolKanbanBoundary, type ToolKanbanBoundaryEvaluation, } from './security/kanban-boundary.js';
119
119
  export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './security/permission-policy-schema.js';
120
120
  export { DefaultSecretScrubber } from './security/secret-scrubber.js';
121
- export { getSessionRegistry, hasSessionRegistry, type SessionLiveStatus, SessionRegistry, type SessionRegistryEntry, } from './session-registry.js';
121
+ export * from './session-catalog/index.js';
122
+ export { getProjectSessionRegistry as getSessionRegistry, hasProjectSessionRegistry as hasSessionRegistry, ProjectSessionRegistry as SessionRegistry, } from './session-catalog/registry.js';
123
+ export type { SessionLiveStatus, SessionRegistryEntry, } from './session-registry.js';
122
124
  export * from './skills/index.js';
123
125
  export * from './storage/index.js';
124
126
  export { type AuditLevel, createSessionEventBridge, resolveAuditLevel, resolveSessionLoggingConfig, type SessionEventBridge, type SessionEventBridgeOptions, type SessionSamplingOptions, type ToolProgressSamplingOptions, } from './storage/session-event-bridge.js';