diff --git a/.crumb b/.crumb index 9aa0f09..102dc1d 100644 --- a/.crumb +++ b/.crumb @@ -19,21 +19,21 @@ "purpose": "Directory crates. Purpose not yet described by a human." }, { - "digest": "7dcc2b4dd4387e1c881350a18e174c57f8f8af8e4d6a2c609045008f5536b5b8", - "last_commit": "a50a2fa", + "digest": "6504fae30e11f8e79dca0151bb2be96c838c85559c15afd6515dd700d2afe94e", + "last_commit": "0622708", "name": "specs", "purpose": "Directory specs. Purpose not yet described by a human." } ], - "children_root": "sha256:772219c4d552f80fe973032e5e9e4e006a2c1ef26f5db0228c80f53c2a49987e", - "compiled_at": "2026-10-18T17:04:17Z", + "children_root": "sha256:1f1e38f78c005237a8281b8d85918d44792ecdd9875a7e63ec997a620d52c7ab", + "compiled_at": "2026-10-18T17:25:18Z", "compiler": "crumb-compile/1", - "digest": "sha256:c9867dc638a90a717a8d40b633960502ac30a3c601d595070d430d5f205e17b4", + "digest": "sha256:201b80ddc128d4fc8c118c1997e39506d03598c07ae7d9c0042509899ca56bb0", "evidence_files": 1, "evidence_root": "sha256:87c36bf8ed7be61c064552ebf141834707770b75d070ea49328a3e06d510afba", - "files": 474, - "generated_at_commit": "1c3fef59d373a05c5b61f5208b4614e95e518a68", - "source_tree": "sha256:f0f7bcb2a825dbd6f4ada1965d96baac1e465e7eb134bf3235e1393ac800e89f" + "files": 475, + "generated_at_commit": "7eff296a70c6a3eb2c70eb9dedb319cc5a2998d8", + "source_tree": "sha256:498ecab3dce74be1de4ee0caa156a7584747d828dc706117736e2697db100d07" }, "owner_lane": "", "seed": { diff --git a/CHANGELOG.md b/CHANGELOG.md index 4730a93..d624381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ VERSIONING.md. ### Specifications +- `specs/pi-spark-task`: PST1 Draft v0, the Pi-Spark task message for + ALLEN Pi/Spark lane C1 (aien-protocols-mv#28): inventory of reused formats, + layering over M6-A and M6-B, 224-byte big-endian header, 14 message types, + size and refusal rules, the limits of exactly once, and a no-permission + clause. No code and no vectors yet (C3). - `specs/osh-platform`: OSH Platform ABI v1 DRAFT (not frozen) for the Omega-native shell of aien-architecture#158: step and status protocol, request record, platform operations, authority and interrupted-effect diff --git a/README.md b/README.md index a8922fe..c0a6d15 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Research-grade and pre-alpha. The specifications and reference Rust crates (AGPL specs/ Normative specifications (Community Specification License 1.0): agent-state, inference, evaluation, crumb-visible, execution-transcript, evidence (AEI1, draft), evidence-receipt (partial), verified-crumb, - osc-unit-artifact (v1 frozen), osh-platform (draft) + osc-unit-artifact (v1 frozen), osh-platform (draft), + pi-spark-task (PST1 draft) crates/ Reference Rust crates (AGPL-3.0-or-later), scaffolding: aien-protocol-types, aien-agent-state-abi, aien-inference-protocol, aien-inference-client, aien-action-protocol, aien-event-protocol, diff --git a/specs/.crumb b/specs/.crumb index 33c0cc3..a5d8189 100644 --- a/specs/.crumb +++ b/specs/.crumb @@ -69,17 +69,23 @@ "last_commit": "37a2159", "name": "osh-platform", "purpose": "OSH platform ABI draft (osh-platform)" + }, + { + "digest": "9a6ce8d6661b08b2893b5201d9d2de3165b678f448fe8d5f39ce61485c4f6d28", + "last_commit": "0622708", + "name": "pi-spark-task", + "purpose": "PST1 Pi-Spark task message format (draft)" } ], - "children_root": "sha256:6cf5b33d05298483b233481bc67ac65845482a73ed7a7e876ba7b3cef3bc3527", - "compiled_at": "2026-10-14T13:23:26Z", + "children_root": "sha256:875d2673c118a7814e5d0e3d0a27791031ef1f48164c60ea2b1218b027ec3b7a", + "compiled_at": "2026-10-16T19:28:14Z", "compiler": "crumb-compile/1", - "digest": "sha256:7dcc2b4dd4387e1c881350a18e174c57f8f8af8e4d6a2c609045008f5536b5b8", + "digest": "sha256:6504fae30e11f8e79dca0151bb2be96c838c85559c15afd6515dd700d2afe94e", "evidence_files": 1, "evidence_root": "sha256:87c36bf8ed7be61c064552ebf141834707770b75d070ea49328a3e06d510afba", - "files": 416, - "generated_at_commit": "7d10e1adb9d04310273d6022f2744d471995db55", - "source_tree": "sha256:bdeace5168d590bab6484e6221c2e36cba90badd8a0abf00b02a72dd5884fe44" + "files": 417, + "generated_at_commit": "06227089aecd9d561e70c536108ebf1ce009b973", + "source_tree": "sha256:05fc11d76190d3112e2ab26fccef20164319d009e7a6f6868501c85538455957" }, "owner_lane": "", "seed": { diff --git a/specs/pi-spark-task/.crumb b/specs/pi-spark-task/.crumb new file mode 100644 index 0000000..e778059 --- /dev/null +++ b/specs/pi-spark-task/.crumb @@ -0,0 +1,19 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-16T19:28:14Z", + "compiler": "crumb-compile/1", + "digest": "sha256:9a6ce8d6661b08b2893b5201d9d2de3165b678f448fe8d5f39ce61485c4f6d28", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 1, + "generated_at_commit": "06227089aecd9d561e70c536108ebf1ce009b973", + "source_tree": "sha256:98ca102fbe14d7df8b4b8ae5c74bb1e14ceeec7172c5e2b603ad3111d044b17a" + } + }, + "name": "pi-spark-task", + "purpose": "PST1 Pi-Spark task message format (draft)", + "schema_version": "1.0.0" +} diff --git a/specs/pi-spark-task/SPEC.md b/specs/pi-spark-task/SPEC.md new file mode 100644 index 0000000..d3cad86 --- /dev/null +++ b/specs/pi-spark-task/SPEC.md @@ -0,0 +1,142 @@ +# Pi-Spark Task Message: PST1 + +**Status**: Draft v0 (ALLEN Pi/Spark lane C1, 2026-10-16). Not yet produced or read by any runtime. +**Contract version**: 0.1.0 (major zero: may change by minor bump, see VERSIONING.md) +**Wire version**: 1 (the `version` byte below) +**License**: Community Specification License 1.0 +**Tracking**: aien-dev/aien-protocols-mv#28 (C1), parent #27, lane C of aien-dev/aien-architecture-mv#231 +**Not in this document**: vectors and the C checker (C3), the Spark gate (C2), the Rust reader (C4), the order rules between messages (C5), the INTERPLANE mapping (C6), network framing and retry (aienos-mv#398). + +## 1. Purpose + +The Pi and the Spark need one agreed way to say "please do this task", "here is how it is going" and "here is the receipt". PST1 is that agreement: one bounded message that rides inside exactly one message of the existing reliable channel (M6-A), which rides inside the existing secure session (M6-B). + +PST1 is a control-plane application format. It is not a network stack, not a scheduler, not an authorization layer and not a replacement for INTERPLANE. No PST1 message grants a capability or a permission (section 9). + +## 2. Inventory of what already exists + +| Existing piece | Where | Reused? | Reason | +|---|---|---|---| +| M6-A reliable channel | AIENOS `native/net/aienos_ctl.h` | Yes, as the carrier | In-order, exactly-once delivery inside one session. `CT_MAX_PAYLOAD` is 1024. Big-endian. | +| M6-B secure session | AIENOS `native/net/aienos_sec.h` | Yes, as the trust anchor | Mutual authentication against a pinned roster of one peer key, and an 8-byte `session_id`. TEST keys only today. | +| Cause id and origin run id | aien-architecture `docs/hardening/causal-id-join-v0.md` sections 2.1 and 2.3 (DRAFT, ADR 0025 PROPOSED) | Yes, as header fields | One 32-byte cause id is copied across every handoff, never minted again by the receiver. No runtime mints it yet. | +| Objective id | aien-sovereign-core `crates/aien-runtime/src/objective.rs` | Yes, as a header field | SHA-256 of `AIEN_E2E_OBJECTIVE_V1`, a newline, and the objective text. Written on the Spark by the operator tool, never by the daemon. | +| Effect ledger | aien-sovereign-core `crates/aien-runtime/src/effects.rs` | Yes, as the reconciliation authority | States OPEN, DONE, NOT_DONE, UNRESOLVED. Uncertain results are reconciled against it. | +| ALLEN subject | AIENOS `docs/adr/0018-allen-subject-state-object.md` | Yes, as a reference | The 32-byte agent id. No key material travels. | +| `aien-event-protocol`, `aien-action-protocol` | this repository, `crates/` | No | JSON with unbounded text and free-form `serde_json::Value` payloads. They cannot meet a fixed size limit. | +| TRN1 | this repository, `specs/execution-transcript/` | Pattern only | The house pattern for a byte format with a C reference checker and refusal codes. TRN1 is little-endian; PST1 is not (section 6). | +| INTERPLANE core | `interplane` `rust/crates/interplane-core` | No (mapped only for real tool calls, C6) | It translates tool requests. It is not a scheduler, a link or an authority. | + +## 3. Layering + +| Layer | Proves or does | Trust | +|---|---|---| +| M6-B | Who the peer is (the pinned key) and which session this is (`session_id`). | Trusted because the transport proved it. | +| M6-A | Delivers each message in order, exactly once, inside one session. | Trusted because the transport proved it. | +| PST1 | Says what the message means: which task, which objective, which kind of event. | Every PST1 field is a claim by the sender. | + +Rules that follow: + +1. The peer and the session are never read from a PST1 field. A receiver takes them from the transport and ignores any PST1 field that claims otherwise. PST1 has no peer field and no session field. +2. A PST1 field that the receiver can check against its own authoritative records (objective id, ALLEN subject id, effect state) is checked before it is believed. +3. A transport acknowledgement means "the message arrived". It never means "the work is done" (section 8). + +## 4. Fixed header + +One PST1 message is a 224-byte fixed header followed by `payload_len` bytes of payload. All integers are big-endian. Every reserved byte is zero on send and refused if non-zero on receipt. + +| Offset | Size | Field | Allowed values | +|---|---|---|---| +| 0 | 1 | `version` | 1 | +| 1 | 1 | `type` | 1 to 14 (section 5) | +| 2 | 2 | `reserved0` | 0 | +| 4 | 32 | `cause_id` | Not all zero | +| 36 | 32 | `origin_run_id` | Any value (opaque, copied) | +| 68 | 32 | `objective_id` | Not all zero for `request`; copied on every later message | +| 100 | 32 | `subject_id` | The ALLEN subject reference (ADR 0018); no key material | +| 132 | 16 | `parent_task_id` | All zero means "no parent" | +| 148 | 16 | `task_id` | Not all zero | +| 164 | 16 | `idempotence_key` | Not all zero; see section 8 | +| 180 | 4 | `ordinal` | u32; see section 5 | +| 184 | 1 | `effect_class` | 0 NONE, 1 COMPUTE, 2 EFFECT | +| 185 | 3 | `reserved1` | 0 | +| 188 | 2 | `payload_len` | 0 to 800 | +| 190 | 2 | `reserved2` | 0 | +| 192 | 32 | `payload_digest` | SHA-256 of the payload bytes (of the empty string when `payload_len` is 0) | + +Total header: 224 bytes. + +`effect_class` is a claim about the work, not a permission. EFFECT work still needs a real grant from the Spark approval desk (lane G, G6). + +## 5. Message types + +`request`, `cancel request` and `resume request` are sent by the Pi. Every other type is sent by the Spark. A message of a type from the wrong side is refused. + +| Value | Type | Side | Payload | +|---|---|---|---| +| 1 | `request` | Pi | Task description bytes (UTF-8 text, or the request body named by the task kind) | +| 2 | `accepted` | Spark | Empty | +| 3 | `queued` | Spark | Empty | +| 4 | `running` | Spark | Empty | +| 5 | `text_chunk` | Spark | One piece of streamed text | +| 6 | `waiting_for_approval` | Spark | The 32-byte digest of the action awaiting approval | +| 7 | `completed` | Spark | The 32-byte digest of the result | +| 8 | `failed` | Spark | A short reason code and text | +| 9 | `cancelled` | Spark | Empty | +| 10 | `uncertain_after_disconnect` | Spark | Empty. Means "not known whether it happened" (section 8) | +| 11 | `resume_snapshot` | Spark | The state of one task as read from the authoritative records | +| 12 | `receipt_reference` | Spark | The 32-byte digest of a receipt held on the Spark | +| 13 | `cancel_request` | Pi | Empty | +| 14 | `resume_request` | Pi | Empty | + +`ordinal` numbers the messages of one task from the sender's side, starting at 0 and rising by one. `text_chunk` messages of one task carry consecutive ordinals so a lost or repeated chunk is visible. The order rules between types are not defined here; they belong to C5. + +Status is derived from authoritative execution state on the Spark. A `completed`, `failed` or `cancelled` message is only sent after the authoritative record says so. Events are hints until the receiver has checked what it can. + +## 6. Size and byte order + +1. One PST1 message (224 header bytes plus up to 800 payload bytes, so at most 1024) fits in one M6-A message (`CT_MAX_PAYLOAD`, 1024). A message that would be longer is refused with `PST_BAD_LENGTH`. +2. A long text stream is split into numbered `text_chunk` messages. There is no reassembly of one PST1 message across several transport messages. The receiver joins chunks by ordinal, not by transport framing. +3. **Byte order is big-endian**, to match the M6-A and M6-B headers PST1 rides inside, so one implementation reads one convention on the whole link. TRN1 chose little-endian for a file format that never rides on this link. This choice is a recommendation made without a measurement; it is not final until C3 vectors and the aienos lane both accept it. + +## 7. Refusal codes + +A receiver refuses the message and takes no action. It reports one of these. A refusal never changes task state. + +| Code | Meaning | +|---|---| +| `PST_BAD_VERSION` | `version` is not 1 | +| `PST_DOWNGRADE` | `version` is lower than the version already used in this session | +| `PST_BAD_TYPE` | `type` is 0 or above 14 | +| `PST_WRONG_SIDE` | A Pi-only type from the Spark, or the reverse | +| `PST_BAD_LENGTH` | Fewer than 224 bytes, `payload_len` above 800, or the total differs from 224 plus `payload_len` | +| `PST_TRAILING_BYTES` | Bytes after the declared payload | +| `PST_RESERVED_NONZERO` | Any reserved byte is non-zero | +| `PST_NO_CAUSE` | `cause_id` is all zero | +| `PST_NO_TASK` | `task_id` or `idempotence_key` is all zero | +| `PST_DIGEST_MISMATCH` | `payload_digest` does not match the payload | +| `PST_BAD_EFFECT_CLASS` | `effect_class` above 2 | +| `PST_SUBJECT_MISMATCH` | `subject_id` differs from the subject bound to this session | + +A receiver that gets work with no cause id refuses it (`PST_NO_CAUSE`); it does not mint one. The cause id is minted once, where the outside request first enters AIEN (on the Pi, at the user's turn), per the causal id join spec. + +## 8. Exactly once has limits + +1. A transport acknowledgement is not "done". M6-A delivers a message once; it says nothing about whether the work ran. +2. A repeated `request` with the same `idempotence_key` and the same `task_id` is recognised as the same request and does not start a second task. +3. When the link drops while an effect is in flight, the Spark reports `uncertain_after_disconnect`. It does not report `failed` or `cancelled` when it does not know. +4. An effect whose outcome is unknown is reconciled against the Spark effect ledger (OPEN, DONE, NOT_DONE, UNRESOLVED) before anything is retried. A possibly committed effect is never sent again on the strength of a retry alone. +5. A local model's routing choice on the Pi grants nothing. Model output is never an authorization. + +## 9. No capability, no permission + +No message type, field or value in PST1 grants a capability, a permission, an approval or an identity. `waiting_for_approval` asks; it does not decide. Approvals come from the Spark approval desk and are not carried as PST1 fields. The ALLEN subject stays the authority on the Pi. + +## 10. Open questions + +These are stated plainly so the C3 vectors and the neighbouring lanes can settle them. None is decided here. + +1. Task id width (16 bytes here) and whether it should instead be derived from the cause id. UNVERIFIED. +2. Whether `resume_snapshot` needs its own payload layout, or a task-kind byte inside the payload. To be fixed by G3 and C5. +3. The aienos lane (aienos-mv#398) must confirm it can carry 1024-byte messages end to end and agree the framing. +4. Whether big-endian stays (section 6, item 3).