@solidnumber/cli 2.26.0 → 2.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 (66) hide show
  1. package/CHANGELOG.md +105 -1
  2. package/README.md +61 -32
  3. package/dist/commands/app.d.ts.map +1 -1
  4. package/dist/commands/app.js +64 -14
  5. package/dist/commands/app.js.map +1 -1
  6. package/dist/commands/code.d.ts.map +1 -1
  7. package/dist/commands/code.js +13 -8
  8. package/dist/commands/code.js.map +1 -1
  9. package/dist/commands/find.d.ts +5 -0
  10. package/dist/commands/find.d.ts.map +1 -1
  11. package/dist/commands/find.js +48 -11
  12. package/dist/commands/find.js.map +1 -1
  13. package/dist/commands/history.d.ts.map +1 -1
  14. package/dist/commands/history.js +10 -6
  15. package/dist/commands/history.js.map +1 -1
  16. package/dist/commands/map.d.ts +4 -1
  17. package/dist/commands/map.d.ts.map +1 -1
  18. package/dist/commands/map.js +11 -3
  19. package/dist/commands/map.js.map +1 -1
  20. package/dist/commands/notes.d.ts.map +1 -1
  21. package/dist/commands/notes.js +16 -10
  22. package/dist/commands/notes.js.map +1 -1
  23. package/dist/commands/push.d.ts +2 -0
  24. package/dist/commands/push.d.ts.map +1 -1
  25. package/dist/commands/push.js +103 -1
  26. package/dist/commands/push.js.map +1 -1
  27. package/dist/commands/verbs.d.ts +24 -3
  28. package/dist/commands/verbs.d.ts.map +1 -1
  29. package/dist/commands/verbs.js +258 -9
  30. package/dist/commands/verbs.js.map +1 -1
  31. package/dist/data/cms-blocks.json +880 -305
  32. package/dist/lib/api-client.d.ts +15 -0
  33. package/dist/lib/api-client.d.ts.map +1 -1
  34. package/dist/lib/api-client.js +116 -93
  35. package/dist/lib/api-client.js.map +1 -1
  36. package/dist/lib/find-answer.d.ts +42 -0
  37. package/dist/lib/find-answer.d.ts.map +1 -0
  38. package/dist/lib/find-answer.js +59 -0
  39. package/dist/lib/find-answer.js.map +1 -0
  40. package/dist/lib/output-contract.d.ts +70 -0
  41. package/dist/lib/output-contract.d.ts.map +1 -0
  42. package/dist/lib/output-contract.js +83 -0
  43. package/dist/lib/output-contract.js.map +1 -0
  44. package/dist/lib/pull-readme.js +1 -1
  45. package/dist/lib/push-catalog.d.ts +46 -0
  46. package/dist/lib/push-catalog.d.ts.map +1 -0
  47. package/dist/lib/push-catalog.js +124 -0
  48. package/dist/lib/push-catalog.js.map +1 -0
  49. package/dist/lib/push-diff.d.ts +24 -0
  50. package/dist/lib/push-diff.d.ts.map +1 -0
  51. package/dist/lib/push-diff.js +58 -0
  52. package/dist/lib/push-diff.js.map +1 -0
  53. package/dist/lib/sandbox-verbs.d.ts +4 -5
  54. package/dist/lib/sandbox-verbs.d.ts.map +1 -1
  55. package/dist/lib/sandbox-verbs.js +10 -17
  56. package/dist/lib/sandbox-verbs.js.map +1 -1
  57. package/dist/lib/verb-envelope.d.ts +43 -0
  58. package/dist/lib/verb-envelope.d.ts.map +1 -0
  59. package/dist/lib/verb-envelope.js +71 -0
  60. package/dist/lib/verb-envelope.js.map +1 -0
  61. package/dist/lib/verb-snapshot.d.ts +33 -0
  62. package/dist/lib/verb-snapshot.d.ts.map +1 -0
  63. package/dist/lib/verb-snapshot.js +84 -0
  64. package/dist/lib/verb-snapshot.js.map +1 -0
  65. package/package.json +4 -2
  66. package/platform-docs/llms.txt +5 -5
