@hyperframes/share 0.9.92 → 0.9.94

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.
package/README.md CHANGED
@@ -78,7 +78,7 @@ can use video-only; changed source, conflicts and unexpected upload failures nee
78
78
  an explicit choice to omit source. The CLI exposes `--video-only` for that choice.
79
79
  `filesForExport` only validates already-prepared source; it does not upload.
80
80
 
81
- The adapter uses the portable-source-v11 capture/manifest rules and
81
+ The adapter uses the portable-source-v12 capture/manifest rules and
82
82
  multipart transport. The pinned policy, Unicode 15.1 registry (with its license),
83
83
  and manifest test vectors are checked into this repository. Source is captured through
84
84
  verified file handles; upload bytes are streamed and checked against their hash.
@@ -17,6 +17,7 @@ export function snapshotFingerprint(snapshot: Snapshot): string;
17
17
  export function snapshotFiles(dir: string, files: Iterable<string>, { lenientIgnore }?: IgnoreOptions): Promise<Map<string, unknown> | null>;
18
18
  /** @param {Snapshot} before @param {Snapshot} after */
19
19
  export function diffChangedFiles(before: Snapshot, after: Snapshot): string[];
20
+ export { readSourceIgnore };
20
21
  export const HF_ID_ATTRIBUTE: RegExp;
