dreamteamer 0.32.0 → 0.33.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.
Files changed (67) hide show
  1. package/README.md +4 -2
  2. package/collections/agents.collection.yaml +41 -32
  3. package/collections/collections.collection.yaml +68 -230
  4. package/collections/command-bindings.collection.yaml +37 -43
  5. package/collections/commands.collection.yaml +50 -35
  6. package/collections/mixins.collection.yaml +49 -0
  7. package/collections/modules.collection.yaml +76 -122
  8. package/collections/repos.collection.yaml +53 -56
  9. package/collections/skills.collection.yaml +32 -21
  10. package/collections/ui-views.collection.yaml +57 -46
  11. package/mixins/docs.mixin.yaml +21 -0
  12. package/mixins/entity.mixin.yaml +22 -0
  13. package/package.json +5 -3
  14. package/scripts/migrate-descriptors-v2.mjs +795 -0
  15. package/skills/using-dreamteamer/SKILL.md +27 -24
  16. package/skills/using-dreamteamer/references/agents.md +1 -1
  17. package/skills/using-dreamteamer/references/before-you-build.md +1 -5
  18. package/skills/using-dreamteamer/references/collections.md +450 -348
  19. package/skills/using-dreamteamer/references/commands.md +49 -35
  20. package/skills/using-dreamteamer/references/data-modeling.md +342 -319
  21. package/skills/using-dreamteamer/references/extensions.md +8 -5
  22. package/skills/using-dreamteamer/references/getting-started.md +6 -4
  23. package/skills/using-dreamteamer/references/records.md +43 -34
  24. package/skills/using-dreamteamer/references/skills.md +4 -3
  25. package/skills/using-dreamteamer/references/ui-components.md +30 -32
  26. package/skills/using-dreamteamer/references/ui-views.md +122 -124
  27. package/src/api.d.ts +22 -2
  28. package/src/api.js +16 -1
  29. package/src/check.js +55 -40
  30. package/src/checkout.js +14 -13
  31. package/src/cli.js +118 -71
  32. package/src/collections-cli.js +136 -144
  33. package/src/commit.js +9 -8
  34. package/src/compile-collections.js +346 -0
  35. package/src/compile.js +232 -1068
  36. package/src/descriptor-v2.js +165 -0
  37. package/src/descriptor.js +90 -0
  38. package/src/doctor.js +57 -0
  39. package/src/events.js +11 -10
  40. package/src/extensions.js +48 -10
  41. package/src/field-values.js +7 -6
  42. package/src/fields.js +254 -0
  43. package/src/filter.js +45 -1
  44. package/src/fractional-index.js +2 -2
  45. package/src/harnesses.js +80 -52
  46. package/src/history.js +3 -3
  47. package/src/init.js +74 -46
  48. package/src/namespace.js +23 -9
  49. package/src/placement.js +26 -16
  50. package/src/presentation.js +153 -299
  51. package/src/record-commands.js +12 -12
  52. package/src/records-api.d.ts +106 -7
  53. package/src/records-api.js +2 -1
  54. package/src/records.js +20 -14
  55. package/src/ref.js +3 -39
  56. package/src/relations.js +23 -24
  57. package/src/runtime.js +12 -35
  58. package/src/schema-ops.js +1181 -1275
  59. package/src/store.js +212 -82
  60. package/src/template.js +100 -24
  61. package/src/temporal.js +11 -3
  62. package/src/views.js +176 -0
  63. package/src/workspace.js +14 -0
  64. package/src/yaml.js +66 -5
  65. package/collection-templates/docs.collection-template.yaml +0 -17
  66. package/collection-templates/entity.collection-template.yaml +0 -20
  67. package/collections/collection-templates.collection.yaml +0 -20
@@ -99,44 +99,48 @@ and nothing is silently dropped.
99
99
  `modules/<module>/command-bindings/<command>--<collection>.command-binding.yaml` — an m2m record:
100
100
 
