praxis-agent 0.26.0 → 0.28.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.
Files changed (44) hide show
  1. package/dist/application/session-memory.d.ts +43 -10
  2. package/dist/application/session-memory.js +263 -62
  3. package/dist/application/session-service.d.ts +13 -4
  4. package/dist/application/session-service.js +139 -36
  5. package/dist/application/subagent-service.d.ts +1 -0
  6. package/dist/application/subagent-service.js +23 -1
  7. package/dist/cli-runtime.d.ts +4 -0
  8. package/dist/cli-runtime.js +10 -0
  9. package/dist/core/runtime.d.ts +10 -0
  10. package/dist/core/runtime.js +111 -28
  11. package/dist/core/tool-execution-scheduler.d.ts +38 -0
  12. package/dist/core/tool-execution-scheduler.js +95 -0
  13. package/dist/core/tool-scheduling-policy.d.ts +4 -0
  14. package/dist/core/tool-scheduling-policy.js +24 -0
  15. package/dist/extensions/claude-extension-tools.d.ts +1 -0
  16. package/dist/extensions/claude-extension-tools.js +6 -0
  17. package/dist/hooks/claude-hook-tools.d.ts +4 -0
  18. package/dist/hooks/claude-hook-tools.js +6 -0
  19. package/dist/mcp/claude-mcp-tools.d.ts +1 -0
  20. package/dist/mcp/claude-mcp-tools.js +42 -0
  21. package/dist/permissions/claude-permission-resolver.js +3 -3
  22. package/dist/permissions/permission-updates.d.ts +1 -0
  23. package/dist/permissions/permission-updates.js +13 -1
  24. package/dist/tools/claude-capabilities.d.ts +1 -0
  25. package/dist/tools/claude-capabilities.js +5 -0
  26. package/dist/tools/claude-interactive-tools.js +7 -0
  27. package/dist/tools/claude-lsp-tool.js +7 -0
  28. package/dist/tools/claude-scheduled-tools.d.ts +1 -0
  29. package/dist/tools/claude-scheduled-tools.js +7 -0
  30. package/dist/tools/claude-task-tools.d.ts +1 -0
  31. package/dist/tools/claude-task-tools.js +11 -0
  32. package/dist/tools/claude-user-message.d.ts +1 -0
  33. package/dist/tools/claude-user-message.js +7 -0
  34. package/dist/tools/claude-workflow-tools.d.ts +1 -0
  35. package/dist/tools/claude-workflow-tools.js +7 -0
  36. package/dist/tools/claude-worktree-tools.d.ts +1 -0
  37. package/dist/tools/claude-worktree-tools.js +7 -0
  38. package/dist/tools/filtered-tool-registry.d.ts +1 -0
  39. package/dist/tools/filtered-tool-registry.js +5 -0
  40. package/dist/tools/local-tools.d.ts +17 -0
  41. package/dist/tools/local-tools.js +86 -1
  42. package/dist/tools/web.d.ts +1 -0
  43. package/dist/tools/web.js +27 -0
  44. package/package.json +1 -1
@@ -1,9 +1,14 @@
1
- import type { ModelMessage } from '../core/runtime.js';
1
+ import { type ModelMessage } from '../core/runtime.js';
2
2
  /** Versioned, explicit progress state for one session's extracted memory. */
