Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.9.5

- Skills synced from Control: shared state in a bit now covers what it can
do, controls only the bit's creator can use, limits the server enforces
(one entry each, length, a close switch), pages rendered from live data, a
hidden answer revealed later, and how to change live data after
publishing (spam, a fresh round, closing). Agents offer creators distinct
directions and a few concrete next steps.
- Skills synced from Control: a place can open its follower, following and
bit lists.

## 0.9.4

- Skills synced from Control: a bit stays smooth and cool on a mid-range
Expand Down
2 changes: 1 addition & 1 deletion directory/differ/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down
4 changes: 2 additions & 2 deletions directory/differ/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down Expand Up @@ -95,7 +95,7 @@
"commerce_description": "Differ does not sell anything or take payments."
},
"publication": {
"release_notes": "Differ 0.9.4: make, publish and diff bits; publish as a guest or connect a Differ account."
"release_notes": "Differ 0.9.5: make, publish and diff bits; publish as a guest or connect a Differ account."
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions directory/differ/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down Expand Up @@ -97,7 +97,7 @@
"commerce_description": "Differ does not sell anything or take payments."
},
"publication": {
"release_notes": "Differ 0.9.4: make, publish and diff bits; publish as a guest or connect a Differ account."
"release_notes": "Differ 0.9.5: make, publish and diff bits; publish as a guest or connect a Differ account."
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions directory/differ/skills.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"files": [
{
"uri": "skill://interactive-content/SKILL.md",
"digest": "sha256:a6e50dcea018017e4bf7d096f71bd282a64d5cbef88e7a06a7e477e0b8ba35d1",
"size": 7350
"digest": "sha256:71e9df3e3628c2505913f9edef82c90b70eadeb8089b0476bee47141143afaf4",
"size": 8493
},
{
"uri": "skill://interactive-content/references/recording.md",
Expand All @@ -12,8 +12,8 @@
},
{
"uri": "skill://publish-content/SKILL.md",
"digest": "sha256:db7723d6272a4e37ed750dd4ce3d48daff8ec7f68db1416a532fdb9ed5b53979",
"size": 9789
"digest": "sha256:3b359d4572006d5f15ffaa787a1e02f6c0182dad065742bc910e17e53fea09e6",
"size": 9902
},
{
"uri": "skill://publish-content/examples/board/README.md",
Expand Down Expand Up @@ -42,13 +42,13 @@
},
{
"uri": "skill://publish-content/references/participation.md",
"digest": "sha256:9ad40fd746c1cc6304156a9a0f67811b1bad127fd98bf3e1436d2e1cd62fb3ed",
"size": 9780
"digest": "sha256:14f9f673d6bcb1c4d6e256b601190bd277e239df324947455082363ded000db2",
"size": 18212
},
{
"uri": "skill://publish-content/references/place.md",
"digest": "sha256:cb2235685cb90d57cb861c5a90cbd4e4cf6346d6c0960c19eb988536fac81beb",
"size": 7905
"digest": "sha256:2db4604c6fd583b48aec725366b2ee19ccaa78ef295cb5f7104e4b915a920ccb",
"size": 8112
},
{
"uri": "skill://publish-content/references/setup.md",
Expand Down
20 changes: 19 additions & 1 deletion directory/differ/skills/interactive-content/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ implement opportunities inherent in the premise, not unrelated mechanics.
Participation is optional for visitors, not optional to consider.
Infer from the brief; ask only about consequential gaps.

When the human is exploring or asks what they could make, offer a few
distinct directions, not variations of one: for example a passive piece, a
personal result, something everyone adds to, and something the creator runs
(a reveal, rounds, a winner). Make each concrete in a line or two: what
people do and what they get. The participation reference's "What shared state
can do" lists what Differ can hold and enforce; promise nothing outside it.

## Author

- Start with a finished, specific piece: this dog, this handshake, someone's
Expand Down Expand Up @@ -95,7 +102,10 @@ publishing authority.
On Differ, a root `rules.html` selects the document runtime. Authored HTML can
compose live documents under `/data/`; `/uploads/` holds participant images.
Read the publishing skill's participation reference before building shared
state, including its complete examples and runtime checks. Decide what each
state, including what shared state can do, the creator's controls, rules
the server enforces, and its complete examples and runtime checks. Enforce
the brief's limits (one each, short entries, creator-only actions) on the
server, not only in the page. Decide what each
person may do from the premise; do not treat every board as private contributions
or every interactive bit as shared state. Visitors can explore without signing in; ask them to join only when
they choose to save a contribution. Keep paid/server model actions out of bits.
Expand Down Expand Up @@ -123,4 +133,12 @@ When testing diff behaviour, distinguish consumption, participation, diffing,
and subsequent sharing. Forced steps do not demonstrate desire. Inherited
exposure is a distribution condition to verify, not assume; accept null results.

When you hand over, offer two to four concrete next steps for this bit, a
line each, chosen for this human from what Differ can do: for example a
creator control (reveal, close, pick a winner, remove junk), a new round
that keeps the last one readable, their own photo of the real thing, a
server-rendered count or reveal, or a limit they may want. Say plainly what
they asked for that Differ can't do, and the nearest thing it can. Describe
limits and protections only as you built and checked them.

For requested social videos, read [recording](references/recording.md).
4 changes: 3 additions & 1 deletion directory/differ/skills/publish-content/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ version, and a published version never changes. Each bit has its own origin on
differ.page and normal browser storage and capabilities, subject to the
browser's permission prompts. Private audiences and arbitrary Node servers are
unsupported. For shared durable state, use the document runtime described in
[participation](references/participation.md).
[participation](references/participation.md): what it can do, the creator's
controls, rules the server enforces, and how to change live data after
publishing.
A bit is at most 256 files and 20 MiB. Files under `data/` need a root
`rules.html`, since only live participation serves them; a bundle with them and
no `rules.html` is refused with the code data_without_rules, so put static
Expand Down
172 changes: 172 additions & 0 deletions directory/differ/skills/publish-content/references/participation.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,178 @@ fail with an actionable error. Logging out revokes the runtime sessions created
by that browser login. Browser copies may survive bit removal, but the platform
stops delivering the removed bit and accepting its writes.

## What shared state can do

Use this to choose a design and to show the human what they could ask for.
Offer the options that serve their idea, not the whole list.

- **Kinds of shared state**: a collection people add to (answers, photos,
places), one choice per person (votes, picks, guesses), a shared surface
anyone may rewrite (a board, a story), and state only the creator changes
(an answer, a round, a winner).
- **Server-enforced rules**: who may write what, one entry or N entries per
person, length or value limits, a creator-controlled open/closed switch.
- **The creator's controls** inside the bit: reveal an answer, close or reopen
a round, pin a winner, clear a document. Nobody else can use them.
- **Pages rendered from live data**: counts, tallies or a reveal computed on
the server, and views only the creator sees.
- **Photos** people upload, and live updates for everyone watching.
- **Lifecycle**: updates keep everything people added; a new round is a new
document in an update; closing participation keeps what is there; a diff
starts empty.

It cannot send notifications or email, show participants' names or handles
(people type a name if the bit asks), keep secrets, call paid or model APIs,
reach other servers, or run anything on a schedule. Don't rely on
server-side clock checks: close a round with the creator's switch or an
update. Participation is per bit.

## The creator's controls

The actor `role:moderator` is the bit's creator when they open it signed in
on Differ. Grant them what visitors lack:

```html
<div itemscope itemtype="https://pagelove.org/AuthorizationRule">
<meta itemprop="actor" content="role:moderator">
<meta itemprop="resource" content="/data/state.html">
<meta itemprop="method" content="PUT">
<meta itemprop="action" content="Allow">
</div>
```

Seed `data/state.html`, for example `<div id="state" data-open="yes"></div>`,
and have the creator replace it with a selector-scoped `PUT`
(`Range: selector=#state`) to reveal an answer or close a round. A `PUT` of
a whole document (no Range) clears it, for example to empty a board. Show the
controls only when `await (await fetch('/-/me')).json()` has
`moderator: true`; the rule, not the hidden button, is what protects them.
Everyone watching gets the change live. Give the creator only what the
brief reserves for them; what it gives participants (marking their own find
returned, editing their own entry) stays theirs.

Authored files and seeds are public, so a secret never goes in the bundle.
The creator can type it in later instead: deny public reads of its document,
let `role:moderator` `GET` and `PUT` it, and render it on the server only
once revealed (see below):

```html
<p r:answer="#answer" r:shown="#state[data-revealed=yes]" p:template="text/liquid">
{% if shown.size > 0 or request.auth.roles contains "moderator" %}{{ answer | first }}{% else %}Revealed on Friday{% endif %}
</p>
```

with `data/secret.html` seeded as `<p id="answer"></p>`, a rule with actor
`*`, method `GET` and action `Deny` on it, and `data/state.html` as the
creator's switch.

## Rules the server enforces

A rule in `rules.html` says who may write; a Trigger checks each write and
can refuse it with a status and a message the bit shows. These run on the
server, so a modified browser cannot skip them. One Trigger can check
identity, shape, length, a per-person quota and the creator's switch:

```html
<div itemscope itemtype="https://pagelove.org/Trigger">
<meta itemprop="resource" content="/data/lines.html">
<meta itemprop="method" content="POST">
<div itemprop="action" itemscope itemtype="https://pagelove.org/Sessel">
<script itemprop="source" type="text/sessel">
@schema Context url("https://pagelove.org/Context");
@schema HTTPResponse url("https://pagelove.org/HTTPResponse");
let me = Context.request.auth.username;
let body = Document.parse("<div>" + Context.request.body + "</div>");
if (body.children().count() != 1 || body.${li}.count() != 1) {
throw new HTTPResponse { status: 422, message: "Add one line." }
}
let line = body.children().first();
if (line.attr("data-by") != me) {
throw new HTTPResponse { status: 403, message: "Write only as yourself." }
}
if (line.text().count() > 140) {
throw new HTTPResponse { status: 422, message: "Keep it under 140 characters." }
}
if ((${li} from "/data/lines.html").filter(l => l.attr("data-by") == me).count() >= 2) {
throw new HTTPResponse { status: 429, message: "Two lines each." }
}
if ((${#state[data-open="no"]} from "/data/state.html").count() > 0) {
throw new HTTPResponse { status: 403, message: "This round is closed." }
}
</script>
</div>
</div>
```

The client sends `data-by` set to its `pagelike.participate()` identity; the
Trigger refuses any other. Enforce on the server every limit the page
promises, or a signed-in person can bypass it with a plain request. Some
checks that come up often:

- Text that must be real: `let text = line.text().trim();` then refuse
`text.isEmpty()`, and `text.contains("\n")` for one line.
- Ids the client picks: refuse one that exists, or a second entry can take
over the first:
`(${li} from "/data/finds.html").filter(l => l.attr("id") == line.attr("id")).count() > 0`.
- One entry each: a quota of 1 as above. For a changeable choice, let the
page count each person's latest entry, as the vote example does. Today a
burst of simultaneous requests from one person can slip a few past a
quota, so the page should still count each person's entries as the brief
means them.

Add a ShapeConstraint, as in the vote example, to permit only the element
shapes the bit uses. Show the message from a refused write's error document
to the person.

## Pages rendered from live data

Authored HTML pages are composed on the server on every request. Declare
`xmlns:p="https://pagelove.org/1.0"` and
`xmlns:r="https://pagelove.org/Binding/CSS"` on `<html>`. `r:name="selector"`
binds every matching element in the bit's documents; `p:template="text/liquid"`
renders the element's content with Liquid; `<p:include selector="#x"
resource="/data/x.html"></p:include>` splices one element in:

```html
<p r:guesses="#guesses > li" p:template="text/liquid">{{ guesses.size }} guesses so far</p>
<p p:template="text/liquid">{% if request.auth.roles contains "moderator" %}You made this bit.{% endif %}</p>
```

Bindings read every document, even one whose public GET a rule denies, so a
page can show a count of entries nobody can read directly, or reveal them only
to the creator. Escape participants' text with `| escape`. Server rendering
happens on load; for live changes, subscribe with `EventSource` and refetch.

## After publishing

No tool reads, edits, resets or exports a published bit's live data for you.
You can read a publicly readable document at
`https://<bit>.differ.page/data/<name>`. To change live data, offer the human:

- **Spam or a wrong entry**: as the creator, remove it in the bit's
**Your participation** (`/-/manage`); anyone removes their own there.
- **Something the creator does again and again** (reveal, close, reset, pick
a winner): a creator control in the bit, added by an update.
- **A fresh round on the same bit**: an update whose code reads and writes a
new document, seeded as a new path such as `data/december.html`. The old
round stays readable, so the bit can show last round's result. Changing an
existing seed does nothing: a seed applies once per path.
- **Stop new entries**: an update without the write grant, or the creator's
switch. Existing entries stay.
- **A different activity, or empty data under a new link**: a diff.

## pagelike's own documentation

The runtime is pagelike (`https://github.com/sky-valley/pagelike`), a
PageLove-compatible server. Its docs, starting at
`https://sky-valley.github.io/pagelike/llms.txt`, specify Sessel, composition,
Liquid and schemas in depth under `https://sky-valley.github.io/pagelike/spec/`
(`sessel/`, `composing/`, `liquid/`, `modeling/`). On Differ, this reference
wins where they differ: there is no WebDAV, sign-in route, local account or
authoring key; data is inert; only Differ's identity and the actors above
exist; and uploads follow the limits here. Check anything else from there
with the rehearsal before relying on it.

## Complete example and rehearsal

### Get the example code
Expand Down
3 changes: 3 additions & 0 deletions directory/differ/skills/publish-content/references/place.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ never reference `/__differ/sdk.js`. Read the creator's data only through it:
and a tap on it asks to open the bit.
- `differ.showBit(id)` asks Differ to open one of the creator's bits. Show
their bits however suits the place, or not at all.
- `differ.showList("followers")`, `differ.showList("following")` and
`differ.showList("bits")` ask Differ to open that list, as the profile does.
Make every count the place shows a button that calls it.
- `differ.on("hide", …)` and `differ.on("show", …)`: pause everything, sound
included, while the place is hidden. Sound may start as soon as the place
opens.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "differ-plugin",
"version": "0.9.4",
"version": "0.9.5",
"private": true,
"type": "module",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/differ/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down
2 changes: 1 addition & 1 deletion plugins/differ/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down
2 changes: 1 addition & 1 deletion plugins/differ/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "differ",
"version": "0.9.4",
"version": "0.9.5",
"description": "Make, publish and diff interactive bits on Differ.",
"author": {
"name": "Sky Valley",
Expand Down
2 changes: 1 addition & 1 deletion plugins/differ/scripts/differ.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39769,7 +39769,7 @@ var import_node_child_process3 = require("node:child_process");
// package.json
var package_default = {
name: "differ-plugin",
version: "0.9.4",
version: "0.9.5",
private: true,
type: "module",
engines: {
Expand Down
Loading
Loading