@hypit/hypit 0.1.12 → 0.1.14

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 (74) hide show
  1. package/README.md +36 -2
  2. package/bin/hypit.mjs +0 -2
  3. package/dist/public/model-kit.d.ts +16 -0
  4. package/package.json +3 -1
  5. package/packages/cli/README.md +3 -0
  6. package/packages/cli/package.json +1 -0
  7. package/packages/cli/src/commands/environment.ts +12 -7
  8. package/packages/cli/src/commands/results.ts +19 -3
  9. package/packages/cli/src/main.ts +2 -1
  10. package/packages/cli/src/oauth.ts +50 -7
  11. package/packages/cli/src/output.ts +2 -2
  12. package/packages/cli/src/source-discovery.ts +2 -2
  13. package/packages/credential-store-file/README.md +60 -0
  14. package/packages/credential-store-file/package.json +21 -0
  15. package/packages/credential-store-file/src/activation.ts +29 -0
  16. package/packages/credential-store-file/src/index.ts +1 -0
  17. package/packages/credential-store-file/src/store.ts +89 -0
  18. package/packages/fonts-open/src/surface.ts +8 -2
  19. package/packages/hyperframes/README.md +16 -2
  20. package/packages/hyperframes/src/browser-program.ts +6 -1
  21. package/packages/hyperframes/src/document.ts +31 -21
  22. package/packages/hyperframes/src/project.ts +11 -20
  23. package/packages/media-execution/README.md +7 -0
  24. package/packages/media-execution/src/execute.ts +5 -5
  25. package/packages/media-execution/src/index.ts +1 -1
  26. package/packages/media-execution/src/process-env.ts +20 -0
  27. package/packages/media-execution/src/surface.ts +83 -76
  28. package/packages/model-kit/README.md +28 -0
  29. package/packages/model-kit/src/index.ts +58 -19
  30. package/packages/package-loader-node/README.md +10 -0
  31. package/packages/package-loader-node/src/index.ts +1 -0
  32. package/packages/package-loader-node/src/loader.ts +25 -5
  33. package/packages/package-loader-node/src/location.ts +11 -2
  34. package/packages/project-context-node/README.md +2 -0
  35. package/packages/project-context-node/src/project-context.ts +5 -3
  36. package/packages/provider-hyperframes-local/README.md +95 -13
  37. package/packages/provider-hyperframes-local/package.json +13 -3
  38. package/packages/provider-hyperframes-local/src/activation.ts +20 -6
  39. package/packages/provider-hyperframes-local/src/browser-install.ts +5 -0
  40. package/packages/provider-hyperframes-local/src/browser.ts +118 -0
  41. package/packages/provider-hyperframes-local/src/capture-bootstrap.ts +4 -6
  42. package/packages/provider-hyperframes-local/src/capture-exit.ts +24 -0
  43. package/packages/provider-hyperframes-local/src/capture-process.ts +54 -59
  44. package/packages/provider-hyperframes-local/src/capture-worker.ts +28 -7
  45. package/packages/provider-hyperframes-local/src/capture.ts +12 -5
  46. package/packages/provider-hyperframes-local/src/opaque-capture.ts +46 -18
  47. package/packages/provider-hyperframes-local/src/options.ts +2 -2
  48. package/packages/provider-hyperframes-local/src/process-tree.ts +82 -0
  49. package/packages/provider-hyperframes-local/src/process.ts +22 -0
  50. package/packages/provider-hyperframes-local/src/program.ts +25 -33
  51. package/packages/provider-hyperframes-local/src/provider.ts +4 -7
  52. package/packages/provider-hyperframes-local/src/render.ts +9 -4
  53. package/packages/provider-hypihub/README.md +3 -0
  54. package/packages/runtime-host-node/README.md +5 -0
  55. package/packages/runtime-host-node/src/index.ts +7 -2
  56. package/packages/runtime-host-node/src/packages.ts +13 -7
  57. package/packages/runtime-local/README.md +10 -0
  58. package/packages/runtime-local/src/config.ts +1 -1
  59. package/packages/runtime-local/src/credentials.ts +10 -5
  60. package/packages/runtime-local/src/runtime.ts +1 -1
  61. package/packages/seedance/README.md +42 -0
  62. package/packages/seedance/src/index.ts +5 -22
  63. package/packages/seedance/src/surface.ts +2 -3
  64. package/packages/seedance/src/validation.ts +16 -0
  65. package/packages/studio/src/preview/runtime-shim.ts +17 -3
  66. package/packages/studio/src/server.ts +2 -2
  67. package/packages/video-cli/README.md +5 -1
  68. package/packages/video-cli/package.json +1 -0
  69. package/packages/video-cli/src/distribution.ts +3 -10
  70. package/packages/video-cli/src/version.ts +1 -1
  71. package/packages/workspace-fs-node/src/workspace.ts +2 -2
  72. package/packages/yt-dlp/README.md +3 -2
  73. package/packages/yt-dlp/package.json +4 -0
  74. package/packages/yt-dlp/src/download.ts +10 -14
