instar 1.3.565 → 1.3.567

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 (55) hide show
  1. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  2. package/dist/config/ConfigDefaults.js +16 -1
  3. package/dist/config/ConfigDefaults.js.map +1 -1
  4. package/dist/core/BitwardenProvider.d.ts +8 -0
  5. package/dist/core/BitwardenProvider.d.ts.map +1 -1
  6. package/dist/core/BitwardenProvider.js +10 -0
  7. package/dist/core/BitwardenProvider.js.map +1 -1
  8. package/dist/core/PostUpdateMigrator.d.ts +13 -0
  9. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  10. package/dist/core/PostUpdateMigrator.js +55 -0
  11. package/dist/core/PostUpdateMigrator.js.map +1 -1
  12. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  13. package/dist/core/devGatedFeatures.js +12 -0
  14. package/dist/core/devGatedFeatures.js.map +1 -1
  15. package/dist/core/types.d.ts +42 -0
  16. package/dist/core/types.d.ts.map +1 -1
  17. package/dist/core/types.js.map +1 -1
  18. package/dist/lifeline/ServerSupervisor.d.ts +9 -0
  19. package/dist/lifeline/ServerSupervisor.d.ts.map +1 -1
  20. package/dist/lifeline/ServerSupervisor.js +174 -84
  21. package/dist/lifeline/ServerSupervisor.js.map +1 -1
  22. package/dist/monitoring/BlockerLedger.d.ts +43 -2
  23. package/dist/monitoring/BlockerLedger.d.ts.map +1 -1
  24. package/dist/monitoring/BlockerLedger.js +90 -5
  25. package/dist/monitoring/BlockerLedger.js.map +1 -1
  26. package/dist/monitoring/DurableVaultSession.d.ts +91 -0
  27. package/dist/monitoring/DurableVaultSession.d.ts.map +1 -0
  28. package/dist/monitoring/DurableVaultSession.js +145 -0
  29. package/dist/monitoring/DurableVaultSession.js.map +1 -0
  30. package/dist/monitoring/SelfUnblockChecklist.d.ts +281 -0
  31. package/dist/monitoring/SelfUnblockChecklist.d.ts.map +1 -0
  32. package/dist/monitoring/SelfUnblockChecklist.js +433 -0
  33. package/dist/monitoring/SelfUnblockChecklist.js.map +1 -0
  34. package/dist/monitoring/SelfUnblockProbeProviders.d.ts +116 -0
  35. package/dist/monitoring/SelfUnblockProbeProviders.d.ts.map +1 -0
  36. package/dist/monitoring/SelfUnblockProbeProviders.js +286 -0
  37. package/dist/monitoring/SelfUnblockProbeProviders.js.map +1 -0
  38. package/dist/scaffold/templates.d.ts.map +1 -1
  39. package/dist/scaffold/templates.js +8 -0
  40. package/dist/scaffold/templates.js.map +1 -1
  41. package/dist/server/AgentServer.d.ts +16 -0
  42. package/dist/server/AgentServer.d.ts.map +1 -1
  43. package/dist/server/AgentServer.js +106 -0
  44. package/dist/server/AgentServer.js.map +1 -1
  45. package/dist/server/routes.d.ts +10 -0
  46. package/dist/server/routes.d.ts.map +1 -1
  47. package/dist/server/routes.js +117 -0
  48. package/dist/server/routes.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/data/builtin-manifest.json +64 -64
  51. package/src/scaffold/templates.ts +8 -0
  52. package/upgrades/1.3.566.md +104 -0
  53. package/upgrades/1.3.567.md +39 -0
  54. package/upgrades/side-effects/self-unblock-before-escalating.md +258 -0
  55. package/upgrades/side-effects/supervisor-respawn-guarantee.md +61 -0
@@ -5824,6 +5824,123 @@ export function createRoutes(ctx) {
5824
5824
  res.status(500).json({ error: msg });
5825
5825
  }
5826
5826
  });