3
3
  export interface SessionMemoryState {
4
4
  schemaVersion: 1;
5
5
  initialized: boolean;
6
6
  lastObservedTokens: number;
7
+ /** Current-context growth baseline after a durable compaction reduction. */
8
+ growthBaselineTokens?: number;
9
+ /** Latest extraction attempt occupancy, successful or failed. Older
10
+ * sidecars omit it and fall back to the successful watermark. */
11
+ lastAttemptedTokens?: number;
7
12
  lastObservedToolCalls: number;
8
13
  lastSummarizedMessageId: string | null;
9
14
  extractionStartedAt: number | null;
@@ -19,6 +24,10 @@ export declare class SessionMemoryTimeoutError extends Error {
19
24
  constructor(message: string);
20
25
  }
21
26
  export declare function createFreshSessionMemoryState(): SessionMemoryState;
27
+ export interface SessionMemorySnapshot {
28
+ state: SessionMemoryState;
29
+ summary: string;
30
+ }
22
31
  export interface SessionMemoryStoreOptions {
23
32
  configRoot: string;
24
33
  sessionId: string;
@@ -35,13 +44,23 @@ export interface SessionMemoryStoreOptions {
35
44
  */
36
45
  export declare class SessionMemoryStore {
37
46
  private readonly directory;
47
+ private readonly artifactsDirectory;
38
48
  private readonly stateFile;
39
49
  private readonly summaryFile;
40
50
  constructor(options: SessionMemoryStoreOptions);
41
51
  load(): Promise<SessionMemoryState>;
52
+ /** Reads the pointer record once, then resolves exactly the artifact named
53
+ * by that record. Concurrent commits cannot pair an old watermark with a
54
+ * newer summary. */
55
+ loadSnapshot(): Promise<SessionMemorySnapshot>;
56
+ private loadRecord;
42
57
  loadSummary(): Promise<string>;
58
+ private loadSummaryForRecord;
43
59
  writeSummary(summary: string): Promise<void>;
44
- writeState(state: SessionMemoryState): Promise<void>;
60
+ writeState(state: SessionMemoryState, summaryFile?: string): Promise<void>;
61
+ /** Writes an immutable summary artifact, then atomically commits its pointer
62
+ * with the progress watermark. summary.md is a best-effort readable mirror. */
63
+ commitExtraction(state: SessionMemoryState, summary: string): Promise<void>;
45
64
  clear(): Promise<void>;
46
65
  }
47
66
  export interface SessionMemoryExtractorInput {
@@ -49,15 +68,18 @@ export interface SessionMemoryExtractorInput {
49
68
  tokens: number;
50
69
  toolCalls: number;
51
70
  messages?: readonly ModelMessage[];
71
+ signal: AbortSignal;
52
72
  }
53
73
  export type SessionMemoryExtractor = (input: SessionMemoryExtractorInput) => Promise<string> | string;
54
74
  export interface SessionMemoryControllerOptions {
55
75
  store: SessionMemoryStore;
56
76
  extractor: SessionMemoryExtractor;
77
+ onExtractionError?: (error: unknown) => void;
57
78
  initTokens?: number;
58
79
  updateTokens?: number;
59
80
  updateToolCalls?: number;
60
81
  waitTimeoutMs?: number;
82
+ staleExtractionMs?: number;
61
83
  }
62
84
  /**
63
85
  * Serialized extraction lifecycle for one session. Concurrent callers of
@@ -71,20 +93,23 @@ export declare class SessionMemoryController {
71
93
  private readonly updateTokens;
72
94
  private readonly updateToolCalls;
73
95
  private readonly waitTimeoutMs;
96
+ private readonly staleExtractionMs;
74
97
  private stateValue;
75
98
  private summaryValue;
76
99
  private inFlight;
100
+ private extractionController;
77
101
  private loading;
78
102
  private observedTokens;
103
+ private tokenBaseline;
104
+ private attemptTokenBaseline;
79
105
  private observedToolCalls;
106
+ private closed;
80
107
  constructor(options: SessionMemoryControllerOptions);
81
108
  observe(tokens: number, toolCalls: number, messageId: string, messages?: readonly ModelMessage[]): Promise<boolean>;
82
- /**
83
- * Adds non-negative deltas to the current cumulative observed totals and
84
- * delegates to the serialized extraction path with those cumulative totals.
85
- * The persisted counters only advance once an extraction succeeds.
86
- */
87
- observeDelta(inputTokens: number, toolCalls: number, messageId: string, messages?: readonly ModelMessage[]): Promise<boolean>;
109
+ /** Observes the current provider-visible context occupancy and a per-turn
110
+ * tool-call delta. Unlike provider input-token deltas, occupancy may shrink
111
+ * after compaction; that establishes a new growth baseline. */
112
+ observeContext(currentTokens: number, turnToolCalls: number, messageId: string, messages?: readonly ModelMessage[]): Promise<boolean>;
88
113
  /**
89
114
  * Records the observed totals and starts an extraction when the fixed
90
115
  * eligibility contract is met. Returns true when an extraction is running or
@@ -97,14 +122,22 @@ export declare class SessionMemoryController {
97
122
  state(): Promise<SessionMemoryState>;
98
123
  /**
99
124
  * Resolves when no extraction is running; rejects on extraction failure.
100
- * Compact callers wait softly: if extraction outlives the bounded
101
- * `waitTimeoutMs`, this resolves so compaction can proceed anyway.
125
+ * Normal turns do not await this diagnostic seam.
102
126
  */
103
127
  waitForIdle(): Promise<void>;
128
+ /** Compact consumes only the last committed artifact. It waits softly for a
129
+ * useful extraction, swallows retryable failures, and cancels stale work. */
130
+ waitForCompact(): Promise<void>;
131
+ /** Cancels owned extraction work and waits only for the configured bounded
132
+ * interval. A provider that ignores AbortSignal cannot hold service close. */
133
+ close(): Promise<void>;
104
134
  clear(): Promise<void>;
105
135
  private ensureLoaded;
106
136
  private loadState;
107
137
  private isExtractionDue;
108
138
  private runExtraction;
139
+ private assertOpen;
140
+ private rebaseAfterContextReduction;
141
+ private waitBoundedly;
109
142
  }
110
143
  //# sourceMappingURL=session-memory.d.ts.map