@@ -13,6 +13,7 @@
13
13
  "@hypit/cli": "workspace:*",
14
14
  "@hypit/compiler-markup-node": "workspace:*",
15
15
  "@hypit/composition": "workspace:*",
16
+ "@hypit/credential-store-file": "workspace:*",
16
17
  "@hypit/credential-store-os": "workspace:*",
17
18
  "@hypit/driver-node": "workspace:*",
18
19
  "@hypit/estimate": "workspace:*",
@@ -12,8 +12,7 @@ import {
12
12
 
13
13
  // The Distribution root is the replaceable Hypit tool checkout, not this
14
14
  // package's source directory and never the author's project.
15
- const packageRoot = resolve(process.env.HYPIT_DISTRIBUTION_ROOT ?? resolve(import.meta.dirname, "../../.."));
16
- const installedLauncher = process.env.HYPIT_CLI_LAUNCHER;
15
+ const packageRoot = resolve(import.meta.dirname, "../../..");
17
16
  const defaultBuildResultRepository = {
18
17
  use: "@hypit/build-result-fs",
19
18
  config: { path: ".hypit/results" },
@@ -57,14 +56,8 @@ export const videoCliDistribution: CliDistribution = {
57
56
  : { distributionPackageRoot: options.distributionPackageRoot }),
58
57
  workerLaunch: {
59
58
  command: process.execPath,
60
- // The repository launcher registers TypeScript support before entering the CLI.
61
- // Tests that import this Distribution directly keep the current Node arguments.
62
- args: installedLauncher === undefined
63
- ? [
64
- ...process.execArgv.filter((item) => !item.startsWith("--test")),
65
- fileURLToPath(new URL("./cli.ts", import.meta.url)),
66
- ]
67
- : [installedLauncher],
59
+ // The loaded Distribution owns its Worker entry and TypeScript/package resolution.
60
+ args: [fileURLToPath(new URL("../../../bin/hypit.mjs", import.meta.url))],
68
61
  },
69
62
  }),
