Skip to content

Commit 222e66f

Browse files
committed
feat: fix
1 parent f25ae08 commit 222e66f

9 files changed

Lines changed: 1416 additions & 50 deletions

File tree

src/graphrefly/patterns/ai.py

Lines changed: 628 additions & 3 deletions
Large diffs are not rendered by default.

tests/test_patterns_ai.py

Lines changed: 725 additions & 1 deletion
Large diffs are not rendered by default.

website/src/content/docs/api/first_value_from.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Block until the first ``DATA`` value or a terminal ``ERROR`` arrives.
88
On ``COMPLETE`` without prior ``DATA``, raises :exc:`StopIteration`. With
99
*timeout*, raises :exc:`TimeoutError` if no terminal message arrives in time.
1010

11+
**Important:** This subscribes to *source* and waits for a **future**
12+
emission. It does NOT read the cached value — data that has already
13+
flowed is gone. You must call this **before** the upstream emits, or
14+
use ``source.get()`` / ``source.status`` to read already-cached state.
15+
See COMPOSITION-GUIDE §2 (subscription ordering).
16+
1117
## Signature
1218

1319
```python

website/src/content/docs/api/from_any.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dispatch rules:
99

1010
- Existing :class:`~graphrefly.core.node.Node` -> returned as-is.
1111
- :class:`collections.abc.AsyncIterable` / async iterator -> :func:`from_async_iter`.
12-
- Awaitable / :class:`asyncio.Future` / coroutine -> :func:`from_awaitable`.
12+
- :class:`collections.abc.Awaitable` (incl. coroutines, futures) -> :func:`from_awaitable`.
1313
- Otherwise tries ``iter(value)``; if that fails uses :func:`of`.
1414

1515
## Signature

website/src/content/docs/api/index.md

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,22 @@ Reference pages for modules listed in `website/scripts/gen_api_docs.py` (`EXTRA_
77

88
## API index
99

