@oddington/cli 0.1.20 → 0.1.23

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 (3) hide show
  1. package/README.md +133 -3
  2. package/dist/os.js +190 -172
  3. package/package.json +4 -2
package/README.md CHANGED
@@ -22,6 +22,129 @@ Run `os --help` or add `--help` to any command for the full command list.
22
22
  Commands print readable output by default. Add `--json` when another program
23
23
  will consume the result.
24
24
 
25
+ ## Local apps
26
+
27
+ From anywhere inside the app’s Git worktree, run:
28
+
29
+ ```sh
30
+ os app launch <name>
31
+ ```
32
+
33
+ Launch reads exactly `apps/<name>/app.json`, checks current membership in its
34
+ declared workspace, runs the colocated package’s fixed `npm run build`, and
35
+ opens its confined public interface in your ordinary browser. Prepare the app’s
36
+ documented dependencies separately; launch never installs them. Git, npm and
37
+ the required Node version must be available. Missing declarations, dependencies,
38
+ build output or membership stop launch with setup guidance.
39
+
40
+ Each `routines` mapping must declare `routine`, `input`, and ordered public
41
+ `steps`; `result` is optional. A mapping containing only `routine` is invalid.
42
+ For example:
43
+
44
+ ```json
45
+ {
46
+ "name": "accounting",
47
+ "workspace": "sample",
48
+ "interface": { "root": "dist/interface" },
49
+ "repositories": ["general"],
50
+ "routines": {
51
+ "reconcile": {
52
+ "routine": "reconcile-records",
53
+ "input": {
54
+ "type": "object",
55
+ "properties": {
56
+ "includeArchived": { "type": "boolean" },
57
+ "limit": { "type": "integer", "minimum": 1, "maximum": 100 }
58
+ },
59
+ "additionalProperties": false
60
+ },
61
+ "result": {
62
+ "type": "object",
63
+ "properties": { "processed": { "type": "integer" } },
64
+ "required": ["processed"],
65
+ "additionalProperties": false
66
+ },
67
+ "steps": [
68
+ { "id": "read" },
69
+ {
70
+ "id": "write",
71
+ "summary": {
72
+ "type": "object",
73
+ "properties": { "changed": { "type": "integer" } },
74
+ "required": ["changed"],
75
+ "additionalProperties": false
76
+ }
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ Contracts use a closed V0 value-schema grammar. Each schema has a `type` of
85
+ `object`, `array`, `boolean`, `string`, `integer`, `number`, or `file`, with only
86
+ the fields supported by that type. Objects declare `properties` and
87
+ `additionalProperties: false`; optional `required` lists contain unique declared
88
+ property names. Property names start with a lowercase letter and contain only
89
+ letters and numbers. Arrays declare `items` and `maxItems` from 1 to 64. Strings
90
+ may declare `maxLength` from 0 to 4,096 and otherwise have a 4,096-character limit.
91
+ Numbers may declare inclusive `minimum` and `maximum`; numbers must be finite,
92
+ and integers and their bounds must be safe integers. A `file` value is a complete
93
+ shared File descriptor, never a bare ID or operating-system path.
94
+
95
+ Schemas nest at most eight nodes deep, and an operation's input, result and step
96
+ summaries share a budget of 64 object properties. Encoded input and result each
97
+ fit within 16 KiB of UTF-8 JSON. Declare one to 64 ordered steps with unique
98
+ lowercase letter or number IDs separated by single hyphens. Each step has only
99
+ `id` and an optional `summary` schema. Omitting a summary or result schema permits
100
+ no corresponding value. Values are not coerced, schemas have no defaults, and
101
+ an optional property stays absent rather than accepting `null`.
102
+
103
+ Declare a closed empty object for input with no properties; an app without
104
+ routine operations may use `"routines": {}`. Unsupported schema or process-control
105
+ fields stop launch before build or hosting. Validation grants no routine or File
106
+ authority, and opening the interface does not require local routine code.
107
+
108
+ The command prints the clean assigned IPv4 loopback URL and owns the host until
109
+ Ctrl-C or termination. No root, workspace, command or port override is accepted;
110
+ `os app run` is unsupported. Browser authority is separate, origin-scoped and
111
+ bounded to ten minutes or the retained access session’s earlier expiry window.
112
+ Local sign-out leaves CLI sign-in intact. Removing CLI storage alone leaves an
113
+ established app session intact; every protected request still checks upstream
114
+ identity and workspace access. Host shutdown ends it immediately. An opener
115
+ failure stops the host without printing a bootstrap secret.
116
+
117
+ Launch supplies authenticated context and unchanged interface assets. The SDK's
118
+ typed `app.routines.<key>.availability()` assesses only a retained declared
119
+ binding, without starting code or creating a run. It reports ordered public
120
+ step IDs when available, or `authority_unavailable` / `execution_unavailable`
121
+ without steps. Customer-owned module augmentation supplies the property types;
122
+ it grants no authority.
123
+
124
+ Local readiness requires the mapped `routines/<routine>/run.ts` and owning
125
+ `routines/package.json` inside this worktree, Node native TypeScript stripping,
126
+ `"type": "module"`, a satisfied npm `engines.node` range, and an installed
127
+ `@oddington/sdk` that resolves without import. The assessment never imports
128
+ routine code, runs package scripts, installs dependencies or accepts browser
129
+ path/runtime overrides. Missing code still permits app launch. Availability
130
+ is fresh assessment, not a reservation or guarantee of later execution.
131
+ Hosted bindings report execution unavailable without local fallback.
132
+ `app.routines.<key>.run(input)` starts only that mapped installed routine as a
133
+ fixed Node child. Its private `appRun.current()` input is immutable; declared
134
+ steps and finish await host acceptance. Success requires accepted finish and
135
+ zero exit. Shared effects publish immediately, without a preparation selector.
136
+ Supplied File inputs reject execution unavailable before capability issuance;
137
+ File-use transfer and local Data/Files adapters remain unsupported.
138
+
139
+ The host owns children across refresh and tab closure. Exact-origin browser
140
+ state permits `recover()` without a run selector while the host/session remains
141
+ authorized. `events()` reconnects in order; `cancel()` resolves after child
142
+ termination and capability revocation. Host stop, local sign-out, expiry or
143
+ authority loss ends active execution. At most four runs occupy authorization,
144
+ execution or cleanup slots; event retention is bounded to 256 events / 1 MiB
145
+ per run, with ten minutes of terminal grace and at most 16 terminal streams.
146
+ Cancellation or later failure does not undo confirmed shared effects.
147
+
25
148
  ## Connections
26
149
 
27
150
  A connection gives a workspace controlled access to GitHub, Gmail, Airtable,
@@ -269,12 +392,19 @@ reference. Connections can still contact their providers. A failed child cannot
269
392
  publish. Inspect the files and bounded Git diff, then publish from the original
270
393
  root. With several ready runs, select one using `--run`.
271
394
 
272
- The SDK's `data.repository(name)` collection and selection calls also work in
395
+ The SDK's `data.repository(name)` collection, selection and search calls also work in
273
396
  this mode, using only installed repository grants and the exact committed
274
397
  checkout version captured for the run. Dirty and untracked files are ignored;
275
398
  an OS cache outside the checkout reuses derived data without remote access.
276
- Accepted record effects advance later selections to their exact proposed
277
- version. A run that only reads or validates creates no prepared-run directory
399
+ Accepted record effects advance later selections and searches to their exact
400
+ proposed version. Validation and another publisher leave the captured view
401
+ unchanged; replaying an older publication cannot rewind it. For example,
402
+ `general.records.search('acme overdue', { collections: ['invoices'], limit: 20 })`
403
+ returns bounded full Records with guards usable in Changes, or empty matches
404
+ with the searched version. Missing/incomplete search data fails retryably with
405
+ `unavailable`, and a dead parent has no hosted fallback. Ordinary immediate
406
+ `os routine run` continues to deliver search through the hosted service.
407
+ A run that only reads or validates creates no prepared-run directory
278
408
  and reports completion without a publish instruction. Authentication and named
279
409
  provider connections retain their normal network and authority requirements;
280
410
  preparation does not promise offline execution and may contact OS or providers.