@hasna/nopen 0.0.1
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 +52 -0
- package/dist/adapters/cloudflare.d.ts +136 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -0
- package/dist/adapters/deployment.d.ts +50 -0
- package/dist/adapters/deployment.d.ts.map +1 -0
- package/dist/adapters/domains.d.ts +44 -0
- package/dist/adapters/domains.d.ts.map +1 -0
- package/dist/adapters/email.d.ts +20 -0
- package/dist/adapters/email.d.ts.map +1 -0
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/sandbox.d.ts +82 -0
- package/dist/adapters/sandbox.d.ts.map +1 -0
- package/dist/adapters/skills.d.ts +19 -0
- package/dist/adapters/skills.d.ts.map +1 -0
- package/dist/adapters/stripe.d.ts +85 -0
- package/dist/adapters/stripe.d.ts.map +1 -0
- package/dist/agents/architect.d.ts +26 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/autopilot.d.ts +23 -0
- package/dist/agents/autopilot.d.ts.map +1 -0
- package/dist/agents/build.d.ts +31 -0
- package/dist/agents/build.d.ts.map +1 -0
- package/dist/agents/coders.d.ts +77 -0
- package/dist/agents/coders.d.ts.map +1 -0
- package/dist/agents/deploy-guard.d.ts +18 -0
- package/dist/agents/deploy-guard.d.ts.map +1 -0
- package/dist/agents/digest.d.ts +12 -0
- package/dist/agents/digest.d.ts.map +1 -0
- package/dist/agents/goal-build.d.ts +43 -0
- package/dist/agents/goal-build.d.ts.map +1 -0
- package/dist/agents/harness.d.ts +56 -0
- package/dist/agents/harness.d.ts.map +1 -0
- package/dist/agents/index.d.ts +10 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/launch.d.ts +23 -0
- package/dist/agents/launch.d.ts.map +1 -0
- package/dist/agents/loop.d.ts +24 -0
- package/dist/agents/loop.d.ts.map +1 -0
- package/dist/agents/models.d.ts +7 -0
- package/dist/agents/models.d.ts.map +1 -0
- package/dist/agents/moderation.d.ts +22 -0
- package/dist/agents/moderation.d.ts.map +1 -0
- package/dist/agents/planner.d.ts +40 -0
- package/dist/agents/planner.d.ts.map +1 -0
- package/dist/agents/reconciler.d.ts +7 -0
- package/dist/agents/reconciler.d.ts.map +1 -0
- package/dist/agents/reviewer.d.ts +56 -0
- package/dist/agents/reviewer.d.ts.map +1 -0
- package/dist/agents/scaffolds.d.ts +36 -0
- package/dist/agents/scaffolds.d.ts.map +1 -0
- package/dist/agents/scheduler.d.ts +19 -0
- package/dist/agents/scheduler.d.ts.map +1 -0
- package/dist/agents/seeder.d.ts +16 -0
- package/dist/agents/seeder.d.ts.map +1 -0
- package/dist/agents/tools.d.ts +70 -0
- package/dist/agents/tools.d.ts.map +1 -0
- package/dist/agents/workers.d.ts +25 -0
- package/dist/agents/workers.d.ts.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +68984 -0
- package/dist/db/client.d.ts +32 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/migrate.d.ts +3 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/repo.d.ts +320 -0
- package/dist/db/repo.d.ts.map +1 -0
- package/dist/db/rls.d.ts +16 -0
- package/dist/db/rls.d.ts.map +1 -0
- package/dist/db/schema.d.ts +3391 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/lib/auth.d.ts +65 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/build-agents.d.ts +81 -0
- package/dist/lib/build-agents.d.ts.map +1 -0
- package/dist/lib/checkout.d.ts +24 -0
- package/dist/lib/checkout.d.ts.map +1 -0
- package/dist/lib/client.d.ts +52 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/config.d.ts +118 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/connect.d.ts +14 -0
- package/dist/lib/connect.d.ts.map +1 -0
- package/dist/lib/credits.d.ts +52 -0
- package/dist/lib/credits.d.ts.map +1 -0
- package/dist/lib/doctor.d.ts +25 -0
- package/dist/lib/doctor.d.ts.map +1 -0
- package/dist/lib/ingest.d.ts +9 -0
- package/dist/lib/ingest.d.ts.map +1 -0
- package/dist/lib/iprate.d.ts +26 -0
- package/dist/lib/iprate.d.ts.map +1 -0
- package/dist/lib/mailer.d.ts +15 -0
- package/dist/lib/mailer.d.ts.map +1 -0
- package/dist/lib/oauth.d.ts +10 -0
- package/dist/lib/oauth.d.ts.map +1 -0
- package/dist/lib/ratelimit.d.ts +14 -0
- package/dist/lib/ratelimit.d.ts.map +1 -0
- package/dist/lib/site-template.d.ts +73 -0
- package/dist/lib/site-template.d.ts.map +1 -0
- package/dist/lib/task-charge.d.ts +10 -0
- package/dist/lib/task-charge.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5265 -0
- package/dist/sdk/index.d.ts +18 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +4246 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# nopen — autonomous mini-site factory
|
|
2
|
+
|
|
3
|
+
`nopen.co` builds and self-manages mini-sites from a single prompt. An AI agent
|
|
4
|
+
(ai-sdk.dev, Anthropic + OpenAI) architects a site, deploys it to Cloudflare
|
|
5
|
+
Workers, buys a domain via the Cloudflare Registrar, provisions DNS + TLS + email,
|
|
6
|
+
and keeps it healthy in a closed loop — with heartbeats, schedules, and skills.
|
|
7
|
+
|
|
8
|
+
**Packaging:** the public `@hasna/nopen` client (CLI + MCP + SDK) ships as
|
|
9
|
+
standalone OSS and stays dependency-light. The private control plane
|
|
10
|
+
(`platform-nopen`: server, dashboard, db, billing, deploy) **may use our own
|
|
11
|
+
`@hasna/*` / `open-*` SDKs** (OpenLoops, OpenDomains, OpenEmails, …) rather than
|
|
12
|
+
re-implementing them.
|
|
13
|
+
|
|
14
|
+
## Surfaces
|
|
15
|
+
|
|
16
|
+
- **CLI** — `nopen goal "<prompt>"` (build+deploy, ralph-style until live),
|
|
17
|
+
`nopen list`, `nopen reconcile`, `nopen daemon`, `nopen skills`,
|
|
18
|
+
`nopen login` / `approve` (device-code auth).
|
|
19
|
+
- **MCP** — `nopen-mcp` (tools: create_site, list_sites, site_status,
|
|
20
|
+
suggest_domains) so Claude Code drives it after `nopen login`.
|
|
21
|
+
- **HTTP API** — `nopen-serve` (Hono): device auth + `/api/sites` + `/api/credits`.
|
|
22
|
+
- **Dashboard** — `dashboard/` (Vite + React + Tailwind, shadcn-style): device
|
|
23
|
+
login, build sites, list, credits.
|
|
24
|
+
|
|
25
|
+
## Stack
|
|
26
|
+
|
|
27
|
+
Bun + TypeScript · PostgreSQL + Drizzle (with **multi-tenant RLS**) · Hono ·
|
|
28
|
+
ai-sdk.dev · Cloudflare (Registrar + Workers + DNS + Email Routing) · Stripe
|
|
29
|
+
**credit-pack checkout** (signature-verified webhook, reconciled against a stored
|
|
30
|
+
session) + agent `PaymentIntent`s. (Subscription lifecycle is not yet implemented.)
|
|
31
|
+
|
|
32
|
+
> The default builder (`nopen goal`, API, MCP) is a deterministic closed loop.
|
|
33
|
+
> `nopen agent` is an **experimental** ai-sdk tool-calling agent mode.
|
|
34
|
+
|
|
35
|
+
## Quick start (dev)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bun install
|
|
39
|
+
createdb nopen
|
|
40
|
+
bun run db:migrate # schema + RLS
|
|
41
|
+
cp .env.example .env # fill from the vault
|
|
42
|
+
bun run dev:serve # API on :3340
|
|
43
|
+
cd dashboard && bun run dev # UI on :3341
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## The closed loop
|
|
47
|
+
|
|
48
|
+
`prompt → architect (spec) → render Worker → deploy → verify live → buy domain →
|
|
49
|
+
provision apex (TLS) → email routing → record` — retries until the site actually
|
|
50
|
+
serves, then the daemon keeps it healthy.
|
|
51
|
+
|
|
52
|
+
See `DEPLOY.md` for the (shared-EC2) deploy model and `.implementation/` for design docs.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export interface RegistrarDomain {
|
|
2
|
+
name: string;
|
|
3
|
+
registrable: boolean;
|
|
4
|
+
tier?: string;
|
|
5
|
+
pricing?: {
|
|
6
|
+
currency: string;
|
|
7
|
+
registration_cost: string;
|
|
8
|
+
renewal_cost: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface RegistrantContact {
|
|
12
|
+
first_name: string;
|
|
13
|
+
last_name: string;
|
|
14
|
+
organization?: string;
|
|
15
|
+
email: string;
|
|
16
|
+
phone: string;
|
|
17
|
+
address: string;
|
|
18
|
+
city: string;
|
|
19
|
+
state: string;
|
|
20
|
+
zip: string;
|
|
21
|
+
country: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CfResult<T> {
|
|
24
|
+
success: boolean;
|
|
25
|
+
errors: {
|
|
26
|
+
code: number;
|
|
27
|
+
message: string;
|
|
28
|
+
}[];
|
|
29
|
+
messages: unknown[];
|
|
30
|
+
result: T;
|
|
31
|
+
}
|
|
32
|
+
export declare class CloudflareError extends Error {
|
|
33
|
+
readonly errors: {
|
|
34
|
+
code: number;
|
|
35
|
+
message: string;
|
|
36
|
+
}[];
|
|
37
|
+
constructor(message: string, errors?: {
|
|
38
|
+
code: number;
|
|
39
|
+
message: string;
|
|
40
|
+
}[]);
|
|
41
|
+
}
|
|
42
|
+
export declare class CloudflareClient {
|
|
43
|
+
private accountId;
|
|
44
|
+
constructor(opts?: {
|
|
45
|
+
token?: string;
|
|
46
|
+
email?: string;
|
|
47
|
+
globalKey?: string;
|
|
48
|
+
accountId?: string;
|
|
49
|
+
});
|
|
50
|
+
private token?;
|
|
51
|
+
private email?;
|
|
52
|
+
private globalKey?;
|
|
53
|
+
private headers;
|
|
54
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
55
|
+
/** Verify credentials; returns the authenticated user. */
|
|
56
|
+
verify(): Promise<{
|
|
57
|
+
id: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** Resolve (and cache) the account id. */
|
|
61
|
+
getAccountId(): Promise<string>;
|
|
62
|
+
listZones(name?: string): Promise<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
status: string;
|
|
66
|
+
}[]>;
|
|
67
|
+
createZone(domain: string): Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
name_servers: string[];
|
|
71
|
+
}>;
|
|
72
|
+
upsertDnsRecord(zoneId: string, rec: {
|
|
73
|
+
type: string;
|
|
74
|
+
name: string;
|
|
75
|
+
content: string;
|
|
76
|
+
proxied?: boolean;
|
|
77
|
+
ttl?: number;
|
|
78
|
+
priority?: number;
|
|
79
|
+
}): Promise<unknown>;
|
|
80
|
+
/** Search for brandable registrable domains from a keyword. */
|
|
81
|
+
domainSearch(q: string, limit?: number): Promise<RegistrarDomain[]>;
|
|
82
|
+
/** Check registrability + price for up to 20 exact domains. */
|
|
83
|
+
domainCheck(domains: string[]): Promise<RegistrarDomain[]>;
|
|
84
|
+
/** Register a domain via the Registrar beta. Spends real money. */
|
|
85
|
+
registerDomain(domain: string, contacts?: RegistrantContact): Promise<{
|
|
86
|
+
name: string;
|
|
87
|
+
status?: string;
|
|
88
|
+
}>;
|
|
89
|
+
/** Upload (deploy) a Worker script as an ES module. */
|
|
90
|
+
deployWorker(name: string, moduleSource: string, opts?: {
|
|
91
|
+
bindings?: unknown[];
|
|
92
|
+
compatibilityDate?: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
id: string;
|
|
95
|
+
}>;
|
|
96
|
+
/** Enable the workers.dev subdomain route for a script. */
|
|
97
|
+
enableWorkerSubdomain(name: string): Promise<unknown>;
|
|
98
|
+
/** Attach a custom domain/hostname to a Worker (Workers custom domains). */
|
|
99
|
+
attachWorkerDomain(opts: {
|
|
100
|
+
workerName: string;
|
|
101
|
+
hostname: string;
|
|
102
|
+
zoneId: string;
|
|
103
|
+
environment?: string;
|
|
104
|
+
}): Promise<{
|
|
105
|
+
id: string;
|
|
106
|
+
cert_id?: string;
|
|
107
|
+
}>;
|
|
108
|
+
/** List worker custom-domain bindings for a zone. */
|
|
109
|
+
listWorkerDomains(zoneId: string): Promise<{
|
|
110
|
+
id: string;
|
|
111
|
+
hostname: string;
|
|
112
|
+
service: string;
|
|
113
|
+
cert_id?: string;
|
|
114
|
+
}[]>;
|
|
115
|
+
/** List SSL certificate packs for a zone (to observe cert issuance status). */
|
|
116
|
+
listCertPacks(zoneId: string): Promise<{
|
|
117
|
+
status: string;
|
|
118
|
+
hosts: string[];
|
|
119
|
+
}[]>;
|
|
120
|
+
/** Enable Email Routing on a zone. */
|
|
121
|
+
enableEmailRouting(zoneId: string): Promise<unknown>;
|
|
122
|
+
/** Get the DNS records Email Routing needs (MX + SPF). */
|
|
123
|
+
getEmailRoutingDns(zoneId: string): Promise<{
|
|
124
|
+
type: string;
|
|
125
|
+
name: string;
|
|
126
|
+
content: string;
|
|
127
|
+
priority?: number;
|
|
128
|
+
}[]>;
|
|
129
|
+
/** Add a destination address (must be verified by the recipient once). */
|
|
130
|
+
addEmailDestination(accountIdRequired: boolean, email: string): Promise<unknown>;
|
|
131
|
+
/** Create a catch-all forwarding rule for the zone. */
|
|
132
|
+
setEmailCatchAll(zoneId: string, forwardTo: string): Promise<unknown>;
|
|
133
|
+
private uploadHeaders;
|
|
134
|
+
}
|
|
135
|
+
export declare const cloudflare: CloudflareClient;
|
|
136
|
+
//# sourceMappingURL=cloudflare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudfl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AU,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment adapter — mirrors the @hasna/deployment (open-deployment) surface
|
|
3
|
+
* (deploy / status) but backed directly by the Cloudflare client, so
|
|
4
|
+
* platform-nopen has no hard dependency on the open-deployment package.
|
|
5
|
+
*
|
|
6
|
+
* Deploys a single-file ES-module Worker and returns its live workers.dev URL.
|
|
7
|
+
* Custom-domain routing is attached separately once a domain is owned.
|
|
8
|
+
*/
|
|
9
|
+
import { CloudflareClient } from "./cloudflare.js";
|
|
10
|
+
/** Thrown when a worker module fails the deploy-safety scan. */
|
|
11
|
+
export declare class DeployBlockedError extends Error {
|
|
12
|
+
violations: string[];
|
|
13
|
+
constructor(violations: string[]);
|
|
14
|
+
}
|
|
15
|
+
export interface DeployResult {
|
|
16
|
+
workerName: string;
|
|
17
|
+
versionId: string | null;
|
|
18
|
+
url: string;
|
|
19
|
+
success: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class DeploymentAdapter {
|
|
22
|
+
private cf;
|
|
23
|
+
private subdomainCache;
|
|
24
|
+
constructor(cf?: CloudflareClient);
|
|
25
|
+
/** Resolve the account's workers.dev subdomain (cached). */
|
|
26
|
+
workersSubdomain(): Promise<string>;
|
|
27
|
+
/** Deploy a Worker module and return its live URL. */
|
|
28
|
+
deploySite(workerName: string, moduleSource: string, opts?: {
|
|
29
|
+
bindings?: unknown[];
|
|
30
|
+
compatibilityDate?: string;
|
|
31
|
+
}): Promise<DeployResult>;
|
|
32
|
+
/** Idempotently ensure the worker custom-domain binding exists (no waiting). */
|
|
33
|
+
ensureApexBinding(workerName: string, hostname: string, zoneId: string): Promise<void>;
|
|
34
|
+
/** Quick one-shot liveness probe of an apex (no polling). */
|
|
35
|
+
apexLive(hostname: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Fully provision an apex domain on a worker — IN-APP, no manual steps.
|
|
38
|
+
* Attaches the binding once, then polls for cert + edge propagation.
|
|
39
|
+
* Returns whether the apex serves https within the provided wait budget.
|
|
40
|
+
*/
|
|
41
|
+
provisionApex(workerName: string, hostname: string, zoneId: string, opts?: {
|
|
42
|
+
onProgress?: (m: string) => void;
|
|
43
|
+
maxWaitMs?: number;
|
|
44
|
+
}): Promise<boolean>;
|
|
45
|
+
private isLive;
|
|
46
|
+
/** Poll a deployed URL until it serves a 2xx (edge propagation can lag). */
|
|
47
|
+
waitUntilLive(url: string, tries?: number, delayMs?: number): Promise<boolean>;
|
|
48
|
+
}
|
|
49
|
+
export declare const deploymentAdapter: DeploymentAdapter;
|
|
50
|
+
//# sourceMappingURL=deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/adapters/deployment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAG/D,gEAAgE;AAChE,qBAAa,kBAAmB,SAAQ,KAAK;IACxB,UAAU,EAAE,MAAM,EAAE;gBAApB,UAAU,EAAE,MAAM,EAAE;CAIxC;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,EAAE;IAFtB,OAAO,CAAC,cAAc,CAAuB;gBAEzB,EAAE,GAAE,gBAA6B;IAErD,4DAA4D;IACtD,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAWzC,sDAAsD;IAChD,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1D,OAAO,CAAC,YAAY,CAAC;IAiBxB,gFAAgF;IAC1E,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5F,6DAA6D;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlD;;;;OAIG;IACG,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D,OAAO,CAAC,OAAO,CAAC;YAyBL,MAAM;IASpB,4EAA4E;IACtE,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAI,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY9E;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domains adapter — mirrors the @hasna/domains (open-domains) operation surface
|
|
3
|
+
* (search / checkAvailability / register / ensureZone) but is backed directly by
|
|
4
|
+
* the Cloudflare Registrar beta API, so platform-nopen does not depend on the
|
|
5
|
+
* open-domains package.
|
|
6
|
+
*
|
|
7
|
+
* register() spends real money, so it requires an explicit confirm flag.
|
|
8
|
+
*/
|
|
9
|
+
import { CloudflareClient, type RegistrantContact } from "./cloudflare.js";
|
|
10
|
+
export interface DomainAvailability {
|
|
11
|
+
domain: string;
|
|
12
|
+
available: boolean;
|
|
13
|
+
priceCents: number | null;
|
|
14
|
+
renewCents: number | null;
|
|
15
|
+
currency: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface RegisterResult {
|
|
18
|
+
domain: string;
|
|
19
|
+
registered: boolean;
|
|
20
|
+
zoneId: string | null;
|
|
21
|
+
pricePaidCents: number | null;
|
|
22
|
+
partialFailure?: "zone";
|
|
23
|
+
zoneError?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class DomainsAdapter {
|
|
26
|
+
private cf;
|
|
27
|
+
constructor(cf?: CloudflareClient);
|
|
28
|
+
/** Suggest brandable, registrable domains for a keyword. */
|
|
29
|
+
suggest(keyword: string, limit?: number): Promise<DomainAvailability[]>;
|
|
30
|
+
/** Check exact domains for registrability + price. */
|
|
31
|
+
checkAvailability(domain: string): Promise<DomainAvailability>;
|
|
32
|
+
checkMany(domains: string[]): Promise<DomainAvailability[]>;
|
|
33
|
+
/** Ensure a Cloudflare zone exists for the domain; returns its id. */
|
|
34
|
+
ensureZone(domain: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Register a domain via Cloudflare Registrar. Requires confirm:true (spends money).
|
|
37
|
+
*/
|
|
38
|
+
register(domain: string, opts: {
|
|
39
|
+
confirm: boolean;
|
|
40
|
+
contact?: RegistrantContact;
|
|
41
|
+
}): Promise<RegisterResult>;
|
|
42
|
+
}
|
|
43
|
+
export declare const domainsAdapter: DomainsAdapter;
|
|
44
|
+
//# sourceMappingURL=domains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../src/adapters/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,gBAAgB,EAGhB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,qBAAa,cAAc;IACb,OAAO,CAAC,EAAE;gBAAF,EAAE,GAAE,gBAA6B;IAErD,4DAA4D;IACtD,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAWxE,sDAAsD;IAChD,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAW9D,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAejE,sEAAsE;IAChE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOjD;;OAEG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,iBAAiB,CAAA;KAAE,GACtD,OAAO,CAAC,cAAc,CAAC;CA0B3B;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email adapter — sets up Cloudflare Email Routing for a site's domain:
|
|
3
|
+
* enable routing, ensure MX/SPF DNS, add+forward to a destination (catch-all).
|
|
4
|
+
* Self-contained (Cloudflare-backed); no open-emails dependency.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: the destination address must be verified once by its owner (Cloudflare
|
|
7
|
+
* sends a verification email). Everything else is automatic.
|
|
8
|
+
*/
|
|
9
|
+
import { CloudflareClient } from "./cloudflare.js";
|
|
10
|
+
export declare class EmailAdapter {
|
|
11
|
+
private cf;
|
|
12
|
+
constructor(cf?: CloudflareClient);
|
|
13
|
+
/** Configure email for a domain: routing + DNS + catch-all forward. */
|
|
14
|
+
setup(zoneId: string, forwardTo: string, onProgress?: (m: string) => void): Promise<{
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
dnsAdded: number;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export declare const emailAdapter: EmailAdapter;
|
|
20
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/adapters/email.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAE/D,qBAAa,YAAY;IACX,OAAO,CAAC,EAAE;gBAAF,EAAE,GAAE,gBAA6B;IAErD,uEAAuE;IACjE,KAAK,CACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CA+BnD;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface ExecResult {
|
|
2
|
+
exitCode: number;
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ExecOptions {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface Sandbox {
|
|
12
|
+
/** Provider-assigned sandbox id (useful for logs/forensics). */
|
|
13
|
+
readonly id: string;
|
|
14
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
15
|
+
writeFiles(files: Record<string, string>): Promise<void>;
|
|
16
|
+
readFile(path: string): Promise<string>;
|
|
17
|
+
exists(path: string): Promise<boolean>;
|
|
18
|
+
/** Recursive list of file paths under `dir`. */
|
|
19
|
+
listFiles(dir: string): Promise<string[]>;
|
|
20
|
+
/** Run a shell command. NEVER throws on a non-zero exit — inspect `exitCode`. */
|
|
21
|
+
run(cmd: string, opts?: ExecOptions): Promise<ExecResult>;
|
|
22
|
+
kill(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface SandboxProvider {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
create(opts?: {
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
template?: string;
|
|
29
|
+
}): Promise<Sandbox>;
|
|
30
|
+
}
|
|
31
|
+
/** Real provider backed by e2b. Lazily imports the SDK so the fake path and
|
|
32
|
+
* tests never pull the network SDK in. */
|
|
33
|
+
export declare class E2BSandboxProvider implements SandboxProvider {
|
|
34
|
+
private apiKey;
|
|
35
|
+
readonly name = "e2b";
|
|
36
|
+
constructor(apiKey: string);
|
|
37
|
+
create(opts?: {
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
template?: string;
|
|
40
|
+
}): Promise<Sandbox>;
|
|
41
|
+
}
|
|
42
|
+
export type MemoryRunHandler = (cmd: string, ctx: {
|
|
43
|
+
files: Map<string, string>;
|
|
44
|
+
cwd: string;
|
|
45
|
+
env: Record<string, string>;
|
|
46
|
+
}) => ExecResult | Promise<ExecResult>;
|
|
47
|
+
/** Deterministic in-memory sandbox for tests. Records every command so callers
|
|
48
|
+
* can assert that building happened in the sandbox (and never on the host). */
|
|
49
|
+
export declare class MemorySandbox implements Sandbox {
|
|
50
|
+
private handler;
|
|
51
|
+
readonly id: string;
|
|
52
|
+
files: Map<string, string>;
|
|
53
|
+
commands: string[];
|
|
54
|
+
killed: boolean;
|
|
55
|
+
constructor(id: string, handler: MemoryRunHandler);
|
|
56
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
57
|
+
writeFiles(files: Record<string, string>): Promise<void>;
|
|
58
|
+
readFile(path: string): Promise<string>;
|
|
59
|
+
exists(path: string): Promise<boolean>;
|
|
60
|
+
listFiles(dir: string): Promise<string[]>;
|
|
61
|
+
run(cmd: string, opts?: ExecOptions): Promise<ExecResult>;
|
|
62
|
+
kill(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
export declare class MemorySandboxProvider implements SandboxProvider {
|
|
65
|
+
private handler;
|
|
66
|
+
readonly name = "memory";
|
|
67
|
+
created: MemorySandbox[];
|
|
68
|
+
private seq;
|
|
69
|
+
constructor(handler?: MemoryRunHandler);
|
|
70
|
+
create(): Promise<Sandbox>;
|
|
71
|
+
}
|
|
72
|
+
/** True when sandboxed building is available + enabled. */
|
|
73
|
+
export declare function sandboxAvailable(): boolean;
|
|
74
|
+
/** Returns the configured provider, or null when sandboxing is unavailable. */
|
|
75
|
+
export declare function getSandboxProvider(): SandboxProvider | null;
|
|
76
|
+
/**
|
|
77
|
+
* Kill leaked/orphaned e2b sandboxes older than maxAgeMs. The harness kills its
|
|
78
|
+
* own sandbox in a finally, but a host crash mid-build can leak a billable
|
|
79
|
+
* sandbox; at autopilot scale this runs each scheduler tick.
|
|
80
|
+
*/
|
|
81
|
+
export declare function reapOrphanedSandboxes(maxAgeMs?: number, onError?: (m: string) => void): Promise<number>;
|
|
82
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/adapters/sandbox.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EA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I,YAAY;IACzB,OAAO,EAAE,aAAa,EAAE,CAAM;IAC9B,OAAO,CAAC,GAAG,CAAK;gBACI,OAAO,GAAE,gBAAkE;IACzF,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAKjC;AAID,2DAA2D;AAC3D,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAG3D;AAID;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,SAAc,EACtB,OAAO,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAA8B,GACrD,OAAO,CAAC,MAAM,CAAC,CA4BjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SkillDef {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
run: (input: Record<string, unknown>) => Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare function listSkillDefs(): SkillDef[];
|
|
7
|
+
/** Ensure the registry is reflected in the DB (for dashboard/visibility). */
|
|
8
|
+
export declare function seedSkills(): Promise<void>;
|
|
9
|
+
export declare function listSkills(): Promise<{
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
description: string | null;
|
|
15
|
+
spec: Record<string, unknown> | null;
|
|
16
|
+
}[]>;
|
|
17
|
+
/** Run a skill by name. */
|
|
18
|
+
export declare function runSkill(name: string, input?: Record<string, unknown>): Promise<unknown>;
|
|
19
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/adapters/skills.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AA8BD,wBAAgB,aAAa,IAAI,QAAQ,EAAE,CAE1C;AAED,6EAA6E;AAC7E,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAOhD;AAED,wBAAsB,UAAU;;;;;;;KAE/B;AAED,2BAA2B;AAC3B,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIlG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare class StripeError extends Error {
|
|
2
|
+
}
|
|
3
|
+
/** Constant-time comparison of two hex strings (HMAC digests). */
|
|
4
|
+
export declare function timingSafeEqualHex(a: string, b: string): boolean;
|
|
5
|
+
export declare class StripeClient {
|
|
6
|
+
private key;
|
|
7
|
+
constructor(key?: string | undefined);
|
|
8
|
+
private request;
|
|
9
|
+
/** Create an Express connected account for a site owner. */
|
|
10
|
+
createConnectAccount(email: string, metadata?: Record<string, string>): Promise<{
|
|
11
|
+
id: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Hosted onboarding link for a connected account. */
|
|
14
|
+
createAccountLink(accountId: string, refreshUrl: string, returnUrl: string): Promise<{
|
|
15
|
+
url: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** Onboarding/charge status of a connected account. */
|
|
18
|
+
retrieveAccount(accountId: string): Promise<{
|
|
19
|
+
id: string;
|
|
20
|
+
charges_enabled: boolean;
|
|
21
|
+
details_submitted: boolean;
|
|
22
|
+
payouts_enabled: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* A one-time checkout for a site's product as a DIRECT charge on the owner's
|
|
26
|
+
* connected account — the money lands in the owner's balance. We take an
|
|
27
|
+
* application fee (the platform take rate).
|
|
28
|
+
*/
|
|
29
|
+
createConnectCheckout(opts: {
|
|
30
|
+
connectedAccountId: string;
|
|
31
|
+
productName: string;
|
|
32
|
+
amountCents: number;
|
|
33
|
+
currency?: string;
|
|
34
|
+
applicationFeeCents: number;
|
|
35
|
+
successUrl: string;
|
|
36
|
+
cancelUrl: string;
|
|
37
|
+
metadata?: Record<string, string>;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
id: string;
|
|
40
|
+
url: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** Retrieve a checkout session (optionally on a connected account) to confirm payment. */
|
|
43
|
+
retrieveCheckoutSession(sessionId: string, stripeAccount?: string): Promise<{
|
|
44
|
+
id: string;
|
|
45
|
+
payment_status: string;
|
|
46
|
+
amount_total: number;
|
|
47
|
+
currency: string;
|
|
48
|
+
payment_intent: string | null;
|
|
49
|
+
metadata?: Record<string, string>;
|
|
50
|
+
}>;
|
|
51
|
+
/** Checkout for a credit pack (one-time payment; encodes grant in metadata). */
|
|
52
|
+
createCreditCheckout(opts: {
|
|
53
|
+
credits: number;
|
|
54
|
+
amountCents: number;
|
|
55
|
+
userId: string;
|
|
56
|
+
successUrl: string;
|
|
57
|
+
cancelUrl: string;
|
|
58
|
+
customerEmail?: string;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
id: string;
|
|
61
|
+
url: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Verify a Stripe webhook signature (HMAC-SHA256 over `${t}.${payload}`) and
|
|
65
|
+
* return the parsed event. Throws on bad signature or stale timestamp.
|
|
66
|
+
*/
|
|
67
|
+
verifyWebhook(payload: string, sigHeader: string, secret: string): Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
type: string;
|
|
70
|
+
data: {
|
|
71
|
+
object: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
createPaymentIntent(opts: {
|
|
75
|
+
amountCents: number;
|
|
76
|
+
currency?: string;
|
|
77
|
+
metadata?: Record<string, string>;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
id: string;
|
|
80
|
+
client_secret: string;
|
|
81
|
+
status: string;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export declare const stripe: StripeClient;
|
|
85
|
+
//# sourceMappingURL=stripe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/adapters/stripe.ts"],"names":[],"mappings":"AAeA,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAEzC,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAMhE;AAgBD,qBAAa,YAAY;IACX,OAAO,CAAC,GAAG;gBAAH,GAAG,GAAE,MAAM,GAAG,SAAkC;YAEtD,OAAO;IAwBrB,4DAA4D;IAC5D,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YACzC,MAAM;;IAQlC,sDAAsD;IACtD,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;aAC7C,MAAM;;IAOnC,uDAAuD;IACvD,eAAe,CAAC,SAAS,EAAE,MAAM;YACL,MAAM;yBAAmB,OAAO;2BAAqB,OAAO;yBAAmB,OAAO;;IAKlH;;;;OAIG;IACH,qBAAqB,CAAC,IAAI,EAAE;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;YAe2B,MAAM;aAAO,MAAM;;IAG/C,0FAA0F;IAC1F,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;YAEzD,MAAM;wBACM,MAAM;sBACR,MAAM;kBACV,MAAM;wBACA,MAAM,GAAG,IAAI;mBAClB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;IAIrC,gFAAgF;IAChF,oBAAoB,CAAC,IAAI,EAAE;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;YAC2B,MAAM;aAAO,MAAM;;IAgB/C;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,CAAC;IAyBzJ,mBAAmB,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;YAC3E,MAAM;uBAAiB,MAAM;gBAAU,MAAM;;CAO1E;AAED,eAAO,MAAM,MAAM,cAAqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type SiteSpec } from "../lib/site-template.js";
|
|
3
|
+
export declare const GoalSchema: z.ZodObject<{
|
|
4
|
+
northStar: z.ZodString;
|
|
5
|
+
successMetric: z.ZodString;
|
|
6
|
+
suggestedBudgetCredits: z.ZodNumber;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
northStar: string;
|
|
9
|
+
successMetric: string;
|
|
10
|
+
suggestedBudgetCredits: number;
|
|
11
|
+
}, {
|
|
12
|
+
northStar: string;
|
|
13
|
+
successMetric: string;
|
|
14
|
+
suggestedBudgetCredits: number;
|
|
15
|
+
}>;
|
|
16
|
+
export type AppGoal = z.infer<typeof GoalSchema>;
|
|
17
|
+
export interface ArchitectResult {
|
|
18
|
+
spec: SiteSpec;
|
|
19
|
+
domainSuggestions: string[];
|
|
20
|
+
goal: AppGoal;
|
|
21
|
+
}
|
|
22
|
+
/** A safe default goal when the model omits one. */
|
|
23
|
+
export declare function fallbackGoal(spec: SiteSpec): AppGoal;
|
|
24
|
+
/** Generate a SiteSpec (+ domain suggestions + a revenue goal) from a user prompt. */
|
|
25
|
+
export declare function architectSite(prompt: string): Promise<ArchitectResult>;
|
|
26
|
+
//# sourceMappingURL=architect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExE,eAAO,MAAM,UAAU;;;;;;;;;;;;EASrB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAMpD;AAED,sFAAsF;AACtF,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAuB5E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Worker } from "./workers.js";
|
|
2
|
+
export type TaskOutcome = "done" | "rescheduled" | "retry" | "dead_letter" | "paused" | "capped" | "error";
|
|
3
|
+
export interface CycleResult {
|
|
4
|
+
claimed: number;
|
|
5
|
+
outcomes: Array<{
|
|
6
|
+
taskId: string;
|
|
7
|
+
type: string;
|
|
8
|
+
outcome: TaskOutcome;
|
|
9
|
+
message: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
/** Parse "every N(m|h|d)" into milliseconds (defaults to 1h). */
|
|
13
|
+
export declare function intervalMs(cron: string | null | undefined): number;
|
|
14
|
+
/** Run one autopilot cycle: claim + execute up to `max` actionable tasks. */
|
|
15
|
+
export declare function runAutopilotCycle(opts?: {
|
|
16
|
+
workerId?: string;
|
|
17
|
+
max?: number;
|
|
18
|
+
registry?: Record<string, Worker>;
|
|
19
|
+
/** Restrict claiming to these sites (e.g. a launch running its own build task). Omit for the global daemon. */
|
|
20
|
+
siteIds?: string[];
|
|
21
|
+
onProgress?: (m: string) => void;
|
|
22
|
+
}): Promise<CycleResult>;
|
|
23
|
+
//# sourceMappingURL=autopilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopilot.d.ts","sourceRoot":"","sources":["../../src/agents/autopilot.ts"],"names":[],"mappings":"AAWA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAK1D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3G,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1F;AAED,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAMlE;AAoID,6EAA6E;AAC7E,wBAAsB,iBAAiB,CACrC,IAAI,GAAE;IACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,GACL,OAAO,CAAC,WAAW,CAAC,CA4BtB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared build+deploy: turn a SiteSpec into a live Worker. Used by both the
|
|
3
|
+
* legacy one-shot loop and the autopilot build worker. ALL building runs in the
|
|
4
|
+
* e2b sandbox when available. The host template is only a fallback for simple
|
|
5
|
+
* one-page builds; feature-complete app builds must use the sandbox.
|
|
6
|
+
*/
|
|
7
|
+
import { type SiteSpec } from "../lib/site-template.js";
|
|
8
|
+
import { type ContentPage } from "./harness.js";
|
|
9
|
+
import { type BuildChoice } from "../lib/build-agents.js";
|
|
10
|
+
export interface BuildDeployResult {
|
|
11
|
+
url: string;
|
|
12
|
+
live: boolean;
|
|
13
|
+
versionId: string | null;
|
|
14
|
+
module: string;
|
|
15
|
+
sandboxBuilt: boolean;
|
|
16
|
+
/** Which engine actually built it ("cloud"|"codewith"|"seed"|"template").
|
|
17
|
+
* Anything other than "seed"/"template" is treated as a full agent run by
|
|
18
|
+
* fairBuildCost, so only ever emit those exact values. */
|
|
19
|
+
agentUsed: string;
|
|
20
|
+
/** True when the chosen agent was unavailable and a cheaper path was used. */
|
|
21
|
+
downgraded: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Build the worker (sandboxed) and deploy it; wait until /health is reachable. */
|
|
24
|
+
export declare function buildAndDeploy(spec: SiteSpec, workerName: string, onProgress?: (m: string) => void, opts?: {
|
|
25
|
+
checkoutUrl?: string;
|
|
26
|
+
pages?: ContentPage[];
|
|
27
|
+
subscribeUrl?: string;
|
|
28
|
+
analyticsUrl?: string;
|
|
29
|
+
build?: BuildChoice;
|
|
30
|
+
}): Promise<BuildDeployResult>;
|
|
31
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/agents/build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAKhF,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB;;+DAE2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,mFAAmF;AACnF,wBAAsB,cAAc,CAClC,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAChC,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAA;CAAO,GAC5H,OAAO,CAAC,iBAAiB,CAAC,CA6C5B"}
|