@@ -39,7 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.apiClient = exports.CLI_VERSION = void 0;
42
+ exports.apiClient = exports.CLI_SESSION_REF = exports.CLI_VERSION = void 0;
43
+ exports.resolveSessionRef = resolveSessionRef;
43
44
  exports.setOverrideToken = setOverrideToken;
44
45
  exports.hasOverrideToken = hasOverrideToken;
45
46
  exports.setOverrideTimeoutMs = setOverrideTimeoutMs;
@@ -56,6 +57,11 @@ const config_1 = require("./config");
56
57
  const dry_run_1 = require("./dry-run");
57
58
  const offline_queue_1 = require("./offline-queue");
58
59
  const list_envelope_1 = require("./list-envelope");
60
+ const output_contract_1 = require("./output-contract");
61
+ function receiptOf(headers) {
62
+ const ref = (0, output_contract_1.receiptRefOf)(headers);
63
+ return ref ? { receipt: ref } : {};
64
+ }
59
65
  const version_skew_1 = require("./version-skew");
60
66
  // Resolve our package version once. Used for the X-Solid-CLI-Version header
61
67
  // on every outbound request so the backend can log/compare CLI clients.
@@ -69,6 +75,22 @@ try {
69
75
  catch {
70
76
  // leave as 0.0.0 — version-skew is best-effort, never fatal
71
77
  }
78
+ /**
79
+ * One id for this run, sent as X-Solid-Session on every request so the backend
80
+ * stamps it on each verb receipt — `audit.receipts session_ref=<this>` then reads
81
+ * the whole run back in order. Before this every CLI receipt had session_ref
82
+ * null and a run could not be grouped at all.
83
+ *
84
+ * One process is one run by default. An agent that drives several `solid`
85
+ * invocations as ONE piece of work sets SOLID_SESSION_ID once and every
86
+ * invocation joins the same session. The backend only accepts `cli:` plus 8–64
87
+ * of [A-Za-z0-9_-]; anything else in the env var is replaced, never sent.
88
+ */
89
+ function resolveSessionRef(env = process.env.SOLID_SESSION_ID) {
90
+ const given = (env || '').trim().replace(/^cli:/, '');
91
+ return `cli:${/^[A-Za-z0-9_-]{8,64}$/.test(given) ? given : (0, node_crypto_1.randomUUID)()}`;
92
+ }
93
+ exports.CLI_SESSION_REF = resolveSessionRef();
72
94
  // Global override for per-invocation auth. Set by `--token <val>` on the
73
95
  // root program before any command runs; takes precedence over SOLID_API_KEY,
74
96
  // SOLID_TOKEN, and the cached session.
@@ -238,6 +260,7 @@ class ApiClient {
238
260
  // response headers to trigger the skew warning.
239
261
  requestConfig.headers['X-Solid-CLI-Version'] = exports.CLI_VERSION;
240
262
  requestConfig.headers['User-Agent'] = `solid-cli/${exports.CLI_VERSION} node/${process.version.slice(1)}`;
263
+ requestConfig.headers['X-Solid-Session'] = exports.CLI_SESSION_REF;
241
264
  // Agent-aware headers — when an AI (Claude/Cursor/Codex) drives the
242
265
  // CLI via `solid ai`, these tell the backend WHO is making the call
243
266
  // and WHICH human started the session. Backend audit logs can then
@@ -556,7 +579,7 @@ class ApiClient {
556
579
  // Generic HTTP methods (used by droplet, dev, etc.)
557
580
  async get(url, options) {
558
581
  const response = await this.client.get(url, options);
559
- return { data: response.data, status: response.status, success: true };
582
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
560
583
  }
561
584
  // Dry-run interception happens at the request-interceptor layer —
562
585
  // every mutation (incl. those using this.client.* directly) is caught.
@@ -566,15 +589,15 @@ class ApiClient {
566
589
  // per-call key (stable across internal retries only). See the interceptor.
567
590
  async post(url, data, options) {
568
591
  const response = await this.client.post(url, data, idempotencyConfig(options));
569
- return { data: response.data, status: response.status, success: true };
592
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
570
593
  }
571
594
  async put(url, data, options) {
572
595
  const response = await this.client.put(url, data, idempotencyConfig(options));
573
- return { data: response.data, status: response.status, success: true };
596
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
574
597
  }
575
598
  async patch(url, data, options) {
576
599
  const response = await this.client.patch(url, data, idempotencyConfig(options));
577
- return { data: response.data, status: response.status, success: true };
600
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
578
601
  }
579
602
  async delete(url, options) {
580
603
  const response = await this.client.delete(url, {
@@ -582,7 +605,7 @@ class ApiClient {
582
605
  ...(options?.data !== undefined ? { data: options.data } : {}),
583
606
  ...idempotencyConfig(options),
584
607
  });
585
- return { data: response.data, status: response.status, success: true };
608
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
586
609
  }
587
610
  // Auth endpoints
588
611
  async login(email, password) {
@@ -590,7 +613,7 @@ class ApiClient {
590
613
  email,
591
614
  password,
592
615
  });
593
- return { data: response.data, status: response.status, success: true };
616
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
594
617
  }
595
618
  async authStatus() {
596
619
  try {
@@ -605,80 +628,80 @@ class ApiClient {
605
628
  // Health endpoints
606
629
  async healthQuick() {
607
630
  const response = await this.client.get('/api/v1/healthcheck/quick');
608
- return { data: response.data, status: response.status, success: true };
631
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
609
632
  }
610
633
  async healthFull() {
611
634
  const response = await this.client.get('/api/v1/health');
612
- return { data: response.data, status: response.status, success: true };
635
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
613
636
  }
614
637
  async healthMcp() {
615
638
  const response = await this.client.get('/api/v1/healthcheck/mcp');
616
- return { data: response.data, status: response.status, success: true };
639
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
617
640
  }
618
641
  // Integration endpoints
619
642
  async integrationsCatalog() {
620
643
  const response = await this.client.get('/api/v1/vibe/integrations/catalog');
621
- return { data: response.data, status: response.status, success: true };
644
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
622
645
  }
623
646
  async integrationsList(status) {
624
647
  const params = status ? { status } : {};
625
648
  const response = await this.client.get('/api/v1/vibe/integrations/', { params });
626
- return { data: response.data, status: response.status, success: true };
649
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
627
650
  }
628
651
  async integrationsHealth() {
629
652
  const response = await this.client.get('/api/v1/vibe/integrations/health');
630
- return { data: response.data, status: response.status, success: true };
653
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
631
654
  }
632
655
  async integrationsGenerate(params) {
633
656
  const response = await this.client.post('/api/v1/vibe/integrations/generate', params);
634
- return { data: response.data, status: response.status, success: true };
657
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
635
658
  }
636
659
  async integrationsValidate(integrationId) {
637
660
  const response = await this.client.post(`/api/v1/vibe/integrations/validate/${integrationId}`);
638
- return { data: response.data, status: response.status, success: true };
661
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
639
662
  }
640
663
  async integrationsTest(integrationId, testParams) {
641
664
  const response = await this.client.post(`/api/v1/vibe/integrations/test/${integrationId}`, {
642
665
  test_params: testParams || {},
643
666
  });
644
- return { data: response.data, status: response.status, success: true };
667
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
645
668
  }
646
669
  async integrationsDeploy(integrationId) {
647
670
  const response = await this.client.post(`/api/v1/vibe/integrations/deploy/${integrationId}`);
648
- return { data: response.data, status: response.status, success: true };
671
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
649
672
  }
650
673
  async integrationsDisable(integrationId, reason) {
651
674
  const response = await this.client.post(`/api/v1/vibe/integrations/disable/${integrationId}`, { reason });
652
- return { data: response.data, status: response.status, success: true };
675
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
653
676
  }
654
677
  async integrationsRollback(integrationId, reason) {
655
678
  const response = await this.client.post(`/api/v1/vibe/integrations/rollback/${integrationId}`, { reason });
656
- return { data: response.data, status: response.status, success: true };
679
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
657
680
  }
658
681
  async integrationsLogs(integrationId, limit = 100) {
659
682
  const response = await this.client.get(`/api/v1/vibe/integrations/${integrationId}/logs`, {
660
683
  params: { limit },
661
684
  });
662
- return { data: response.data, status: response.status, success: true };
685
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
663
686
  }
664
687
  // Vibe endpoints
665
688
  async vibeAnalyze(prompt) {
666
689
  const response = await this.client.post('/api/v1/vibe/analyze', { prompt });
667
- return { data: response.data, status: response.status, success: true };
690
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
668
691
  }
669
692
  async vibeApply(previewId) {
670
693
  const response = await this.client.post('/api/v1/vibe/apply', {
671
694
  preview_id: previewId,
672
695
  confirm: true,
673
696
  });
674
- return { data: response.data, status: response.status, success: true };
697
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
675
698
  }
676
699
  // Company info
677
700
  async companyInfo() {
678
701
  const response = await this.client.post('/api/v1/rpc/Company/info', {
679
702
  query: { id: config_1.config.companyId },
680
703
  });
681
- return { data: response.data, status: response.status, success: true };
704
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
682
705
  }
683
706
  // KB endpoints (via REST API)
684
707
  async kbSearch(query, limit = 20, offset = 0) {
@@ -713,7 +736,7 @@ class ApiClient {
713
736
  // CMS Pages
714
737
  async pagesList(params) {
715
738
  const response = await this.client.get('/api/v1/cms/pages', { params });
716
- return { data: response.data, status: response.status, success: true };
739
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
717
740
  }
718
741
  async pagesPublish(pageId) {
719
742
  // The endpoint takes a required WebsitePagePublish body (generate_mcp,
@@ -722,16 +745,16 @@ class ApiClient {
722
745
  // all made FastAPI report a missing required field, and `solid pages
723
746
  // publish` returned 422 for every tenant, on every page.
724
747
  const response = await this.client.post(`/api/v1/cms/pages/${pageId}/publish`, {});
725
- return { data: response.data, status: response.status, success: true };
748
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
726
749
  }
727
750
  async pagesUnpublish(pageId) {
728
751
  const response = await this.client.post(`/api/v1/cms/pages/${pageId}/unpublish`);
729
- return { data: response.data, status: response.status, success: true };
752
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
730
753
  }
731
754
  // Services
732
755
  async servicesList() {
733
756
  const response = await this.client.get(`/api/v1/services/catalog`);
734
- return { data: response.data, status: response.status, success: true };
757
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
735
758
  }
736
759
  // Products
737
760
  async productsList(params) {
@@ -739,7 +762,7 @@ class ApiClient {
739
762
  const response = await this.client.get(`/api/v1/cms/public/products`, {
740
763
  params: { company_id: companyId, ...params },
741
764
  });
742
- return { data: response.data, status: response.status, success: true };
765
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
743
766
  }
744
767
  // Website settings update
745
768
  async updateWebsiteSettings(settings) {
@@ -747,31 +770,31 @@ class ApiClient {
747
770
  const response = await this.client.patch(`/api/v1/companies/${companyId}`, {
748
771
  website_settings: settings,
749
772
  });
750
- return { data: response.data, status: response.status, success: true };
773
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
751
774
  }
752
775
  // Single page (full detail with layout_json)
753
776
  async pageGet(pageId) {
754
777
  const response = await this.client.get(`/api/v1/cms/pages/${pageId}`);
755
- return { data: response.data, status: response.status, success: true };
778
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
756
779
  }
757
780
  // Update page
758
781
  async pageUpdate(pageId, data) {
759
782
  const response = await this.client.patch(`/api/v1/cms/pages/${pageId}`, data);
760
- return { data: response.data, status: response.status, success: true };
783
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
761
784
  }
762
785
  // Create page
763
786
  async pageCreate(data) {
764
787
  const response = await this.client.post(`/api/v1/cms/pages`, data);
765
- return { data: response.data, status: response.status, success: true };
788
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
766
789
  }
767
790
  // Sites (solid site)
768
791
  async sitesList() {
769
792
  const response = await this.client.get('/api/v1/sites');
770
- return { data: response.data, status: response.status, success: true };
793
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
771
794
  }
772
795
  async siteGet(siteId) {
773
796
  const response = await this.client.get(`/api/v1/sites/${siteId}`);
774
- return { data: response.data, status: response.status, success: true };
797
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
775
798
  }
776
799
  async siteCreate(slug, template, name, isLive) {
777
800
  const response = await this.client.post('/api/v1/sites', {
@@ -780,20 +803,20 @@ class ApiClient {
780
803
  name: name || undefined,
781
804
  is_live: isLive ?? false,
782
805
  });
783
- return { data: response.data, status: response.status, success: true };
806
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
784
807
  }
785
808
  async siteDelete(siteId) {
786
809
  const response = await this.client.delete(`/api/v1/sites/${siteId}`);
787
- return { data: response.data, status: response.status, success: true };
810
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
788
811
  }
789
812
  async siteTemplates() {
790
813
  const response = await this.client.get('/api/v1/sites/templates');
791
- return { data: response.data, status: response.status, success: true };
814
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
792
815
  }
793
816
  // Page management (additional)
794
817
  async pageDelete(pageId) {
795
818
  const response = await this.client.delete(`/api/v1/cms/pages/${pageId}`);
796
- return { data: response.data, status: response.status, success: true };
819
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
797
820
  }
798
821
  // AI Chat (talk to agents)
799
822
  async agentChat(message, agentName = 'sarah') {
@@ -801,105 +824,105 @@ class ApiClient {
801
824
  message,
802
825
  agent: agentName,
803
826
  });
804
- return { data: response.data, status: response.status, success: true };
827
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
805
828
  }
806
829
  // Templates (solid clone)
807
830
  async templatesList() {
808
831
  const response = await this.client.get('/api/v1/cli/templates/');
809
- return { data: response.data, status: response.status, success: true };
832
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
810
833
  }
811
834
  async templatePreview(name) {
812
835
  const response = await this.client.get(`/api/v1/cli/templates/${name}`);
813
- return { data: response.data, status: response.status, success: true };
836
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
814
837
  }
815
838
  async templateClone(name) {
816
839
  const response = await this.client.post(`/api/v1/cli/templates/${name}/clone`);
817
- return { data: response.data, status: response.status, success: true };
840
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
818
841
  }
819
842
  // Multi-company (CLI Agency)
820
843
  async companiesList() {
821
844
  const response = await this.client.get('/api/v1/cli/companies/');
822
- return { data: response.data, status: response.status, success: true };
845
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
823
846
  }
824
847
  async companyCreate(name, template, industry) {
825
848
  const response = await this.client.post('/api/v1/cli/companies/', { name, template, industry });
826
- return { data: response.data, status: response.status, success: true };
849
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
827
850
  }
828
851
  async companySwitch(companyId) {
829
852
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/switch`);
830
- return { data: response.data, status: response.status, success: true };
853
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
831
854
  }
832
855
  async companyMembers(companyId) {
833
856
  const response = await this.client.get(`/api/v1/cli/companies/${companyId}/members`);
834
- return { data: response.data, status: response.status, success: true };
857
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
835
858
  }
836
859
  async companyMemberRevoke(companyId, userId) {
837
860
  const response = await this.client.delete(`/api/v1/cli/companies/${companyId}/members/${userId}`);
838
- return { data: response.data, status: response.status, success: true };
861
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
839
862
  }
840
863
  async companyInvite(companyId, email, role = 'developer') {
841
864
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/invite`, { email, role });
842
- return { data: response.data, status: response.status, success: true };
865
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
843
866
  }
844
867
  // ── T10 — Agency-managed companies + design-lock ─────────────────
845
868
  async companyCreateForClient(payload) {
846
869
  const response = await this.client.post('/api/v1/cli/companies/for-client', payload);
847
- return { data: response.data, status: response.status, success: true };
870
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
848
871
  }
849
872
  async companyLockStatus(companyId) {
850
873
  const response = await this.client.get(`/api/v1/cli/companies/${companyId}/lock-status`);
851
- return { data: response.data, status: response.status, success: true };
874
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
852
875
  }
853
876
  async companyLock(companyId, areas) {
854
877
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/lock`, { areas });
855
- return { data: response.data, status: response.status, success: true };
878
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
856
879
  }
857
880
  async companyUnlock(companyId, areas, all = false) {
858
881
  const body = { all };
859
882
  if (!all)
860
883
  body.areas = areas;
861
884
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/unlock`, body);
862
- return { data: response.data, status: response.status, success: true };
885
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
863
886
  }
864
887
  // ── SPRINT-AGENT-FIREWALL — agent identities, quarantine, reputation ──
865
888
  async agentIdentityList(includeRevoked = false) {
866
889
  const response = await this.client.get('/api/v1/agent/identities', { params: includeRevoked ? { include_revoked: true } : {} });
867
- return { data: response.data, status: response.status, success: true };
890
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
868
891
  }
869
892
  async agentIdentityCreate(body) {
870
893
  const response = await this.client.post('/api/v1/agent/identities', body);
871
- return { data: response.data, status: response.status, success: true };
894
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
872
895
  }
873
896
  async agentIdentityRevoke(id) {
874
897
  const response = await this.client.delete(`/api/v1/agent/identities/${id}`);
875
- return { data: response.data, status: response.status, success: true };
898
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
876
899
  }
877
900
  async agentIdentityQuarantine(id, reason) {
878
901
  const response = await this.client.post(`/api/v1/agent/identities/${id}/quarantine`, { reason });
879
- return { data: response.data, status: response.status, success: true };
902
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
880
903
  }
881
904
  async agentIdentityRelease(id) {
882
905
  const response = await this.client.post(`/api/v1/agent/identities/${id}/release`);
883
- return { data: response.data, status: response.status, success: true };
906
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
884
907
  }
885
908
  async agentIdentityReputation(id) {
886
909
  const response = await this.client.get(`/api/v1/agent/identities/${id}/reputation`);
887
- return { data: response.data, status: response.status, success: true };
910
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
888
911
  }
889
912
  async agentRisk(days = 7) {
890
913
  const response = await this.client.get('/api/v1/agent/identities/risk', { params: { days } });
891
- return { data: response.data, status: response.status, success: true };
914
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
892
915
  }
893
916
  async companyLockPreset(companyId, profile) {
894
917
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/lock-preset`, { profile });
895
- return { data: response.data, status: response.status, success: true };
918
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
896
919
  }
897
920
  async companyRequestUnlock(companyId, areas, reason) {
898
921
  const response = await this.client.post(`/api/v1/cli/companies/${companyId}/request-unlock`, {
899
922
  areas,
900
923
  reason,
901
924
  });
902
- return { data: response.data, status: response.status, success: true };
925
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
903
926
  }
904
927
  // ── Tenant Activity Gate ────────────────────────────────────────────────
905
928
  // See Owners-Manual/06-Operations/TENANT-ACTIVITY-GATE/ for the full spec.
@@ -946,15 +969,15 @@ class ApiClient {
946
969
  expires_in_days: expiresInDays,
947
970
  ...(extra?.require_approval ? { require_approval: true } : {}),
948
971
  });
949
- return { data: response.data, status: response.status, success: true };
972
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
950
973
  }
951
974
  async apiKeyList() {
952
975
  const response = await this.client.get('/api/v1/cli/api-keys/');
953
- return { data: response.data, status: response.status, success: true };
976
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
954
977
  }
955
978
  async apiKeyRevoke(keyId) {
956
979
  const response = await this.client.delete(`/api/v1/cli/api-keys/${keyId}`);
957
- return { data: response.data, status: response.status, success: true };
980
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
958
981
  }
959
982
  // Agent management endpoints
960
983
  async agentsList() {
@@ -962,32 +985,32 @@ class ApiClient {
962
985
  // and axios/follow-redirects strips the Authorization header, causing
963
986
  // spurious 401s under SOLID_API_KEY auth. Verified 2026-04-19.
964
987
  const response = await this.client.get('/api/v1/cli/agents/');
965
- return { data: response.data, status: response.status, success: true };
988
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
966
989
  }
967
990
  async agentDetail(agentType) {
968
991
  const response = await this.client.get(`/api/v1/cli/agents/${agentType}`);
969
- return { data: response.data, status: response.status, success: true };
992
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
970
993
  }
971
994
  async agentTools(agentType) {
972
995
  const response = await this.client.get(`/api/v1/cli/agents/${agentType}/tools`);
973
- return { data: response.data, status: response.status, success: true };
996
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
974
997
  }
975
998
  async agentData(agentType) {
976
999
  const response = await this.client.get(`/api/v1/cli/agents/${agentType}/data`);
977
- return { data: response.data, status: response.status, success: true };
1000
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
978
1001
  }
979
1002
  async orchestrationDashboard() {
980
1003
  const response = await this.client.get('/api/orchestration/dashboard');
981
- return { data: response.data, status: response.status, success: true };
1004
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
982
1005
  }
983
1006
  async orchestrationAgents(statusFilter) {
984
1007
  const params = statusFilter ? { status_filter: statusFilter } : {};
985
1008
  const response = await this.client.get('/api/orchestration/agents', { params });
986
- return { data: response.data, status: response.status, success: true };
1009
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
987
1010
  }
988
1011
  async orchestrationAgentDetail(agentId) {
989
1012
  const response = await this.client.get(`/api/orchestration/agents/${agentId}`);
990
- return { data: response.data, status: response.status, success: true };
1013
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
991
1014
  }
992
1015
  async orchestrationDelegate(agentId, task, priority) {
993
1016
  const response = await this.client.post('/api/orchestration/delegate', {
@@ -995,12 +1018,12 @@ class ApiClient {
995
1018
  task,
996
1019
  priority: priority || 5,
997
1020
  });
998
- return { data: response.data, status: response.status, success: true };
1021
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
999
1022
  }
1000
1023
  async orchestrationAnalytics(days) {
1001
1024
  const params = days ? { days } : {};
1002
1025
  const response = await this.client.get('/api/orchestration/analytics', { params });
1003
- return { data: response.data, status: response.status, success: true };
1026
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1004
1027
  }
1005
1028
  // Dragon — Mission orchestration
1006
1029
  async missionCreate(mission, agentIds) {
@@ -1008,16 +1031,16 @@ class ApiClient {
1008
1031
  if (agentIds && agentIds.length > 0)
1009
1032
  body.agent_ids = agentIds;
1010
1033
  const response = await this.client.post('/api/v1/agents/missions', body);
1011
- return { data: response.data, status: response.status, success: true };
1034
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1012
1035
  }
1013
1036
  async missionExecute(missionId) {
1014
1037
  const response = await this.client.post(`/api/v1/agents/missions/${missionId}/execute`);
1015
- return { data: response.data, status: response.status, success: true };
1038
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1016
1039
  }
1017
1040
  // Dragon — Telemetry
1018
1041
  async telemetrySummary() {
1019
1042
  const response = await this.client.get('/api/v1/telemetry/agents/summary');
1020
- return { data: response.data, status: response.status, success: true };
1043
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1021
1044
  }
1022
1045
  // =========================================================================
1023
1046
  // CLI History & Rollback
@@ -1025,57 +1048,57 @@ class ApiClient {
1025
1048
  async historyPages(slug, limit = 50) {
1026
1049
  const url = slug ? `/api/v1/cli/history/pages/${slug}` : '/api/v1/cli/history/pages';
1027
1050
  const response = await this.client.get(url, { params: { limit } });
1028
- return { data: response.data, status: response.status, success: true };
1051
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1029
1052
  }
1030
1053
  async historyPageVersion(slug, version) {
1031
1054
  const response = await this.client.get(`/api/v1/cli/history/pages/${slug}/${version}`);
1032
- return { data: response.data, status: response.status, success: true };
1055
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1033
1056
  }
1034
1057
  async rollbackPage(slug, version) {
1035
1058
  const response = await this.client.post(`/api/v1/cli/history/pages/${slug}/rollback`, { version });
1036
- return { data: response.data, status: response.status, success: true };
1059
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1037
1060
  }
1038
1061
  async historyKB(entryId, limit = 50) {
1039
1062
  const url = entryId ? `/api/v1/cli/history/kb/${entryId}` : '/api/v1/cli/history/kb';
1040
1063
  const response = await this.client.get(url, { params: { limit } });
1041
- return { data: response.data, status: response.status, success: true };
1064
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1042
1065
  }
1043
1066
  async rollbackKB(entryId, version) {
1044
1067
  const response = await this.client.post(`/api/v1/cli/history/kb/${entryId}/rollback`, { version });
1045
- return { data: response.data, status: response.status, success: true };
1068
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1046
1069
  }
1047
1070
  async createSnapshot(source = 'cli', changeSummary) {
1048
1071
  const response = await this.client.post('/api/v1/cli/history/snapshot', {
1049
1072
  source,
1050
1073
  change_summary: changeSummary,
1051
1074
  });
1052
- return { data: response.data, status: response.status, success: true };
1075
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1053
1076
  }
1054
1077
  // =========================================================================
1055
1078
  // CLI Preview Deployments
1056
1079
  // =========================================================================
1057
1080
  async previewCreate(options = {}) {
1058
1081
  const response = await this.client.post('/api/v1/cli/preview', options);
1059
- return { data: response.data, status: response.status, success: true };
1082
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1060
1083
  }
1061
1084
  async previewList(status, limit = 20) {
1062
1085
  const params = { limit };
1063
1086
  if (status)
1064
1087
  params.status = status;
1065
1088
  const response = await this.client.get('/api/v1/cli/preview', { params });
1066
- return { data: response.data, status: response.status, success: true };
1089
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1067
1090
  }
1068
1091
  async previewGet(token) {
1069
1092
  const response = await this.client.get(`/api/v1/cli/preview/${token}`);
1070
- return { data: response.data, status: response.status, success: true };
1093
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1071
1094
  }
1072
1095
  async previewPromote(token) {
1073
1096
  const response = await this.client.post(`/api/v1/cli/preview/${token}/promote`, { confirm: true });
1074
- return { data: response.data, status: response.status, success: true };
1097
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1075
1098
  }
1076
1099
  async previewExpire(token) {
1077
1100
  const response = await this.client.delete(`/api/v1/cli/preview/${token}`);
1078
- return { data: response.data, status: response.status, success: true };
1101
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1079
1102
  }
1080
1103
  // =========================================================================
1081
1104
  // CLI Agent Logs & Testing
@@ -1083,30 +1106,30 @@ class ApiClient {
1083
1106
  async agentLogs(agentType, options = {}) {
1084
1107
  const url = agentType ? `/api/v1/cli/agents/${agentType}/logs` : '/api/v1/cli/agents/logs';
1085
1108
  const response = await this.client.get(url, { params: options });
1086
- return { data: response.data, status: response.status, success: true };
1109
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1087
1110
  }
1088
1111
  async agentErrors(agentType, hours = 24, limit = 50) {
1089
1112
  const response = await this.client.get(`/api/v1/cli/agents/${agentType}/logs/errors`, { params: { hours, limit } });
1090
- return { data: response.data, status: response.status, success: true };
1113
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1091
1114
  }
1092
1115
  async agentTest(options) {
1093
1116
  const response = await this.client.post('/api/v1/cli/agents/test', options);
1094
- return { data: response.data, status: response.status, success: true };
1117
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1095
1118
  }
1096
1119
  async agentTestResults(hours = 24, limit = 50) {
1097
1120
  const response = await this.client.get('/api/v1/cli/agents/test/results', { params: { hours, limit } });
1098
- return { data: response.data, status: response.status, success: true };
1121
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1099
1122
  }
1100
1123
  // =========================================================================
1101
1124
  // CLI Company Migration
1102
1125
  // =========================================================================
1103
1126
  async migratePreview(options) {
1104
1127
  const response = await this.client.post('/api/v1/cli/migrate/preview', options);
1105
- return { data: response.data, status: response.status, success: true };
1128
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1106
1129
  }
1107
1130
  async migrateExecute(options) {
1108
1131
  const response = await this.client.post('/api/v1/cli/migrate/execute', options);
1109
- return { data: response.data, status: response.status, success: true };
1132
+ return { data: response.data, status: response.status, success: true, ...receiptOf(response.headers) };
1110
1133
  }
1111
1134
  }
1112
1135
  exports.apiClient = new ApiClient();