@yiaany/ghostapi 0.1.7 → 0.1.9
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/CHANGELOG.md +42 -2
- package/CONTRIBUTING.md +119 -117
- package/LICENSE +21 -21
- package/README.md +208 -181
- package/SECURITY.md +53 -37
- package/dist/actions/gateway.d.ts +179 -0
- package/dist/actions/gateway.js +514 -0
- package/dist/actions/gateway.js.map +1 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/ai/aiClient.js +4 -4
- package/dist/ai/aiClient.js.map +1 -1
- package/dist/ai/aiGenerator.d.ts +2 -2
- package/dist/ai/aiGenerator.js +21 -72
- package/dist/ai/aiGenerator.js.map +1 -1
- package/dist/ai/prompts.js +51 -51
- package/dist/ai/prompts.js.map +1 -1
- package/dist/approvals/approvalInbox.d.ts +150 -0
- package/dist/approvals/approvalInbox.js +412 -0
- package/dist/approvals/approvalInbox.js.map +1 -0
- package/dist/approvals/index.d.ts +2 -0
- package/dist/approvals/index.js +2 -0
- package/dist/approvals/index.js.map +1 -0
- package/dist/behavior/behaviorStore.d.ts +2 -0
- package/dist/behavior/behaviorStore.js +50 -46
- package/dist/behavior/behaviorStore.js.map +1 -1
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.js +58 -14
- package/dist/cache/index.js.map +1 -1
- package/dist/cli/index.js +438 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/openUrl.d.ts +10 -0
- package/dist/cli/openUrl.js +31 -0
- package/dist/cli/openUrl.js.map +1 -0
- package/dist/cli/parser.d.ts +155 -0
- package/dist/cli/parser.js +504 -2
- package/dist/cli/parser.js.map +1 -1
- package/dist/config/dataPaths.d.ts +31 -0
- package/dist/config/dataPaths.js +45 -0
- package/dist/config/dataPaths.js.map +1 -0
- package/dist/config/localConfig.d.ts +1 -2
- package/dist/config/localConfig.js +27 -21
- package/dist/config/localConfig.js.map +1 -1
- package/dist/config/serverConfig.d.ts +2 -0
- package/dist/config/serverConfig.js +8 -1
- package/dist/config/serverConfig.js.map +1 -1
- package/dist/contracts/contract.d.ts +76 -0
- package/dist/contracts/contract.js +603 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/index.d.ts +2 -0
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/credentials/credentialBroker.d.ts +207 -0
- package/dist/credentials/credentialBroker.js +588 -0
- package/dist/credentials/credentialBroker.js.map +1 -0
- package/dist/credentials/index.d.ts +2 -0
- package/dist/credentials/index.js +2 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/dashboard/app.js +685 -615
- package/dist/dashboard/index.html +13 -7
- package/dist/dashboard/styles.css +349 -349
- package/dist/egress/capabilities.d.ts +32 -0
- package/dist/egress/capabilities.js +165 -0
- package/dist/egress/capabilities.js.map +1 -0
- package/dist/egress/linuxBootstrap.d.ts +1 -0
- package/dist/egress/linuxBootstrap.js +121 -0
- package/dist/egress/linuxBootstrap.js.map +1 -0
- package/dist/egress/run.d.ts +18 -0
- package/dist/egress/run.js +305 -0
- package/dist/egress/run.js.map +1 -0
- package/dist/errors/errorEngine.d.ts +2 -2
- package/dist/errors/errorEngine.js +3 -40
- package/dist/errors/errorEngine.js.map +1 -1
- package/dist/evals/evals.d.ts +126 -0
- package/dist/evals/evals.js +466 -0
- package/dist/evals/evals.js.map +1 -0
- package/dist/evals/index.d.ts +2 -0
- package/dist/evals/index.js +2 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evidence/index.d.ts +2 -0
- package/dist/evidence/index.js +2 -0
- package/dist/evidence/index.js.map +1 -0
- package/dist/evidence/report.d.ts +143 -0
- package/dist/evidence/report.js +556 -0
- package/dist/evidence/report.js.map +1 -0
- package/dist/fault/faultLab.d.ts +5 -4
- package/dist/fault/faultLab.js +66 -24
- package/dist/fault/faultLab.js.map +1 -1
- package/dist/index.d.ts +46 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/analysis.d.ts +12 -0
- package/dist/inventory/analysis.js +457 -0
- package/dist/inventory/analysis.js.map +1 -0
- package/dist/inventory/index.d.ts +5 -0
- package/dist/inventory/index.js +4 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/inventory/inventoryController.d.ts +53 -0
- package/dist/inventory/inventoryController.js +1044 -0
- package/dist/inventory/inventoryController.js.map +1 -0
- package/dist/inventory/types.d.ts +579 -0
- package/dist/inventory/types.js +787 -0
- package/dist/inventory/types.js.map +1 -0
- package/dist/landing/assets/index-CxWsopzP.css +1 -0
- package/dist/landing/assets/index-DZlpyhqd.js +55 -0
- package/dist/landing/assets/index-Dk-Xezs3.js +55 -0
- package/dist/landing/index.html +15 -15
- package/dist/ledger/actionLedger.d.ts +125 -0
- package/dist/ledger/actionLedger.js +594 -0
- package/dist/ledger/actionLedger.js.map +1 -0
- package/dist/ledger/index.d.ts +2 -0
- package/dist/ledger/index.js +2 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/mcp/server.js +4 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/policy/index.d.ts +3 -0
- package/dist/policy/index.js +2 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/policy.d.ts +14 -0
- package/dist/policy/policy.js +282 -0
- package/dist/policy/policy.js.map +1 -0
- package/dist/policy/types.d.ts +52 -0
- package/dist/policy/types.js +2 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/productTelemetry/index.d.ts +16 -0
- package/dist/productTelemetry/index.js +142 -0
- package/dist/productTelemetry/index.js.map +1 -0
- package/dist/providers/conformance.d.ts +7 -0
- package/dist/providers/conformance.js +48 -0
- package/dist/providers/conformance.js.map +1 -0
- package/dist/providers/index.d.ts +4 -2
- package/dist/providers/index.js +3 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/packs/resendPack.d.ts +2 -0
- package/dist/providers/packs/resendPack.js +147 -0
- package/dist/providers/packs/resendPack.js.map +1 -0
- package/dist/providers/packs/stripePack.d.ts +2 -0
- package/dist/providers/packs/stripePack.js +852 -0
- package/dist/providers/packs/stripePack.js.map +1 -0
- package/dist/providers/registry.d.ts +7 -3
- package/dist/providers/registry.js +55 -4
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/resend.js +2 -11
- package/dist/providers/resend.js.map +1 -1
- package/dist/providers/runtime.d.ts +8 -0
- package/dist/providers/runtime.js +48 -0
- package/dist/providers/runtime.js.map +1 -0
- package/dist/providers/stripeWebhook.d.ts +13 -0
- package/dist/providers/stripeWebhook.js +50 -0
- package/dist/providers/stripeWebhook.js.map +1 -0
- package/dist/providers/types.d.ts +153 -0
- package/dist/proxy/cacheKey.js +3 -3
- package/dist/proxy/cacheKey.js.map +1 -1
- package/dist/proxy/providerDetector.d.ts +2 -7
- package/dist/proxy/providerDetector.js +4 -4
- package/dist/proxy/providerDetector.js.map +1 -1
- package/dist/proxy/proxyHandler.js +116 -12
- package/dist/proxy/proxyHandler.js.map +1 -1
- package/dist/proxy/requestNormalizer.d.ts +0 -1
- package/dist/proxy/requestNormalizer.js +2 -5
- package/dist/proxy/requestNormalizer.js.map +1 -1
- package/dist/reliability/costGovernance.d.ts +175 -0
- package/dist/reliability/costGovernance.js +515 -0
- package/dist/reliability/costGovernance.js.map +1 -0
- package/dist/reliability/index.d.ts +8 -0
- package/dist/reliability/index.js +5 -0
- package/dist/reliability/index.js.map +1 -0
- package/dist/reliability/reconciliation.d.ts +157 -0
- package/dist/reliability/reconciliation.js +522 -0
- package/dist/reliability/reconciliation.js.map +1 -0
- package/dist/reliability/runtimeHealth.d.ts +60 -0
- package/dist/reliability/runtimeHealth.js +356 -0
- package/dist/reliability/runtimeHealth.js.map +1 -0
- package/dist/reliability/slo.d.ts +131 -0
- package/dist/reliability/slo.js +375 -0
- package/dist/reliability/slo.js.map +1 -0
- package/dist/report/safetyReport.js +7 -3
- package/dist/report/safetyReport.js.map +1 -1
- package/dist/safety/index.d.ts +2 -0
- package/dist/safety/index.js +2 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/safety/safetyController.d.ts +187 -0
- package/dist/safety/safetyController.js +477 -0
- package/dist/safety/safetyController.js.map +1 -0
- package/dist/scenarios/scenarioBundle.d.ts +75 -0
- package/dist/scenarios/scenarioBundle.js +750 -0
- package/dist/scenarios/scenarioBundle.js.map +1 -0
- package/dist/scenarios/scenarioStore.d.ts +1 -0
- package/dist/scenarios/scenarioStore.js +47 -32
- package/dist/scenarios/scenarioStore.js.map +1 -1
- package/dist/security/headerSanitizer.d.ts +2 -0
- package/dist/security/headerSanitizer.js +36 -1
- package/dist/security/headerSanitizer.js.map +1 -1
- package/dist/security/secrets.js +24 -4
- package/dist/security/secrets.js.map +1 -1
- package/dist/server/accessControl.d.ts +5 -0
- package/dist/server/accessControl.js +100 -0
- package/dist/server/accessControl.js.map +1 -0
- package/dist/server/createServer.d.ts +0 -5
- package/dist/server/createServer.js +9 -29
- package/dist/server/createServer.js.map +1 -1
- package/dist/server/eventsStore.d.ts +6 -1
- package/dist/server/eventsStore.js +83 -15
- package/dist/server/eventsStore.js.map +1 -1
- package/dist/server/routes.js +42 -10
- package/dist/server/routes.js.map +1 -1
- package/dist/server/sse.d.ts +2 -1
- package/dist/server/sse.js +15 -3
- package/dist/server/sse.js.map +1 -1
- package/dist/setup/setupGenerator.js +53 -6
- package/dist/setup/setupGenerator.js.map +1 -1
- package/dist/state/stateStore.d.ts +5 -0
- package/dist/state/stateStore.js +48 -62
- package/dist/state/stateStore.js.map +1 -1
- package/dist/storage/fileStore.d.ts +10 -0
- package/dist/storage/fileStore.js +131 -0
- package/dist/storage/fileStore.js.map +1 -0
- package/dist/teamControl/controlPlane.d.ts +255 -0
- package/dist/teamControl/controlPlane.js +918 -0
- package/dist/teamControl/controlPlane.js.map +1 -0
- package/dist/teamControl/deployment.d.ts +33 -0
- package/dist/teamControl/deployment.js +67 -0
- package/dist/teamControl/deployment.js.map +1 -0
- package/dist/teamControl/index.d.ts +4 -0
- package/dist/teamControl/index.js +3 -0
- package/dist/teamControl/index.js.map +1 -0
- package/dist/tests/testGenerator.js +4 -1
- package/dist/tests/testGenerator.js.map +1 -1
- package/dist/trust/index.d.ts +2 -0
- package/dist/trust/index.js +2 -0
- package/dist/trust/index.js.map +1 -0
- package/dist/trust/trustLadder.d.ts +182 -0
- package/dist/trust/trustLadder.js +560 -0
- package/dist/trust/trustLadder.js.map +1 -0
- package/dist/worlds/index.d.ts +2 -0
- package/dist/worlds/index.js +2 -0
- package/dist/worlds/index.js.map +1 -0
- package/dist/worlds/worlds.d.ts +160 -0
- package/dist/worlds/worlds.js +491 -0
- package/dist/worlds/worlds.js.map +1 -0
- package/docs/assets/dashboard.png +0 -0
- package/docs/ci.md +49 -0
- package/docs/commercial/README.md +29 -0
- package/docs/commercial/data-inventory.md +36 -0
- package/docs/commercial/manual-invoicing.md +44 -0
- package/docs/commercial/metrics.md +51 -0
- package/docs/commercial/pricing.md +103 -0
- package/docs/commercial/privacy-policy-draft.md +41 -0
- package/docs/commercial/terms-topics-for-counsel.md +51 -0
- package/docs/design-partners/README.md +52 -0
- package/docs/design-partners/demo-narratives.md +33 -0
- package/docs/design-partners/design-partner-offer.md +39 -0
- package/docs/design-partners/discovery-questions.md +28 -0
- package/docs/design-partners/feedback-capture-template.md +48 -0
- package/docs/design-partners/icp-one-pager.md +43 -0
- package/docs/design-partners/onboarding-checklist.md +33 -0
- package/docs/design-partners/pilot-success-criteria.md +27 -0
- package/docs/design-partners/pricing-interview-script.md +18 -0
- package/docs/design-partners/telemetry-plan.md +48 -0
- package/docs/development/baseline.md +114 -0
- package/docs/development/onboarding-smoke.md +37 -0
- package/docs/development/verification-0.1.8.md +25 -0
- package/docs/enterprise-product-roadmap-ru.md +1879 -0
- package/docs/fundraising/README.md +87 -0
- package/docs/fundraising/data-room-checklist.md +72 -0
- package/docs/fundraising/demo-script.md +52 -0
- package/docs/fundraising/design-partners-50.md +74 -0
- package/docs/fundraising/launch-posts.md +37 -0
- package/docs/fundraising/metrics-and-evidence.md +30 -0
- package/docs/fundraising/roadmap-12-month.md +25 -0
- package/docs/fundraising/technical-due-diligence-index.md +37 -0
- package/docs/fundraising/yc-application.md +25 -0
- package/docs/github-actions.md +84 -0
- package/docs/hosted-pilot.md +111 -0
- package/docs/mcp.md +52 -50
- package/docs/operations/disaster-recovery-runbook.md +81 -0
- package/docs/operations/kill-switch-runbook.md +32 -0
- package/docs/policy.md +61 -0
- package/docs/providers/authoring-packs.md +175 -0
- package/docs/providers/stripe-core-pack.md +82 -0
- package/docs/release-checklist.md +83 -71
- package/docs/release-migration-and-rollback.md +63 -0
- package/docs/release-readiness.md +39 -0
- package/docs/security/action-gateway-threat-model.md +34 -0
- package/docs/security/action-ledger-incident-replay-threat-model.md +42 -0
- package/docs/security/approval-inbox-threat-model.md +35 -0
- package/docs/security/credential-broker-threat-model.md +52 -0
- package/docs/security/egress-threat-model.md +126 -0
- package/docs/security/inventory-threat-model.md +104 -0
- package/docs/security/kill-switch-budgets-threat-model.md +37 -0
- package/docs/security/reliability-threat-model.md +111 -0
- package/docs/security/trust-ladder-threat-model.md +33 -0
- package/docs/team-control-plane.md +72 -0
- package/docs/usage.md +571 -57
- package/examples/README.md +10 -0
- package/examples/agent-instructions/README.md +39 -39
- package/examples/ci-smoke/README.md +21 -0
- package/examples/ci-smoke/ghostapi.policy.yaml +22 -0
- package/examples/ci-smoke/package.json +9 -0
- package/examples/ci-smoke/production-egress.mjs +2 -0
- package/examples/ci-smoke/safe.mjs +17 -0
- package/examples/evals/README.md +24 -0
- package/examples/evals/retry-after.eval.json +52 -0
- package/examples/generic-rest/README.md +27 -27
- package/examples/github-fetch/README.md +35 -35
- package/examples/openai-streaming/README.md +16 -0
- package/examples/openai-streaming/streaming-tool-call.mjs +31 -0
- package/examples/policy/ghostapi.policy.yaml +27 -0
- package/examples/record-replay/README.md +19 -0
- package/examples/record-replay/replay-requests.json +22 -0
- package/examples/record-replay/stripe-checkout.har.json +30 -0
- package/examples/resend-node/README.md +22 -22
- package/examples/stripe-node/README.md +35 -29
- package/examples/stripe-node/checkout-flow.mjs +61 -0
- package/examples/twilio-node/README.md +21 -21
- package/examples/worlds/README.md +19 -0
- package/examples/worlds/subscription-recovery.mjs +12 -0
- package/package.json +27 -12
- package/dist/providers/stripe.d.ts +0 -2
- package/dist/providers/stripe.js +0 -15
- package/dist/providers/stripe.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
|
|
3
|
+
const host = process.env.GHOSTAPI_HOST ?? "127.0.0.1";
|
|
4
|
+
const port = Number(process.env.GHOSTAPI_PORT ?? "8080");
|
|
5
|
+
const protocol = process.env.GHOSTAPI_PROTOCOL ?? "http";
|
|
6
|
+
const baseUrl = `${protocol}://${host}:${port}`;
|
|
7
|
+
const webhookSecret = process.env.GHOSTAPI_STRIPE_WEBHOOK_SECRET ?? "whsec_ghostapi_local_test_secret";
|
|
8
|
+
|
|
9
|
+
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? "sk_test_ghostapi_local_only", {
|
|
10
|
+
host,
|
|
11
|
+
port,
|
|
12
|
+
protocol,
|
|
13
|
+
apiVersion: "2026-02-25.clover"
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const customer = await stripe.customers.create({
|
|
17
|
+
email: "ada@example.com",
|
|
18
|
+
name: "Ada Lovelace",
|
|
19
|
+
metadata: { example: "ghostapi-subscription-flow" }
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const product = await stripe.products.create({ name: "GhostAPI Pro" });
|
|
23
|
+
const price = await stripe.prices.create({
|
|
24
|
+
product: product.id,
|
|
25
|
+
currency: "usd",
|
|
26
|
+
unit_amount: 2500,
|
|
27
|
+
recurring: { interval: "month" }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const subscription = await stripe.subscriptions.create({
|
|
31
|
+
customer: customer.id,
|
|
32
|
+
items: [{ price: price.id }],
|
|
33
|
+
trial_period_days: 7
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// The renewal action is a GhostAPI local test control, not a live Stripe endpoint.
|
|
37
|
+
const renewalResponse = await fetch(`${baseUrl}/v1/subscriptions/${subscription.id}/renew`, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: { "content-type": "application/json" },
|
|
40
|
+
body: JSON.stringify({})
|
|
41
|
+
});
|
|
42
|
+
const renewed = await renewalResponse.json();
|
|
43
|
+
|
|
44
|
+
const events = await stripe.events.list({ limit: 20 });
|
|
45
|
+
const event = events.data.find((candidate) => candidate.type === "invoice.payment_succeeded");
|
|
46
|
+
if (event === undefined) throw new Error("Expected a local invoice.payment_succeeded webhook event.");
|
|
47
|
+
|
|
48
|
+
const delivery = await fetch(`${baseUrl}/v1/events/${event.id}/deliver?delivery_mode=duplicate`);
|
|
49
|
+
const payload = await delivery.text();
|
|
50
|
+
const signature = delivery.headers.get("stripe-signature");
|
|
51
|
+
if (signature === null) throw new Error("GhostAPI webhook delivery did not include stripe-signature.");
|
|
52
|
+
const verifiedEvent = stripe.webhooks.constructEvent(payload, signature, webhookSecret);
|
|
53
|
+
|
|
54
|
+
console.log(JSON.stringify({
|
|
55
|
+
customer: customer.id,
|
|
56
|
+
product: product.id,
|
|
57
|
+
price: price.id,
|
|
58
|
+
trialSubscription: subscription.id,
|
|
59
|
+
renewedSubscription: renewed.id,
|
|
60
|
+
verifiedWebhook: { id: verifiedEvent.id, type: verifiedEvent.type }
|
|
61
|
+
}, null, 2));
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# Twilio Node Example
|
|
2
|
-
|
|
3
|
-
Send a Twilio-like SMS through GhostAPI. This does not send a real SMS.
|
|
4
|
-
|
|
5
|
-
## Run
|
|
6
|
-
|
|
7
|
-
Start GhostAPI:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ghostapi start
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Send a message:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
curl -X POST http://localhost:8080/2010-04-01/Accounts/AC_mock/Messages.json \
|
|
17
|
-
-H "content-type: application/x-www-form-urlencoded" \
|
|
18
|
-
-d "To=+15551234567&From=+15557654321&Body=Hello%20from%20GhostAPI"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
GhostAPI detects Twilio from the `/2010-04-01/Accounts/...` path and returns a local message SID.
|
|
1
|
+
# Twilio Node Example
|
|
2
|
+
|
|
3
|
+
Send a Twilio-like SMS through GhostAPI. This does not send a real SMS.
|
|
4
|
+
|
|
5
|
+
## Run
|
|
6
|
+
|
|
7
|
+
Start GhostAPI:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ghostapi start
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Send a message:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -X POST http://localhost:8080/2010-04-01/Accounts/AC_mock/Messages.json \
|
|
17
|
+
-H "content-type: application/x-www-form-urlencoded" \
|
|
18
|
+
-d "To=+15551234567&From=+15557654321&Body=Hello%20from%20GhostAPI"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
GhostAPI detects Twilio from the `/2010-04-01/Accounts/...` path and returns a local message SID.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Stateful Synthetic World Example
|
|
2
|
+
|
|
3
|
+
This local-only workflow keeps one synthetic persona and organization consistent across Stripe, GitHub, email, and generic REST state.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
ghostapi world create --id subscription-recovery --seed demo-seed
|
|
7
|
+
npm run build
|
|
8
|
+
node examples/worlds/subscription-recovery.mjs
|
|
9
|
+
ghostapi world inspect subscription-recovery --json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The workflow atomically creates a Stripe customer and past-due subscription, records a generic REST payment failure, sends a synthetic email to a `ghostapi.invalid` inbox, and opens a synthetic GitHub recovery issue. Re-running the same action is idempotent. Reset and fork remain local:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
ghostapi world reset subscription-recovery
|
|
16
|
+
ghostapi world fork subscription-recovery --id subscription-recovery-investigation
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Worlds are local JSON under `.ghostapi/worlds/`. They are bounded to 512 KiB and 100 workflow receipts, use one file lock plus atomic replacement for each transition, and intentionally do not call provider APIs or contain real credentials, inboxes, or PII.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { runSubscriptionFailureWorkflow } from "../../dist/index.js";
|
|
2
|
+
|
|
3
|
+
const worldId = process.env.GHOSTAPI_WORLD_ID ?? "subscription-recovery";
|
|
4
|
+
const receipt = await runSubscriptionFailureWorkflow(worldId, "subscription-payment-failed");
|
|
5
|
+
|
|
6
|
+
console.log(JSON.stringify({
|
|
7
|
+
customerId: receipt.customerId,
|
|
8
|
+
subscriptionId: receipt.subscriptionId,
|
|
9
|
+
emailId: receipt.emailId,
|
|
10
|
+
githubIssue: receipt.issueNumber,
|
|
11
|
+
genericRestFailureId: receipt.genericFailureId
|
|
12
|
+
}, null, 2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yiaany/ghostapi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "The local internet for AI coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,17 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/yiaany/ghostapi/issues"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/yiaany/
|
|
13
|
+
"homepage": "https://github.com/yiaany/ghostapi#readme",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
14
24
|
"bin": {
|
|
15
25
|
"ghostapi": "dist/cli/index.js"
|
|
16
26
|
},
|
|
@@ -26,11 +36,14 @@
|
|
|
26
36
|
],
|
|
27
37
|
"scripts": {
|
|
28
38
|
"dev": "tsx src/cli/index.ts start",
|
|
29
|
-
"build": "tsc -p tsconfig.json &&
|
|
39
|
+
"build": "tsc -p tsconfig.json && npm run build:static",
|
|
30
40
|
"build:static": "node -e \"const {cpSync, mkdirSync} = require('fs'); mkdirSync('dist/dashboard', {recursive:true}); cpSync('src/dashboard/index.html', 'dist/dashboard/index.html'); cpSync('src/dashboard/styles.css', 'dist/dashboard/styles.css'); cpSync('src/dashboard/app.js', 'dist/dashboard/app.js');\"",
|
|
31
41
|
"start": "node dist/cli/index.js start",
|
|
32
42
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
-
"test": "vitest run"
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"smoke:package": "node scripts/package-smoke.mjs",
|
|
45
|
+
"lint": "npm run format:check",
|
|
46
|
+
"format:check": "prettier --check package.json tsconfig.json vitest.config.ts scripts/package-smoke.mjs test/dashboardAssets.test.ts"
|
|
34
47
|
},
|
|
35
48
|
"keywords": [
|
|
36
49
|
"mcp",
|
|
@@ -49,23 +62,25 @@
|
|
|
49
62
|
],
|
|
50
63
|
"license": "MIT",
|
|
51
64
|
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
65
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
53
66
|
"express": "^4.19.2",
|
|
54
67
|
"selfsigned": "^5.5.0",
|
|
68
|
+
"yaml": "2.9.0",
|
|
55
69
|
"zod": "^4.4.3"
|
|
56
70
|
},
|
|
71
|
+
"overrides": {
|
|
72
|
+
"@hono/node-server": "2.1.0",
|
|
73
|
+
"fast-uri": "3.1.5",
|
|
74
|
+
"hono": "4.13.0",
|
|
75
|
+
"ip-address": "10.4.0"
|
|
76
|
+
},
|
|
57
77
|
"devDependencies": {
|
|
58
78
|
"@types/express": "^4.17.21",
|
|
59
79
|
"@types/node": "^20.14.10",
|
|
60
|
-
"
|
|
61
|
-
"@types/react-dom": "^19.2.3",
|
|
62
|
-
"@vitejs/plugin-react": "^4.7.0",
|
|
63
|
-
"react": "^19.2.3",
|
|
64
|
-
"react-dom": "^19.2.3",
|
|
80
|
+
"prettier": "^3.9.6",
|
|
65
81
|
"tsx": "^4.16.2",
|
|
66
82
|
"typescript": "^5.5.3",
|
|
67
|
-
"
|
|
68
|
-
"vitest": "^2.0.3"
|
|
83
|
+
"vitest": "^4.1.11"
|
|
69
84
|
},
|
|
70
85
|
"engines": {
|
|
71
86
|
"node": ">=20"
|
package/dist/providers/stripe.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const stripeAdapter = {
|
|
2
|
-
name: "stripe",
|
|
3
|
-
displayName: "Stripe",
|
|
4
|
-
formatError(details) {
|
|
5
|
-
return {
|
|
6
|
-
error: {
|
|
7
|
-
type: details.type ?? "invalid_request_error",
|
|
8
|
-
message: details.message,
|
|
9
|
-
code: typeof details.code === "string" ? details.code : "parameter_missing",
|
|
10
|
-
param: details.param ?? "unknown"
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=stripe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../src/providers/stripe.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,WAAW,CAAC,OAA6B;QACvC,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,uBAAuB;gBAC7C,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB;gBAC3E,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,SAAS;aAClC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|