70
63
  openProjectResults: async (projectRoot, options) => {
@@ -20,7 +20,7 @@ export function writeVersionHelp(io: CliIo): void {
20
20
  /** Installation discovery belongs to the executable, independent of video execution and Skill installers. */
21
21
  export async function runVersionCli(argv: readonly string[], io: CliIo, environment: VersionEnvironment = {
22
22
  packageRoot: resolve(import.meta.dirname, "../../.."),
23
- ...(process.env.HYPIT_CLI_LAUNCHER === undefined ? {} : { launcher: process.env.HYPIT_CLI_LAUNCHER }),
23
+ launcher: resolve(import.meta.dirname, "../../../bin/hypit.mjs"),
24
24
  fetch: globalThis.fetch,
25
25
  }): Promise<void> {
26
26
  let check = false;
@@ -2,7 +2,7 @@ import { pathToFileURL } from "node:url";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { createReadStream } from "node:fs";
4
4
  import { readFile, realpath, stat } from "node:fs/promises";
5
- import { basename, dirname, isAbsolute, relative, resolve } from "node:path";
5
+ import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
6
6
 
7
7
  import type {
8
8
  Awaitable,
@@ -20,7 +20,7 @@ import type { BlobRef } from "@hypit/protocol";
20
20
 
21
21
  function isWithin(root: string, path: string): boolean {
22
22
  const relation = relative(root, path);
23
- return relation === "" || (!relation.startsWith("..") && !isAbsolute(relation));
23
+ return relation === "" || (relation !== ".." && !relation.startsWith(`..${sep}`) && !isAbsolute(relation));
24
24
  }
25
25
 
26
26
  export type NodeFilesystemExternalSource = {
@@ -17,8 +17,9 @@ Runtime Profile and creates no Build.
17
17
  - `downloadVideo(url, target)` downloads one video to the given path. Its caller owns destination
18
18
  preparation and overwrite policy. The target extension must be `.mp4`, `.mkv`, `.webm` or `.mov`.
19
19
 
20
- The downloader invokes the locked Python project in `services/yt-dlp` through `uv`, located relative
21
- to the installed Distribution. Ship its `pyproject.toml` and `uv.lock` with this package's source.
20
+ The downloader locates its declared `@hypit/yt-dlp-service-runtime` package through the active
21
+ Distribution/package resolver and invokes that package's locked Python project through `uv`.
22
+ Ship its `pyproject.toml` and `uv.lock`; the caller's location and a `services/` ancestor are irrelevant.
22
23
  `uv` and `ffmpeg` must be available on PATH; the CLI also uses `ffprobe` to report the saved media.
23
24
 
24
25
  The request selects `bv*+ba/b`, with `res:1080,vcodec:h264` format preferences and `--no-playlist`.
@@ -6,5 +6,9 @@
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./src/index.ts"
9
+ },
10
+ "dependencies": {
11
+ "@hypit/package-loader-node": "workspace:*",
12
+ "@hypit/yt-dlp-service-runtime": "workspace:*"
9
13
  }
10
14
  }
@@ -11,11 +11,11 @@
11
11
  * the same shape WhisperX and OpenCV already use for their Python programs.
12
12
  */
13
13
  import { spawnSync } from "node:child_process";
14
- import { existsSync } from "node:fs";
15
14
  import { copyFile, mkdtemp, readdir, rename, rm } from "node:fs/promises";
16
15
  import { tmpdir } from "node:os";
17
16
  import { dirname, extname, join } from "node:path";
18
- import { fileURLToPath } from "node:url";
17
+
18
+ import { resolveNodePackageResource } from "@hypit/package-loader-node";
19
19
 
20
20
  /**
21
21
  * Whether this is a link to fetch rather than a path to open.
@@ -34,20 +34,16 @@ export function isVideoUrl(value: string): boolean {
34
34
  }
35
35
 
36
36
  /**
37
- * The uv project holding the pinned `yt-dlp`, found by walking up from this module rather than from
38
- * the working directory, which is wherever the author happened to run the command from.
37
+ * The locked uv project is a Distribution package asset, the same way WhisperX and
38
+ * OpenCV locate their Python programs. Walking parents of this file only works
39
+ * while the module still sits above `services/` in a contributor checkout.
39
40
  */
40
41
  function serviceProject(): string {
41
- let directory = dirname(fileURLToPath(import.meta.url));
42
- while (true) {
43
- const candidate = join(directory, "services", "yt-dlp", "pyproject.toml");
44
- if (existsSync(candidate)) return dirname(candidate);
45
- const parent = dirname(directory);
46
- if (parent === directory) {
47
- throw new Error("no services/yt-dlp project above this module; the Distribution is incomplete");
48
- }
49
- directory = parent;
50
- }
42
+ return dirname(resolveNodePackageResource(
43
+ "@hypit/yt-dlp-service-runtime",
44
+ "pyproject.toml",
45
+ { from: import.meta.url },
46
+ ));
51
47
  }
52
48
 
53
49
  /**