@hugex/artifact 0.1.1 → 0.2.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/dist/do/ArtifactDO.d.ts +21 -3
- package/dist/hash.d.ts +11 -3
- package/dist/host-route.d.ts +8 -0
- package/dist/host.d.ts +3 -2
- package/dist/index.js +354 -289
- package/dist/limits.d.ts +1 -1
- package/dist/mcp/auth.d.ts +11 -3
- package/dist/mcp/authz.d.ts +1 -0
- package/dist/mcp/context.d.ts +17 -0
- package/dist/mcp/domains/artifacts.d.ts +8 -0
- package/dist/mcp/index.d.ts +6 -4
- package/dist/mcp/oauth/config.d.ts +16 -0
- package/dist/mcp/oauth/consent.d.ts +4 -0
- package/dist/mcp/oauth/oidc.d.ts +29 -0
- package/dist/mcp/oauth/provider.d.ts +21 -0
- package/dist/mcp/oauth/transactions.d.ts +5 -0
- package/dist/mcp/registry.d.ts +3 -0
- package/dist/mcp/scopes.d.ts +5 -0
- package/dist/mcp/tools.d.ts +2 -4
- package/dist/types.d.ts +81 -1
- package/dist/validate.d.ts +6 -0
- package/dist/worker-client.d.ts +2 -0
- package/package.json +3 -2
package/dist/do/ArtifactDO.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DurableObject } from "cloudflare:workers";
|
|
2
|
-
import type { ArtifactEnv, ArtifactFile, ArtifactLogEntry, ArtifactMeta, ArtifactRpc, ArtifactVersion, CreateArtifactInput, QueryResult, SettingsInput, WriteInput, WriteResult } from "../types";
|
|
2
|
+
import type { AllowsWorkerInput, AllowsWorkerResult, ArtifactEnv, ArtifactFile, ArtifactLogEntry, ArtifactMeta, ArtifactRpc, ArtifactVersion, CreateArtifactInput, QueryResult, SettingsInput, WorkerGrant, WriteInput, WriteResult } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* One instance per artifact (`idFromName(slug)`).
|
|
5
|
-
* Supervisor SQLite holds meta, files, versions, and
|
|
6
|
-
* `server.js` runs in a facet named `app`, loaded with `globalOutbound: null
|
|
5
|
+
* Supervisor SQLite holds meta, files, versions, logs, and Worker grants.
|
|
6
|
+
* `server.js` runs in a facet named `app`, loaded with `globalOutbound: null`. Its `env` is
|
|
7
|
+
* `{ HX }` (the tenant's `ArtifactWorkerGateway`, from `ctx.exports`) when the tenant exports
|
|
8
|
+
* it, and `{}` otherwise.
|
|
7
9
|
*/
|
|
8
10
|
export declare class ArtifactDO extends DurableObject<ArtifactEnv> implements ArtifactRpc {
|
|
9
11
|
/** Bumped when an activation window expires so a late health check cannot publish. */
|
|
@@ -45,6 +47,20 @@ export declare class ArtifactDO extends DurableObject<ArtifactEnv> implements Ar
|
|
|
45
47
|
ok: true;
|
|
46
48
|
oraSyncFailed?: boolean;
|
|
47
49
|
} | null>;
|
|
50
|
+
allowsWorker(input: AllowsWorkerInput): Promise<AllowsWorkerResult>;
|
|
51
|
+
listWorkerGrants(): Promise<WorkerGrant[] | null>;
|
|
52
|
+
grantWorker(input: {
|
|
53
|
+
flowId: string;
|
|
54
|
+
grantedBy: string;
|
|
55
|
+
expectUuid: string;
|
|
56
|
+
expectOwner: string;
|
|
57
|
+
}): Promise<WorkerGrant | null>;
|
|
58
|
+
revokeWorker(input: {
|
|
59
|
+
flowId: string;
|
|
60
|
+
expectUuid: string;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
removed: boolean;
|
|
63
|
+
} | null>;
|
|
48
64
|
/** Harness / diagnostics: supervisor SQLite size and row counts. */
|
|
49
65
|
storageStats(): Promise<{
|
|
50
66
|
databaseSize: number;
|
|
@@ -71,6 +87,8 @@ export declare class ArtifactDO extends DurableObject<ArtifactEnv> implements Ar
|
|
|
71
87
|
private markFailed;
|
|
72
88
|
/** Active/previous/meta move together, and the index is marked dirty in the same transaction. */
|
|
73
89
|
private promote;
|
|
90
|
+
private workerGateway;
|
|
91
|
+
private hasWorkerGateway;
|
|
74
92
|
private runtimeId;
|
|
75
93
|
private loadApp;
|
|
76
94
|
private facetOf;
|
package/dist/hash.d.ts
CHANGED
|
@@ -12,12 +12,20 @@ export declare function truncateUtf8(text: string, maxBytes: number): string;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function hashFileSet(files: ReadonlyMap<string, string> | Record<string, string>): Promise<string>;
|
|
14
14
|
export declare function sameFileSet(a: ReadonlyMap<string, string>, b: ReadonlyMap<string, string>): boolean;
|
|
15
|
-
/**
|
|
16
|
-
export declare
|
|
15
|
+
/** Name of the tenant entrypoint the loader binds as `env.HX` when `ctx.exports` has it. */
|
|
16
|
+
export declare const ARTIFACT_GATEWAY_EXPORT = "ArtifactWorkerGateway";
|
|
17
|
+
/**
|
|
18
|
+
* Stable config mixed into runtimeId. `globalOutbound: null` is part of the contract.
|
|
19
|
+
* `env` describes the bindings: empty, or `HX` bound to the tenant gateway (props are set by
|
|
20
|
+
* the loader per artifact, so only the entrypoint name enters the hash).
|
|
21
|
+
*/
|
|
22
|
+
export declare function artifactWorkerConfig(compatibilityDate?: string, opts?: {
|
|
23
|
+
gateway?: boolean;
|
|
24
|
+
}): {
|
|
17
25
|
compatibilityDate: string;
|
|
18
26
|
mainModule: string;
|
|
19
27
|
globalOutbound: null;
|
|
20
|
-
env: Record<string,
|
|
28
|
+
env: Record<string, string>;
|
|
21
29
|
};
|
|
22
30
|
/**
|
|
23
31
|
* runtimeId = sha256(server modules + package version + compatibilityDate + config).
|
package/dist/host-route.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export type ArtifactRoute = {
|
|
|
13
13
|
key: string;
|
|
14
14
|
internalPath: string;
|
|
15
15
|
basePath: string;
|
|
16
|
+
}
|
|
17
|
+
/** `<base>/__hx/agent/<flowId>/<sessionId>`: same-origin proxy to a granted Worker. */
|
|
18
|
+
| {
|
|
19
|
+
kind: "agent";
|
|
20
|
+
slug: string;
|
|
21
|
+
key: string;
|
|
22
|
+
flowId: string;
|
|
23
|
+
sessionId: string;
|
|
16
24
|
};
|
|
17
25
|
export interface RouteInput {
|
|
18
26
|
pathname: string;
|
package/dist/host.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { artifactDevPrefix } from "./dev-prefix";
|
|
2
|
-
import type { ArtifactEnv } from "./types";
|
|
2
|
+
import type { ArtifactEnv, ArtifactHostOptions } from "./types";
|
|
3
3
|
export { artifactDevPrefix };
|
|
4
4
|
/**
|
|
5
5
|
* Terminal on `ARTIFACT_HOST`. On localhost, 127.0.0.1, or [::1], mounts the same
|
|
6
6
|
* routes under `ARTIFACT_DEV_PATH` (for example `/app/...`). Any other hostname
|
|
7
7
|
* ignores that variable. Returns null when the path is unrelated.
|
|
8
|
+
* `options.agentProxy` turns on `<base>/__hx/agent/<flowId>/<sessionId>`.
|
|
8
9
|
*/
|
|
9
|
-
export declare function handleArtifactHost(request: Request, env: ArtifactEnv, ctx: ExecutionContext): Promise<Response | null>;
|
|
10
|
+
export declare function handleArtifactHost(request: Request, env: ArtifactEnv, ctx: ExecutionContext, options?: ArtifactHostOptions): Promise<Response | null>;
|