@yiaany/ghostapi 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/CONTRIBUTING.md +132 -119
  3. package/LICENSE +21 -21
  4. package/PROVENANCE.md +13 -0
  5. package/README.md +78 -84
  6. package/SECURITY.md +56 -53
  7. package/dist/actions/gateway.js +320 -72
  8. package/dist/actions/gateway.js.map +1 -1
  9. package/dist/actions/index.d.ts +2 -2
  10. package/dist/actions/index.js +1 -1
  11. package/dist/actions/index.js.map +1 -1
  12. package/dist/agents/agentPrompt.js +7 -5
  13. package/dist/agents/agentPrompt.js.map +1 -1
  14. package/dist/ai/aiClient.js +5 -5
  15. package/dist/ai/aiClient.js.map +1 -1
  16. package/dist/ai/aiGenerator.js +66 -26
  17. package/dist/ai/aiGenerator.js.map +1 -1
  18. package/dist/ai/genericInference.js +151 -36
  19. package/dist/ai/genericInference.js.map +1 -1
  20. package/dist/ai/prompts.js +55 -49
  21. package/dist/ai/prompts.js.map +1 -1
  22. package/dist/approvals/approvalInbox.js +649 -133
  23. package/dist/approvals/approvalInbox.js.map +1 -1
  24. package/dist/approvals/index.d.ts +2 -2
  25. package/dist/approvals/index.js +1 -1
  26. package/dist/approvals/index.js.map +1 -1
  27. package/dist/behavior/behaviorStore.js +34 -14
  28. package/dist/behavior/behaviorStore.js.map +1 -1
  29. package/dist/cache/index.js +14 -5
  30. package/dist/cache/index.js.map +1 -1
  31. package/dist/cli/index.js +226 -93
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/cli/openUrl.js +17 -3
  34. package/dist/cli/openUrl.js.map +1 -1
  35. package/dist/cli/parser.js +79 -18
  36. package/dist/cli/parser.js.map +1 -1
  37. package/dist/config/dataPaths.js +4 -2
  38. package/dist/config/dataPaths.js.map +1 -1
  39. package/dist/config/localConfig.js +5 -2
  40. package/dist/config/localConfig.js.map +1 -1
  41. package/dist/config/serverConfig.js +11 -5
  42. package/dist/config/serverConfig.js.map +1 -1
  43. package/dist/contracts/contract.js +311 -83
  44. package/dist/contracts/contract.js.map +1 -1
  45. package/dist/contracts/index.d.ts +2 -2
  46. package/dist/contracts/index.js +1 -1
  47. package/dist/contracts/index.js.map +1 -1
  48. package/dist/credentials/credentialBroker.js +391 -79
  49. package/dist/credentials/credentialBroker.js.map +1 -1
  50. package/dist/credentials/index.d.ts +2 -2
  51. package/dist/credentials/index.js +1 -1
  52. package/dist/credentials/index.js.map +1 -1
  53. package/dist/dashboard/app.js +823 -685
  54. package/dist/dashboard/dashboard.js.map +1 -1
  55. package/dist/dashboard/index.html +704 -267
  56. package/dist/dashboard/styles.css +1040 -349
  57. package/dist/egress/capabilities.js +55 -25
  58. package/dist/egress/capabilities.js.map +1 -1
  59. package/dist/egress/linuxBootstrap.js +47 -11
  60. package/dist/egress/linuxBootstrap.js.map +1 -1
  61. package/dist/egress/run.js +170 -31
  62. package/dist/egress/run.js.map +1 -1
  63. package/dist/errors/errorEngine.js +15 -3
  64. package/dist/errors/errorEngine.js.map +1 -1
  65. package/dist/errors/providerErrors.js.map +1 -1
  66. package/dist/evals/evals.js +304 -78
  67. package/dist/evals/evals.js.map +1 -1
  68. package/dist/evals/index.d.ts +2 -2
  69. package/dist/evals/index.js +1 -1
  70. package/dist/evals/index.js.map +1 -1
  71. package/dist/evidence/index.d.ts +2 -2
  72. package/dist/evidence/index.js +1 -1
  73. package/dist/evidence/index.js.map +1 -1
  74. package/dist/evidence/report.d.ts +1 -1
  75. package/dist/evidence/report.js +263 -79
  76. package/dist/evidence/report.js.map +1 -1
  77. package/dist/fault/faultLab.js +24 -9
  78. package/dist/fault/faultLab.js.map +1 -1
  79. package/dist/index.d.ts +42 -42
  80. package/dist/index.js +21 -21
  81. package/dist/index.js.map +1 -1
  82. package/dist/inventory/analysis.d.ts +1 -1
  83. package/dist/inventory/analysis.js +174 -50
  84. package/dist/inventory/analysis.js.map +1 -1
  85. package/dist/inventory/index.d.ts +4 -4
  86. package/dist/inventory/index.js +3 -3
  87. package/dist/inventory/index.js.map +1 -1
  88. package/dist/inventory/inventoryController.js +362 -115
  89. package/dist/inventory/inventoryController.js.map +1 -1
  90. package/dist/inventory/types.js +680 -140
  91. package/dist/inventory/types.js.map +1 -1
  92. package/dist/ledger/actionLedger.js +355 -78
  93. package/dist/ledger/actionLedger.js.map +1 -1
  94. package/dist/ledger/index.d.ts +2 -2
  95. package/dist/ledger/index.js +1 -1
  96. package/dist/ledger/index.js.map +1 -1
  97. package/dist/mcp/server.js +26 -11
  98. package/dist/mcp/server.js.map +1 -1
  99. package/dist/policy/index.d.ts +2 -2
  100. package/dist/policy/index.js +1 -1
  101. package/dist/policy/index.js.map +1 -1
  102. package/dist/policy/policy.js +112 -32
  103. package/dist/policy/policy.js.map +1 -1
  104. package/dist/productTelemetry/index.js +71 -20
  105. package/dist/productTelemetry/index.js.map +1 -1
  106. package/dist/providers/conformance.js +10 -5
  107. package/dist/providers/conformance.js.map +1 -1
  108. package/dist/providers/discord.js +2 -2
  109. package/dist/providers/generic.js +3 -3
  110. package/dist/providers/github.js +2 -2
  111. package/dist/providers/index.d.ts +3 -3
  112. package/dist/providers/index.js +2 -2
  113. package/dist/providers/index.js.map +1 -1
  114. package/dist/providers/openai.js +3 -3
  115. package/dist/providers/packs/resendPack.js +51 -25
  116. package/dist/providers/packs/resendPack.js.map +1 -1
  117. package/dist/providers/packs/stripePack.js +590 -121
  118. package/dist/providers/packs/stripePack.js.map +1 -1
  119. package/dist/providers/registry.js +4 -4
  120. package/dist/providers/registry.js.map +1 -1
  121. package/dist/providers/runtime.js +7 -6
  122. package/dist/providers/runtime.js.map +1 -1
  123. package/dist/providers/stripeWebhook.js +39 -10
  124. package/dist/providers/stripeWebhook.js.map +1 -1
  125. package/dist/providers/twilio.js +2 -2
  126. package/dist/proxy/cacheKey.js +9 -2
  127. package/dist/proxy/cacheKey.js.map +1 -1
  128. package/dist/proxy/providerDetector.js +22 -9
  129. package/dist/proxy/providerDetector.js.map +1 -1
  130. package/dist/proxy/proxyHandler.js +57 -22
  131. package/dist/proxy/proxyHandler.js.map +1 -1
  132. package/dist/proxy/requestNormalizer.js +4 -2
  133. package/dist/proxy/requestNormalizer.js.map +1 -1
  134. package/dist/reliability/costGovernance.js +211 -49
  135. package/dist/reliability/costGovernance.js.map +1 -1
  136. package/dist/reliability/index.d.ts +8 -8
  137. package/dist/reliability/index.js +4 -4
  138. package/dist/reliability/index.js.map +1 -1
  139. package/dist/reliability/reconciliation.js +274 -65
  140. package/dist/reliability/reconciliation.js.map +1 -1
  141. package/dist/reliability/runtimeHealth.js +127 -35
  142. package/dist/reliability/runtimeHealth.js.map +1 -1
  143. package/dist/reliability/slo.js +257 -50
  144. package/dist/reliability/slo.js.map +1 -1
  145. package/dist/report/safetyReport.d.ts +6 -0
  146. package/dist/report/safetyReport.js +56 -12
  147. package/dist/report/safetyReport.js.map +1 -1
  148. package/dist/rules/aiRules.js +5 -5
  149. package/dist/rules/aiRules.js.map +1 -1
  150. package/dist/safety/index.d.ts +2 -2
  151. package/dist/safety/index.js +1 -1
  152. package/dist/safety/index.js.map +1 -1
  153. package/dist/safety/safetyController.js +675 -165
  154. package/dist/safety/safetyController.js.map +1 -1
  155. package/dist/scenarios/scenarioBundle.js +204 -71
  156. package/dist/scenarios/scenarioBundle.js.map +1 -1
  157. package/dist/scenarios/scenarioStore.js +88 -29
  158. package/dist/scenarios/scenarioStore.js.map +1 -1
  159. package/dist/security/headerSanitizer.js +52 -10
  160. package/dist/security/headerSanitizer.js.map +1 -1
  161. package/dist/security/secrets.js +10 -5
  162. package/dist/security/secrets.js.map +1 -1
  163. package/dist/server/accessControl.js +37 -10
  164. package/dist/server/accessControl.js.map +1 -1
  165. package/dist/server/createServer.js +1 -1
  166. package/dist/server/createServer.js.map +1 -1
  167. package/dist/server/eventsStore.js +15 -5
  168. package/dist/server/eventsStore.js.map +1 -1
  169. package/dist/server/routes.js +61 -19
  170. package/dist/server/routes.js.map +1 -1
  171. package/dist/server/sse.js +1 -1
  172. package/dist/server/sse.js.map +1 -1
  173. package/dist/setup/sdkDetector.js +7 -2
  174. package/dist/setup/sdkDetector.js.map +1 -1
  175. package/dist/setup/setupGenerator.js +136 -48
  176. package/dist/setup/setupGenerator.js.map +1 -1
  177. package/dist/state/stateExtractor.js +3 -1
  178. package/dist/state/stateExtractor.js.map +1 -1
  179. package/dist/state/stateResolver.js +10 -7
  180. package/dist/state/stateResolver.js.map +1 -1
  181. package/dist/state/stateStore.js +13 -4
  182. package/dist/state/stateStore.js.map +1 -1
  183. package/dist/storage/fileStore.js +12 -4
  184. package/dist/storage/fileStore.js.map +1 -1
  185. package/dist/teamControl/controlPlane.js +846 -174
  186. package/dist/teamControl/controlPlane.js.map +1 -1
  187. package/dist/teamControl/deployment.js +19 -5
  188. package/dist/teamControl/deployment.js.map +1 -1
  189. package/dist/teamControl/index.d.ts +4 -4
  190. package/dist/teamControl/index.js +2 -2
  191. package/dist/teamControl/index.js.map +1 -1
  192. package/dist/tests/testGenerator.js +15 -7
  193. package/dist/tests/testGenerator.js.map +1 -1
  194. package/dist/trust/index.d.ts +2 -2
  195. package/dist/trust/index.js +1 -1
  196. package/dist/trust/index.js.map +1 -1
  197. package/dist/trust/trustLadder.js +309 -63
  198. package/dist/trust/trustLadder.js.map +1 -1
  199. package/dist/worlds/index.d.ts +2 -2
  200. package/dist/worlds/index.js +1 -1
  201. package/dist/worlds/index.js.map +1 -1
  202. package/dist/worlds/worlds.js +364 -65
  203. package/dist/worlds/worlds.js.map +1 -1
  204. package/docs/assets/dashboard.png +0 -0
  205. package/docs/ci.md +49 -49
  206. package/docs/github-actions.md +84 -84
  207. package/docs/mcp.md +58 -52
  208. package/docs/policy.md +63 -61
  209. package/docs/providers/authoring-packs.md +180 -175
  210. package/docs/providers/stripe-core-pack.md +84 -82
  211. package/docs/releases/README.md +13 -0
  212. package/docs/security/action-gateway-threat-model.md +34 -34
  213. package/docs/security/action-ledger-incident-replay-threat-model.md +42 -42
  214. package/docs/security/approval-inbox-threat-model.md +35 -35
  215. package/docs/security/credential-broker-threat-model.md +52 -52
  216. package/docs/security/egress-threat-model.md +126 -126
  217. package/docs/security/inventory-threat-model.md +104 -104
  218. package/docs/security/kill-switch-budgets-threat-model.md +37 -37
  219. package/docs/security/reliability-threat-model.md +111 -111
  220. package/docs/security/trust-ladder-threat-model.md +33 -33
  221. package/docs/telemetry.md +14 -0
  222. package/docs/usage.md +680 -571
  223. package/examples/README.md +10 -10
  224. package/examples/agent-instructions/README.md +39 -39
  225. package/examples/ci-smoke/README.md +21 -21
  226. package/examples/ci-smoke/ghostapi.policy.yaml +22 -22
  227. package/examples/ci-smoke/package.json +9 -9
  228. package/examples/ci-smoke/production-egress.mjs +4 -2
  229. package/examples/ci-smoke/safe.mjs +21 -17
  230. package/examples/evals/README.md +24 -24
  231. package/examples/evals/retry-after.eval.json +71 -52
  232. package/examples/generic-rest/README.md +27 -27
  233. package/examples/github-fetch/README.md +38 -35
  234. package/examples/openai-streaming/README.md +16 -16
  235. package/examples/openai-streaming/streaming-tool-call.mjs +44 -31
  236. package/examples/policy/ghostapi.policy.yaml +27 -27
  237. package/examples/record-replay/README.md +19 -19
  238. package/examples/record-replay/replay-requests.json +22 -22
  239. package/examples/record-replay/stripe-checkout.har.json +30 -30
  240. package/examples/resend-node/README.md +22 -22
  241. package/examples/stripe-node/README.md +35 -35
  242. package/examples/stripe-node/checkout-flow.mjs +87 -61
  243. package/examples/twilio-node/README.md +21 -21
  244. package/examples/worlds/README.md +19 -19
  245. package/examples/worlds/subscription-recovery.mjs +21 -12
  246. package/package.json +28 -6
  247. package/dist/landing/assets/index-BXR41fAD.css +0 -1
  248. package/dist/landing/assets/index-CxWsopzP.css +0 -1
  249. package/dist/landing/assets/index-D8_ggMRE.js +0 -55
  250. package/dist/landing/assets/index-DZlpyhqd.js +0 -55
  251. package/dist/landing/assets/index-Dk-Xezs3.js +0 -55
  252. package/dist/landing/index.html +0 -15
  253. package/dist/landing/landing.d.ts +0 -3
  254. package/dist/landing/landing.js +0 -12
  255. package/dist/landing/landing.js.map +0 -1
  256. package/docs/commercial/README.md +0 -29
  257. package/docs/commercial/data-inventory.md +0 -36
  258. package/docs/commercial/manual-invoicing.md +0 -44
  259. package/docs/commercial/metrics.md +0 -51
  260. package/docs/commercial/pricing.md +0 -103
  261. package/docs/commercial/privacy-policy-draft.md +0 -41
  262. package/docs/commercial/terms-topics-for-counsel.md +0 -51
  263. package/docs/design-partners/README.md +0 -52
  264. package/docs/design-partners/demo-narratives.md +0 -33
  265. package/docs/design-partners/design-partner-offer.md +0 -39
  266. package/docs/design-partners/discovery-questions.md +0 -28
  267. package/docs/design-partners/feedback-capture-template.md +0 -48
  268. package/docs/design-partners/icp-one-pager.md +0 -43
  269. package/docs/design-partners/onboarding-checklist.md +0 -33
  270. package/docs/design-partners/pilot-success-criteria.md +0 -27
  271. package/docs/design-partners/pricing-interview-script.md +0 -18
  272. package/docs/design-partners/telemetry-plan.md +0 -48
  273. package/docs/development/baseline.md +0 -114
  274. package/docs/development/onboarding-smoke.md +0 -37
  275. package/docs/development/verification-0.1.8.md +0 -25
  276. package/docs/enterprise-product-roadmap-ru.md +0 -1879
  277. package/docs/fundraising/README.md +0 -87
  278. package/docs/fundraising/data-room-checklist.md +0 -72
  279. package/docs/fundraising/demo-script.md +0 -52
  280. package/docs/fundraising/design-partners-50.md +0 -74
  281. package/docs/fundraising/launch-posts.md +0 -37
  282. package/docs/fundraising/metrics-and-evidence.md +0 -30
  283. package/docs/fundraising/roadmap-12-month.md +0 -25
  284. package/docs/fundraising/technical-due-diligence-index.md +0 -37
  285. package/docs/fundraising/yc-application.md +0 -25
  286. package/docs/hosted-pilot.md +0 -111
  287. package/docs/operations/disaster-recovery-runbook.md +0 -81
  288. package/docs/operations/kill-switch-runbook.md +0 -32
  289. package/docs/release-checklist.md +0 -83
  290. package/docs/release-migration-and-rollback.md +0 -63
  291. package/docs/release-readiness.md +0 -39
  292. package/docs/team-control-plane.md +0 -72
