@caupulican/pi-adaptative 0.80.88 → 0.80.90

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 +39 -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 +279 -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,42 @@
1
+ ## [0.80.90] - 2026-07-02
2
+
3
+ ### Fixed
4
+
5
+ - Fixed profile tool grants never ACTIVATING: activation was only ever the requested defaults
6
+ intersected with the profile allow-list, so a profile granting non-default tools (e.g. a
7
+ search-only profile allowing grep/find) produced an empty or truncated "Available tools" set on
8
+ load and across /reload. Explicitly named tools in an active profile's allow list now activate
9
+ from the registry (a blanket "*" stays grant-only, deriving activation from the defaults).
10
+
11
+ ## [0.80.89] - 2026-07-02
12
+
13
+ ### Added
14
+
15
+ - Added the brain-assisted context curator (opt-in `contextPolicy.curation` settings + Settings ->
16
+ Context Curation submenu): a local-model sidecar that (a) writes 1-2 line semantic digests into
17
+ Context GC's packed stubs so the main model stops re-running tools to rediscover packed content,
18
+ and (b) scores stale artifact-backed tool outputs against the current goal so the prompt-policy
19
+ enforcement pilot can evict irrelevant content earlier. Advisories are asymmetric by design: a
20
+ verdict can only ever shrink the prompt, never keep or stub protected content, and every consumer
21
+ behaves identically when a result is absent. Curation jobs are queued/bounded/idempotent, drain
22
+ off-turn through the isolated-completion path with spawned-usage accounting, and persist auditable
23
+ session records. The curator refuses models that have not PASSED the new `digest` fitness surface
24
+ on this host (visible skip reasons, never silent degradation).
25
+ - Added a `digest` surface to the `model_fitness` probe: chunks carry nonce identifiers, and a
26
+ digest only scores as faithful when strict JSON parses AND the nonce survives verbatim — measuring
27
+ extraction fidelity, not narration.
28
+ - Added `/context`, a user-facing context composition dashboard decomposing what rides on EVERY
29
+ request: system prompt tokens, per-tool schema costs (heaviest first), per-extension contributions,
30
+ message classes (raw vs GC-packed vs policy-stubbed vs memory recall pages), GC/enforcement/curation
31
+ activity, spawned background spend, and provider-reported vs estimated deltas — plus actionable
32
+ observations (e.g. an oversized tool schema riding on every request) for users building their own
33
+ pi integrations.
34
+ - Added `/fitness [model] [trials]` as a first-class, discoverable command: with no arguments it
35
+ opens the model picker, runs the probe on the selection, shows the six-surface report, and then
36
+ offers ONE-STEP role assignment — context curator, router cheap/medium/expensive tier, routing
37
+ judge, or learning model — writing the matching settings for you (with a hint when the model
38
+ router itself is still disabled). With an explicit model it behaves like `/autonomy fitness`.
39
+
1
40
  ## [0.80.88] - 2026-07-02
2
41
 
3
42
  ## [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;