@oddington/sdk 0.1.7 → 0.1.9

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.
package/README.md CHANGED
@@ -18,9 +18,29 @@ The OS-owned browser entry point initializes the existing shared refreshing
18
18
  session source before app code runs:
19
19
 
20
20
  ```ts
21
- import { os } from '@oddington/sdk';
21
+ import { os, data, files, DataOperationError, FileOperationError } from '@oddington/sdk';
22
22
 
23
- os.init({ auth });
23
+ os.init({ auth }); // OS-owned startup, once before app modules run.
24
+
25
+ // App code uses the installed capabilities directly.
26
+ const general = data.repository('general');
27
+ try {
28
+ const selected = await general.records.select({ invoices: { $: { limit: 20 } } });
29
+ const found = await general.records.search('acme overdue', {
30
+ collections: ['invoices'], limit: 20,
31
+ });
32
+ const statement = await files.create({
33
+ file: selectedFile, name: 'September statement.csv', path: 'HSC/2026/09',
34
+ });
35
+ const content = await files.read(statement.id);
36
+ // selected and found contain canonical Records and their opaque version guards.
37
+ // content is an unconsumed Web Response.
38
+ } catch (error) {
39
+ if (error instanceof DataOperationError || error instanceof FileOperationError) {
40
+ console.error(error.code, error.retryable); // Bounded public failure information.
41
+ }
42
+ throw error;
43
+ }
24
44
  ```
25
45
 
26
46
  This returns `void` and derives context from the current HTTPS workspace origin
@@ -34,9 +54,10 @@ an OS-launched IPv4 loopback origin. It checks `/_os/app/context` on that exact
34
54
  origin for every protected operation, without reading hosted access credentials.
35
55
  It accepts no workspace, endpoint or token option. Missing, forged, expired or
36
56
  changed local context fails closed, as do sign-out and initialization replacement.
37
- Local Data and Files currently return `context_unavailable` and
38
- `unsupported_context` respectively after checking context; they do not return
39
- empty data, upload locally or fall back to hosted services. Local app routine
57
+ Local Data selects from the Host's exact published index; a warm selection
58
+ neither initiates nor waits for renewal or synchronous hosted authority checks.
59
+ Local Files returns `unsupported_context` after checking context. Neither path
60
+ falls back to hosted services. Local app routine
40
61
  execution uses the installed routine's immediate-publication authority.
41
62
 
42
63
  Apps can assess a declared routine without starting it:
@@ -84,14 +105,26 @@ Only event reads reconnect, with bounded backoff and duplicate suppression;
84
105
  launch and cancellation requests are never automatically retried. Failed
85
106
  cancellation requests do not acknowledge cancellation. Handles expose no IDs,
86
107
  cursors, raw output or process controls. Local sign-out, expiry, context
87
- replacement and origin/credential changes invalidate pending work.
108
+ replacement, origin changes and unconfirmed credential changes invalidate pending work.
88
109
 
89
110
  The exact-origin browser credential survives reload and tab closure in local
90
- storage. Host expiry and current membership remain authoritative; stored state
91
- cannot revive a stopped host. Recovery covers only the operation's current
92
- session and bounded terminal grace, without relaunching or durable history.
111
+ storage. Each active initialization proactively renews before expiry, normally
112
+ sixty seconds early with a shorter lead for shorter lifetimes. Only the exact
113
+ Local Host silently refreshes the secure CLI login and confirms unchanged
114
+ complete access. Successful renewal rotates only the bounded browser credential;
115
+ it exposes no CLI credential or login prompt. Other tabs and SDK instances
116
+ retain only their unchanged deadline during a temporary renewal outage and
117
+ retry proactively without starting or delaying Data reads. They
118
+ confirm the stored winner against the same Host and logical session before
119
+ silently adopting it. Rotation preserves admitted Data/results and owned runs;
120
+ old credentials cannot admit new requests and failed writes, launches and
121
+ cancellations are never replayed. Sign-out, replacement and expiry cancel
122
+ renewal, including pending response bodies. Host expiry and current membership
123
+ remain authoritative; stored state cannot revive a stopped host. Recovery
124
+ covers only the operation's current logical session and bounded terminal grace,
125
+ without relaunching or durable history.
93
126
  Supplied File inputs currently reject `execution_unavailable` before launch;
94
- File-use transfer and local Data/Files adapters are separate work.
127
+ File-use transfer and a local browser Files adapter are separate work.
95
128
 
96
129
  The fixed child imports `appRun` from the same package and shares the app's
97
130
  customer-owned input/result/step types:
@@ -113,6 +146,48 @@ input is deeply immutable; declared reports await host acceptance. Success
113
146
  requires accepted finish and zero exit. Cancellation or later failure does not
114
147
  undo already confirmed shared effects.
115
148
 
149
+ Browser bundlers select the standard `browser` condition at the package root.
150
+ Named imports retain the selected browser capabilities without Node built-ins,
151
+ compatibility shims or unused routine, filesystem, Inbox and connection code.
152
+ Use the same `@oddington/sdk` import and declarations in both environments;
153
+ there is no browser subpath or required alias, polyfill or consumer build define.
154
+ Node imports retain the complete supported routine and managed-handler runtime
155
+ on Node.js 22.12.0 or later. Browser operations requiring a Node working root
156
+ remain unsupported.
157
+
158
+ Verify the installed tarball with `bun run --filter @oddington/sdk verify:package`
159
+ from the repository. This checks Node runtime exports and declarations, all public
160
+ text for leaks, and the named browser imports in a realm without Node globals or
161
+ a module loader. It rejects bundler warnings, external dependencies, Node/shim
162
+ code, unused implementations and increases beyond the reviewed SDK byte ceiling.
163
+ The newer Local Host app imports are bundled and exercised separately under the
164
+ same strict compatibility audit, so they cannot weaken or inflate the hosted
165
+ Data/Files size comparison.
166
+
167
+ The browser budget uses pinned esbuild 0.28.1, browser platform, bundled ESM,
168
+ `es2022`, minification, default tree shaking and inline legal comments, with no
169
+ source map, aliases, polyfills, external modules or consumer defines. Its fixed
170
+ named-import fixture exercises hosted Data selection/search and Files operations.
171
+ SDK bytes include all emitted JavaScript except the bundler-attributed fixture
172
+ bytes; generated helpers count toward the SDK. Gzip is diagnostic only.
173
+
174
+ | Same named-import fixture | Legacy diagnostic | Current strict proof |
175
+ | --- | ---: | ---: |
176
+ | Total minified JavaScript bytes | 488,539 | 40,534 |
177
+ | Fixture-attributed bytes | 5,954 | 5,897 |
178
+ | SDK bytes | 482,585 | 34,637 |
179
+ | Total gzip bytes | 198,612 | 12,414 |
180
+
181
+ The legacy diagnostic externalized three unresolved Node built-ins and failed
182
+ browser compatibility. The current strict proof has no imports, shims or warnings
183
+ and reduces SDK bytes by 92.8%. Its literal ceiling is **40,000 SDK bytes**:
184
+ 5,363 bytes (15.5%) of headroom for bounded client fixes. The increase from the
185
+ original 24,000-byte measurement accounts for the subsequently added Local Host
186
+ bootstrap that `os.init` must select at runtime. The verifier pins the fixture
187
+ hash and bundler version; changing either requires a reviewed measurement
188
+ comparison. Future ceiling increases require explicit review of added browser
189
+ capability and must never be automatically regenerated from an oversized output.
190
+
116
191
  Create and recover a private immutable original through the same host context:
117
192
 
118
193
  ```ts