21
22
  export function projectFingerprint(projectPath: string, options?: {
22
23
  byContent?: boolean;
@@ -25,3 +26,5 @@ export type Snapshot = Map<string, unknown>;
25
26
  export type IgnoreOptions = {
26
27
  lenientIgnore?: boolean;
27
28
  };
29
+ import { readSourceIgnore } from "./sourceIgnore.mjs";
30
+ export { isPrivateSourcePath, privateSourceSpelling } from "./sources/privateSource.mjs";
@@ -13,6 +13,7 @@ export function checkInventoryPaths(paths: readonly string[], keyOf?: (value: st
13
13
  export function excludedFolder(dir: string): boolean;
14
14
  /** A stored manifest may contain paths that are no longer eligible for upload. @param {string} path */
15
15
  export function canUploadStoredPath(path: string): boolean;
16
+ export { isPrivateSourcePath };
16
17
  /** @typedef {import("./types.js").PathRule} PathRule @typedef {import("./types.js").PolicyDocument} PolicyDocument */
17
18
  /** A path the policy refuses: `code` is the golden vectors' shared vocabulary, `rule` the excluding rule's id. */
18
19
  export class PathViolation extends Error {
@@ -24,7 +25,7 @@ export class PathViolation extends Error {
24
25
  }
25
26
  export function prefiltered(name: string): boolean;
26
27
  export function skippedSymlink(path: string): boolean;
27
- export function isPrivateSourcePath(path: string): boolean;
28
28
  export type PathMode = "current" | "stored" | "localV4";
29
29
  export type PathRule = import("./types.js").PathRule;
30
30
  export type PolicyDocument = import("./types.js").PolicyDocument;
31
+ import { isPrivateSourcePath } from "./privateSource.mjs";
@@ -0,0 +1,2 @@
1
+ export function isPrivateSourcePath(path: string): boolean;
2
+ export function privateSourceSpelling(path: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/share",
3
- "version": "0.9.92",
3
+ "version": "0.9.94",
4
4
  "description": "Shared review identity, version upload and sharing state for HyperFrames hosts",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -104,7 +104,7 @@
104
104
  "access": "public"
105
105
  },
106
106
  "dependencies": {
107
- "@hyperframes/parsers": "0.9.92"
107
+ "@hyperframes/parsers": "0.9.94"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@types/node": "^25.0.10",
@@ -8,6 +8,9 @@ import path from "node:path";
8
8
  import { createHash } from "node:crypto";
9
9
  import { isOutsideFilm } from "./appOwnedPaths.mjs";
10
10
 
11
+ export { readSourceIgnore };
12
+ export { isPrivateSourcePath, privateSourceSpelling } from "./sources/privateSource.mjs";
13
+
11
14
  export const HF_ID_ATTRIBUTE = /\sdata-hf-id\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/g;
12
15
 
13
16
  const sha256 = (/** @type {import("node:crypto").BinaryLike} */ data) =>
@@ -1,5 +1,5 @@
1
1
  {
2
- "policy_version": "portable-source-v11",
2
+ "policy_version": "portable-source-v12",
3
3
  "manifest": {
4
4
  "format_version": 1,
5
5
  "entrypoint": "index.html",
@@ -57,7 +57,7 @@
57
57
  "max_segment_bytes": 240,
58
58
  "separator": "/",
59
59
  "forbidden_characters": "<>:\"|?*\\",
60
- "reserved_segment_regex": "(?:con|prn|aux|nul|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\\..*)?",
60
+ "reserved_segment_regex": "(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\..*)?",
61
61
  "reserved_segment_match": "full match against each segment's comparison key, so CON, Con.txt and nul.tar.gz are all reserved",
62
62
  "canonical_spelling_roots": [
63
63
  ".media",
@@ -71,11 +71,13 @@
71
71
  ".amazonq",
72
72
  ".augment",
73
73
  ".aws",
74
+ ".azure",
74
75
  ".cache",
75
76
  ".claude",
76
77
  ".cline",
77
78
  ".clinerules",
78
79
  ".codex",
80
+ ".config",
79
81
  ".continue",
80
82
  ".continuerc.json",
81
83
  ".crush",
@@ -83,6 +85,7 @@
83
85
  ".cursor",
84
86
  ".devcontainer",
85
87
  ".devcontainer.json",
88
+ ".docker",
86
89
  ".ds_store",
87
90
  ".env",
88
91
  ".envrc",
@@ -92,9 +95,11 @@
92
95
  ".git",
93
96
  ".git-credentials",
94
97
  ".gitattributes",
98
+ ".gitconfig",
95
99
  ".github",
96
100
  ".gitmodules",
97
101
  ".gitpod.yml",
102
+ ".gnupg",
98
103
  ".grok",
99
104
  ".hg",
100
105
  ".hyperframes",
@@ -103,6 +108,7 @@
103
108
  ".junie",
104
109
  ".kilocode",
105
110
  ".kiro",
111
+ ".kube",
106
112
  ".lock",
107
113
  ".mcp.json",
108
114
  ".media",
@@ -293,10 +299,10 @@
293
299
  },
294
300
  {
295
301
  "id": "credential-files",
296
- "regex": "(?:[^/]+/)*(?:\\.netrc|\\.pypirc|\\.git-credentials|[^/]*\\.(?:pem|p12|pfx)|id_rsa[^/]*|id_ed25519[^/]*|(?:\\.ssh|\\.aws)(?:/.*)?)",
302
+ "regex": "(?:[^/]+/)*(?:\\.netrc|_netrc|\\.pypirc|\\.git-credentials|\\.gitconfig|pip\\.ini|[^/]*\\.(?:pem|p12|pfx)|id_(?:rsa|dsa|ecdsa|ed25519)[^/]*|(?:\\.ssh|\\.aws|\\.gnupg|\\.docker|\\.kube|\\.azure|\\.config/(?:gcloud|gh))(?:/.*)?)",
297
303
  "client_action": "exclude",
298
304
  "server_action": "reject",
299
- "basis": "Credential files by name at any depth. *.key is deliberately absent: Keynote decks are plausible project sources"
305
+ "basis": "Credential files and stores by name at any depth."
300
306
  },
301
307
  {
302
308
  "id": "os-metadata",
@@ -312,6 +318,13 @@
312
318
  "server_action": "reject",
313
319
  "basis": "A .hyperframes folder below the project root, such as one inside a project copied into compositions/, holds that copy's client records; only the root folder's named portable files below travel"
314
320
  },
321
+ {
322
+ "id": "private-source",
323
+ "regex": "(?:[^/]*/)*(?:(?:\\.git|\\.env[^/]*)(?:/.*)?|\\.npmrc|\\.yarnrc|\\.yarnrc\\.yml|\\.pypirc|pip\\.conf|pip\\.ini|\\.netrc|_netrc|\\.git-credentials|\\.gitconfig|\\.mcp\\.json|credentials\\.json|serviceaccountkey\\.json|service-account\\.json|service_account\\.json|id_(?:rsa|dsa|ecdsa|ed25519)[^/]*|[^/]*\\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx|tfstate(?:\\.backup)?|tfvars(?:\\.json)?)|(?:\\.ssh|\\.aws|\\.gnupg|\\.docker|\\.kube|\\.azure|\\.claude|\\.codex|\\.cursor|\\.agents|\\.gemini|\\.vscode|\\.idea|\\.config/(?:gcloud|gh))(?:/.*)?)",
324
+ "client_action": "exclude",
325
+ "server_action": "reject",
326
+ "basis": "The private-path rule for credentials, tool state, Git and environment files. Also match the parser spelling after NFKC, upper then lower case, removal of default-ignorable code points and Windows segment cleanup."
327
+ },
315
328
  {
316
329
  "id": "portable-transcripts",
317
330
  "regex": "\\.hyperframes/transcripts/(?:[^/]+/)*[^/]+\\.json",
@@ -440,7 +453,9 @@
440
453
  "agent-client-state": "(?:[^/]+/)*(?:\\.claude|\\.agents|\\.cursor|\\.vscode|\\.idea)(?:/.*)?",
441
454
  "work-tree-config": "(?!)",
442
455
  "git-directory-head": "(?!)",
443
- "nested-hyperframes-state": "(?!)"
456
+ "nested-hyperframes-state": "(?!)",
457
+ "credential-files": "(?:[^/]+/)*(?:\\.netrc|\\.pypirc|\\.git-credentials|[^/]*\\.(?:pem|p12|pfx)|id_rsa[^/]*|id_ed25519[^/]*|(?:\\.ssh|\\.aws)(?:/.*)?)",
458
+ "private-source": "(?!)"
444
459
  },
445
460
  "legacy_short_name_alias_names": [
446
461
  ".agent",
@@ -483,6 +498,6 @@
483
498
  ".yarnrc",
484
499
  ".yarnrc.yml"
485
500
  ],
486
- "rule": "Only stored snapshot reads use each listed rule's regex in place of its current one, and the v10 short_name_alias_names in place of the current ones, to retain immutable manifest digests: agent-client-state its v3 regex, and work-tree-config, added in v7, git-directory-head, added in v9, and nested-hyperframes-state, added in v10, none. New captures and uploads use the current rules and short names. Clients never install, and the server never signs a download URL for, a path a current rule excludes or a segment that is a current short name."
501
+ "rule": "Only stored snapshot reads use each listed rule's regex in place of its current one, and the v10 short_name_alias_names in place of the current ones, to retain immutable manifest digests: agent-client-state its v3 regex, and work-tree-config, added in v7, git-directory-head, added in v9, and nested-hyperframes-state, added in v10, none. The credential-files rule keeps its v11 regex. New captures and uploads use the current rules and short names. Clients never install, and the server never signs a download URL for, a path a current rule excludes or a segment that is a current short name. The private-source rule applies only to current validation and delivery."
487
502
  }
488
503
  }
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
2
  // Validate source manifests against the bundled sync contract.
3
- import { isCredentialOrToolStatePath, isVcsOrSecretPath } from "@hyperframes/parsers/private-path";
3
+ import { isPrivateSourcePath, privateSourceSpelling } from "./privateSource.mjs";
4
+ export { isPrivateSourcePath };
4
5
  import { readContract } from "./contract.mjs";
5
6
  import {
6
7
  UNICODE_VERSION,
@@ -11,7 +12,7 @@ import {
11
12
  withoutIgnorable,
12
13
  } from "./unicode.mjs";
13
14
 
14
- const PATH_POLICY_VERSION = "portable-source-v11";
15
+ const PATH_POLICY_VERSION = "portable-source-v12";
15
16
 
16
17
  /** @typedef {import("./types.js").PathRule} PathRule @typedef {import("./types.js").PolicyDocument} PolicyDocument */
17
18
 
@@ -109,10 +110,15 @@ const policy = () => (compiled ??= compile(readContract("path-policy.json")));
109
110
  /** Every segment replaced by its comparison key. @param {string} path */
110
111
  const foldedPath = (path) => path.split("/").map(comparisonKey).join("/");
111
112
 
113
+ /** @param {{ pattern: RegExp, rule: PathRule }} entry @param {string} folded @param {string} path */
114
+ const matches = ({ pattern, rule }, folded, path) =>
115
+ pattern.test(folded) ||
116
+ (rule.id === "private-source" && pattern.test(privateSourceSpelling(path)));
117
+
112
118
  /** The first rule matching a path's folded spelling. @param {string} path @returns {PathRule} */
113
119
  export function classifyPath(path) {
114
120
  const folded = foldedPath(path);
115
- const found = policy().rules.find(({ pattern }) => pattern.test(folded));
121
+ const found = policy().rules.find((entry) => matches(entry, folded, path));
116
122
  if (!found) throw new Error("the path policy's catch-all rule did not match");
117
123
  return found.rule;
118
124
  }
@@ -169,7 +175,7 @@ export function validatePath(path, mode = "current") {
169
175
  if (root !== undefined && segments[0] !== root)
170
176
  throw new PathViolation("reserved_path_alias", path);
171
177
  const folded = keys.join("/");
172
- const found = rules.find(({ pattern }) => pattern.test(folded));
178
+ const found = rules.find((entry) => matches(entry, folded, path));
173
179
  if (!found) throw new Error("the path policy's catch-all rule did not match");
174
180
  if (found.rule.server_action === "reject")
175
181
  throw new PathViolation("excluded_path", path, found.rule.id);
@@ -246,10 +252,6 @@ export function excludedFolder(dir) {
246
252
  });
247
253
  }
248
254
 
249
- /** Private names omitted locally even when the wire contract accepts them. @param {string} path */
250
- export const isPrivateSourcePath = (path) =>
251
- isVcsOrSecretPath(path) || isCredentialOrToolStatePath(path);
252
-
253
255
  /** A stored manifest may contain paths that are no longer eligible for upload. @param {string} path */
254
256
  export function canUploadStoredPath(path) {
255
257
  if (isPrivateSourcePath(path)) return false;
@@ -0,0 +1,13 @@
1
+ // @ts-check
2
+ import {
3
+ isCredentialOrToolStatePath,
4
+ isVcsOrSecretPath,
5
+ projectPathSegments,
6
+ } from "@hyperframes/parsers/private-path";
7
+
8
+ /** @param {string} path */
9
+ export const isPrivateSourcePath = (path) =>
10
+ isVcsOrSecretPath(path) || isCredentialOrToolStatePath(path);
11
+
12
+ /** @param {string} path */
13
+ export const privateSourceSpelling = (path) => projectPathSegments(path).join("/");