@caupulican/pi-adaptative 0.80.88 → 0.80.89

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 (53) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/core/agent-session.d.ts +35 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +262 -0
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/context/brain-curator.d.ts +88 -0
  7. package/dist/core/context/brain-curator.d.ts.map +1 -0
  8. package/dist/core/context/brain-curator.js +192 -0
  9. package/dist/core/context/brain-curator.js.map +1 -0
  10. package/dist/core/context/context-composition.d.ts +122 -0
  11. package/dist/core/context/context-composition.d.ts.map +1 -0
  12. package/dist/core/context/context-composition.js +163 -0
  13. package/dist/core/context/context-composition.js.map +1 -0
  14. package/dist/core/context/context-prompt-enforcement.d.ts +13 -0
  15. package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -1
  16. package/dist/core/context/context-prompt-enforcement.js +17 -2
  17. package/dist/core/context/context-prompt-enforcement.js.map +1 -1
  18. package/dist/core/context-gc.d.ts +13 -0
  19. package/dist/core/context-gc.d.ts.map +1 -1
  20. package/dist/core/context-gc.js +6 -0
  21. package/dist/core/context-gc.js.map +1 -1
  22. package/dist/core/research/model-fitness.d.ts +3 -0
  23. package/dist/core/research/model-fitness.d.ts.map +1 -1
  24. package/dist/core/research/model-fitness.js +54 -3
  25. package/dist/core/research/model-fitness.js.map +1 -1
  26. package/dist/core/settings-manager.d.ts +13 -0
  27. package/dist/core/settings-manager.d.ts.map +1 -1
  28. package/dist/core/settings-manager.js +19 -0
  29. package/dist/core/settings-manager.js.map +1 -1
  30. package/dist/core/slash-commands.d.ts.map +1 -1
  31. package/dist/core/slash-commands.js +6 -1
  32. package/dist/core/slash-commands.js.map +1 -1
  33. package/dist/modes/interactive/components/fitness-role-selector.d.ts +13 -0
  34. package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -0
  35. package/dist/modes/interactive/components/fitness-role-selector.js +65 -0
  36. package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -0
  37. package/dist/modes/interactive/components/settings-selector.d.ts +4 -1
  38. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  39. package/dist/modes/interactive/components/settings-selector.js +84 -0
  40. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  41. package/dist/modes/interactive/interactive-mode.d.ts +5 -0
  42. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  43. package/dist/modes/interactive/interactive-mode.js +91 -0
  44. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  45. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  46. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  47. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  48. package/examples/extensions/sandbox/package-lock.json +2 -2
  49. package/examples/extensions/sandbox/package.json +1 -1
  50. package/examples/extensions/with-deps/package-lock.json +2 -2
  51. package/examples/extensions/with-deps/package.json +1 -1
  52. package/npm-shrinkwrap.json +12 -12
  53. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [0.80.89] - 2026-07-02
2
+
3
+ ### Added
4
+
5
+ - Added the brain-assisted context curator (opt-in `contextPolicy.curation` settings + Settings ->
6
+ Context Curation submenu): a local-model sidecar that (a) writes 1-2 line semantic digests into
7
+ Context GC's packed stubs so the main model stops re-running tools to rediscover packed content,
8
+ and (b) scores stale artifact-backed tool outputs against the current goal so the prompt-policy
9
+ enforcement pilot can evict irrelevant content earlier. Advisories are asymmetric by design: a
10
+ verdict can only ever shrink the prompt, never keep or stub protected content, and every consumer
11
+ behaves identically when a result is absent. Curation jobs are queued/bounded/idempotent, drain
12
+ off-turn through the isolated-completion path with spawned-usage accounting, and persist auditable
13
+ session records. The curator refuses models that have not PASSED the new `digest` fitness surface
14
+ on this host (visible skip reasons, never silent degradation).
15
+ - Added a `digest` surface to the `model_fitness` probe: chunks carry nonce identifiers, and a
16
+ digest only scores as faithful when strict JSON parses AND the nonce survives verbatim — measuring
17
+ extraction fidelity, not narration.
18
+ - Added `/context`, a user-facing context composition dashboard decomposing what rides on EVERY
19
+ request: system prompt tokens, per-tool schema costs (heaviest first), per-extension contributions,
20
+ message classes (raw vs GC-packed vs policy-stubbed vs memory recall pages), GC/enforcement/curation
21
+ activity, spawned background spend, and provider-reported vs estimated deltas — plus actionable
22
+ observations (e.g. an oversized tool schema riding on every request) for users building their own
23
+ pi integrations.
24
+ - Added `/fitness [model] [trials]` as a first-class, discoverable command: with no arguments it
25
+ opens the model picker, runs the probe on the selection, shows the six-surface report, and then
26
+ offers ONE-STEP role assignment — context curator, router cheap/medium/expensive tier, routing
27
+ judge, or learning model — writing the matching settings for you (with a hint when the model
28
+ router itself is still disabled). With an explicit model it behaves like `/autonomy fitness`.
29
+
1
30
  ## [0.80.88] - 2026-07-02
2
31
 
3
32
  ## [0.80.87] - 2026-07-02
@@ -5,7 +5,9 @@ import { type LaneRecord } from "./autonomy/lane-tracker.ts";
5
5
  import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot } from "./autonomy/status.ts";
6
6
  import { type BashResult } from "./bash-executor.ts";
7
7
  import { type CompactionResult } from "./compaction/index.ts";
8
+ import { type CurationTelemetrySnapshot } from "./context/brain-curator.ts";
8
9
  import { type ContextAuditReport } from "./context/context-audit.ts";
10
+ import { type ContextCompositionReport } from "./context/context-composition.ts";
9
11
  import { type PromptEnforcementReport } from "./context/context-prompt-enforcement.ts";
10
12
  import { type PromptPolicyGcCorrelationReport, type PromptPolicyShadowReport } from "./context/context-prompt-policy.ts";
11
13
  import { type MemoryPromptInclusionReport } from "./context/memory-diagnostics.ts";
@@ -333,6 +335,10 @@ export declare class AgentSession {
333
335
  private _autoCompactionAbortController;
334
336
  private _overflowRecoveryAttempted;
335
337
  private _latestContextGcReport;
338
+ /** Brain-curation sidecar (design: brain-context-curation-design.md). Inert unless the
339
+ * contextPolicy.curation setting is enabled AND the model passes the digest fitness gate. */
340
+ private readonly _brainCurator;
341
+ private _lastCurationSkipReason;
336
342
  private _toolArtifactStore;
337
343
  private _latestContextAuditReport;
338
344
  private _latestPromptPolicyReport;
@@ -551,6 +557,35 @@ export declare class AgentSession {
551
557
  * Never throws into a live turn: any failure degrades to returning `messages` unchanged.
552
558
  */
553
559
  private _runPromptEnforcement;
560
+ /**
561
+ * Enqueue relevance-scoring jobs for stale, artifact-backed tool outputs the enforcement
562
+ * pilot could act on. Pure queueing — the verdicts only ever take effect through the
563
+ * asymmetric advisory lever inside enforcePromptPolicy. Never throws into a turn.
564
+ */
565
+ private _enqueueRelevanceCuration;
566
+ /**
567
+ * Drain gate: settings on, model configured+authed, and the model has PASSED the digest
568
+ * fitness probe on THIS host (design: unfit or unprobed models are refused with a visible
569
+ * reason, never silently degraded). Fire-and-forget; never throws into a turn.
570
+ */
571
+ private _maybeDrainBrainCuration;
572
+ private _drainBrainCuration;
573
+ /**
574
+ * Context composition dashboard data: decomposes the per-request payload (system prompt, tool
575
+ * schemas, extension contributions, message classes incl. GC/policy stubs and recall pages)
576
+ * plus background spend, so users can see exactly what their integrations cost per request.
577
+ * Read-only: uses the GC report path (writePayloads=false), never mutates anything.
578
+ */
579
+ getContextCompositionReport(): ContextCompositionReport;
580
+ /** Bounded plain-text rendering of {@link getContextCompositionReport} for the /context command. */
581
+ formatContextCompositionDashboard(): string;
582
+ /** Curation status for diagnostics/dashboard: settings, live telemetry, last refusal reason. */
583
+ getContextCurationStatus(): {
584
+ enabled: boolean;
585
+ model?: string;
586
+ telemetry: CurationTelemetrySnapshot;
587
+ lastSkipReason?: string;
588
+ };
554
589
  /** Read-only inspection of the latest prompt-enforcement report, for tests/debugging. */
555
590
  getPromptEnforcementReport(): PromptEnforcementReport;
556
591
  private _runMemoryRetrieval;