@nimbus-sh/worker 0.4.0 → 0.6.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.
- package/README.md +46 -43
- package/dist/_shared/preview-host.d.ts +33 -2
- package/dist/_shared/preview-host.d.ts.map +1 -1
- package/dist/_shared/preview-host.js +73 -8
- package/dist/_shared/session-router.d.ts +43 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +59 -12
- package/dist/facets/durable-images.d.ts +59 -0
- package/dist/facets/durable-images.d.ts.map +1 -0
- package/dist/facets/durable-images.js +94 -0
- package/dist/facets/durable-slots.d.ts +45 -0
- package/dist/facets/durable-slots.d.ts.map +1 -0
- package/dist/facets/durable-slots.js +95 -0
- package/dist/facets/esbuild-transform.d.ts +10 -0
- package/dist/facets/esbuild-transform.d.ts.map +1 -0
- package/dist/facets/esbuild-transform.js +36 -0
- package/dist/facets/manager.d.ts +244 -6
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +901 -117
- package/dist/facets/resident-identity.d.ts +23 -0
- package/dist/facets/resident-identity.d.ts.map +1 -0
- package/dist/facets/resident-identity.js +31 -0
- package/dist/git/commands.d.ts +22 -1
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +429 -425
- package/dist/git-bundle.generated.d.ts +2 -2
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +97 -3
- package/dist/router/public-directory-do.d.ts +17 -0
- package/dist/router/public-directory-do.d.ts.map +1 -0
- package/dist/router/public-directory-do.js +16 -0
- package/dist/router/public-directory.d.ts +79 -0
- package/dist/router/public-directory.d.ts.map +1 -0
- package/dist/router/public-directory.js +122 -0
- package/dist/router/remote-api.d.ts +27 -1
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +48 -2
- package/dist/runtime/cpython-resident.d.ts.map +1 -1
- package/dist/runtime/cpython-resident.js +3 -1
- package/dist/runtime/node-shims.d.ts +4 -1
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +324 -6
- package/dist/runtime/package-manager.d.ts +44 -1
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +168 -3
- package/dist/runtime/ruby-resident.d.ts.map +1 -1
- package/dist/runtime/ruby-resident.js +2 -0
- package/dist/session/agent.d.ts +11 -0
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/agent.js +28 -1
- package/dist/session/helpers.js +1 -1
- package/dist/session/init-phases.d.ts +17 -23
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +17 -41
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +28 -15
- package/dist/session/keys.d.ts +12 -0
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +12 -0
- package/dist/session/nimbus-session.d.ts +63 -5
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +131 -17
- package/dist/session/port-capability.d.ts +141 -8
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +265 -8
- package/dist/session/programmatic.d.ts +145 -3
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +434 -12
- package/dist/session/routes.d.ts +26 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +117 -25
- package/dist/session/rpc.d.ts +24 -1
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +65 -98
- package/dist/session/shell-socket.d.ts +76 -0
- package/dist/session/shell-socket.d.ts.map +1 -0
- package/dist/session/shell-socket.js +172 -0
- package/dist/session/start-real-vite.js +1 -1
- package/dist/session/supervisor-op.d.ts +42 -0
- package/dist/session/supervisor-op.d.ts.map +1 -0
- package/dist/session/supervisor-op.js +96 -0
- package/dist/session/supervisor-rpc.d.ts +6 -10
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +91 -71
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +19 -4
- package/package.json +4 -4
- package/public/_assets/runtime/{node-shims-fea906843f6d594e.js → node-shims-9e1380d9ee430fcc.js} +320 -5
- package/public/s/index.html +101 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* facets/resident-identity.ts — the derived identity of an ordinary resident.
|
|
3
|
+
*
|
|
4
|
+
* A durable application used to be whatever an embedder reserved a port for.
|
|
5
|
+
* Under the universal model every resident has an identity from the moment
|
|
6
|
+
* it is spawned, derived from what the user typed: the working directory
|
|
7
|
+
* and the argv. Two spawns of `node server.js` from the same directory are
|
|
8
|
+
* the same application — before, after and across a supervisor reset — and
|
|
9
|
+
* that is what a lazily created reservation binds to.
|
|
10
|
+
*
|
|
11
|
+
* The environment is deliberately NOT an input: a rotated secret, a changed
|
|
12
|
+
* `PORT`, a different `TERM` must not turn one application into another.
|
|
13
|
+
*
|
|
14
|
+
* The derived form is namespaced (`auto:`) so it can never collide with an
|
|
15
|
+
* ordinary caller-chosen owner. Reservation policy is NOT inferred from
|
|
16
|
+
* this prefix: the reservation's persisted explicit/derived kind determines
|
|
17
|
+
* whether its first binder adopts an owner or must already match it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DERIVED_OWNER_PREFIX = "auto:";
|
|
20
|
+
/** `auto:` + the first 24 hex of sha256(cwd ++ NUL ++ argv.join(NUL)). */
|
|
21
|
+
export declare function deriveResidentOwner(cwd: string, argv: readonly string[]): Promise<string>;
|
|
22
|
+
export declare function isDerivedOwner(owner: string): boolean;
|
|
23
|
+
//# sourceMappingURL=resident-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resident-identity.d.ts","sourceRoot":"","sources":["../../src/facets/resident-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,0EAA0E;AAC1E,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAM/F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* facets/resident-identity.ts — the derived identity of an ordinary resident.
|
|
3
|
+
*
|
|
4
|
+
* A durable application used to be whatever an embedder reserved a port for.
|
|
5
|
+
* Under the universal model every resident has an identity from the moment
|
|
6
|
+
* it is spawned, derived from what the user typed: the working directory
|
|
7
|
+
* and the argv. Two spawns of `node server.js` from the same directory are
|
|
8
|
+
* the same application — before, after and across a supervisor reset — and
|
|
9
|
+
* that is what a lazily created reservation binds to.
|
|
10
|
+
*
|
|
11
|
+
* The environment is deliberately NOT an input: a rotated secret, a changed
|
|
12
|
+
* `PORT`, a different `TERM` must not turn one application into another.
|
|
13
|
+
*
|
|
14
|
+
* The derived form is namespaced (`auto:`) so it can never collide with an
|
|
15
|
+
* ordinary caller-chosen owner. Reservation policy is NOT inferred from
|
|
16
|
+
* this prefix: the reservation's persisted explicit/derived kind determines
|
|
17
|
+
* whether its first binder adopts an owner or must already match it.
|
|
18
|
+
*/
|
|
19
|
+
export const DERIVED_OWNER_PREFIX = 'auto:';
|
|
20
|
+
/** `auto:` + the first 24 hex of sha256(cwd ++ NUL ++ argv.join(NUL)). */
|
|
21
|
+
export async function deriveResidentOwner(cwd, argv) {
|
|
22
|
+
const material = new TextEncoder().encode(`${cwd}\0${argv.join('\0')}`);
|
|
23
|
+
const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', material));
|
|
24
|
+
let hex = '';
|
|
25
|
+
for (const byte of digest)
|
|
26
|
+
hex += byte.toString(16).padStart(2, '0');
|
|
27
|
+
return `${DERIVED_OWNER_PREFIX}${hex.slice(0, 24)}`;
|
|
28
|
+
}
|
|
29
|
+
export function isDerivedOwner(owner) {
|
|
30
|
+
return owner.startsWith(DERIVED_OWNER_PREFIX);
|
|
31
|
+
}
|
package/dist/git/commands.d.ts
CHANGED
|
@@ -9,6 +9,20 @@
|
|
|
9
9
|
* to the SqliteVFS.
|
|
10
10
|
*/
|
|
11
11
|
import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
|
|
12
|
+
import { type VfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
13
|
+
type Ctx = {
|
|
14
|
+
pid: number;
|
|
15
|
+
cred: VfsCred;
|
|
16
|
+
args: string[];
|
|
17
|
+
stdout: {
|
|
18
|
+
write(s: string): void;
|
|
19
|
+
};
|
|
20
|
+
stderr: {
|
|
21
|
+
write(s: string): void;
|
|
22
|
+
};
|
|
23
|
+
cwd: string;
|
|
24
|
+
env: Record<string, string>;
|
|
25
|
+
};
|
|
12
26
|
export interface ParsedCloneArgs {
|
|
13
27
|
url: string | undefined;
|
|
14
28
|
dest: string | undefined;
|
|
@@ -25,5 +39,12 @@ export declare const CLONE_USAGE = "usage: git clone [--depth <n>] [--no-shallow
|
|
|
25
39
|
* "blobless" clone that was not blobless.
|
|
26
40
|
*/
|
|
27
41
|
export declare function parseCloneArgs(args: string[]): ParsedCloneArgs;
|
|
28
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The `git` command handler. Split out from registration so it can be
|
|
44
|
+
* lazy-loaded (`await import('./commands.js')`) on first `git` use, keeping
|
|
45
|
+
* this module and its ~106 KB network-facet dependency out of the cold
|
|
46
|
+
* script-eval graph.
|
|
47
|
+
*/
|
|
48
|
+
export declare function runGitCommand(ctx: Ctx, vfs: SqliteVFS, doCtx?: DurableObjectState, doEnv?: any): Promise<number>;
|
|
49
|
+
export {};
|
|
29
50
|
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AA8JvF,KAAK,GAAG,GAAG;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE;QAAE,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE;QAAE,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,CAAC;AAaF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,mGAC0E,CAAC;AAEnG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CA4C9D;AAWD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,SAAS,EACd,KAAK,CAAC,EAAE,kBAAkB,EAC1B,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,MAAM,CAAC,CA0bjB"}
|