@treeseed/sdk 0.13.0-rc.43 → 0.13.0-rc.45

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.
@@ -0,0 +1,32 @@
1
+ import type { GuaranteeDiagnostic, GuaranteeVerifierResult } from './index.js';
2
+ export interface UiEvidenceTrustInput {
3
+ requestedDevice: {
4
+ id: string;
5
+ viewport: {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ isMobile: boolean;
10
+ hasTouch: boolean;
11
+ };
12
+ actualDevice: {
13
+ id: string;
14
+ viewport: {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ isMobile: boolean;
19
+ hasTouch: boolean;
20
+ };
21
+ consoleErrors?: Array<{
22
+ message: string;
23
+ asserted?: boolean;
24
+ }>;
25
+ networkErrors?: Array<{
26
+ status?: number;
27
+ message: string;
28
+ asserted?: boolean;
29
+ }>;
30
+ }
31
+ export declare function validateUiEvidenceTrust(input: UiEvidenceTrustInput): GuaranteeDiagnostic[];
32
+ export declare function runUiEvidenceTrustVerifier(): GuaranteeVerifierResult;
@@ -0,0 +1,47 @@
1
+ function validateUiEvidenceTrust(input) {
2
+ const diagnostics = [];
3
+ const requested = input.requestedDevice, actual = input.actualDevice;
4
+ if (requested.id !== actual.id || requested.viewport.width !== actual.viewport.width || requested.viewport.height !== actual.viewport.height || requested.isMobile !== actual.isMobile || requested.hasTouch !== actual.hasTouch) {
5
+ diagnostics.push({ severity: "error", code: "guarantee.scene_device_mismatch", message: `Requested ${requested.id}, but evidence recorded ${actual.id}.` });
6
+ }
7
+ for (const error of input.consoleErrors ?? []) if (!error.asserted) diagnostics.push({
8
+ severity: "error",
9
+ code: "guarantee.scene_unexpected_console_error",
10
+ message: error.message
11
+ });
12
+ for (const error of input.networkErrors ?? []) if (!error.asserted) diagnostics.push({
13
+ severity: "error",
14
+ code: "guarantee.scene_unexpected_network_error",
15
+ message: error.message
16
+ });
17
+ return diagnostics;
18
+ }
19
+ function runUiEvidenceTrustVerifier() {
20
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
21
+ const mismatch = validateUiEvidenceTrust({
22
+ requestedDevice: { id: "mobile_chromium", viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true },
23
+ actualDevice: { id: "desktop_chromium", viewport: { width: 1600, height: 900 }, isMobile: false, hasTouch: false },
24
+ consoleErrors: [{ message: "ReferenceError", asserted: false }],
25
+ networkErrors: [{ status: 500, message: "HTTP 500", asserted: false }]
26
+ });
27
+ const required = /* @__PURE__ */ new Set(["guarantee.scene_device_mismatch", "guarantee.scene_unexpected_console_error", "guarantee.scene_unexpected_network_error"]);
28
+ const observed = new Set(mismatch.map((entry) => entry.code));
29
+ const ok = [...required].every((code) => observed.has(code));
30
+ return {
31
+ schemaVersion: "treeseed.guarantee-verifier-result/v1",
32
+ verifierId: "@treeseed/sdk/ui-evidence-trust",
33
+ startedAt,
34
+ completedAt: (/* @__PURE__ */ new Date()).toISOString(),
35
+ ok,
36
+ checks: [{
37
+ id: "sdk.ui.evidence-trust",
38
+ status: ok ? "passed" : "failed",
39
+ durationMs: 0,
40
+ diagnostics: ok ? [] : [{ severity: "error", code: "guarantee.ui_evidence_trust_incomplete", message: "UI evidence trust did not reject every invalid vector." }]
41
+ }]
42
+ };
43
+ }
44
+ export {
45
+ runUiEvidenceTrustVerifier,
46
+ validateUiEvidenceTrust
47
+ };
@@ -1,3 +1,4 @@
1
+ export { runUiEvidenceTrustVerifier, validateUiEvidenceTrust } from './evidence-trust.js';
1
2
  export type GuaranteeRunStatus = 'passed' | 'failed' | 'skipped' | 'blocked';
2
3
  export type GuaranteeFilter = Record<string, unknown>;
3
4
  export interface GuaranteeDiagnostic {
@@ -67,6 +68,40 @@ export interface GuaranteeRunReport {
67
68
  diagnostics?: GuaranteeDiagnostic[];
68
69
  [key: string]: unknown;
69
70
  }
71
+ export interface ArtifactGuaranteeVerifier {
72
+ kind: 'artifact';
73
+ ownerPackage: string;
74
+ artifactId: string;
75
+ entrypoint: string;
76
+ exportName?: string;
77
+ caseId: string;
78
+ description?: string;
79
+ }
80
+ export interface CatalogOperationGuaranteeVerifier {
81
+ kind: 'catalogOperation';
82
+ ownerPackage: string;
83
+ operationId: string;
84
+ caseId: string;
85
+ description?: string;
86
+ }
87
+ export type GuaranteeVerifierDefinition = ArtifactGuaranteeVerifier | CatalogOperationGuaranteeVerifier;
88
+ export interface GuaranteeVerifierCheck {
89
+ id: string;
90
+ status: 'passed' | 'failed';
91
+ durationMs: number;
92
+ diagnostics?: GuaranteeDiagnostic[];
93
+ error?: string;
94
+ evidence?: string[];
95
+ }
96
+ export interface GuaranteeVerifierResult {
97
+ schemaVersion: 'treeseed.guarantee-verifier-result/v1';
98
+ verifierId: string;
99
+ startedAt: string;
100
+ completedAt: string;
101
+ ok: boolean;
102
+ checks: GuaranteeVerifierCheck[];
103
+ [key: string]: unknown;
104
+ }
70
105
  interface GuaranteeManifest {
71
106
  id: string;
72
107
  journey: string;
@@ -93,4 +128,3 @@ export declare function discoverGuarantees(input: {
93
128
  total: number;
94
129
  };
95
130
  };
96
- export {};
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
2
2
  import { relative, resolve } from "node:path";
3
3
  import { parse } from "yaml";
4
+ import { runUiEvidenceTrustVerifier, validateUiEvidenceTrust } from "./evidence-trust.js";
4
5
  function walk(root, out = []) {
5
6
  if (!existsSync(root)) return out;
6
7
  for (const name of readdirSync(root)) {
@@ -37,5 +38,7 @@ function discoverGuarantees(input) {
37
38
  return { ok: diagnostics.every((entry) => entry.severity !== "error"), guarantees, diagnostics, counts: { total: guarantees.length } };
38
39
  }
39
40
  export {
40
- discoverGuarantees
41
+ discoverGuarantees,
42
+ runUiEvidenceTrustVerifier,
43
+ validateUiEvidenceTrust
41
44
  };
@@ -71,6 +71,16 @@ export interface OAuthDeviceAuthorizationResponse {
71
71
  expiresIn: number;
72
72
  interval: number;
73
73
  }
74
+ /** Safe browser presentation of a pending device grant. It never contains the device code. */
75
+ export interface OAuthDeviceApprovalPresentation {
76
+ schemaVersion: 'treeseed.oauth.device-approval-presentation/v1';
77
+ clientId: string;
78
+ clientName: string;
79
+ userCode: string;
80
+ scopes: OAuthScope[];
81
+ expiresAt: string;
82
+ status: 'pending';
83
+ }
74
84
  export interface OAuthTokenReceipt {
75
85
  tokenType: 'Bearer';
76
86
  accessToken: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.13.0-rc.43",
3
+ "version": "0.13.0-rc.45",
4
4
  "description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {