@h-rig/transport-plugin 0.0.6-alpha.158
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 +1 -0
- package/dist/relay-registry/src/client.d.ts +43 -0
- package/dist/relay-registry/src/schema.d.ts +317 -0
- package/dist/src/discovery.d.ts +33 -0
- package/dist/src/discovery.js +308 -0
- package/dist/src/dispatch.d.ts +47 -0
- package/dist/src/dispatch.js +915 -0
- package/dist/src/identity-env.d.ts +13 -0
- package/dist/src/identity-env.js +45 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +943 -0
- package/dist/src/plugin.d.ts +12 -0
- package/dist/src/plugin.js +923 -0
- package/dist/src/relay-registry.d.ts +3 -0
- package/dist/src/relay-registry.js +284 -0
- package/dist/src/run-discovery-bus.d.ts +32 -0
- package/dist/src/run-discovery-bus.js +24 -0
- package/dist/src/transport-provider.d.ts +9 -0
- package/dist/src/transport-provider.js +915 -0
- package/package.json +57 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const PUBLIC_IDENTITY_ENV_KEYS: readonly ["RIG_SELECTED_REPO", "RIG_GITHUB_USER_ID", "RIG_GITHUB_LOGIN", "RIG_GITHUB_NAMESPACE_KEY"];
|
|
2
|
+
export type TransportIdentityEnvKey = (typeof PUBLIC_IDENTITY_ENV_KEYS)[number];
|
|
3
|
+
export type TransportIdentityEnv = Partial<Record<TransportIdentityEnvKey, string>>;
|
|
4
|
+
/**
|
|
5
|
+
* Transport-only public identity env reader used before a plugin host exists.
|
|
6
|
+
*
|
|
7
|
+
* Runtime surfaces should prefer the RUN_IDENTITY_ENV capability. Dispatch is
|
|
8
|
+
* lower in the boot path: it only needs public owner/repo env for child process
|
|
9
|
+
* placement, so it mirrors the provider's state-file vocabulary without
|
|
10
|
+
* importing the provider or the temporary @rig/shared compatibility shim.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveTransportIdentityEnv(workspaceRoot: string): TransportIdentityEnv;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/transport-plugin/src/identity-env.ts
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
import { resolve } from "path";
|
|
5
|
+
function stringField(value) {
|
|
6
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
7
|
+
}
|
|
8
|
+
function githubUserId(value) {
|
|
9
|
+
if (typeof value === "number" && Number.isInteger(value))
|
|
10
|
+
return String(value);
|
|
11
|
+
return stringField(value);
|
|
12
|
+
}
|
|
13
|
+
function readJsonRecord(path) {
|
|
14
|
+
if (!existsSync(path))
|
|
15
|
+
return null;
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
18
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function resolveTransportIdentityEnv(workspaceRoot) {
|
|
24
|
+
const stateDir = resolve(workspaceRoot, ".rig", "state");
|
|
25
|
+
const auth = readJsonRecord(resolve(stateDir, "github-auth.json"));
|
|
26
|
+
const connection = readJsonRecord(resolve(stateDir, "connection.json"));
|
|
27
|
+
const projectLink = readJsonRecord(resolve(stateDir, "project-link.json"));
|
|
28
|
+
const values = {};
|
|
29
|
+
const selectedRepo = stringField(auth?.selectedRepo) ?? stringField(connection?.project) ?? stringField(projectLink?.repoSlug);
|
|
30
|
+
const userId = githubUserId(auth?.userId);
|
|
31
|
+
const login = stringField(auth?.login);
|
|
32
|
+
const namespaceKey = stringField(auth?.userNamespaceKey);
|
|
33
|
+
if (selectedRepo)
|
|
34
|
+
values.RIG_SELECTED_REPO = selectedRepo;
|
|
35
|
+
if (userId)
|
|
36
|
+
values.RIG_GITHUB_USER_ID = userId;
|
|
37
|
+
if (login)
|
|
38
|
+
values.RIG_GITHUB_LOGIN = login;
|
|
39
|
+
if (namespaceKey)
|
|
40
|
+
values.RIG_GITHUB_NAMESPACE_KEY = namespaceKey;
|
|
41
|
+
return values;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
resolveTransportIdentityEnv
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rig/transport-plugin barrel — the collab transport backbone surface.
|
|
3
|
+
*
|
|
4
|
+
* The plugin definition + run-discovery capability live in `./plugin`; the
|
|
5
|
+
* boot-path transport provider in `./transport-provider`; the backbone impl in
|
|
6
|
+
* the dispatch/discovery/registry-room/remote/remote-config/placement/
|
|
7
|
+
* run-provisioning/run-discovery-* modules (also exposed as package subpaths so
|
|
8
|
+
* consumers can import a single concern without the barrel).
|
|
9
|
+
*/
|
|
10
|
+
export { transportPlugin, createTransportPlugin, TRANSPORT_PLUGIN_NAME, RUN_DISCOVERY, RUN_DISCOVERY_CAPABILITY_ID, type RunDiscoveryService, } from "./plugin";
|
|
11
|
+
export { createPlacementTransportProviderPlugin } from "./transport-provider";
|
|
12
|
+
export { createPlacementRunTransport, dispatchRun, spawnRunProcess, resolveRigRunBin, sessionIdFromDispatchSnapshot, resolveDispatchTransportPlacement, type DispatchRunDeps, type DispatchTransportPlacement, type SpawnRunProcessInput, } from "./dispatch";
|
|
13
|
+
export { listActiveRunCollab, registrySnapshotStream, runDiscoveryStream, attachViaRelay, collabFromRegistryEntry, matchesRun, registryBaseUrl, type RigExtensionAttachResult, type AttachViaRelayInput, type RegistryBackedCollabProjection, } from "./discovery";
|