@volter/twin-runhuman 0.1.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/LICENSE +202 -0
- package/README.md +81 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +25 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +44 -0
- package/dist/src/runhuman-budget.d.ts +23 -0
- package/dist/src/runhuman-budget.js +45 -0
- package/dist/src/runhuman-capabilities.d.ts +7 -0
- package/dist/src/runhuman-capabilities.js +451 -0
- package/dist/src/runhuman-conformance.d.ts +10 -0
- package/dist/src/runhuman-conformance.js +11 -0
- package/dist/src/runhuman-connector.d.ts +32 -0
- package/dist/src/runhuman-connector.js +58 -0
- package/dist/src/runhuman-server.d.ts +13 -0
- package/dist/src/runhuman-server.js +25 -0
- package/dist/src/runhuman-twin.d.ts +16 -0
- package/dist/src/runhuman-twin.js +1162 -0
- package/dist/src/runhuman-validate.d.ts +40 -0
- package/dist/src/runhuman-validate.js +161 -0
- package/package.json +51 -0
- package/src/cli.ts +24 -0
- package/src/index.ts +61 -0
- package/src/runhuman-budget.ts +66 -0
- package/src/runhuman-capabilities.ts +470 -0
- package/src/runhuman-conformance.ts +14 -0
- package/src/runhuman-connector.ts +67 -0
- package/src/runhuman-server.ts +32 -0
- package/src/runhuman-twin.ts +1078 -0
- package/src/runhuman-validate.ts +185 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// FETCH-FIRST (runtime contract R12b): the pack's HTTP surface is a plain
|
|
2
|
+
// `(Request) => Promise<Response>` built by the kernel's ONE adaptation — a Worker/DO
|
|
3
|
+
// entry mounts it in-process (no ports on workerd), and the local server is one line of
|
|
4
|
+
// Bun.serve around the SAME closure. Vendor differences are VALUES on the config
|
|
5
|
+
// (manifest, header extras, response headers); a wire that genuinely exceeds the common
|
|
6
|
+
// shape (SSE, multipart, raw bytes) replaces the adapter with a hand-written fetch —
|
|
7
|
+
// openai is that reference.
|
|
8
|
+
import { handleRunhumanTwinRequest } from './runhuman-twin.ts';
|
|
9
|
+
import { createTwinFetchFromHandler, serveHttp, statefulTwinManifest } from '@volter/world-core';
|
|
10
|
+
|
|
11
|
+
export interface RunhumanTwinFetchOptions {
|
|
12
|
+
root?: string;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createRunhumanTwinFetch(options: RunhumanTwinFetchOptions = {}): (request: Request) => Promise<Response> {
|
|
17
|
+
return createTwinFetchFromHandler(handleRunhumanTwinRequest, {
|
|
18
|
+
...options,
|
|
19
|
+
manifest: statefulTwinManifest({ vendor: 'runhuman', twinOf: 'the Runhuman 1 API (runhuman.com/api)', stores: 'organizations, projects, API keys, testers, and jobs through their claim → results pipeline → completion lifecycle',
|
|
20
|
+
identity: 'Authenticate as RH1 does: `Authorization: Bearer rh_…` API keys bound to an organization, and web users (the tester side) in RH1\'s Clerk mock-mode form `Bearer clerk_<email>`; the tester\'s per-job testerToken comes from the claim. RH1 creates organizations, projects, keys and testers outside the job API, so a world seeds them with POST /_twin/organizations {name, id?}, /_twin/projects {organizationId, name, id?, defaultUrl?}, /_twin/api-keys {organizationId, key?}, /_twin/testers {email, alias?, devices?, organizationIds?}.',
|
|
21
|
+
notes: 'The AI results pipeline is folded into GET /api/tester/jobs/:jobId/processing/:processingJobId (the first read completes the run); time-driven monitors (claim-window expiry, overdue) and integrations are not modelled and answer RH1\'s JSON 404 with an x-twin-gap header.' }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function createRunhumanTwinServer(options: { port?: number; root?: string; readOnly?: boolean } = {}): Promise<{ port: number; stop: () => void }> {
|
|
26
|
+
const server = await serveHttp({
|
|
27
|
+
port: options.port ?? 0,
|
|
28
|
+
idleTimeout: 60,
|
|
29
|
+
fetch: createRunhumanTwinFetch(options),
|
|
30
|
+
});
|
|
31
|
+
return { port: server.port ?? options.port ?? 0, stop: () => server.stop(true) };
|
|
32
|
+
}
|