create-stellar-service 0.0.0-stage → 0.1.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/dist/files.js ADDED
@@ -0,0 +1,374 @@
1
+ // The files a new project gets. Code, Dockerfiles and fly.toml come from templates/, with {{placeholders}} filled in;
2
+ // the files that depend on the answers (package.json, .env, the README, the Python kind's gateway config) are built here.
3
+ //
4
+ // Every kind runs with settings from .env: PAY_TO (the account clients pay), PUBLIC_ORIGIN (where clients reach the
5
+ // service), JOB_DB_PATH (the job database) and AGENT_ID (its Stellar 8004 agent id, once launched). A gateway config
6
+ // reads them as "env:NAME", so the same file runs on a laptop and in a container. PAY_TO starts empty: on testnet,
7
+ // `npm run dev` makes a throwaway account to be paid to, and `npm run launch` replaces it with the developer's own.
8
+ // A mainnet project (--network mainnet) also reads FACILITATOR_AUTH, the API key of mainnet's facilitator, and
9
+ // SOROBAN_RPC_URL. No file holds a Stellar secret key.
10
+ import { readFileSync } from "node:fs";
11
+ import { KIT_CLI, OVERRIDES } from "./kit.js";
12
+ /** The facilitator that verifies and settles a project's payments: x402.org's on testnet, OpenZeppelin's on mainnet. */
13
+ export const FACILITATORS = {
14
+ "stellar:testnet": "https://x402.org/facilitator",
15
+ "stellar:pubnet": "https://channels.openzeppelin.com/x402",
16
+ };
17
+ /** Where mainnet's facilitator gives out API keys. */
18
+ export const FACILITATOR_KEYS = "https://channels.openzeppelin.com/gen";
19
+ /** The Soroban RPC a mainnet project starts with: the one the Stellar 8004 SDK reads the registry through. */
20
+ export const MAINNET_RPC = "https://mainnet.sorobanrpc.com";
21
+ /** What a mainnet project also reads from .env, kept as secrets: the facilitator's API key, and an RPC URL, which may hold one. */
22
+ export const MAINNET_SETTINGS = ["FACILITATOR_AUTH", "SOROBAN_RPC_URL"];
23
+ export const KINDS = {
24
+ wrap: "Wrap an API you already run, in any language (no code changes)",
25
+ typescript: "A new service in TypeScript",
26
+ python: "A new service in Python (FastAPI)",
27
+ };
28
+ /** What every kind's provider says until the developer writes their own: the template's service. */
29
+ export const TEMPLATE_DESCRIPTION = "Summarizes English text for agents: the first sentences, with sentence and word counts.";
30
+ /** The price a service starts with, in USDC, when none is given. */
31
+ export const DEFAULT_PRICE = "0.01";
32
+ /** The template service, as the Python kind's gateway config describes it. src/services/summarize.ts and app.py match it. */
33
+ export const SUMMARIZE = {
34
+ name: "summarize",
35
+ title: "Summarize",
36
+ description: "Returns the first sentences of an English text, with its sentence and word counts. Use it to shorten text before passing it on. Accepts up to 20,000 characters; it does not paraphrase.",
37
+ price: DEFAULT_PRICE,
38
+ charge: "on-success",
39
+ expectedDurationSeconds: 2,
40
+ inputSchema: {
41
+ type: "object",
42
+ required: ["text"],
43
+ properties: {
44
+ text: { type: "string", minLength: 1, maxLength: 20000, description: "The text to summarize" },
45
+ sentences: { type: "integer", minimum: 1, maximum: 5, default: 1, description: "How many sentences to keep" },
46
+ },
47
+ additionalProperties: false,
48
+ },
49
+ outputSchema: {
50
+ type: "object",
51
+ required: ["summary", "sentences", "words"],
52
+ properties: {
53
+ summary: { type: "string" },
54
+ sentences: { type: "integer", description: "Sentences in the text" },
55
+ words: { type: "integer", description: "Words in the text" },
56
+ },
57
+ },
58
+ examples: [{ input: { text: "Stellar settles in seconds. Fees are tiny.", sentences: 1 }, output: { summary: "Stellar settles in seconds.", sentences: 2, words: 7 } }],
59
+ capacity: { concurrency: 4, maxQueueWaitSeconds: 20 },
60
+ upstream: { url: "http://127.0.0.1:8000/summarize" },
61
+ };
62
+ /** The settings every project reads from .env, which a gateway config names as "env:NAME". */
63
+ export const SETTINGS = ["PAY_TO", "PUBLIC_ORIGIN", "JOB_DB_PATH", "AGENT_ID"];
64
+ /** The command that starts the Python kind's API on this computer: with uv when it is installed, else from .venv. */
65
+ export function apiCommand(project) {
66
+ return project.uv
67
+ ? "uv run --no-project --with-requirements requirements.txt -- uvicorn app:app --port 8000 --reload"
68
+ : ".venv/bin/uvicorn app:app --port 8000 --reload";
69
+ }
70
+ /** A file from templates/<directory>/, with every {{placeholder}} filled in. */
71
+ export function template(directory, file, project) {
72
+ const text = readFileSync(new URL(`../templates/${directory}/${file}`, import.meta.url), "utf8");
73
+ const values = {
74
+ name: project.name,
75
+ nameJson: JSON.stringify(project.name),
76
+ descriptionJson: JSON.stringify(project.description),
77
+ package: project.package,
78
+ app: project.app,
79
+ price: project.price,
80
+ apiCommand: apiCommand(project),
81
+ };
82
+ return text
83
+ .replace(/^\{\{vendor\}\}\n/gm, project.vendored ? "COPY vendor ./vendor\n" : "")
84
+ .replace(/\{\{(\w+)\}\}/g, (placeholder, key) => values[key] ?? placeholder);
85
+ }
86
+ /** The template files each kind copies: [template directory, file]. */
87
+ export const TEMPLATE_FILES = {
88
+ wrap: [
89
+ ["gateway", "Dockerfile"],
90
+ ["fly", "fly.toml"],
91
+ ],
92
+ typescript: [
93
+ ["typescript", "Dockerfile"],
94
+ ["typescript", "tsconfig.json"],
95
+ ["typescript", "src/server.ts"],
96
+ ["typescript", "src/services/summarize.ts"],
97
+ ["fly", "fly.toml"],
98
+ ],
99
+ python: [
100
+ ["python", "Dockerfile"],
101
+ ["python", "app.py"],
102
+ ["python", "requirements.txt"],
103
+ ["python", "start.sh"],
104
+ ["fly", "fly.toml"],
105
+ ],
106
+ };
107
+ export function packageJson(project, dependencies) {
108
+ const kit = (command) => `node --env-file-if-exists=.env ${KIT_CLI} ${command}`;
109
+ const server = "node --disable-warning=ExperimentalWarning dist/server.js";
110
+ const deploy = "fly deploy --ha=false";
111
+ const scripts = project.kind === "typescript"
112
+ ? {
113
+ build: "tsc",
114
+ dev: `tsc && provider-kit dev -- ${server}`,
115
+ try: 'provider-kit try --start "npm run dev"',
116
+ check: "provider-kit check --manifest http://localhost:8787/.well-known/stellar-agent-services.json --dev",
117
+ status: "provider-kit status",
118
+ launch: `tsc && provider-kit launch --start "${server}"`,
119
+ deploy,
120
+ start: `node --env-file-if-exists=.env --disable-warning=ExperimentalWarning dist/server.js`,
121
+ }
122
+ : {
123
+ dev: kit(`dev --config provider.config.json${project.kind === "python" ? ` --with "${apiCommand(project)}"` : ""}`),
124
+ // A Python project's API runs next to the gateway, which `npm run dev` starts too.
125
+ try: kit(`try --config provider.config.json${project.kind === "python" ? ' --start "npm run dev"' : ""}`),
126
+ check: kit("check --config provider.config.json --dev"),
127
+ status: kit("status --config provider.config.json"),
128
+ launch: kit("launch --config provider.config.json"),
129
+ deploy,
130
+ start: kit("serve --config provider.config.json"),
131
+ };
132
+ // try pays with test money, which only testnet has.
133
+ const { try: _try, ...mainnetScripts } = scripts;
134
+ const file = {
135
+ name: project.package,
136
+ version: "0.1.0",
137
+ private: true,
138
+ description: project.description,
139
+ type: "module",
140
+ engines: { node: ">=22.13" },
141
+ scripts: project.network === "stellar:pubnet" ? mainnetScripts : scripts,
142
+ dependencies,
143
+ ...(project.kind === "typescript" ? { devDependencies: { "@types/node": "22.20.5", typescript: "6.0.3" } } : {}),
144
+ overrides: OVERRIDES,
145
+ };
146
+ return `${JSON.stringify(file, null, 2)}\n`;
147
+ }
148
+ /** The Python kind's gateway config: the template service in front of app.py, at the project's price. */
149
+ export function pythonGatewayConfig(project) {
150
+ return `${JSON.stringify(gatewayConfig(project.name, project.description, [{ ...SUMMARIZE, price: project.price }], project.network), null, 2)}\n`;
151
+ }
152
+ function gatewayConfig(name, description, services, network) {
153
+ return {
154
+ $schema: "./node_modules/@stellar-agent-services/provider-kit/schemas/gateway-config.schema.json",
155
+ baseUrl: "env:PUBLIC_ORIGIN",
156
+ network,
157
+ payTo: "env:PAY_TO",
158
+ ...facilitatorSettings(network),
159
+ provider: { name, description, agentId: "env:AGENT_ID", dataUse: { storesInputs: false, trainsOnInputs: false } },
160
+ store: "env:JOB_DB_PATH",
161
+ services,
162
+ };
163
+ }
164
+ /** A gateway config's facilitator: on mainnet with its API key, and the RPC that decides uncertain payments, from .env. */
165
+ function facilitatorSettings(network) {
166
+ if (network !== "stellar:pubnet")
167
+ return { facilitator: FACILITATORS["stellar:testnet"] };
168
+ return { facilitator: FACILITATORS[network], facilitatorHeaders: { Authorization: "env:FACILITATOR_AUTH" }, rpcUrl: "env:SOROBAN_RPC_URL" };
169
+ }
170
+ /**
171
+ * A config `provider-kit init` wrote, made to run anywhere: baseUrl, store and the agent id from .env, no "dev" (npm run
172
+ * dev runs in development), the name, description and price given, and on mainnet its facilitator, key and RPC. Returns
173
+ * the config and the other variables it reads, such as the API key init named for an upstream header.
174
+ */
175
+ export function adaptInitConfig(text, provider, network = "stellar:testnet") {
176
+ let config = JSON.parse(text);
177
+ config["baseUrl"] = "env:PUBLIC_ORIGIN";
178
+ config["store"] = "env:JOB_DB_PATH";
179
+ delete config["dev"];
180
+ // init writes a testnet config: the network and facilitator settings change in their places.
181
+ const facilitator = facilitatorSettings(network);
182
+ if (!("facilitator" in config))
183
+ config["facilitator"] = facilitator["facilitator"];
184
+ config = Object.fromEntries(Object.entries(config).flatMap(([key, value]) => {
185
+ if (key === "network")
186
+ return [[key, network]];
187
+ if (key === "facilitator")
188
+ return Object.entries(facilitator);
189
+ return key in facilitator ? [] : [[key, value]];
190
+ }));
191
+ if (provider.name !== undefined)
192
+ config.provider["name"] = provider.name;
193
+ if (provider.description !== undefined)
194
+ config.provider["description"] = provider.description;
195
+ config.provider["agentId"] = "env:AGENT_ID";
196
+ if (provider.price !== undefined)
197
+ for (const service of config.services ?? [])
198
+ service["price"] = provider.price;
199
+ const variables = new Set();
200
+ JSON.stringify(config, (_key, value) => {
201
+ if (typeof value === "string" && value.startsWith("env:"))
202
+ variables.add(value.slice("env:".length));
203
+ return value;
204
+ });
205
+ for (const setting of SETTINGS)
206
+ variables.delete(setting);
207
+ // A mainnet project's .env has these with their own notes (envFile).
208
+ if (network === "stellar:pubnet")
209
+ for (const setting of MAINNET_SETTINGS)
210
+ variables.delete(setting);
211
+ return { config: `${JSON.stringify(config, null, 2)}\n`, variables: [...variables] };
212
+ }
213
+ /** .env, or .env.example with `example`: the settings, and the variables a gateway config also reads. */
214
+ export function envFile(project, values, example = false) {
215
+ const testnet = project.network !== "stellar:pubnet";
216
+ const lines = [
217
+ example
218
+ ? "# The settings npm run dev and the other scripts read. Copy this file to .env and fill it in; .env stays out of git."
219
+ : "# The settings npm run dev and the other scripts read. This file stays out of git; .env.example lists the same.",
220
+ "# No Stellar secret key goes here, or anywhere else in this project.",
221
+ "",
222
+ ...(testnet
223
+ ? ["# The account clients pay, in USDC: a public G... address. Leave it empty: npm run dev makes a throwaway testnet", "# account to be paid to, and npm run launch sets up one in your own wallet."]
224
+ : ["# The account clients pay, in USDC: a public G... address in your own wallet. Leave it empty: npm run launch sets", "# one up. Mainnet has no throwaway accounts."]),
225
+ `PAY_TO=${example ? "" : (values.payTo ?? "")}`,
226
+ "# Where clients reach this service on this computer. npm run launch takes the public one from fly.toml.",
227
+ "PUBLIC_ORIGIN=http://localhost:8787",
228
+ "# The job database: paid jobs live here, so keep it on a disk that survives restarts.",
229
+ "JOB_DB_PATH=./jobs.sqlite",
230
+ "# Your Stellar 8004 agent id: npm run launch saves it.",
231
+ "AGENT_ID=",
232
+ ];
233
+ if (project.kind === "typescript") {
234
+ // A gateway's network is in provider.config.json; the TypeScript service reads it here, as provider-kit does.
235
+ lines.push("# The network: stellar:testnet takes test money, stellar:pubnet is mainnet, real USDC.", `STELLAR_NETWORK=${project.network}`);
236
+ if (testnet)
237
+ lines.push("# A Soroban RPC, to decide uncertain payments from the chain. Testnet has a default.", "# SOROBAN_RPC_URL=");
238
+ }
239
+ if (!testnet) {
240
+ lines.push("", `# Mainnet's facilitator settles payments with an API key: get one at ${FACILITATOR_KEYS}, and write it here`, '# as "Bearer <key>". npm run launch stages it, and SOROBAN_RPC_URL, as Fly secrets.', "FACILITATOR_AUTH=", "# A Soroban RPC, to decide uncertain payments from the chain: mainnet has no default. This is the one the Stellar", "# 8004 SDK uses; for production traffic, a provider's is safer: https://developers.stellar.org/docs/data/apis/rpc/providers", `SOROBAN_RPC_URL=${MAINNET_RPC}`);
241
+ }
242
+ const variables = values.variables ?? [];
243
+ if (variables.length > 0)
244
+ lines.push("", "# What provider.config.json sends your API, such as its key. npm run launch stages it as a Fly secret.", ...variables.map((name) => `${name}=`));
245
+ return `${lines.join("\n")}\n`;
246
+ }
247
+ export function gitignore(project) {
248
+ const lines = ["node_modules/", ".env", "jobs.sqlite*"];
249
+ if (project.kind === "typescript")
250
+ lines.push("dist/");
251
+ if (project.kind === "python")
252
+ lines.push(".venv/", "__pycache__/");
253
+ return `${lines.join("\n")}\n`;
254
+ }
255
+ export function dockerignore(project) {
256
+ return `${[".git", ...gitignore(project).trimEnd().split("\n")].join("\n")}\n`;
257
+ }
258
+ /** The project's README: run it, try it, take it live, see where it stands, and make it yours. */
259
+ export function readme(project, options) {
260
+ const docs = "https://github.com/AlgoriaLabs/stellar-agent-services/blob/main";
261
+ const run = {
262
+ wrap: [
263
+ `1. Start your API, if it isn't running. ${options.upstream === undefined ? "" : `The gateway calls it at ${options.upstream}.`}`.trimEnd(),
264
+ "2. `npm run dev` starts the gateway at http://localhost:8787, in front of your API.",
265
+ "3. `npm run try` pays for one call with test money, from another terminal. It starts the gateway itself when it isn't running.",
266
+ ],
267
+ typescript: [
268
+ "1. `npm run dev` builds the service and starts it at http://localhost:8787.",
269
+ "2. `npm run try` pays for one call with test money, from another terminal. It starts the service itself when it isn't running.",
270
+ ],
271
+ python: project.uv
272
+ ? [
273
+ "1. `npm run dev` starts the API (with uv, which installs its packages) and the gateway in front of it, at http://localhost:8787.",
274
+ "2. `npm run try` pays for one call with test money, from another terminal. It starts both itself when they aren't running.",
275
+ ]
276
+ : [
277
+ "1. `python3 -m venv .venv && .venv/bin/pip install -r requirements.txt` installs the API's packages, once.",
278
+ "2. `npm run dev` starts the API and the gateway in front of it, at http://localhost:8787.",
279
+ "3. `npm run try` pays for one call with test money, from another terminal. It starts both itself when they aren't running.",
280
+ ],
281
+ }[project.kind];
282
+ const testnet = project.network !== "stellar:pubnet";
283
+ // Mainnet has no test money and no throwaway account: launch sets up the account clients pay before anything runs.
284
+ const starts = { wrap: "the gateway, in front of your API,", typescript: "the service", python: "the API and the gateway in front of it," }[project.kind];
285
+ const steps = testnet
286
+ ? run
287
+ : [
288
+ ...(project.kind === "python" && !project.uv ? ["`python3 -m venv .venv && .venv/bin/pip install -r requirements.txt` installs the API's packages, once."] : []),
289
+ `Set \`FACILITATOR_AUTH\` in \`.env\`: mainnet's facilitator settles payments with an API key, from ${FACILITATOR_KEYS}.`,
290
+ "`npm run launch` sets up the account clients pay in your own wallet, registers the service and deploys it: see below.",
291
+ `\`npm run dev\` then runs ${starts} at http://localhost:8787 too.${project.kind === "wrap" ? " Start your API first." : ""}`,
292
+ ].map((line, index) => `${index + 1}. ${line}`);
293
+ const yours = {
294
+ wrap: [
295
+ "`provider.config.json` describes each service: its price in USDC, when it's charged (`on-success` or `upfront`),",
296
+ "its description and schemas, and the URL of your API it calls. The timing and capacity are first guesses.",
297
+ `Its JSON Schema gives your editor help with every field. Reference: [gateway mode](${docs}/packages/provider-kit/README.md#gateway-mode).`,
298
+ ],
299
+ typescript: [
300
+ "`src/services/summarize.ts` is an example service. Replace its handler with your own work, such as a model call, and",
301
+ "keep its description, schemas and example in step: agents read them before they pay. Add more services next to it",
302
+ `and list them in \`src/server.ts\`. Reference: [the Provider Kit](${docs}/packages/provider-kit/README.md).`,
303
+ ],
304
+ python: [
305
+ "`app.py` is the service: replace the work in `summarize` with your own, such as a model call. The gateway's",
306
+ "`provider.config.json` describes it to agents: price, charge, description and schemas. Keep its schemas in step with",
307
+ "the models in `app.py`. A new endpoint needs a service there too. With the API running,",
308
+ "`npx provider-kit init --openapi http://127.0.0.1:8000/openapi.json --out new.config.json` writes one from FastAPI's document.",
309
+ ],
310
+ }[project.kind];
311
+ const files = [
312
+ ...(project.kind === "typescript"
313
+ ? [
314
+ ["`src/server.ts`", "The provider: settings, the services it offers, the job database"],
315
+ ["`src/services/summarize.ts`", "An example service, to replace"],
316
+ ]
317
+ : []),
318
+ ...(project.kind === "python" ? [["`app.py`", "The service, a FastAPI app"], ["`start.sh`", "Starts the app and the gateway together, in Docker"]] : []),
319
+ ...(project.kind === "typescript" ? [] : [["`provider.config.json`", `The gateway config, for ${options.services}`]]),
320
+ ["`.env`", "Your settings, kept out of git. `.env.example` lists them."],
321
+ ["`Dockerfile`", "The image to deploy, on any host that runs a container"],
322
+ ["`fly.toml`", `Fly.io's settings: the app, ${project.app}, and the volume for the job database`],
323
+ ...(project.vendored ? [["`vendor/`", "The Provider Kit, packed from your clone until it is on npm. Commit it."]] : []),
324
+ ];
325
+ return `# ${project.name}
326
+
327
+ ${project.description}
328
+
329
+ A paid service on Stellar: agents pay for each call in USDC, through x402, under
330
+ [Provider Standard v1](${docs}/docs/provider-standard.md). Made with \`npm create stellar-service\`.
331
+
332
+ ## Run it
333
+
334
+ ${steps.join("\n")}
335
+
336
+ ${testnet
337
+ ? `No wallet yet: while \`PAY_TO\` in \`.env\` is empty, \`npm run dev\` makes a throwaway testnet account to be paid to. Its
338
+ key is dropped at once, so the test money it receives can't be spent.`
339
+ : `This project takes real USDC on Stellar mainnet, so there is no throwaway account and no test money: to try paid
340
+ calls first, make a testnet project.`} \`npm run check\` checks the service against the
341
+ standard and shows how agents see it.
342
+
343
+ ## Take it live
344
+
345
+ \`npm run launch\` does the rest, on ${testnet ? "testnet" : "mainnet"}:
346
+
347
+ 1. It reads your service's public address from \`fly.toml\`: https://${project.app}.fly.dev.
348
+ 2. A page opens where your own wallet (Freighter, xBull, Albedo and others) approves, in one go: a USDC trustline, so
349
+ the account can be paid; the registration in the Stellar 8004 registry, where agents find you; and a request to a
350
+ verifier to check the service.${testnet ? "" : " The account needs a few XLM, for the trustline's reserve and the fees."}
351
+ 3. It saves \`PAY_TO\` and \`AGENT_ID\` in \`.env\` and \`fly.toml\`, deploys to Fly.io with \`flyctl\` if you say yes, and
352
+ waits until the service answers at its public address.${testnet ? "" : " `FACILITATOR_AUTH` and `SOROBAN_RPC_URL` go to\n Fly as secrets."}
353
+
354
+ \`npm run status\` shows where it stands at any time, from running here to verified, and the command to run next.
355
+ \`npm run deploy\` deploys again after a change.
356
+
357
+ Another host works too: \`npm run launch -- --url https://your.domain --no-deploy\` registers that address and prints
358
+ the settings to deploy with. Run the \`Dockerfile\` there with a persistent volume at \`/data\` for the job database.
359
+ ${project.kind === "wrap" ? "In the container, 127.0.0.1 is the container itself: point each `upstream.url` at an address it reaches your API on.\n" : ""}
360
+ Search matches the provider's name and description (on testnet, its services too), so use the words buyers type. More:
361
+ [the setup guide](${docs}/docs/provider-setup-guide.md).
362
+
363
+ ## Make it yours
364
+
365
+ ${yours.join("\n")}
366
+
367
+ ## Files
368
+
369
+ | File | What it is |
370
+ | --- | --- |
371
+ ${files.map(([file, what]) => `| ${file} | ${what} |`).join("\n")}
372
+ `;
373
+ }
374
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,0HAA0H;AAC1H,EAAE;AACF,oHAAoH;AACpH,qHAAqH;AACrH,mHAAmH;AACnH,oHAAoH;AACpH,+GAA+G;AAC/G,uDAAuD;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAO9C,wHAAwH;AACxH,MAAM,CAAC,MAAM,YAAY,GAA4B;IACnD,iBAAiB,EAAE,8BAA8B;IACjD,gBAAgB,EAAE,wCAAwC;CAC3D,CAAC;AAEF,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AAExE,8GAA8G;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAE5D,mIAAmI;AACnI,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,CAAU,CAAC;AAEjF,MAAM,CAAC,MAAM,KAAK,GAAyB;IACzC,IAAI,E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,CAAwB,CAAC;QAC7I,CAAC,QAAQ,EAAE,4DAA4D,CAAC;QACxE,CAAC,cAAc,EAAE,wDAAwD,CAAC;QAC1E,CAAC,YAAY,EAAE,+BAA+B,OAAO,CAAC,GAAG,uCAAuC,CAAC;QACjG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,CAAC,WAAW,EAAE,yEAAyE,CAAC,CAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;KAChJ,CAAC;IACF,OAAO,KAAK,OAAO,CAAC,IAAI;;EAExB,OAAO,CAAC,WAAW;;;yBAGI,IAAI;;;;EAI3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;;EAGhB,OAAO;QACL,CAAC,CAAC;sEACgE;QAClE,CAAC,CAAC;qCAEN;;;;;uCAKuC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;;uEAEC,OAAO,CAAC,GAAG;;;mCAG/C,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,yEAAyE;;2DAEhE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qEAAqE;;;;;;;EAO7I,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,wHAAwH,CAAC,CAAC,CAAC,EAAE;;oBAErI,IAAI;;;;EAItB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;EAMhB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAChE,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ // The create-stellar-service command, which `npm create stellar-service` runs. The work is in main.ts.
3
+ import { Cancelled, create, USAGE, UsageError } from "./main.js";
4
+ create(process.argv.slice(2)).then((code) => {
5
+ process.exitCode = code;
6
+ }, (error) => {
7
+ if (error instanceof Cancelled) {
8
+ console.error("\nCancelled.");
9
+ process.exitCode = 130;
10
+ return;
11
+ }
12
+ if (error instanceof UsageError || (error instanceof TypeError && "code" in error && String(error.code).startsWith("ERR_PARSE_ARGS"))) {
13
+ console.error(`create-stellar-service: ${error.message}\n\n${USAGE}`);
14
+ process.exitCode = 2;
15
+ return;
16
+ }
17
+ console.error(`create-stellar-service: ${error instanceof Error ? error.message : String(error)}`);
18
+ process.exitCode = 1;
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,uGAAuG;AAEvG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAChC,CAAC,IAAI,EAAE,EAAE;IACP,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;IACjB,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC;QACvB,OAAO;IACT,CAAC;IACD,IAAI,KAAK,YAAY,UAAU,IAAI,CAAC,KAAK,YAAY,SAAS,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;QACtI,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CACF,CAAC"}
package/dist/kit.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /** The kit's packages: the Provider Kit and the two it depends on. */
2
+ export declare const KIT_PACKAGES: readonly ["protocol", "payment-client", "provider-kit"];
3
+ /**
4
+ * The repository's npm overrides, which a project needs as well. @trionlabs/stellar8004 0.0.11 asks for the Stellar SDK
5
+ * 15, so without them npm installs a second SDK inside it: 18 MB more, and its axios has known vulnerabilities. Only
6
+ * stellar8004's SDK is overridden, so no other package is forced off the version it asks for.
7
+ */
8
+ export declare const OVERRIDES: {
9
+ readonly "@trionlabs/stellar8004": {
10
+ readonly "@stellar/stellar-sdk": "16.4.1";
11
+ };
12
+ };
13
+ /** The provider-kit command inside a project, run with node. */
14
+ export declare const KIT_CLI = "node_modules/@stellar-agent-services/provider-kit/dist/cli/index.js";
15
+ export type KitSource = {
16
+ from: "clone";
17
+ packages: string;
18
+ } | {
19
+ from: "npm";
20
+ version: string;
21
+ };
22
+ /** The clone this scaffolder runs from, or else the version on npm. `here` is a file in this package. */
23
+ export declare function kitSource(here?: string): KitSource;
24
+ /** What a clone must have built before its packages can be packed: each package's dist, and the approval page. */
25
+ export declare function unbuilt(packages: string): string[];
26
+ /** The project's dependencies on the kit: the released version, or each package's file in vendor/, as packed. */
27
+ export declare function kitDependencies(source: KitSource, packed?: Partial<Record<(typeof KIT_PACKAGES)[number], string>>): Record<string, string>;
28
+ //# sourceMappingURL=kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAUA,sEAAsE;AACtE,eAAO,MAAM,YAAY,yDAA0D,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;CAA8E,CAAC;AAErG,gEAAgE;AAChE,eAAO,MAAM,OAAO,wEAAwE,CAAC;AAE7F,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F,yGAAyG;AACzG,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAwB,GAAG,SAAS,CAMnE;AAED,kHAAkH;AAClH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlD;AAED,iHAAiH;AACjH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,GAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS9I"}
package/dist/kit.js ADDED
@@ -0,0 +1,44 @@
1
+ // Where a new project gets the Provider Kit.
2
+ //
3
+ // Installed from npm, the project depends on the kit version released with this scaffolder. Run from a clone of this
4
+ // repository, for changes not released yet, it packs the kit's packages into the project's vendor/ folder: the project
5
+ // then installs and builds by itself, on another computer or in Docker too.
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ /** The kit's packages: the Provider Kit and the two it depends on. */
10
+ export const KIT_PACKAGES = ["protocol", "payment-client", "provider-kit"];
11
+ /**
12
+ * The repository's npm overrides, which a project needs as well. @trionlabs/stellar8004 0.0.11 asks for the Stellar SDK
13
+ * 15, so without them npm installs a second SDK inside it: 18 MB more, and its axios has known vulnerabilities. Only
14
+ * stellar8004's SDK is overridden, so no other package is forced off the version it asks for.
15
+ */
16
+ export const OVERRIDES = { "@trionlabs/stellar8004": { "@stellar/stellar-sdk": "16.4.1" } };
17
+ /** The provider-kit command inside a project, run with node. */
18
+ export const KIT_CLI = "node_modules/@stellar-agent-services/provider-kit/dist/cli/index.js";
19
+ /** The clone this scaffolder runs from, or else the version on npm. `here` is a file in this package. */
20
+ export function kitSource(here = import.meta.url) {
21
+ const root = fileURLToPath(new URL("../", here));
22
+ const packages = join(root, "..");
23
+ if (KIT_PACKAGES.every((name) => existsSync(join(packages, name, "package.json"))))
24
+ return { from: "clone", packages };
25
+ const own = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
26
+ return { from: "npm", version: own.version };
27
+ }
28
+ /** What a clone must have built before its packages can be packed: each package's dist, and the approval page. */
29
+ export function unbuilt(packages) {
30
+ const needed = [...KIT_PACKAGES.map((name) => join(name, "dist", "index.js")), join("provider-kit", "dist", "approve", "index.html")];
31
+ return needed.filter((path) => !existsSync(join(packages, path)));
32
+ }
33
+ /** The project's dependencies on the kit: the released version, or each package's file in vendor/, as packed. */
34
+ export function kitDependencies(source, packed = {}) {
35
+ if (source.from === "npm")
36
+ return { "@stellar-agent-services/provider-kit": source.version };
37
+ return Object.fromEntries(KIT_PACKAGES.map((name) => {
38
+ const file = packed[name];
39
+ if (file === undefined)
40
+ throw new Error(`${name} wasn't packed`);
41
+ return [`@stellar-agent-services/${name}`, `file:vendor/${file}`];
42
+ }));
43
+ }
44
+ //# sourceMappingURL=kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.js","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,qHAAqH;AACrH,uHAAuH;AACvH,4EAA4E;AAE5E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC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AAC,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IACtI,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,SAAiE,EAAE;IACpH,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK;QAAE,OAAO,EAAE,sCAAsC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IAC7F,OAAO,MAAM,CAAC,WAAW,CACvB,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,gBAAgB,CAAC,CAAC;QACjE,OAAO,CAAC,2BAA2B,IAAI,EAAE,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { type KitSource } from "./kit.js";
2
+ export declare const USAGE = "create-stellar-service: a new paid AI service on Stellar, ready to run, try and deploy\n\nUsage:\n npm create stellar-service [<folder>] [-- <options>]\n create-stellar-service [<folder>] [--kind wrap|typescript|python] [--openapi <file | url>]\n [--upstream <url>] [--name <text>] [--description <text>] [--price <usdc>]\n [--network testnet|mainnet] [--wallet | --pay-to <G...>] [--yes]\n\n--kind wrap: an API you already run, in any language, behind the Provider Kit gateway. No\n code changes: --openapi reads its OpenAPI document (FastAPI serves /openapi.json) and\n makes a service of each POST endpoint; without one, --upstream is the URL a paid call\n goes to.\n typescript: a new service, with the Provider Kit library.\n python: a new FastAPI service, behind the gateway.\n--description One sentence on what it offers. Search matches it and the name: use the words buyers type.\n--name The provider's name. Default: the folder's, or the OpenAPI document's title.\n--price What a call costs, in USDC. Default 0.01.\n--network testnet (default): test money, nothing to set up. mainnet: real USDC, through mainnet's\n facilitator, which wants an API key (FACILITATOR_AUTH in .env); no throwaway accounts.\n--wallet Sets up the account clients pay now: a page opens where your own wallet approves a USDC\n trustline, and the address goes in .env as PAY_TO. --pay-to takes an address you have.\n Without either, nothing is needed until npm run launch: on testnet, npm run dev pays a\n throwaway account meanwhile.\n--yes Takes the defaults for questions no flag answers. Without a terminal it never asks, and\n --kind is needed.\n\nTestnet unless --network mainnet. It never asks for a secret key, and never pays.";
3
+ /** A mistake in how it was called: printed with the usage text, exit code 2. */
4
+ export declare class UsageError extends Error {
5
+ name: string;
6
+ }
7
+ /** Ctrl+C or Ctrl+D at a question. */
8
+ export declare class Cancelled extends Error {
9
+ name: string;
10
+ }
11
+ export interface RunResult {
12
+ code: number;
13
+ output: string;
14
+ }
15
+ /** Where the scaffolder meets the terminal, the network and other programs. Tests replace it. */
16
+ export interface CreateIo {
17
+ log(text?: string): void;
18
+ /** A line that shows what is running on a terminal, replaced by the next one. "" clears it. */
19
+ status(text: string): void;
20
+ interactive: boolean;
21
+ /** Asks one question and returns the trimmed answer. Rejects with Cancelled on Ctrl+C or Ctrl+D. */
22
+ ask(question: string): Promise<string>;
23
+ /** Runs a program in `cwd`. With `echo`, its output also shows as it comes. */
24
+ run(command: string, args: string[], options: {
25
+ cwd: string;
26
+ echo?: boolean;
27
+ }): Promise<RunResult>;
28
+ /** Whether a program, such as uv, is installed. */
29
+ has(program: string): Promise<boolean>;
30
+ fetch: typeof fetch;
31
+ kit: KitSource;
32
+ }
33
+ export declare function createIo(): CreateIo;
34
+ export declare function create(argv: string[], io?: CreateIo): Promise<number>;
35
+ /** An answer that names a document (a file, or a URL that looks like one) or else the URL a paid call goes to. */
36
+ export declare function classify(answer: string): {
37
+ openapi: string;
38
+ } | {
39
+ upstream: string;
40
+ };
41
+ /** An npm package name from a folder name. */
42
+ export declare function packageName(folder: string): string;
43
+ /** A Fly.io app name from a folder name: lowercase letters, digits and dashes, starting with a letter. */
44
+ export declare function flyAppName(folder: string): string;
45
+ /** "my-stellar-service" as a name: "My Stellar Service". */
46
+ export declare function titleCase(folder: string): string;
47
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAsCA,OAAO,EAA8D,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAkBtG,eAAO,MAAM,KAAK,s7DA0BgE,CAAC;AASnF,gFAAgF;AAChF,qBAAa,UAAW,SAAQ,KAAK;IAC1B,IAAI,SAAgB;CAC9B;AAED,sCAAsC;AACtC,qBAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,SAAe;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,iGAAiG;AACjG,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,+FAA+F;IAC/F,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,oGAAoG;IACpG,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,+EAA+E;IAC/E,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACnG,mDAAmD;IACnD,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,KAAK,EA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