5827
+ // ── Self-Unblock Before Escalating (read-only checklist-run view, spec §7) ───
5828
+ // Extends the /blockers read surface with the recent self-unblock checklist runs
5829
+ // (per-probe results + the rung). Registered BEFORE GET /blockers/:id so the
5830
+ // literal path is not swallowed by the :id param. Bearer-gated by the same
5831
+ // router-wide authMiddleware (NOT auth-exempt); the 503-when-dark check happens
5832
+ // AFTER auth (an unauthenticated caller gets 401 from the middleware, never a 503
5833
+ // that would confirm the route exists). Cache-Control: no-store — the body is
5834
+ // credential-reachability reconnaissance. Default-bounded (?limit=, last 200) +
5835
+ // skip-corrupt-lines (the store's list() tolerates partial lines). Served through
5836
+ // the <blocker-ledger-data> envelope — each run's untrusted detail is DATA.
5837
+ const SELF_UNBLOCK_DARK = 'Self-Unblock checklist not initialized (monitoring.blockerLedger.selfUnblockChecklist.enabled is false)';
5838
+ router.get('/blockers/self-unblock-runs', async (req, res) => {
5839
+ if (!ctx.selfUnblockRunStore) {
5840
+ res.status(503).json({ error: SELF_UNBLOCK_DARK });
5841
+ return;
5842
+ }
5843
+ try {
5844
+ const { toLlmSafeEnvelope } = await import('../monitoring/BlockerLedger.js');
5845
+ const { resolveRung } = await import('../monitoring/SelfUnblockChecklist.js');
5846
+ const rawLimit = req.query.limit ? Number(req.query.limit) : 200;
5847
+ const limit = Number.isFinite(rawLimit) ? Math.min(Math.max(rawLimit, 1), 200) : 200;
5848
+ const runs = ctx.selfUnblockRunStore.list(limit);
5849
+ const view = runs.map((run) => {
5850
+ // Derive the rung from the run (no action-class / operator-only context
5851
+ // available on a pure read — surface the BASE rung the run implies).
5852
+ const rung = resolveRung({ run }).rung;
5853
+ return {
5854
+ runId: run.runId,
5855
+ target: run.target,
5856
+ requiredAttemptType: run.requiredAttemptType,
5857
+ completedAt: run.completedAt,
5858
+ exhausted: run.exhausted,
5859
+ rung,
5860
+ probes: run.probes.map((p) => ({
5861
+ source: p.source,
5862
+ reachable: p.reachable,
5863
+ holdsRelevantCred: p.holdsRelevantCred,
5864
+ probedAt: p.probedAt,
5865
+ matchedScopeTags: p.matchedScopeTags,
5866
+ // Untrusted free text → DATA, wrapped in the ledger envelope.
5867
+ detail: p.detail ? toLlmSafeEnvelope(p.detail) : undefined,
5868
+ })),
5869
+ };
5870
+ });
5871
+ res.set('Cache-Control', 'no-store');
5872
+ res.json({ runs: view, total: view.length });
5873
+ }
5874
+ catch (err) {
5875
+ const msg = err instanceof Error ? err.message : String(err);
5876
+ res.status(500).json({ error: msg });
5877
+ }
5878
+ });
5879
+ // ── Self-Unblock Before Escalating — RUN the checklist (the PRODUCER, spec §5) ─
5880
+ // POST /blockers/self-unblock-run runs the PRODUCTION checklist (real probe
5881
+ // providers + durable run store) against a target and persists the run, so a
5882
+ // true-blocker settle can REFERENCE that verified run. Without this surface
5883
+ // nothing in production could PRODUCE a run, so enabling the feature made
5884
+ // settling a credential-blocker impossible — this closes that gap.
5885
+ //
5886
+ // Bearer-gated by the router-wide authMiddleware (NOT auth-exempt); the
5887
+ // 503-when-dark check happens AFTER auth (an unauthenticated caller gets 401 from
5888
+ // the middleware, never a 503 confirming the route exists). Cache-Control:
5889
+ // no-store — the body is credential-reachability reconnaissance. Registered
5890
+ // BEFORE POST /blockers/:id/* is irrelevant (those are distinct literal paths),
5891
+ // but it MUST precede GET /blockers/:id (above) — which it does, sharing the
5892
+ // /blockers/self-unblock-* prefix that is registered first. Run is rate-limited.
5893
+ const SELF_UNBLOCK_RUN_DARK = 'Self-Unblock checklist producer not initialized (monitoring.blockerLedger.selfUnblockChecklist.enabled is false)';
5894
+ router.post('/blockers/self-unblock-run', blockerWriteLimiter, async (req, res) => {
5895
+ if (!ctx.selfUnblockChecklist) {
5896
+ res.status(503).json({ error: SELF_UNBLOCK_RUN_DARK });
5897
+ return;
5898
+ }
5899
+ if (req.headers['x-instar-request'] !== '1') {
5900
+ res.status(403).json({ error: 'POST /blockers/self-unblock-run requires the X-Instar-Request: 1 intent header' });
5901
+ return;
5902
+ }
5903
+ try {
5904
+ const body = (req.body ?? {});
5905
+ const target = typeof body.target === 'string' ? body.target.trim() : '';
5906
+ if (!target) {
5907
+ res.status(400).json({ error: 'target (a non-empty service:scope string) is required' });
5908
+ return;
5909
+ }
5910
+ const rawType = body.requiredAttemptType;
5911
+ if (rawType !== undefined && rawType !== 'self-fetch' && rawType !== 'dry-run') {
5912
+ res.status(400).json({ error: "requiredAttemptType must be 'self-fetch' or 'dry-run'" });
5913
+ return;
5914
+ }
5915
+ const requiredAttemptType = rawType === 'dry-run' ? 'dry-run' : 'self-fetch';
5916
+ const { toLlmSafeEnvelope } = await import('../monitoring/BlockerLedger.js');
5917
+ const { resolveRung } = await import('../monitoring/SelfUnblockChecklist.js');
5918
+ const run = await ctx.selfUnblockChecklist.run({ target, requiredAttemptType });
5919
+ const rung = resolveRung({ run }).rung;
5920
+ res.set('Cache-Control', 'no-store');
5921
+ res.json({
5922
+ runId: run.runId,
5923
+ target: run.target,
5924
+ requiredAttemptType: run.requiredAttemptType,
5925
+ completedAt: run.completedAt,
5926
+ exhausted: run.exhausted,
5927
+ rung,
5928
+ probes: run.probes.map((p) => ({
5929
+ source: p.source,
5930
+ reachable: p.reachable,
5931
+ holdsRelevantCred: p.holdsRelevantCred,
5932
+ probedAt: p.probedAt,
5933
+ matchedScopeTags: p.matchedScopeTags,
5934
+ // Untrusted free text → DATA, wrapped in the ledger envelope.
5935
+ detail: p.detail ? toLlmSafeEnvelope(p.detail) : undefined,
5936
+ })),
5937
+ });
5938
+ }
5939
+ catch (err) {
5940
+ const msg = err instanceof Error ? err.message : String(err);
5941
+ res.status(500).json({ error: msg });
5942
+ }
5943
+ });
5827
5944
  router.get('/blockers/:id', (req, res) => {
5828
5945
  if (!ctx.blockerLedger) {
5829
5946
  res.status(503).json({ error: BLOCKER_DARK });