@listen-fire/handbook 0.15.0 → 0.15.2

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.
@@ -69,6 +69,26 @@ Once the system answers again, \`listen-fire listens replay <file>:<movement> --
69
69
  - Race every wait on a person or a system with a \`sleep\`: a record deleted while a run waits on it leaves the wait waiting.
70
70
  - \`listen to sys-[e:Events WHERE e.Kind == "Wait Lost Its Record"]-> fire …\` hears each wait whose record was deleted.
71
71
 
72
+ ### who-acted
73
+
74
+ What lands can say who acted. \`listen-fire\` and the platform both give a landing an \`Actor\`, once its system reports who acted, and a filter and a run read it like any other field:
75
+
76
+ - \`Id\` — the system's own id for them.
77
+ - \`Email\` and \`Domain\` — their address in lower case, and the part after its last \`@\`.
78
+ - \`Phone\` — digits only, country code first.
79
+ - \`Name\` — as the system reports it.
80
+ - \`Proven\` — true when the module checked that the system vouches for who it names.
81
+
82
+ \`Actor\` is missing when the system names nobody, and so are all of its fields but \`Id\` and \`Proven\`, so read it with \`?.\`. A \`Domain\` is exact: \`"acme.test"\` does not match \`acme.test.example.com\`.
83
+
84
+ \`\`\`
85
+ listen to inbox-[e:Emails WHERE e.Key == "deals" AND e.Actor?.Domain == "acme.test"]-> fire \`Intake\`
86
+ \`\`\`
87
+
88
+ \`Proven\` is false for email: nothing in a message vouches for its \`From\` line. Slack, Telegram, Attio, WhatsApp and Granola set it when they name someone.
89
+
90
+ If a system has a field of its own called \`Actor\`, that field is the one you read.
91
+
72
92
  ### inbound-mail
73
93
 
74
94
  \`\`connect \`@lf/email\` \`\` is inbound mail. Which carrier delivers it is a setting of the deployment, not a choice an automation makes.`,
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.2",
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"