@@ -1,10 +1,10 @@
1
- # GhostAPI Starter Examples
2
-
3
- - `stripe-node/`: Stripe checkout, subscription, refund, and local webhook starter using fake local keys.
4
- - `openai-streaming/`: OpenAI-shaped streaming/tool-call request against local GhostAPI.
5
- - `ci-smoke/`: CI policy pass/fail fixtures, including an intentional production-egress failure.
6
- - `record-replay/`: Sanitized HAR import plus deterministic replay with no live provider traffic.
7
- - `evals/`: Agent eval spec starter scored from sanitized evidence.
8
- - `worlds/`: Stateful synthetic world starter for a subscription recovery workflow.
9
-
10
- Run `npx @yiaany/ghostapi doctor` before using `ghostapi run`; Linux namespace enforcement is not claimed on Windows or macOS.
1
+ # GhostAPI Starter Examples
2
+
3
+ - `stripe-node/`: Stripe checkout, subscription, refund, and local webhook starter using fake local keys.
4
+ - `openai-streaming/`: OpenAI-shaped streaming/tool-call request against local GhostAPI.
5
+ - `ci-smoke/`: CI policy pass/fail fixtures, including an intentional production-egress failure.
6
+ - `record-replay/`: Sanitized HAR import plus deterministic replay with no live provider traffic.
7
+ - `evals/`: Agent eval spec starter scored from sanitized evidence.
8
+ - `worlds/`: Stateful synthetic world starter for a subscription recovery workflow.
9
+
10
+ Run `npx @yiaany/ghostapi doctor` before using `ghostapi run`; Linux namespace enforcement is not claimed on Windows or macOS.
@@ -1,39 +1,39 @@
1
- # Agent Instructions
2
-
3
- Use these snippets in AI coding tools when you want agents to test external integrations safely through GhostAPI.
4
-
5
- ## Universal Instruction
6
-
7
- ```text
8
- When testing external API integrations, use GhostAPI at http://localhost:8080. Do not send real requests to Stripe, Twilio, Resend, GitHub, Gmail or other external services unless explicitly approved by the user.
9
- ```
10
-
11
- ## Cursor
12
-
13
- ```text
14
- For integration tests and local development, route external API calls through http://localhost:8080. Treat GhostAPI as the only approved target for Stripe, Twilio, Resend, GitHub, Gmail, Slack, Notion, and other external services unless the user explicitly approves live network calls.
15
- ```
16
-
17
- ## Cline
18
-
19
- ```text
20
- Before running code that touches third-party APIs, rewrite base URLs to http://localhost:8080 and use GhostAPI. Never use production API keys or make real external requests without explicit user approval.
21
- ```
22
-
23
- ## Aider
24
-
25
- ```text
26
- When adding or testing API integrations, prefer GhostAPI at http://localhost:8080 for all external services. Keep credentials local and fake. Do not call real Stripe, Twilio, Resend, GitHub, Gmail, or similar APIs unless explicitly instructed.
27
- ```
28
-
29
- ## Codex
30
-
31
- ```text
32
- Use http://localhost:8080 as the base URL for external API integration tests. GhostAPI should simulate provider responses locally. Avoid real network requests to third-party APIs unless explicitly approved by the user.
33
- ```
34
-
35
- ## OpenCode
36
-
37
- ```text
38
- For provider integration work, point SDKs and fetch calls at GhostAPI on http://localhost:8080. Do not send real requests to Stripe, Twilio, Resend, GitHub, Gmail, Slack, Notion, or any other external service without explicit approval.
39
- ```
1
+ # Agent Instructions
2
+
3
+ Use these snippets in AI coding tools when you want agents to test external integrations safely through GhostAPI.
4
+
5
+ ## Universal Instruction
6
+
7
+ ```text
8
+ When testing external API integrations, use GhostAPI at http://localhost:8080. Do not send real requests to Stripe, Twilio, Resend, GitHub, Gmail or other external services unless explicitly approved by the user.
9
+ ```
10
+
11
+ ## Cursor
12
+
13
+ ```text
14
+ For integration tests and local development, route external API calls through http://localhost:8080. Treat GhostAPI as the only approved target for Stripe, Twilio, Resend, GitHub, Gmail, Slack, Notion, and other external services unless the user explicitly approves live network calls.
15
+ ```
16
+
17
+ ## Cline
18
+
19
+ ```text
20
+ Before running code that touches third-party APIs, rewrite base URLs to http://localhost:8080 and use GhostAPI. Never use production API keys or make real external requests without explicit user approval.
21
+ ```
22
+
23
+ ## Aider
24
+
25
+ ```text
26
+ When adding or testing API integrations, prefer GhostAPI at http://localhost:8080 for all external services. Keep credentials local and fake. Do not call real Stripe, Twilio, Resend, GitHub, Gmail, or similar APIs unless explicitly instructed.
27
+ ```
28
+
29
+ ## Codex
30
+
31
+ ```text
32
+ Use http://localhost:8080 as the base URL for external API integration tests. GhostAPI should simulate provider responses locally. Avoid real network requests to third-party APIs unless explicitly approved by the user.
33
+ ```
34
+
35
+ ## OpenCode
36
+
37
+ ```text
38
+ For provider integration work, point SDKs and fetch calls at GhostAPI on http://localhost:8080. Do not send real requests to Stripe, Twilio, Resend, GitHub, Gmail, Slack, Notion, or any other external service without explicit approval.
39
+ ```
@@ -1,21 +1,21 @@
1
- # GhostAPI CI Smoke Fixture
2
-
3
- This fixture is used by the repository's GitHub Actions reference workflow and can be run on a Linux host that supports GhostAPI namespaces.
4
-
5
- ```bash
6
- export GHOSTAPI_DATA_DIR="$(mktemp -d)"
7
- ghostapi run --policy ghostapi.policy.yaml -- npm run test:safe
8
- ```
9
-
10
- The safe command sends a request only to the GhostAPI endpoint injected by `ghostapi run`. It records `ci.safe_ghostapi`, which the fixture policy requires.
11
-
12
- The unsafe command is a regression test for the namespace boundary. It must exit non-zero when run through GhostAPI:
13
-
14
- ```bash
15
- if ghostapi run --policy ghostapi.policy.yaml -- npm run test:production-egress; then
16
- echo "unexpected production egress"
17
- exit 1
18
- fi
19
- ```
20
-
21
- The unsafe fixture must never be run directly on a developer machine or ordinary CI executor because it intentionally targets `api.stripe.com`.
1
+ # GhostAPI CI Smoke Fixture
2
+
3
+ This fixture is used by the repository's GitHub Actions reference workflow and can be run on a Linux host that supports GhostAPI namespaces.
4
+
5
+ ```bash
6
+ export GHOSTAPI_DATA_DIR="$(mktemp -d)"
7
+ ghostapi run --policy ghostapi.policy.yaml -- npm run test:safe
8
+ ```
9
+
10
+ The safe command sends a request only to the GhostAPI endpoint injected by `ghostapi run`. It records `ci.safe_ghostapi`, which the fixture policy requires.
11
+
12
+ The unsafe command is a regression test for the namespace boundary. It must exit non-zero when run through GhostAPI:
13
+
14
+ ```bash
15
+ if ghostapi run --policy ghostapi.policy.yaml -- npm run test:production-egress; then
16
+ echo "unexpected production egress"
17
+ exit 1
18
+ fi
19
+ ```
20
+
21
+ The unsafe fixture must never be run directly on a developer machine or ordinary CI executor because it intentionally targets `api.stripe.com`.
@@ -1,22 +1,22 @@
1
- version: 1
2
- network:
3
- default: deny
4
- allow:
5
- - host: localhost
6
- - host: 127.0.0.1
7
- deny:
8
- - host: api.stripe.com
9
- productionHosts:
10
- - '*.stripe.com'
11
- credentials:
12
- forbid:
13
- - sk_live_*
14
- requiredScenarios:
15
- - ci.safe_ghostapi
16
- enforcement:
17
- allowedModes:
18
- - linux-network-namespace
19
- reports:
20
- maxProductionEgressAttempts: 0
21
- maxForbiddenCredentialMatches: 0
22
- maxBreakingContractChanges: 0
1
+ version: 1
2
+ network:
3
+ default: deny
4
+ allow:
5
+ - host: localhost
6
+ - host: 127.0.0.1
7
+ deny:
8
+ - host: api.stripe.com
9
+ productionHosts:
10
+ - "*.stripe.com"
11
+ credentials:
12
+ forbid:
13
+ - sk_live_*
14
+ requiredScenarios:
15
+ - ci.safe_ghostapi
16
+ enforcement:
17
+ allowedModes:
18
+ - linux-network-namespace
19
+ reports:
20
+ maxProductionEgressAttempts: 0
21
+ maxForbiddenCredentialMatches: 0
22
+ maxBreakingContractChanges: 0
@@ -1,9 +1,9 @@
1
- {
2
- "name": "ghostapi-ci-smoke-fixtures",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "test:safe": "node safe.mjs",
7
- "test:production-egress": "node production-egress.mjs"
8
- }
9
- }
1
+ {
2
+ "name": "ghostapi-ci-smoke-fixtures",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "test:safe": "node safe.mjs",
7
+ "test:production-egress": "node production-egress.mjs"
8
+ }
9
+ }
@@ -1,2 +1,4 @@
1
- // This fixture deliberately represents unsafe application behavior. Only run it through ghostapi run.
2
- await fetch("https://api.stripe.com/v1/customers", { signal: AbortSignal.timeout(5_000) });
1
+ // This fixture deliberately represents unsafe application behavior. Only run it through ghostapi run.
2
+ await fetch("https://api.stripe.com/v1/customers", {
3
+ signal: AbortSignal.timeout(5_000),
4
+ });
@@ -1,17 +1,21 @@
1
- const baseUrl = process.env.GHOSTAPI_BASE_URL;
2
-
3
- if (!baseUrl) throw new Error("GHOSTAPI_BASE_URL is required; run this fixture through ghostapi run.");
4
-
5
- const response = await fetch(`${baseUrl}/v1/customers`, {
6
- method: "POST",
7
- headers: {
8
- "content-type": "application/json"
9
- },
10
- body: JSON.stringify({
11
- email: "ci-safe@example.invalid",
12
- metadata: { scenario: "ci.safe_ghostapi" }
13
- })
14
- });
15
-
16
- if (!response.ok) throw new Error(`GhostAPI safe fixture failed with HTTP ${response.status}.`);
17
- console.log("GhostAPI safe fixture completed through the loopback runtime.");
1
+ const baseUrl = process.env.GHOSTAPI_BASE_URL;
2
+
3
+ if (!baseUrl)
4
+ throw new Error(
5
+ "GHOSTAPI_BASE_URL is required; run this fixture through ghostapi run.",
6
+ );
7
+
8
+ const response = await fetch(`${baseUrl}/v1/customers`, {
9
+ method: "POST",
10
+ headers: {
11
+ "content-type": "application/json",
12
+ },
13
+ body: JSON.stringify({
14
+ email: "ci-safe@example.invalid",
15
+ metadata: { scenario: "ci.safe_ghostapi" },
16
+ }),
17
+ });
18
+
19
+ if (!response.ok)
20
+ throw new Error(`GhostAPI safe fixture failed with HTTP ${response.status}.`);
21
+ console.log("GhostAPI safe fixture completed through the loopback runtime.");
@@ -1,24 +1,24 @@
1
- # GhostAPI Agent Eval Demo
2
-
3
- This directory shows the coding-agent workflow for deterministic evals.
4
-
5
- 1. Run the agent's integration tests through the safety boundary on a supported Linux host:
6
-
7
- ```bash
8
- ghostapi run -- npm test
9
- ```
10
-
11
- 2. Generate sanitized evidence for the run:
12
-
13
- ```bash
14
- ghostapi evidence generate --run .ghostapi/runs/<run-id>/run.json --out .ghostapi/reports/agent.json
15
- ```
16
-
17
- 3. Score the evidence with a built-in template or the local JSON spec:
18
-
19
- ```bash
20
- ghostapi eval --template retry-after --evidence .ghostapi/reports/agent.json --ci
21
- ghostapi eval --spec examples/evals/retry-after.eval.json --evidence .ghostapi/reports/agent.json --json
22
- ```
23
-
24
- If `--evidence` is omitted, `ghostapi eval --spec ...` launches `task.command` through `ghostapi run`; it never executes the command outside that boundary. Specs that declare `injectedFailures` require pre-generated evidence until the declared synthetic-world setup can be applied automatically. Core score is deterministic and evidence-based. LLM judging is not required and does not affect the security score.
1
+ # GhostAPI Agent Eval Demo
2
+
3
+ This directory shows the coding-agent workflow for deterministic evals.
4
+
5
+ 1. Run the agent's integration tests through the safety boundary on a supported Linux host:
6
+
7
+ ```bash
8
+ ghostapi run -- npm test
9
+ ```
10
+
11
+ 2. Generate sanitized evidence for the run:
12
+
13
+ ```bash
14
+ ghostapi evidence generate --run .ghostapi/runs/<run-id>/run.json --out .ghostapi/reports/agent.json
15
+ ```
16
+
17
+ 3. Score the evidence with a built-in template or the local JSON spec:
18
+
19
+ ```bash
20
+ ghostapi eval --template retry-after --evidence .ghostapi/reports/agent.json --ci
21
+ ghostapi eval --spec examples/evals/retry-after.eval.json --evidence .ghostapi/reports/agent.json --json
22
+ ```
23
+
24
+ If `--evidence` is omitted, `ghostapi eval --spec ...` launches `task.command` through `ghostapi run`; it never executes the command outside that boundary. Specs that declare `injectedFailures` require pre-generated evidence until the declared synthetic-world setup can be applied automatically. Core score is deterministic and evidence-based. LLM judging is not required and does not affect the security score.
@@ -1,52 +1,71 @@
1
- {
2
- "schemaVersion": 1,
3
- "kind": "ghostapi.eval",
4
- "id": "agent.retry_after",
5
- "title": "Agent honors Retry-After",
6
- "syntheticWorld": {
7
- "world": {
8
- "id": "subscription-recovery",
9
- "version": "1.0.0",
10
- "seed": "demo-seed"
11
- },
12
- "providers": ["stripe"],
13
- "scenarios": ["stripe.rate_limited"]
14
- },
15
- "task": {
16
- "description": "Run the coding-agent integration tests under GhostAPI and verify retry behavior.",
17
- "command": ["npm", "test"]
18
- },
19
- "injectedFailures": [
20
- {
21
- "id": "stripe.rate_limited",
22
- "type": "rate-limit",
23
- "provider": "stripe",
24
- "statusCode": 429,
25
- "retryAfterMs": 2000
26
- }
27
- ],
28
- "expectations": [
29
- { "id": "retry-observed", "type": "retry-observed", "points": 40 },
30
- { "id": "no-production-egress", "type": "no-production-egress", "points": 30 },
31
- { "id": "run-finished", "type": "run-finished", "points": 30 }
32
- ],
33
- "forbidden": [
34
- { "id": "production-egress", "type": "production-egress" },
35
- { "id": "secret-leak", "type": "secret-leak" }
36
- ],
37
- "limits": {
38
- "timeoutMs": 60000,
39
- "maxOutputBytes": 524288
40
- },
41
- "rubric": {
42
- "maxScore": 100,
43
- "components": [
44
- { "id": "retry-observed", "expectationId": "retry-observed", "points": 40, "reason": "Retry or Retry-After evidence was observed." },
45
- { "id": "no-production-egress", "expectationId": "no-production-egress", "points": 30, "reason": "Evidence reports zero production egress attempts." },
46
- { "id": "run-finished", "expectationId": "run-finished", "points": 30, "reason": "The GhostAPI run finished and produced lifecycle evidence." }
47
- ]
48
- },
49
- "judge": {
50
- "llmAsJudge": false
51
- }
52
- }
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "ghostapi.eval",
4
+ "id": "agent.retry_after",
5
+ "title": "Agent honors Retry-After",
6
+ "syntheticWorld": {
7
+ "world": {
8
+ "id": "subscription-recovery",
9
+ "version": "1.0.0",
10
+ "seed": "demo-seed"
11
+ },
12
+ "providers": ["stripe"],
13
+ "scenarios": ["stripe.rate_limited"]
14
+ },
15
+ "task": {
16
+ "description": "Run the coding-agent integration tests under GhostAPI and verify retry behavior.",
17
+ "command": ["npm", "test"]
18
+ },
19
+ "injectedFailures": [
20
+ {
21
+ "id": "stripe.rate_limited",
22
+ "type": "rate-limit",
23
+ "provider": "stripe",
24
+ "statusCode": 429,
25
+ "retryAfterMs": 2000
26
+ }
27
+ ],
28
+ "expectations": [
29
+ { "id": "retry-observed", "type": "retry-observed", "points": 40 },
30
+ {
31
+ "id": "no-production-egress",
32
+ "type": "no-production-egress",
33
+ "points": 30
34
+ },
35
+ { "id": "run-finished", "type": "run-finished", "points": 30 }
36
+ ],
37
+ "forbidden": [
38
+ { "id": "production-egress", "type": "production-egress" },
39
+ { "id": "secret-leak", "type": "secret-leak" }
40
+ ],
41
+ "limits": {
42
+ "timeoutMs": 60000,
43
+ "maxOutputBytes": 524288
44
+ },
45
+ "rubric": {
46
+ "maxScore": 100,
47
+ "components": [
48
+ {
49
+ "id": "retry-observed",
50
+ "expectationId": "retry-observed",
51
+ "points": 40,
52
+ "reason": "Retry or Retry-After evidence was observed."
53
+ },
54
+ {
55
+ "id": "no-production-egress",
56
+ "expectationId": "no-production-egress",
57
+ "points": 30,
58
+ "reason": "Evidence reports zero production egress attempts."
59
+ },
60
+ {
61
+ "id": "run-finished",
62
+ "expectationId": "run-finished",
63
+ "points": 30,
64
+ "reason": "The GhostAPI run finished and produced lifecycle evidence."
65
+ }
66
+ ]
67
+ },
68
+ "judge": {
69
+ "llmAsJudge": false
70
+ }
71
+ }
@@ -1,27 +1,27 @@
1
- # Generic REST Example
2
-
3
- Create a generic task resource through GhostAPI. This path uses the generic fallback, not a native adapter.
4
-
5
- ## Run
6
-
7
- Start GhostAPI:
8
-
9
- ```bash
10
- ghostapi start
11
- ```
12
-
13
- Create a task:
14
-
15
- ```bash
16
- curl -X POST http://localhost:8080/tasks \
17
- -H "content-type: application/json" \
18
- -d '{"title":"Write integration tests","status":"open","priority":"high"}'
19
- ```
20
-
21
- Fetch tasks:
22
-
23
- ```bash
24
- curl http://localhost:8080/tasks
25
- ```
26
-
27
- The generic fallback infers the `task` resource from the path and produces local mock IDs like `task_mock_xxx`.
1
+ # Generic REST Example
2
+
3
+ Create a generic task resource through GhostAPI. This path uses the generic fallback, not a native adapter.
4
+
5
+ ## Run
6
+
7
+ Start GhostAPI:
8
+
9
+ ```bash
10
+ ghostapi start
11
+ ```
12
+
13
+ Create a task:
14
+
15
+ ```bash
16
+ curl -X POST http://localhost:8080/tasks \
17
+ -H "content-type: application/json" \
18
+ -d '{"title":"Write integration tests","status":"open","priority":"high"}'
19
+ ```
20
+
21
+ Fetch tasks:
22
+
23
+ ```bash
24
+ curl http://localhost:8080/tasks
25
+ ```
26
+
27
+ The generic fallback infers the `task` resource from the path and produces local mock IDs like `task_mock_xxx`.
@@ -1,35 +1,38 @@
1
- # GitHub Fetch Example
2
-
3
- Create a GitHub-like issue through GhostAPI using plain `fetch` or `curl`. This does not call GitHub.
4
-
5
- ## Run
6
-
7
- Start GhostAPI:
8
-
9
- ```bash
10
- ghostapi start
11
- ```
12
-
13
- Create an issue:
14
-
15
- ```bash
16
- curl -X POST http://localhost:8080/repos/octo/hello-world/issues \
17
- -H "content-type: application/json" \
18
- -H "x-github-api-version: 2022-11-28" \
19
- -H "authorization: Bearer ghp_local_only" \
20
- -d '{"title":"Local integration test","body":"Created through GhostAPI"}'
21
- ```
22
-
23
- Equivalent JavaScript:
24
-
25
- ```js
26
- await fetch("http://localhost:8080/repos/octo/hello-world/issues", {
27
- method: "POST",
28
- headers: {
29
- "content-type": "application/json",
30
- "x-github-api-version": "2022-11-28",
31
- authorization: "Bearer ghp_local_only"
32
- },
33
- body: JSON.stringify({ title: "Local integration test", body: "Created through GhostAPI" })
34
- });
35
- ```
1
+ # GitHub Fetch Example
2
+
3
+ Create a GitHub-like issue through GhostAPI using plain `fetch` or `curl`. This does not call GitHub.
4
+
5
+ ## Run
6
+
7
+ Start GhostAPI:
8
+
9
+ ```bash
10
+ ghostapi start
11
+ ```
12
+
13
+ Create an issue:
14
+
15
+ ```bash
16
+ curl -X POST http://localhost:8080/repos/octo/hello-world/issues \
17
+ -H "content-type: application/json" \
18
+ -H "x-github-api-version: 2022-11-28" \
19
+ -H "authorization: Bearer ghp_local_only" \
20
+ -d '{"title":"Local integration test","body":"Created through GhostAPI"}'
21
+ ```
22
+
23
+ Equivalent JavaScript:
24
+
25
+ ```js
26
+ await fetch("http://localhost:8080/repos/octo/hello-world/issues", {
27
+ method: "POST",
28
+ headers: {
29
+ "content-type": "application/json",
30
+ "x-github-api-version": "2022-11-28",
31
+ authorization: "Bearer ghp_local_only",
32
+ },
33
+ body: JSON.stringify({
34
+ title: "Local integration test",
35
+ body: "Created through GhostAPI",
36
+ }),
37
+ });
38
+ ```
@@ -1,16 +1,16 @@
1
- # OpenAI Streaming And Tool Call Starter
2
-
3
- This starter exercises OpenAI-shaped chat completions against local GhostAPI. It uses a fake key and never requires a live OpenAI account.
4
-
5
- ```bash
6
- npx @yiaany/ghostapi start
7
- node examples/openai-streaming/streaming-tool-call.mjs
8
- ```
9
-
10
- When running on a supported Linux host, execute the app through the egress boundary:
11
-
12
- ```bash
13
- npx @yiaany/ghostapi run -- node examples/openai-streaming/streaming-tool-call.mjs
14
- ```
15
-
16
- Windows and macOS process isolation is unsupported/experimental; use `ghostapi start` and local SDK base URLs there.
1
+ # OpenAI Streaming And Tool Call Starter
2
+
3
+ This starter exercises OpenAI-shaped chat completions against local GhostAPI. It uses a fake key and never requires a live OpenAI account.
4
+
5
+ ```bash
6
+ npx @yiaany/ghostapi start
7
+ node examples/openai-streaming/streaming-tool-call.mjs
8
+ ```
9
+
10
+ When running on a supported Linux host, execute the app through the egress boundary:
11
+
12
+ ```bash
13
+ npx @yiaany/ghostapi run -- node examples/openai-streaming/streaming-tool-call.mjs
14
+ ```
15
+
16
+ Windows and macOS process isolation is unsupported/experimental; use `ghostapi start` and local SDK base URLs there.