101
101
  ```yaml
102
+ # modules/clinic/command-bindings/transcribe-visit--health-visit-recordings.command-binding.yaml
102
103
  command: commands/transcribe-visit
103
104
  collection: collections/health/visit-recordings
104
- target: record # or `collection` for commands that need no record
105
- can-enter: { recording_file: { _nempty: true } }
106
- can-exit: { transcript: { _nempty: true } }
105
+ scope: record # the default; `collection` for commands that need no record
106
+ available_when:
107
+ recording_file:
108
+ _nempty: true
109
+ done_when:
110
+ transcript:
111
+ _nempty: true
107
112
  description: audio present, not yet transcribed
108
113
  ```
109
114
 
110
- What a binding buys: `dt next <collection>[/<id>] [--ids a,b] [--json]` answers "what can I do
111
- with this record right now"; the studio draws the same answer as buttons; and the orientation block
112
- renders every binding with its gates **literally** (`/transcribe-visit (enter: recording_file set ·
113
- exit: transcript set)`) — so the gate you write is also documentation every session reads without
114
- loading anything.
115
+ The keys are closed: `command`, `collection`, `scope`, `available_when`, `done_when`,
116
+ `description`. What a binding buys: `dt next <collection>[/<id>] [--ids a,b] [--json]` answers
117
+ "what can I do with this record right now"; a surface draws the same answer as buttons; and the
118
+ orientation block renders every binding with its gates **literally** (`/transcribe-visit
119
+ (available when: recording_file set · done when: transcript set)`) — so the gate you write is also
120
+ documentation every session reads without loading anything.
115
121
 
116
122
  Each record gets one of three states, evaluated in this order:
117
123
 
118
124
  | state | meaning | evaluation |
119
125
  |---|---|---|
120
- | `done` | the command's post-condition already holds | `can-exit` passes — **checked first**, so a record satisfying both gates reads done, not available |
121
- | `available` | ready to run | `can-enter` passes (or no `can-enter`), and `can-exit` doesn't |
122
- | `not-applicable` | not this record's moment | `can-enter` fails, or the record doesn't resolve |
126
+ | `done` | the command's post-condition already holds | `done_when` passes — **checked first**, so a record satisfying both gates reads done, not available |
127
+ | `available` | ready to run | `available_when` passes (or there is none), and `done_when` doesn't |
128
+ | `not-applicable` | not this record's moment | `available_when` fails, or the record doesn't resolve |
123
129
 
124
130
  Done renders **completed** — a check mark, not a bare grey mystery button: the operator sees work
125
- that happened, and the button is not offered to run again. `target: collection` bindings evaluate
126
- no record: always runnable, and the invocation
127
- carries the collection name — so a command bound to several collections knows where to write.
131
+ that happened, and the button is not offered to run again. `scope: collection` bindings evaluate
132
+ no record: always runnable, and the invocation carries the collection name — so a command bound to
133
+ several collections knows where to write.
128
134
 
129
- Compile holds the referential ground: a binding naming an unknown command or collection **fails
130
- compile**; an unknown filter operator in a gate **fails compile** (never silently narrows at
131
- runtime); a `can-enter`/`can-exit` on a `target: collection` binding warns — there is no record to
132
- evaluate it against.
135
+ Compile holds the referential ground: a binding naming an unknown command or collection, an
136
+ unknown filter operator, an unknown value token (anything but `$today` and `$now`) or a field the
137
+ collection lacks **fails compile** — never a gate that silently never opens. A gate on a
138
+ `scope: collection` binding warns: there is no record to evaluate it against.
133
139
 
134
140
  ## designing the gates
135
141
 
136
142
  The design principle behind all of it: **the record's own fields are the progress marker.** No run
137
- records, no job table — a workflow-run layer existed, was gate-tested through full lifecycles, and
138
- was removed after measurement showed real work never used it. The gates only work if the fields
139
- they read stay honest:
143
+ records, no job table. The gates only work if the fields they read stay honest:
140
144
 
141
145
  - **Pick the provenance signal, not the content signal.** "Is it transcribed?" is
142
146
  `transcription._nempty` — the provenance object — NOT `transcript._nempty`: a body can be filled
@@ -144,14 +148,15 @@ they read stay honest:
144
148
  - **Filters reach one hop OUTBOUND**: `{ recording: { transcript: { _nempty: true } } }` resolves
145
149
  the ref and evaluates the sub-condition on the target; array refs use any-match semantics. A
146
150
  dangling ref, an unknown collection or a non-ref value **narrows, never widens** — a broken gate
147
- makes the command unavailable, not accidentally available.
151
+ makes the command unavailable, not accidentally available. `$today` makes a date gate move on
152
+ its own: `{ follow_up: { _lte: $today } }` is available from the day it falls due.
148
153
  - ⚠ **Inbound refs are unsupported** — "a summary referencing this record exists" is inexpressible
149
154
  as a filter over the record itself. Two honest answers: give the relation a **generated mirror**
150
155
  (`data-modeling.md` Part VI), which turns the inbound fact into a local field —
151
156
  `{ summary: { _nempty: true } }` works the moment `summary` is a mirror — or ship the binding
152
- without a `can-exit` and accept that it never shows done. What is not honest is a proxy field a
157
+ without a `done_when` and accept that it never shows done. What is not honest is a proxy field a
153
158
  human must remember to set.
154
- - **A `can-exit` and a proof's `count` (a proofs extension) answer different questions — put
159
+ - **A `done_when` and a proof's `count` (a proofs extension) answer different questions — put
155
160
  each expectation on its own side.** A gate is a filter over ONE record, evaluated on every render of `dt next` and every board
156
161
  the studio draws, so it can only ever read that record's own fields (plus one outbound hop) — which
157
162
  is exactly the gap the bullet above names: "a summary referencing this record exists" is
@@ -170,17 +175,26 @@ they read stay honest:
170
175
 
171
176
  ## the chain — multi-step processes
172
177
 
173
- There is no workflow kind, deliberately (the digest carries the story). A multi-step process is a
174
- **chain of commands wired by shared fields: step N's `can-exit` is step N+1's `can-enter`.**
178
+ There is no workflow kind, deliberately. A multi-step process is a **chain of commands wired by
179
+ shared fields: step N's `done_when` is step N+1's `available_when`.**
175
180
 
176
181
  ```yaml
177
- # step 1 — transcribe--visit-recordings.command-binding.yaml
178
- can-enter: { recording_file: { _nempty: true } }
179
- can-exit: { transcript: { _nempty: true } }
180
-
181
- # step 2 — summarize--visits.command-binding.yaml (gates one hop through the ref)
182
- can-enter: { recordings: { transcript: { _nempty: true } } }
183
- can-exit: { summary: { _nempty: true } } # a generated mirror — the inbound fact, made local
182
+ # step 1 — transcribe-visit--health-visit-recordings.command-binding.yaml
183
+ available_when:
184
+ recording_file:
185
+ _nempty: true
186
+ done_when:
187
+ transcript:
188
+ _nempty: true
189
+
190
+ # step 2 — summarize-visit--health-visits.command-binding.yaml (gates one hop through the ref)
191
+ available_when:
192
+ recordings:
193
+ transcript:
194
+ _nempty: true
195
+ done_when:
196
+ summary: # a generated mirror — the inbound fact, made local
197
+ _nempty: true
184
198
  ```
185
199
 
186
200
  The queue advances itself: completing step 1 is what makes step 2 available, with no state machine
@@ -198,6 +212,6 @@ others in order; the bindings still show per-step truth.
198
212
  | a command for something a skill should auto-trigger | commands fire only when remembered |
199
213
  | a record command that takes exactly one ref | multi-select invocations carry several; loop in the body |
200
214
  | gating on the content field instead of the provenance field | a hand-filled body reads done with nothing verified |
201
- | a `can-exit` over an inbound ref | unsupported — use a mirror field, or ship without `can-exit` and say so |
202
- | a `can-exit` on a `target: collection` binding | there is no record to evaluate; compile warns |
215
+ | a `done_when` over an inbound ref | unsupported — use a mirror field, or ship without `done_when` and say so |
216
+ | a gate on a `scope: collection` binding | there is no record to evaluate; compile warns |
203
217
  | a destructive command the model may invoke | set `disable-model-invocation` — some verbs are human-only |