instar 1.3.423 → 1.3.424

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 (51) hide show
  1. package/dashboard/index.html +121 -0
  2. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  3. package/dist/config/ConfigDefaults.js +8 -0
  4. package/dist/config/ConfigDefaults.js.map +1 -1
  5. package/dist/core/CircuitBreakingIntelligenceProvider.d.ts +10 -0
  6. package/dist/core/CircuitBreakingIntelligenceProvider.d.ts.map +1 -1
  7. package/dist/core/CircuitBreakingIntelligenceProvider.js +45 -8
  8. package/dist/core/CircuitBreakingIntelligenceProvider.js.map +1 -1
  9. package/dist/core/ClaudeCliIntelligenceProvider.d.ts.map +1 -1
  10. package/dist/core/ClaudeCliIntelligenceProvider.js +6 -0
  11. package/dist/core/ClaudeCliIntelligenceProvider.js.map +1 -1
  12. package/dist/core/CodexCliIntelligenceProvider.d.ts.map +1 -1
  13. package/dist/core/CodexCliIntelligenceProvider.js +9 -0
  14. package/dist/core/CodexCliIntelligenceProvider.js.map +1 -1
  15. package/dist/core/GeminiCliIntelligenceProvider.d.ts.map +1 -1
  16. package/dist/core/GeminiCliIntelligenceProvider.js +7 -0
  17. package/dist/core/GeminiCliIntelligenceProvider.js.map +1 -1
  18. package/dist/core/InteractivePoolIntelligenceProvider.d.ts.map +1 -1
  19. package/dist/core/InteractivePoolIntelligenceProvider.js +8 -0
  20. package/dist/core/InteractivePoolIntelligenceProvider.js.map +1 -1
  21. package/dist/core/MessageSentinel.d.ts.map +1 -1
  22. package/dist/core/MessageSentinel.js +7 -0
  23. package/dist/core/MessageSentinel.js.map +1 -1
  24. package/dist/core/PiCliIntelligenceProvider.d.ts.map +1 -1
  25. package/dist/core/PiCliIntelligenceProvider.js +20 -0
  26. package/dist/core/PiCliIntelligenceProvider.js.map +1 -1
  27. package/dist/core/PostUpdateMigrator.js +6 -6
  28. package/dist/core/PostUpdateMigrator.js.map +1 -1
  29. package/dist/core/types.d.ts +31 -0
  30. package/dist/core/types.d.ts.map +1 -1
  31. package/dist/core/types.js.map +1 -1
  32. package/dist/monitoring/CommitmentSentinel.d.ts.map +1 -1
  33. package/dist/monitoring/CommitmentSentinel.js +16 -0
  34. package/dist/monitoring/CommitmentSentinel.js.map +1 -1
  35. package/dist/monitoring/FeatureMetricsLedger.d.ts +16 -0
  36. package/dist/monitoring/FeatureMetricsLedger.d.ts.map +1 -1
  37. package/dist/monitoring/FeatureMetricsLedger.js +71 -2
  38. package/dist/monitoring/FeatureMetricsLedger.js.map +1 -1
  39. package/dist/scaffold/templates.d.ts.map +1 -1
  40. package/dist/scaffold/templates.js +4 -3
  41. package/dist/scaffold/templates.js.map +1 -1
  42. package/dist/server/AgentServer.d.ts +1 -0
  43. package/dist/server/AgentServer.d.ts.map +1 -1
  44. package/dist/server/AgentServer.js +27 -0
  45. package/dist/server/AgentServer.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/data/builtin-manifest.json +20 -20
  48. package/src/scaffold/templates.ts +4 -3
  49. package/upgrades/1.3.424.md +28 -0
  50. package/upgrades/eli16/observable-intelligence-llm-activity.md +26 -0
  51. package/upgrades/side-effects/observable-intelligence-llm-activity.md +25 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PiCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/PiCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAO5E,MAAM,WAAW,gCAAgC;IAC/C,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAsB;gBAElD,OAAO,EAAE,gCAAgC;IAqB/C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAiB/E"}
1
+ {"version":3,"file":"PiCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/PiCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAO5E,MAAM,WAAW,gCAAgC;IAC/C,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAsB;gBAElD,OAAO,EAAE,gCAAgC;IAqB/C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAgC/E"}
@@ -58,9 +58,29 @@ export class PiCliIntelligenceProvider {
58
58
  // the subscription guard. The construction-time pattern — already
59
59
  // guard-checked — governs every call. This mirrors the spec's rule that
60
60
  // the override is file-config-only, never per-call (§4.3).
61
+ // Observable Intelligence: surface the resolved pi model (which already
62
+ // encodes provider/model, e.g. "github-copilot/gpt-5.4-mini") + framework
63
+ // before the call, so the metrics funnel attributes it even on error.
64
+ try {
65
+ options?.onModel?.({ model: this.model, framework: 'pi-cli' });
66
+ }
67
+ catch { /* @silent-fallback-ok: onModel is pure observability — a throw must never break the LLM path */ }
61
68
  const result = await this.oneShot.evaluate(prompt, {
62
69
  timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
63
70
  });
71
+ // pi's OneShotCompletion surfaces token usage/cost — forward it to the funnel
72
+ // when present (unlike codex/gemini, pi reports tokens). Defensive: shape may
73
+ // vary, so guard every access and never throw into the result path.
74
+ try {
75
+ const u = result.usage;
76
+ if (u && options?.onUsage) {
77
+ const inputTokens = Number(u.inputTokens ?? u.input ?? 0) || 0;
78
+ const outputTokens = Number(u.outputTokens ?? u.output ?? 0) || 0;
79
+ if (inputTokens > 0 || outputTokens > 0)
80
+ options.onUsage({ inputTokens, outputTokens });
81
+ }
82
+ }
83
+ catch { /* @silent-fallback-ok: usage is best-effort observability — never break the result path */ }
64
84
  const text = result.text.trim();
65
85
  if (!text) {
66
86
  throw new Error('pi CLI returned an empty completion');
@@ -1 +1 @@
1
- {"version":3,"file":"PiCliIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/PiCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAqBlC,MAAM,OAAO,yBAAyB;IACnB,OAAO,CAAoB;IAC3B,KAAK,CAAS;IACd,uBAAuB,CAAsB;IAE9D,YAAY,OAAyC;QACnD,IAAI,CAAC,KAAK,GAAG,OAAO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C;YACV,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -3160,16 +3160,16 @@ For any active time-boxed (autonomous) session, this returns the computed elapse
3160
3160
  // the template, so a freshly-initialized agent is never double-patched).
3161
3161
  if (!content.includes('/metrics/features')) {
3162
3162
  const metricsSection = `
3163
- ### Per-Feature LLM Metrics (\`/metrics/features\`)
3163
+ ### Per-Feature LLM Metrics & LLM Activity (\`/metrics/features\`, Observable Intelligence)
3164
3164
 
3165
- See what each LLM-driven gate/sentinel actually costs and how often it fires, so tuning them is evidence-based (which to thin, which to strengthen). Read-only observability (like token usage) — it never gates anything.
3166
- - Check: \`curl -H "Authorization: Bearer $AUTH" "http://localhost:${port}/metrics/features?sinceHours=24"\`
3167
- - Returns \`{ totals, features: [{ feature, calls, tokensIn, tokensOut, fired, noop, fireRate, p50LatencyMs, p95LatencyMs, ... }] }\`one row per system (e.g. MessagingToneGate, CoherenceReviewer). Filter with \`?feature=<name>\`.
3168
- - **When to use**: "which checks cost the most / fire the least?", "is this gate worth it?", or before tuning a sentinel/gate. Spec: \`docs/specs/llm-feature-metrics-spec.md\`.
3165
+ Audit what each LLM-driven gate/sentinel actually does: WHICH provider + model ran it, how often it ACTED (fired) vs found nothing (noop), how often it was skipped to save rate limits (shed), cost, and latency. This is the *Observable Intelligence* standard — no autonomous AI action the system takes is allowed to be invisible. Read-only observability (like token usage) — it never gates anything.
3166
+ - Check: \`curl -H "Authorization: Bearer $AUTH" "http://localhost:${port}/metrics/features?sinceHours=24"\` → \`{ totals, features: [{ feature, frameworks, models, calls, realCalls, tokensIn, tokensOut, fired, noop, shed, fireRate, p50LatencyMs, p95LatencyMs, ... }] }\`. \`frameworks\`/\`models\` = which provider(s) actually served the call; \`fireRate\` = how often it acts; \`shed\` = skipped by the rate-limit guard. Filter with \`?feature=<name>\`.
3167
+ - **Dashboard:** the **LLM Activity** tab renders this in plain language over a 24h / 7d / 30d window point the user there rather than pasting curl output.
3168
+ - **When to use** (PROACTIVE): "which provider is this sentinel running on?" / "are the sentinels actually doing real work or just being skipped?" / "which checks cost the most or fire the least?" / before tuning a sentinel or gate → read the numbers (\`frameworks\`/\`models\` for provider, \`fireRate\` for effectiveness, \`shed\` for skip rate) instead of guessing. Bounded retention (~30 days; tune \`monitoring.featureMetrics.retentionDays\`). Specs: \`docs/specs/observable-intelligence.md\`, \`docs/specs/llm-feature-metrics-spec.md\`.
3169
3169
  `;
3170
3170
  content += '\n' + metricsSection;
3171
3171
  patched = true;
3172
- result.upgraded.push('CLAUDE.md: added Per-Feature LLM Metrics (/metrics/features) awareness (llm-feature-metrics)');
3172
+ result.upgraded.push('CLAUDE.md: added Per-Feature LLM Metrics (/metrics/features) awareness (llm-feature-metrics + observable-intelligence)');
3173
3173
  }
3174
3174
  // correction-capture-backlog (Agent Awareness + Migration Parity): existing
3175
3175
  // agents with the Correction & Preference Learning block need to learn that a