10-
- [NodeActions](./NodeActions/)
11-
- [NodeFn](./NodeFn/)
12-
- [NodeImpl](./NodeImpl/)
13-
- [NodeStatus](./NodeStatus/)
14-
- [SubscribeHints](./SubscribeHints/)
15-
- [node](./node/)
16-
- [PipeOperator](./PipeOperator/)
10+
- [PipeOperator](./pipeoperator/)
1711
- [derived](./derived/)
1812
- [effect](./effect/)
1913
- [pipe](./pipe/)
2014
- [producer](./producer/)
2115
- [state](./state/)
22-
- [DeferWhen](./DeferWhen/)
23-
- [DownStrategy](./DownStrategy/)
24-
- [Message](./Message/)
25-
- [MessageType](./MessageType/)
26-
- [Messages](./Messages/)
16+
- [DeferWhen](./deferwhen/)
17+
- [DownStrategy](./downstrategy/)
18+
- [Message](./message/)
19+
- [MessageType](./messagetype/)
20+
- [Messages](./messages/)
2721
- [batch](./batch/)
2822
- [dispatch_messages](./dispatch_messages/)
2923
- [down_with_batch](./down_with_batch/)
3024
- [is_batching](./is_batching/)
25+
- [is_local_only](./is_local_only/)
3126
- [is_phase2_message](./is_phase2_message/)
3227
- [is_terminal_message](./is_terminal_message/)
3328
- [message_tier](./message_tier/)
@@ -48,7 +43,6 @@ Reference pages for modules listed in `website/scripts/gen_api_docs.py` (`EXTRA_
4843
- [reduce](./reduce/)
4944
- [scan](./scan/)
5045
- [skip](./skip/)
51-
- [start_with](./start_with/)
5246
- [take](./take/)
5347
- [take_until](./take_until/)
5448
- [take_while](./take_while/)
@@ -93,30 +87,30 @@ Reference pages for modules listed in `website/scripts/gen_api_docs.py` (`EXTRA_
9387
- [throw_error](./throw_error/)
9488
- [to_array](./to_array/)
9589
- [to_list](./to_list/)
96-
- [BackoffPreset](./BackoffPreset/)
97-
- [BackoffStrategy](./BackoffStrategy/)
98-
- [JitterMode](./JitterMode/)
90+
- [BackoffPreset](./backoffpreset/)
91+
- [BackoffStrategy](./backoffstrategy/)
92+
- [JitterMode](./jittermode/)
9993
- [constant](./constant/)
10094
- [decorrelated_jitter](./decorrelated_jitter/)
10195
- [exponential](./exponential/)
10296
- [fibonacci](./fibonacci/)
10397
- [linear](./linear/)
10498
- [resolve_backoff_preset](./resolve_backoff_preset/)
10599
- [with_max_attempts](./with_max_attempts/)
106-
- [CheckpointAdapter](./CheckpointAdapter/)
107-
- [DictCheckpointAdapter](./DictCheckpointAdapter/)
108-
- [FileCheckpointAdapter](./FileCheckpointAdapter/)
109-
- [MemoryCheckpointAdapter](./MemoryCheckpointAdapter/)
110-
- [SqliteCheckpointAdapter](./SqliteCheckpointAdapter/)
100+
- [CheckpointAdapter](./checkpointadapter/)
101+
- [DictCheckpointAdapter](./dictcheckpointadapter/)
102+
- [FileCheckpointAdapter](./filecheckpointadapter/)
103+
- [MemoryCheckpointAdapter](./memorycheckpointadapter/)
104+
- [SqliteCheckpointAdapter](./sqlitecheckpointadapter/)
111105
- [checkpoint_node_value](./checkpoint_node_value/)
112106
- [restore_graph_checkpoint](./restore_graph_checkpoint/)
113107
- [save_graph_checkpoint](./save_graph_checkpoint/)
114-
- [CircuitBreaker](./CircuitBreaker/)
115-
- [CircuitOpenError](./CircuitOpenError/)
116-
- [TimeoutError](./TimeoutError/)
117-
- [TokenBucket](./TokenBucket/)
118-
- [WithBreakerBundle](./WithBreakerBundle/)
119-
- [WithStatusBundle](./WithStatusBundle/)
108+
- [CircuitBreaker](./circuitbreaker/)
109+
- [CircuitOpenError](./circuitopenerror/)
110+
- [TimeoutError](./timeouterror/)
111+
- [TokenBucket](./tokenbucket/)
112+
- [WithBreakerBundle](./withbreakerbundle/)
113+
- [WithStatusBundle](./withstatusbundle/)
120114
- [cache](./cache/)
121115
- [circuit_breaker](./circuit_breaker/)
122116
- [fallback](./fallback/)
@@ -127,20 +121,20 @@ Reference pages for modules listed in `website/scripts/gen_api_docs.py` (`EXTRA_
127121
- [token_tracker](./token_tracker/)
128122
- [with_breaker](./with_breaker/)
129123
- [with_status](./with_status/)
130-
- [PubSubHub](./PubSubHub/)
131-
- [ReactiveIndexBundle](./ReactiveIndexBundle/)
132-
- [ReactiveListBundle](./ReactiveListBundle/)
133-
- [ReactiveLogBundle](./ReactiveLogBundle/)
134-
- [ReactiveMapBundle](./ReactiveMapBundle/)
124+
- [PubSubHub](./pubsubhub/)
125+
- [ReactiveIndexBundle](./reactiveindexbundle/)
126+
- [ReactiveListBundle](./reactivelistbundle/)
127+
- [ReactiveLogBundle](./reactivelogbundle/)
128+
- [ReactiveMapBundle](./reactivemapbundle/)
135129
- [log_slice](./log_slice/)
136130
- [pubsub](./pubsub/)
137131
- [reactive_index](./reactive_index/)
138132
- [reactive_list](./reactive_list/)
139133
- [reactive_log](./reactive_log/)
140134
- [reactive_map](./reactive_map/)
141-
- [CompactEntry](./CompactEntry/)
142-
- [DistillBundle](./DistillBundle/)
143-
- [Extraction](./Extraction/)
144-
- [VerifiableBundle](./VerifiableBundle/)
135+
- [CompactEntry](./compactentry/)
136+
- [DistillBundle](./distillbundle/)
137+
- [Extraction](./extraction/)
138+
- [VerifiableBundle](./verifiablebundle/)
145139
- [distill](./distill/)
146140
- [verifiable](./verifiable/)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: 'is_local_only'
3+
description: 'Whether ``t`` is a graph-local signal that should NOT cross a wire/transport boundary.'
4+
---
5+
6+
Whether ``t`` is a graph-local signal that should NOT cross a wire/transport boundary.
7+
8+
Local-only signals (tier 0–2): START, DIRTY, INVALIDATE, PAUSE, RESUME.
9+
Wire-crossing signals (tier 3+): DATA, RESOLVED, COMPLETE, ERROR, TEARDOWN.
10+
Unknown message types (spec §1.3.6 forward-compat) also cross the wire.
11+
12+
## Signature
13+
14+
```python
15+
def is_local_only(t: MessageType) -> bool
16+
```

website/src/content/docs/api/is_terminal_message.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: 'is_terminal_message'
3-
description: 'True for COMPLETE or ERROR (tier 3 — delivered after phase-2 in the same batch).'
3+
description: 'True for COMPLETE or ERROR (tier 4 — delivered after phase-2 in the same batch).'
44
---
55

6-
True for COMPLETE or ERROR (tier 3 — delivered after phase-2 in the same batch).
6+
True for COMPLETE or ERROR (tier 4 — delivered after phase-2 in the same batch).
77

88
## Signature
99

website/src/content/docs/api/message_tier.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ description: 'Return the signal tier for a message type (see module docstring).'
55

66
Return the signal tier for a message type (see module docstring).
77

8-
0: notification (DIRTY, INVALIDATE) — immediate
9-
1: flow control (PAUSE, RESUME) — immediate
10-
2: value (DATA, RESOLVED) — deferred inside batch()
11-
3: terminal (COMPLETE, ERROR) — delivered after phase-2
12-
4: destruction (TEARDOWN) — immediate, usually alone
13-
0 for unknown types (forward-compat: immediate)
8+
0: subscribe handshake (START) — immediate, first in canonical order
9+
1: notification (DIRTY, INVALIDATE) — immediate
10+
2: flow control (PAUSE, RESUME) — immediate
11+
3: value (DATA, RESOLVED) — deferred inside batch()
12+
4: terminal (COMPLETE, ERROR) — delivered after phase-3
13+
5: destruction (TEARDOWN) — immediate, usually alone
14+
1 for unknown types (forward-compat: immediate, after START)
1415

1516
## Signature
1617

website/src/content/docs/api/partition_for_batch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: 'Split *messages* into three groups by signal tier.'
55

66
Split *messages* into three groups by signal tier.
77

8-
Returns ``(immediate, deferred, terminal)`` — tier 0-1/4, tier 2, tier 3.
8+
Returns ``(immediate, deferred, terminal)`` — tier 0-2/5, tier 3, tier 4.
99
Order within each group is preserved.
1010

1111
## Signature

0 commit comments

Comments
 (0)