@nyte-ai/host 0.0.18 → 0.0.19
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/THIRD-PARTY-NOTICES.md +66 -0
- package/dist/chunks/{canvas-preview-5hxat7hh.js → canvas-preview-11nadadc.js} +8 -6
- package/dist/chunks/{canvas-preview-rp6fz0w5.js → canvas-preview-2jwbe14k.js} +5 -5
- package/dist/chunks/{canvas-preview-m02v4yy6.js → canvas-preview-55s0y68g.js} +3 -2
- package/dist/chunks/{canvas-preview-xn10d4f8.js → canvas-preview-5ekjx6sw.js} +9 -4
- package/dist/chunks/{canvas-preview-75db60xy.js → canvas-preview-8xc0vn7v.js} +5 -4
- package/dist/chunks/{canvas-preview-zn2d0k9d.js → canvas-preview-af86jz8t.js} +14 -6
- package/dist/chunks/{canvas-preview-d9wwhbtz.js → canvas-preview-aq5j4p25.js} +1 -1
- package/dist/chunks/{canvas-preview-j1tnf51w.js → canvas-preview-b2v8wfnz.js} +1 -1
- package/dist/chunks/canvas-preview-befkjea2.js +60 -0
- package/dist/chunks/canvas-preview-bxnqt8cd.js +103 -0
- package/dist/chunks/{canvas-preview-vax9ne4e.js → canvas-preview-cawy6vbz.js} +22 -11
- package/dist/chunks/{canvas-preview-senpjwep.js → canvas-preview-crmzxxt8.js} +3 -3
- package/dist/chunks/{canvas-preview-ymgz0937.js → canvas-preview-drctegz4.js} +8 -4
- package/dist/chunks/{canvas-preview-yrfz2ak6.js → canvas-preview-e3vnkkc5.js} +6 -6
- package/dist/chunks/canvas-preview-ec2mt7es.js +108 -0
- package/dist/chunks/{canvas-preview-1ta3avah.js → canvas-preview-fxa0rfb0.js} +10 -5
- package/dist/chunks/{canvas-preview-8xgt67ka.js → canvas-preview-g5fkjs34.js} +1 -1
- package/dist/chunks/{canvas-preview-g3qj3y3k.js → canvas-preview-jeddjex8.js} +13 -3
- package/dist/chunks/{canvas-preview-0nrnbt76.js → canvas-preview-k1yg4fgp.js} +199 -125
- package/dist/chunks/canvas-preview-kp75gb63.js +141 -0
- package/dist/chunks/{canvas-preview-ewgspmsd.js → canvas-preview-n2a35zv5.js} +1 -1
- package/dist/chunks/{canvas-preview-h8hshnff.js → canvas-preview-pkzqg96v.js} +1 -1
- package/dist/chunks/{canvas-preview-evh92ywd.js → canvas-preview-tnqe7k0b.js} +15 -10
- package/dist/chunks/{canvas-preview-ehf3vp31.js → canvas-preview-vm9zdp2t.js} +45 -58
- package/dist/chunks/{canvas-preview-76fwvd6e.js → canvas-preview-w54ymtb3.js} +1 -1
- package/dist/chunks/canvas-preview-y5y6ghaw.js +125 -0
- package/dist/chunks/{canvas-preview-98aj5p34.js → canvas-preview-ycepb05s.js} +1 -1
- package/dist/src/canvas-preview.js +7 -3
- package/dist/src/deploy/cloudflare/worker.js +1 -1
- package/dist/src/deploy/vercel/server/routes/[...].js +2 -2
- package/dist/src/deploy/vercel/server/utils/host.js +1 -1
- package/dist/src/deploy/vercel/server/workflows/drive.js +3 -3
- package/dist/src/images/exif.d.ts +1 -0
- package/dist/src/images/exif.js +6 -0
- package/dist/src/images/node.d.ts +37 -0
- package/dist/src/images/node.js +12 -0
- package/dist/src/images/photon.d.ts +3 -0
- package/dist/src/images/photon.js +7 -0
- package/dist/src/images/worker.d.ts +1 -0
- package/dist/src/images/worker.js +23 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +23 -22
- package/dist/src/listen-fetch.js +3 -3
- package/dist/src/listen.js +4 -4
- package/dist/src/local/command.d.ts +5 -0
- package/dist/src/local/command.js +6 -2
- package/dist/src/local/files.js +2 -2
- package/dist/src/local/git-watch.d.ts +1 -1
- package/dist/src/local/git-watch.js +1 -1
- package/dist/src/local/git.js +3 -3
- package/dist/src/local/github.js +2 -2
- package/dist/src/local/jobs.d.ts +1 -1
- package/dist/src/local/jobs.js +2 -1
- package/dist/src/local/provider.js +9 -9
- package/dist/src/local/snapshots.js +2 -2
- package/dist/src/local/worktrees.js +2 -2
- package/dist/src/mcp/connect.d.ts +0 -13
- package/dist/src/mcp/connect.js +1 -1
- package/dist/src/mcp/hub.js +2 -2
- package/dist/src/open.d.ts +2 -30
- package/dist/src/open.js +20 -18
- package/dist/src/serve/binding.js +1 -1
- package/dist/src/serve/handler.js +2 -2
- package/dist/src/sqlite.d.ts +2 -1
- package/dist/src/sqlite.js +4 -3
- package/dist/src/store-usage.js +4 -1
- package/dist/src/usage-history.d.ts +54 -0
- package/dist/src/usage-history.js +14 -0
- package/dist/src/usage-service.d.ts +2 -1
- package/dist/src/usage-service.js +7 -3
- package/dist/src/usage-worker.js +8 -4
- package/dist/src/usage.d.ts +150 -27
- package/dist/src/usage.js +12 -2
- package/package.json +16 -8
- package/src/canvas-preview.ts +4 -3
- package/src/images/exif.ts +69 -0
- package/src/images/node.ts +163 -0
- package/src/images/photon.ts +141 -0
- package/src/images/worker.ts +29 -0
- package/src/index.ts +19 -1
- package/src/local/command.ts +64 -12
- package/src/local/files.ts +8 -3
- package/src/local/git-watch.ts +16 -6
- package/src/local/git.ts +7 -2
- package/src/local/github.ts +3 -4
- package/src/local/jobs.ts +55 -69
- package/src/local/snapshots.ts +4 -2
- package/src/local/worktrees.ts +4 -4
- package/src/mcp/connect.ts +1 -14
- package/src/open.ts +16 -36
- package/src/serve/binding.ts +4 -3
- package/src/sqlite.ts +33 -8
- package/src/store-usage.ts +5 -2
- package/src/usage-history.ts +219 -0
- package/src/usage-service.ts +12 -3
- package/src/usage.ts +251 -176
- package/dist/chunks/canvas-preview-a3yw0j70.js +0 -72
- package/dist/chunks/canvas-preview-azg56359.js +0 -68
- package/dist/src/store-owner.d.ts +0 -15
- package/dist/src/store-owner.js +0 -9
- package/src/store-owner.ts +0 -98
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -91,6 +91,9 @@ SOFTWARE.
|
|
|
91
91
|
- Transcript reconciliation, checkpoint instruction snapshots, provider system
|
|
92
92
|
updates, and cache warming are ported from the 1.0.0 release commit
|
|
93
93
|
`a13d35a742c6ef8462812a28fbe1d8c8b7431c32`.
|
|
94
|
+
- Fitting images to model limits (`packages/core/src/agent/images.ts` and
|
|
95
|
+
`packages/host/src/images`) is ported from `@earendil-works/pi-durable`'s
|
|
96
|
+
images at commit `73f8de80bc87021375f8b525292ac07492253002`.
|
|
94
97
|
|
|
95
98
|
License: MIT, with the following notice:
|
|
96
99
|
|
|
@@ -148,6 +151,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
148
151
|
THE SOFTWARE.
|
|
149
152
|
```
|
|
150
153
|
|
|
154
|
+
## Photon (`silvia-odwyer/photon`)
|
|
155
|
+
|
|
156
|
+
- Repository: https://github.com/silvia-odwyer/photon
|
|
157
|
+
- Package: `@silvia-odwyer/photon` 0.3.3
|
|
158
|
+
- What: the host decodes, orients, scales and re-encodes images for the model
|
|
159
|
+
with Photon's WebAssembly build.
|
|
160
|
+
|
|
161
|
+
License: Apache License 2.0, reproduced in the appendix below. Copyright 2023
|
|
162
|
+
Silvia O'Dwyer.
|
|
163
|
+
|
|
151
164
|
## Pierre
|
|
152
165
|
|
|
153
166
|
- Repository: https://github.com/pierrecomputer/pierre
|
|
@@ -561,6 +574,59 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
561
574
|
SOFTWARE.
|
|
562
575
|
```
|
|
563
576
|
|
|
577
|
+
## snapcn (`snapcndev/snapcn`)
|
|
578
|
+
|
|
579
|
+
- Repository: https://github.com/snapcndev/snapcn
|
|
580
|
+
- What: the launch film's Logo Flicker and Check Cycle scenes
|
|
581
|
+
(`packages/lab/video/src/snap-cn/`) are adapted from snapcn's registry
|
|
582
|
+
components at commit `47ee435f17d85f74abf48b095b40d64fc9616fb0`.
|
|
583
|
+
|
|
584
|
+
License: MIT, with the following notice:
|
|
585
|
+
|
|
586
|
+
```text
|
|
587
|
+
MIT License
|
|
588
|
+
|
|
589
|
+
Copyright (c) 2026 Sri Nath (snap-cn)
|
|
590
|
+
|
|
591
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
592
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
593
|
+
in the Software without restriction, including without limitation the rights
|
|
594
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
595
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
596
|
+
furnished to do so, subject to the following conditions:
|
|
597
|
+
|
|
598
|
+
The above copyright notice and this permission notice shall be included in all
|
|
599
|
+
copies or substantial portions of the Software.
|
|
600
|
+
|
|
601
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
602
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
603
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
604
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
605
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
606
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
607
|
+
SOFTWARE.
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
## Naybr, "Copyright Free Gameplay (No Commentary) - Minecraft Survival"
|
|
611
|
+
|
|
612
|
+
- Source: https://www.youtube.com/watch?v=GPsGyv5zTlM, by Naybr (youtube.com/@Naybr)
|
|
613
|
+
- What: the launch film opens on four shots from 0:30 to 2:30 of this video
|
|
614
|
+
(`clip` in `packages/lab/video/src/film/media.ts`). The footage is not in
|
|
615
|
+
the repository; `packages/lab/video/README.md` says how to fetch it.
|
|
616
|
+
|
|
617
|
+
License: Creative Commons Attribution, as published on YouTube. The author
|
|
618
|
+
allows use, modification, redistribution and monetisation, with this credit
|
|
619
|
+
wherever the gameplay is used: "Gameplay – youtube.com/@Naybr".
|
|
620
|
+
|
|
621
|
+
## Photographs in the launch film
|
|
622
|
+
|
|
623
|
+
- Source: Wikimedia Commons; each file's author and source page are listed in
|
|
624
|
+
`photos` in `packages/lab/video/src/film/media.ts`.
|
|
625
|
+
- What: eleven photographs the launch film cuts between. They are not in the
|
|
626
|
+
repository.
|
|
627
|
+
|
|
628
|
+
License: every one is public domain or CC0. None requires attribution.
|
|
629
|
+
|
|
564
630
|
## Design references
|
|
565
631
|
|
|
566
632
|
These credits record design sources. They do not grant a license to the
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cacheSavings2,
|
|
3
|
-
usageTokens2
|
|
4
|
-
} from "./canvas-preview-srgfpdmf.js";
|
|
5
1
|
import {
|
|
6
2
|
decodeEvent2,
|
|
7
3
|
parseNumber2,
|
|
8
4
|
parseText2
|
|
9
5
|
} from "./canvas-preview-69fkk9yn.js";
|
|
6
|
+
import {
|
|
7
|
+
storePath2
|
|
8
|
+
} from "./canvas-preview-tnqe7k0b.js";
|
|
9
|
+
import {
|
|
10
|
+
cacheSavings2,
|
|
11
|
+
usageTokens2
|
|
12
|
+
} from "./canvas-preview-srgfpdmf.js";
|
|
10
13
|
|
|
11
14
|
// src/store-usage.ts
|
|
12
15
|
import { existsSync } from "node:fs";
|
|
13
|
-
import { join } from "node:path";
|
|
14
16
|
import { DatabaseSync } from "node:sqlite";
|
|
15
17
|
import {
|
|
16
18
|
decodeObject,
|
|
@@ -145,7 +147,7 @@ function projectUsageReport2(stores, window, readAt) {
|
|
|
145
147
|
}
|
|
146
148
|
function readNyteUsage2(home, window) {
|
|
147
149
|
const readAt = Date.now();
|
|
148
|
-
const path =
|
|
150
|
+
const path = storePath2(home);
|
|
149
151
|
if (!existsSync(path))
|
|
150
152
|
return projectUsageReport2([], window, readAt);
|
|
151
153
|
let database;
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./canvas-preview-0nq75h9k.js";
|
|
4
4
|
import {
|
|
5
5
|
run2
|
|
6
|
-
} from "./canvas-preview-
|
|
6
|
+
} from "./canvas-preview-bxnqt8cd.js";
|
|
7
7
|
|
|
8
8
|
// src/local/worktrees.ts
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { copyFile, mkdir, realpath, rm, stat } from "node:fs/promises";
|
|
11
11
|
import { homedir, tmpdir } from "node:os";
|
|
12
|
-
import { basename, dirname, join } from "node:path";
|
|
12
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
13
13
|
import { SdkError } from "@nyte-ai/schema";
|
|
14
14
|
var ENV = { GIT_TERMINAL_PROMPT: "0", LC_ALL: "C" };
|
|
15
15
|
function gitCommand(binary = "git") {
|
|
@@ -29,7 +29,7 @@ async function listWorktrees2(cwd, options) {
|
|
|
29
29
|
const fields = record.split("\x00");
|
|
30
30
|
const path = fields.find((field) => field.startsWith("worktree "))?.slice(9);
|
|
31
31
|
const branch = fields.find((field) => field.startsWith("branch refs/heads/"))?.slice(18);
|
|
32
|
-
return path === undefined ? [] : [{ path, branch: branch ?? null }];
|
|
32
|
+
return path === undefined ? [] : [{ path: resolve(path), branch: branch ?? null }];
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
async function addWorktree2(cwd, input, options) {
|
|
@@ -67,7 +67,7 @@ function localWorktrees2(options) {
|
|
|
67
67
|
const branch = `nyte/${slug}`;
|
|
68
68
|
const below = (root) => ({
|
|
69
69
|
kind: "local",
|
|
70
|
-
path:
|
|
70
|
+
path: resolve(root, repo.prefix)
|
|
71
71
|
});
|
|
72
72
|
const listed = (await listWorktrees2(repo.root, options)).find((worktree) => worktree.branch === branch);
|
|
73
73
|
if (listed !== undefined)
|
|
@@ -119,7 +119,7 @@ async function readRepository(git, cwd) {
|
|
|
119
119
|
]).catch(() => null);
|
|
120
120
|
const [root, gitDir, prefix = ""] = out?.split(`
|
|
121
121
|
`) ?? [];
|
|
122
|
-
return root === undefined || gitDir === undefined || root === "" ? null : { root, gitDir, prefix };
|
|
122
|
+
return root === undefined || gitDir === undefined || root === "" ? null : { root: resolve(root), gitDir: resolve(gitDir), prefix };
|
|
123
123
|
}
|
|
124
124
|
function worktreeSlug(name, title) {
|
|
125
125
|
const words = (title ?? "").toLowerCase().replace(/[^a-z0-9]+/gu, "-").slice(0, 40).replace(/^-+|-+$/gu, "");
|
|
@@ -65,6 +65,7 @@ function bindConnection2(connection, options) {
|
|
|
65
65
|
return null;
|
|
66
66
|
},
|
|
67
67
|
"models.setDefault": ({ ref }) => connection.models.setDefault(ref),
|
|
68
|
+
"models.setListing": ({ refs, listing }) => connection.models.setListing(refs, listing),
|
|
68
69
|
"models.verify": ({ provider }) => connection.models.verify(provider),
|
|
69
70
|
"models.login": async (input) => {
|
|
70
71
|
const { provider } = input;
|
|
@@ -204,8 +205,8 @@ function bindConnection2(connection, options) {
|
|
|
204
205
|
"mcp.remove": ({ workspace: id, server, scope }) => workspace(id).mcp.remove(server, scope),
|
|
205
206
|
"workspace.update": ({ workspace: id, patch }) => workspace(id).update(patch),
|
|
206
207
|
"workspace.reload": ({ workspace: id }) => workspace(id).reload(),
|
|
207
|
-
"workspace.changes": ({ workspace: id,
|
|
208
|
-
"workspace.patches": async ({ workspace: id,
|
|
208
|
+
"workspace.changes": ({ workspace: id, source }) => workspace(id).changes(source),
|
|
209
|
+
"workspace.patches": async ({ workspace: id, source, paths, options }) => mapped(workspace(id).patches(source, paths, options), patchesWire),
|
|
209
210
|
"workspace.files": async ({ workspace: id }) => capabilityWire(await workspace(id).files()),
|
|
210
211
|
"workspace.git": async ({ workspace: id }) => capabilityWire(await workspace(id).git()),
|
|
211
212
|
"workspace.github": async ({ workspace: id }) => capabilityWire(await workspace(id).github()),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./canvas-preview-0nq75h9k.js";
|
|
4
4
|
import {
|
|
5
5
|
run2
|
|
6
|
-
} from "./canvas-preview-
|
|
6
|
+
} from "./canvas-preview-bxnqt8cd.js";
|
|
7
7
|
import {
|
|
8
8
|
feed2
|
|
9
9
|
} from "./canvas-preview-yjz0f7n4.js";
|
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
} from "./canvas-preview-tjhabynd.js";
|
|
18
18
|
import {
|
|
19
19
|
createWatcher2
|
|
20
|
-
} from "./canvas-preview-
|
|
20
|
+
} from "./canvas-preview-af86jz8t.js";
|
|
21
21
|
import {
|
|
22
22
|
decodeText2
|
|
23
23
|
} from "./canvas-preview-kn7kvbfj.js";
|
|
24
24
|
|
|
25
25
|
// src/local/git.ts
|
|
26
26
|
import { lstat, readFile, stat } from "node:fs/promises";
|
|
27
|
-
import { join } from "node:path";
|
|
27
|
+
import { join, resolve } from "node:path";
|
|
28
28
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
29
29
|
import { dev } from "@nyte-ai/core";
|
|
30
30
|
var PATCH_BATCH = 32;
|
|
@@ -73,7 +73,12 @@ function localGit2(env, options) {
|
|
|
73
73
|
return null;
|
|
74
74
|
const [root, gitDir, prefix = "", commonDir] = ran.stdout.toString("utf8").split(`
|
|
75
75
|
`);
|
|
76
|
-
return root === undefined || gitDir === undefined ? null : {
|
|
76
|
+
return root === undefined || gitDir === undefined ? null : {
|
|
77
|
+
root: resolve(root),
|
|
78
|
+
gitDir: resolve(gitDir),
|
|
79
|
+
commonDir: resolve(commonDir || gitDir),
|
|
80
|
+
prefix
|
|
81
|
+
};
|
|
77
82
|
};
|
|
78
83
|
const repository = async () => {
|
|
79
84
|
const pending = located;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
run2,
|
|
3
|
+
spawnCommand2,
|
|
4
|
+
killTree2,
|
|
3
5
|
findExecutable2
|
|
4
|
-
} from "./canvas-preview-
|
|
6
|
+
} from "./canvas-preview-bxnqt8cd.js";
|
|
5
7
|
|
|
6
8
|
// src/local/github.ts
|
|
7
|
-
import { spawn } from "node:child_process";
|
|
8
9
|
import { homedir } from "node:os";
|
|
9
10
|
import { Type } from "typebox";
|
|
10
11
|
import { Compile } from "typebox/compile";
|
|
@@ -148,7 +149,7 @@ function startSignIn(file, cwd, ended) {
|
|
|
148
149
|
let userCode;
|
|
149
150
|
let verificationUri;
|
|
150
151
|
let done = false;
|
|
151
|
-
const child =
|
|
152
|
+
const child = spawnCommand2(file, [
|
|
152
153
|
"auth",
|
|
153
154
|
"login",
|
|
154
155
|
"--hostname",
|
|
@@ -167,7 +168,7 @@ function startSignIn(file, cwd, ended) {
|
|
|
167
168
|
child.stdout?.destroy();
|
|
168
169
|
child.stderr?.destroy();
|
|
169
170
|
if (child.exitCode === null && child.signalCode === null)
|
|
170
|
-
child
|
|
171
|
+
killTree2(child, "SIGKILL");
|
|
171
172
|
started.resolve(start);
|
|
172
173
|
ended();
|
|
173
174
|
};
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
} from "./canvas-preview-mgcx2b2p.js";
|
|
5
5
|
|
|
6
6
|
// src/local/git-watch.ts
|
|
7
|
-
import {
|
|
7
|
+
import { lstat } from "node:fs/promises";
|
|
8
|
+
import { isAbsolute, join, relative, sep } from "node:path";
|
|
8
9
|
var WATCH_DELAY_MS = 250;
|
|
9
10
|
var POLL_MS = 2000;
|
|
10
11
|
var GIT_STATE = new Set([
|
|
@@ -57,7 +58,8 @@ function createWatcher2(cwd, read, repository, forget) {
|
|
|
57
58
|
check();
|
|
58
59
|
}));
|
|
59
60
|
};
|
|
60
|
-
|
|
61
|
+
const gitEntry = async () => await lstat(join(cwd, ".git")).catch(() => null) !== null;
|
|
62
|
+
Promise.all([repository(), gitEntry()]).then(([repo, hadGit]) => {
|
|
61
63
|
if (stopped)
|
|
62
64
|
return;
|
|
63
65
|
const insideGitDir = repo === null ? null : pathInside(cwd, repo.gitDir);
|
|
@@ -65,8 +67,11 @@ function createWatcher2(cwd, read, repository, forget) {
|
|
|
65
67
|
const moved = async (paths) => {
|
|
66
68
|
let found = "none";
|
|
67
69
|
for (const path of paths) {
|
|
68
|
-
if (path === ".git")
|
|
69
|
-
|
|
70
|
+
if (path === ".git") {
|
|
71
|
+
if (await gitEntry() !== hadGit)
|
|
72
|
+
return "repository";
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
70
75
|
if (repo === null || ignores === null)
|
|
71
76
|
continue;
|
|
72
77
|
if (insideGitDir !== null && (path === insideGitDir || path.startsWith(`${insideGitDir}/`))) {
|
|
@@ -76,7 +81,10 @@ function createWatcher2(cwd, read, repository, forget) {
|
|
|
76
81
|
}
|
|
77
82
|
if (path.endsWith(".gitignore"))
|
|
78
83
|
ignores.forget(`${repo.prefix}${path}`.split("/").slice(0, -1).join("/"));
|
|
79
|
-
if (found
|
|
84
|
+
if (found !== "none")
|
|
85
|
+
continue;
|
|
86
|
+
const directory = (await lstat(join(cwd, path)).catch(() => null))?.isDirectory();
|
|
87
|
+
if (!await ignores.ignored(`${repo.prefix}${path}`, directory === true))
|
|
80
88
|
found = "status";
|
|
81
89
|
}
|
|
82
90
|
return found;
|
|
@@ -123,7 +131,7 @@ function createWatcher2(cwd, read, repository, forget) {
|
|
|
123
131
|
}
|
|
124
132
|
function movesStatus(path) {
|
|
125
133
|
const [top = ""] = path.split("/");
|
|
126
|
-
return path === "" || GIT_STATE.has(top) || path
|
|
134
|
+
return path === "" || GIT_STATE.has(top) || path.startsWith("refs/heads/") || path.startsWith("refs/remotes/");
|
|
127
135
|
}
|
|
128
136
|
function pathInside(cwd, dir) {
|
|
129
137
|
const inside = relative(cwd, dir);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/images/exif.ts
|
|
2
|
+
var ORIENTATION_TAG = 274;
|
|
3
|
+
function exifOrientation2(bytes) {
|
|
4
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
5
|
+
const tiff = tiffStart(bytes, view);
|
|
6
|
+
if (tiff < 0 || tiff + 8 > bytes.length)
|
|
7
|
+
return 1;
|
|
8
|
+
const little = bytes[tiff] === 73 && bytes[tiff + 1] === 73;
|
|
9
|
+
const directory = tiff + view.getUint32(tiff + 4, little);
|
|
10
|
+
if (directory + 2 > bytes.length)
|
|
11
|
+
return 1;
|
|
12
|
+
const entries = view.getUint16(directory, little);
|
|
13
|
+
for (let index = 0;index < entries; index++) {
|
|
14
|
+
const entry = directory + 2 + index * 12;
|
|
15
|
+
if (entry + 12 > bytes.length)
|
|
16
|
+
return 1;
|
|
17
|
+
if (view.getUint16(entry, little) === ORIENTATION_TAG) {
|
|
18
|
+
const value = view.getUint16(entry + 8, little);
|
|
19
|
+
return value >= 1 && value <= 8 ? value : 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
function tiffStart(bytes, view) {
|
|
25
|
+
if (bytes[0] === 255 && bytes[1] === 216) {
|
|
26
|
+
for (let offset = 2;offset + 4 <= bytes.length; ) {
|
|
27
|
+
if (bytes[offset] !== 255)
|
|
28
|
+
return -1;
|
|
29
|
+
const marker = view.getUint8(offset + 1);
|
|
30
|
+
if (marker === 255) {
|
|
31
|
+
offset++;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (marker === 225 && startsExif(bytes, offset + 4))
|
|
35
|
+
return offset + 10;
|
|
36
|
+
offset += 2 + view.getUint16(offset + 2);
|
|
37
|
+
}
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
if (ascii(bytes, 0, "RIFF") && ascii(bytes, 8, "WEBP")) {
|
|
41
|
+
for (let offset = 12;offset + 8 <= bytes.length; ) {
|
|
42
|
+
const size = view.getUint32(offset + 4, true);
|
|
43
|
+
if (ascii(bytes, offset, "EXIF"))
|
|
44
|
+
return startsExif(bytes, offset + 8) ? offset + 14 : offset + 8;
|
|
45
|
+
offset += 8 + size + size % 2;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
function startsExif(bytes, offset) {
|
|
51
|
+
return ascii(bytes, offset, "Exif") && bytes[offset + 4] === 0 && bytes[offset + 5] === 0;
|
|
52
|
+
}
|
|
53
|
+
function ascii(bytes, offset, text) {
|
|
54
|
+
for (let index = 0;index < text.length; index++)
|
|
55
|
+
if (bytes[offset + index] !== text.charCodeAt(index))
|
|
56
|
+
return false;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { exifOrientation2 };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/local/command.ts
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { access, stat } from "node:fs/promises";
|
|
5
|
+
import { delimiter, extname, isAbsolute, join } from "node:path";
|
|
6
|
+
import { SdkError } from "@nyte-ai/schema";
|
|
7
|
+
import { processEnvironment } from "@nyte-ai/core";
|
|
8
|
+
async function run2(file, args, options) {
|
|
9
|
+
await processEnvironment();
|
|
10
|
+
const resolved = process.platform === "win32" ? await findExecutable2(file) ?? file : file;
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const child = spawnCommand2(resolved, args, {
|
|
13
|
+
cwd: options.cwd,
|
|
14
|
+
env: { ...process.env, ...options.env },
|
|
15
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
16
|
+
windowsHide: true,
|
|
17
|
+
timeout: options.timeoutMs
|
|
18
|
+
});
|
|
19
|
+
const stdout = [];
|
|
20
|
+
const stderr = [];
|
|
21
|
+
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
22
|
+
let size = 0;
|
|
23
|
+
let truncated = false;
|
|
24
|
+
child.on("error", (error) => reject(new SdkError("unavailable", `Cannot run ${file}: ${error.message}`)));
|
|
25
|
+
child.stdout?.on("data", (chunk) => {
|
|
26
|
+
if (truncated)
|
|
27
|
+
return;
|
|
28
|
+
size += chunk.byteLength;
|
|
29
|
+
if (size > limit) {
|
|
30
|
+
truncated = true;
|
|
31
|
+
stdout.push(chunk.subarray(0, chunk.byteLength - (size - limit)));
|
|
32
|
+
child.kill("SIGKILL");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
stdout.push(chunk);
|
|
36
|
+
});
|
|
37
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
38
|
+
child.stdin?.on("error", () => {
|
|
39
|
+
return;
|
|
40
|
+
});
|
|
41
|
+
child.on("close", (code) => resolve({
|
|
42
|
+
code,
|
|
43
|
+
stdout: Buffer.concat(stdout),
|
|
44
|
+
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
45
|
+
truncated
|
|
46
|
+
}));
|
|
47
|
+
child.stdin?.end(options.input);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function spawnCommand2(file, args, options) {
|
|
51
|
+
if (process.platform !== "win32" || !/\.(cmd|bat)$/i.test(file))
|
|
52
|
+
return spawn(file, args, options);
|
|
53
|
+
const shim = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i.test(file);
|
|
54
|
+
const line = [escapeCommand(file), ...args.map((arg) => escapeArgument(arg, shim))].join(" ");
|
|
55
|
+
return spawn(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", `"${line}"`], {
|
|
56
|
+
...options,
|
|
57
|
+
windowsVerbatimArguments: true
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function killTree2(child, signal) {
|
|
61
|
+
if (process.platform !== "win32" || child.pid === undefined) {
|
|
62
|
+
child.kill(signal);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
spawn("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
66
|
+
stdio: "ignore",
|
|
67
|
+
windowsHide: true
|
|
68
|
+
}).on("error", () => child.kill(signal));
|
|
69
|
+
}
|
|
70
|
+
var CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
71
|
+
function escapeCommand(command) {
|
|
72
|
+
return command.replace(CMD_META, "^$1");
|
|
73
|
+
}
|
|
74
|
+
function escapeArgument(argument, twice) {
|
|
75
|
+
const quoted = `"${argument.replace(/(\\*)"/g, "$1$1\\\"").replace(/(\\*)$/, "$1$1")}"`;
|
|
76
|
+
const escaped = quoted.replace(CMD_META, "^$1");
|
|
77
|
+
return twice ? escaped.replace(CMD_META, "^$1") : escaped;
|
|
78
|
+
}
|
|
79
|
+
async function findExecutable2(name, directories = []) {
|
|
80
|
+
const pathext = (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";").filter((ext) => ext !== "");
|
|
81
|
+
const extensions = process.platform !== "win32" ? [""] : extname(name) === "" ? pathext : ["", ...pathext];
|
|
82
|
+
if (isAbsolute(name)) {
|
|
83
|
+
for (const extension of extensions)
|
|
84
|
+
if (await executable(`${name}${extension}`))
|
|
85
|
+
return `${name}${extension}`;
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
await processEnvironment();
|
|
89
|
+
const path = (process.env.PATH ?? "").split(delimiter).filter((entry) => entry !== "");
|
|
90
|
+
for (const directory of [...directories, ...path])
|
|
91
|
+
for (const extension of extensions) {
|
|
92
|
+
const candidate = join(directory, `${name}${extension}`);
|
|
93
|
+
if (await executable(candidate))
|
|
94
|
+
return candidate;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
async function executable(path) {
|
|
99
|
+
const found = await stat(path).catch(() => null);
|
|
100
|
+
return found !== null && found.isFile() && await access(path, constants.X_OK).then(() => true, () => false);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { run2, spawnCommand2, killTree2, findExecutable2 };
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
} from "./canvas-preview-5mex725c.js";
|
|
10
10
|
import {
|
|
11
11
|
localGitHubAccount2
|
|
12
|
-
} from "./canvas-preview-
|
|
12
|
+
} from "./canvas-preview-8xc0vn7v.js";
|
|
13
13
|
import {
|
|
14
14
|
localProvider2
|
|
15
|
-
} from "./canvas-preview-
|
|
15
|
+
} from "./canvas-preview-e3vnkkc5.js";
|
|
16
16
|
import {
|
|
17
17
|
importLegacyTrust2
|
|
18
18
|
} from "./canvas-preview-9aqczacs.js";
|
|
@@ -21,10 +21,13 @@ import {
|
|
|
21
21
|
} from "./canvas-preview-4e0pxa32.js";
|
|
22
22
|
import {
|
|
23
23
|
listen2
|
|
24
|
-
} from "./canvas-preview-
|
|
24
|
+
} from "./canvas-preview-ycepb05s.js";
|
|
25
|
+
import {
|
|
26
|
+
nodeImages2
|
|
27
|
+
} from "./canvas-preview-y5y6ghaw.js";
|
|
25
28
|
import {
|
|
26
29
|
createMcpHub2
|
|
27
|
-
} from "./canvas-preview-
|
|
30
|
+
} from "./canvas-preview-g5fkjs34.js";
|
|
28
31
|
import {
|
|
29
32
|
loadPluginDirectory2,
|
|
30
33
|
pluginLoader2
|
|
@@ -33,17 +36,18 @@ import {
|
|
|
33
36
|
defaultSecrets2
|
|
34
37
|
} from "./canvas-preview-skzwvw4d.js";
|
|
35
38
|
import {
|
|
39
|
+
storePath2,
|
|
36
40
|
sqliteStore2
|
|
37
|
-
} from "./canvas-preview-
|
|
41
|
+
} from "./canvas-preview-tnqe7k0b.js";
|
|
38
42
|
import {
|
|
39
43
|
package_default
|
|
40
|
-
} from "./canvas-preview-
|
|
44
|
+
} from "./canvas-preview-jeddjex8.js";
|
|
41
45
|
|
|
42
46
|
// src/open.ts
|
|
43
47
|
import { watch } from "node:fs";
|
|
44
48
|
import { mkdir, readFile } from "node:fs/promises";
|
|
45
49
|
import { homedir, hostname } from "node:os";
|
|
46
|
-
import { join } from "node:path";
|
|
50
|
+
import { dirname, join } from "node:path";
|
|
47
51
|
import process from "node:process";
|
|
48
52
|
import { defaultProviderAuthContext } from "@nyte-ai/ai/auth/context";
|
|
49
53
|
import { FileModelsStore, nyteProviders } from "@nyte-ai/ai";
|
|
@@ -84,8 +88,9 @@ async function openHost2(options) {
|
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
async function defaultStore(home) {
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const path = storePath2(home);
|
|
92
|
+
await mkdir(dirname(path), { recursive: true, mode: 448 });
|
|
93
|
+
return sqliteStore2({ path });
|
|
89
94
|
}
|
|
90
95
|
async function composeOpen(options, input) {
|
|
91
96
|
const { home, workspace, store, owned } = input;
|
|
@@ -115,7 +120,6 @@ async function composeOpen(options, input) {
|
|
|
115
120
|
openaiAstraContext,
|
|
116
121
|
telemetry,
|
|
117
122
|
canvas,
|
|
118
|
-
browserTools,
|
|
119
123
|
claudeCode.plugin,
|
|
120
124
|
acp.plugin
|
|
121
125
|
];
|
|
@@ -133,13 +137,20 @@ async function composeOpen(options, input) {
|
|
|
133
137
|
models,
|
|
134
138
|
mcp: options.mcp ?? createMcpHub2({ home }),
|
|
135
139
|
github: options.github ?? (usesLocalProvider ? localGitHubAccount2({ home }) : undefined),
|
|
140
|
+
images: options.images ?? nodeImages2(),
|
|
136
141
|
plugins: [...plugins, ...files.plugins],
|
|
137
142
|
pluginSources: files.sources,
|
|
138
143
|
secrets,
|
|
139
144
|
home,
|
|
140
145
|
description,
|
|
141
146
|
...settings.seed === null ? {} : { seed: settings.seed },
|
|
142
|
-
...owned === null ? {} : { poll: STORE_POLL_MS }
|
|
147
|
+
...owned === null ? {} : { poll: STORE_POLL_MS },
|
|
148
|
+
member: {
|
|
149
|
+
label: options.label ?? "nyte",
|
|
150
|
+
pid: process.pid,
|
|
151
|
+
capabilities: given.some((plugin) => plugin.id === browserTools.id) ? [browserTools.id] : []
|
|
152
|
+
},
|
|
153
|
+
revoked: options.onRevoked
|
|
143
154
|
});
|
|
144
155
|
projectDirs = async () => (await host.workspaces.list()).flatMap((entry) => entry.trusted === true && ("path" in entry.target) ? [join(entry.target.path, ".nyte", "plugins")] : []);
|
|
145
156
|
for (const row of files.failed)
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./canvas-preview-0nq75h9k.js";
|
|
4
4
|
import {
|
|
5
5
|
run2
|
|
6
|
-
} from "./canvas-preview-
|
|
6
|
+
} from "./canvas-preview-bxnqt8cd.js";
|
|
7
7
|
import {
|
|
8
8
|
PATCH_LIMIT2,
|
|
9
9
|
textEntry2,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
writeFile
|
|
35
35
|
} from "node:fs/promises";
|
|
36
36
|
import { tmpdir } from "node:os";
|
|
37
|
-
import { join } from "node:path";
|
|
37
|
+
import { join, resolve } from "node:path";
|
|
38
38
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
39
39
|
import { dev } from "@nyte-ai/core";
|
|
40
40
|
var GENERATION_NAME = /^g(\d{6})$/;
|
|
@@ -87,7 +87,7 @@ function localSnapshots2(env, options) {
|
|
|
87
87
|
return null;
|
|
88
88
|
const [root, gitDir, prefix = ""] = ran.stdout.toString("utf8").split(`
|
|
89
89
|
`);
|
|
90
|
-
return root === undefined || gitDir === undefined ? null : { root, gitDir, prefix };
|
|
90
|
+
return root === undefined || gitDir === undefined ? null : { root: resolve(root), gitDir: resolve(gitDir), prefix };
|
|
91
91
|
};
|
|
92
92
|
const repository = () => {
|
|
93
93
|
repositoryLookup ??= findRepository();
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
run2,
|
|
6
6
|
findExecutable2
|
|
7
|
-
} from "./canvas-preview-
|
|
7
|
+
} from "./canvas-preview-bxnqt8cd.js";
|
|
8
8
|
import {
|
|
9
9
|
feed2
|
|
10
10
|
} from "./canvas-preview-yjz0f7n4.js";
|
|
@@ -131,7 +131,7 @@ function localFiles2(root, options) {
|
|
|
131
131
|
if (stats === null)
|
|
132
132
|
return null;
|
|
133
133
|
if (stats.isSymbolicLink()) {
|
|
134
|
-
const link = await
|
|
134
|
+
const link = await readLink(target);
|
|
135
135
|
return { kind: "symlink", size: stats.size, version: hashVersion(link), target: link };
|
|
136
136
|
}
|
|
137
137
|
if (stats.isDirectory())
|
|
@@ -173,7 +173,7 @@ function localFiles2(root, options) {
|
|
|
173
173
|
const link = await lstat(target).catch(missing);
|
|
174
174
|
if (link === null)
|
|
175
175
|
return { kind: "stale", current: null };
|
|
176
|
-
const current = await currentVersion(target) ?? (link.isSymbolicLink() ? hashVersion(await
|
|
176
|
+
const current = await currentVersion(target) ?? (link.isSymbolicLink() ? hashVersion(await readLink(target)) : null);
|
|
177
177
|
if (removeOptions?.expect !== undefined && removeOptions.expect !== current)
|
|
178
178
|
return { kind: "stale", current };
|
|
179
179
|
await rm(target, { recursive: link.isDirectory() });
|
|
@@ -258,6 +258,9 @@ async function currentVersion(path) {
|
|
|
258
258
|
return null;
|
|
259
259
|
return stats.isDirectory() ? directoryVersion(path) : hashFile(path).catch(missing);
|
|
260
260
|
}
|
|
261
|
+
async function readLink(path) {
|
|
262
|
+
return (await readlink(path)).split(sep).join("/");
|
|
263
|
+
}
|
|
261
264
|
async function resolveLink(path) {
|
|
262
265
|
const link = await lstat(path).catch(missing);
|
|
263
266
|
return link?.isSymbolicLink() === true ? realpath(path).catch(() => path) : path;
|
|
@@ -376,7 +379,7 @@ function rejectFailure(code, stderr) {
|
|
|
376
379
|
throw new SdkError("invalid", stderr.trim());
|
|
377
380
|
}
|
|
378
381
|
function ripgrepPath(path) {
|
|
379
|
-
return path.
|
|
382
|
+
return path.split(sep).join("/").replace(/^\.\//, "");
|
|
380
383
|
}
|
|
381
384
|
async function* grep(binary, root, input, drafts) {
|
|
382
385
|
if (drafts.size > 0) {
|
|
@@ -422,6 +425,7 @@ async function* grep(binary, root, input, drafts) {
|
|
|
422
425
|
} finally {
|
|
423
426
|
lines.close();
|
|
424
427
|
child.kill();
|
|
428
|
+
await closed;
|
|
425
429
|
}
|
|
426
430
|
}
|
|
427
431
|
var RipgrepMatchSchema = Type.Object({
|