@listen-fire/handbook 0.15.0 → 0.15.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/examples.md CHANGED
@@ -735,3 +735,38 @@ r = all(
735
735
  () => { return count(m-[:Attachments]->) },
736
736
  )
737
737
  ```
738
+
739
+ ### listen-for-a-failed-payment
740
+
741
+ Listen for a Stripe payment that failed, and read its invoice
742
+ search: stripe payment failed failure invoice listen decline card billing customer email amount hosted invoice url change kind
743
+
744
+ ```file fake
745
+ pay = connect `@lf/stripe` using stripe_account
746
+
747
+ function `Payment Failed`(c: <pay-[:InvoiceChange]->>) {
748
+ invoice = only(c-[:Invoice]->)
749
+ if (invoice == null) { fail("a payment failure with no invoice") }
750
+ return invoice.`Customer Email`
751
+ }
752
+ listen to pay-[:Invoices]->-[c:Changes WHERE c.Kind == "payment_failed"]-> fire `Payment Failed`
753
+ ```
754
+
755
+ The invoice is one hop along the change's `Invoice` edge; read its `Amount Due`, `Currency` and `Hosted Invoice URL` the same way.
756
+
757
+ ### call-an-mcp-tool
758
+
759
+ Call an MCP server's tool and read its answer
760
+ search: mcp tool call server answer result read lookup find customer by email crm argument
761
+
762
+ ```file fake
763
+ crm = connect `@lf/mcp` using crm
764
+
765
+ function `Plan Of`(i: <manual-[:Invocations]->>) {
766
+ found = crm-[r:find_customer_by_email WHERE r.email == i.Text]->
767
+ if (found.found != true) { fail("no customer for ${i.Text}") }
768
+ return found.plan
769
+ }
770
+ ```
771
+
772
+ A tool that only reads is an edge off the connection, its arguments the `WHERE` equalities and its answer the record the walk lands on; a tool that changes something is written to.
package/dist/index.js CHANGED
@@ -151,12 +151,22 @@ exports.CORE_CHAPTERS = {
151
151
  reference: reference_1.reference,
152
152
  builtins: builtins_1.builtins,
153
153
  };
154
+ /** A system's chapter is mostly about one thing an author came for among many
155
+ * (Slack's is buttons, blocks and waiting; posting is a paragraph), and the
156
+ * intent index cannot route into sections it has no entry for, so the index
157
+ * names them: a reader fetches one section rather than the whole chapter. */
158
+ function systemSections(chapter) {
159
+ if (!chapter.id.startsWith('system:'))
160
+ return '';
161
+ const sections = (0, handbook_section_1.listChapterSections)(chapter.content);
162
+ return sections.length === 0 ? '' : ` (sections: ${sections.join(', ')})`;
163
+ }
154
164
  /** The routes, then the chapters, of `handbook` — what a reader who does not
155
165
  * yet know where to look is handed. */
156
166
  function renderIndex(handbook) {
157
167
  const intents = handbook.intentIndex.map((e) => `- ${e.intent} → ${(0, handbook_section_1.chapterRoute)(e)}`).join('\n');
158
168
  const chapters = Object.values(handbook.chapters)
159
- .map((c) => `- ${c.id} — ${c.title}`)
169
+ .map((c) => `- ${c.id} — ${c.title}${systemSections(c)}`)
160
170
  .join('\n');
161
171
  return `## Automation authoring handbook — index\n\nA route is a chapter, or \`chapter#section\` — one section of it, which is what to read when you need one rule.\n\nWhen you need to:\n${intents}\n\nChapters (read the relevant one before authoring):\n${chapters}`;
162
172
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@listen-fire/handbook",
3
3
  "license": "Apache-2.0",
4
- "version": "0.15.0",
4
+ "version": "0.15.1",
5
5
  "description": "The movement language's handbook: the hand-written chapters, the front page, the routes into them and the language search over them. A host adds its own systems' and plugins' sections on top (the platform assembles system:* and plugin:* chapters). `testing` is the catalog every shown example is checked against, for a host's tests of its own sections.",
6
6
  "engines": {
7
7
  "node": ">=22.23.4 <23"