@fleetless/sdk 2.1.0 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,157 @@ All notable changes to `@fleetless/sdk`. The format follows Keep a Changelog; th
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [3.0.1] — 2026-09-07
8
+
9
+ No API change. This release exists because **3.0.0 published internal material
10
+ to the registry**, and the only way to withdraw it is to publish a version
11
+ without it.
12
+
13
+ ### Fixed
14
+
15
+ - **The published bundle no longer carries internal text.** `tsup` inlines
16
+ `@fleetless/contracts` into `dist/index.js` and `dist/index.cjs` with its doc
17
+ comments intact, and it writes the path each inlined module came from as a
18
+ comment beside it. In 3.0.0 those paths encoded a `git+ssh://` dependency
19
+ specifier, so an internal hostname appeared **48 times** across the two
20
+ bundles; the inlined comments carried German paragraphs and internal defect
21
+ ids with them. Measured over the published tarballs, the same seventeen
22
+ detectors over `dist/`:
23
+
24
+ | | 3.0.0 | 3.0.1 |
25
+ |---|---|---|
26
+ | internal host or workspace name | 49 | 0 |
27
+ | German prose | 58 | 0 |
28
+ | internal wave labels | 134 | 0 |
29
+ | internal decision labels | 42 | 0 |
30
+ | internal defect ids | 14 | 0 |
31
+ | every other class | 62 | 0 |
32
+
33
+ None of it appeared in this repository's own source, which is why no sweep of
34
+ the source had found it. The fix is the contracts pin — `@fleetless/contracts`
35
+ is a public npm package at an exact version now — plus a sweep of this
36
+ repository's own comments.
37
+
38
+ - **`publishers.publish`, `commands.cancel`, `cameras.live` and the error
39
+ re-exports pointed at README sections that did not exist.** One of them
40
+ (`cancel`'s upgrade message) is a **runtime error** telling a developer to
41
+ read "the README's Actions section" of a README whose sections were named
42
+ something else. The README now has *Actions*, *Errors*, and *Publishers, and
43
+ no teleop helpers*, and every pointer resolves.
44
+
45
+ ### Added
46
+
47
+ - **`SECURITY.md`, `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`**, and all three
48
+ ship inside the tarball, so the README's links resolve from `node_modules` and
49
+ from the npm page. `SECURITY.md` says what is in scope here — how this package
50
+ handles tokens, the PKCE verifier and the `state` value — and that the cloud
51
+ is not in this repository. Security reports go to **security@fleetless.dev**,
52
+ which the README now states literally rather than only by link.
53
+ - **`repository` and `bugs.url`** in `package.json`, pointing at
54
+ <https://github.com/fleetless/sdk>.
55
+ - **An `Errors` section in the README**, documenting the `FleetlessError` `code`
56
+ you branch on, that `rate_limited` is surfaced with its `retry_after_ms` and
57
+ never retried, and that `token_expired` is the one retry the SDK performs.
58
+ - **The SPDX header `// SPDX-License-Identifier: MIT`** on every source file and
59
+ on all four published `dist/` files. `test/license-headers.test.ts` asserts it
60
+ over the repository; `pnpm run test:pack` asserts it over the tarball's own
61
+ bytes, which is the only place that can tell a stamped build from a stamped
62
+ publish.
63
+ - **`test/published-prose.test.ts`**, which is what stops the top item here from
64
+ happening again: fifteen detector classes over `dist/`, `src/`, `test/`,
65
+ `scripts/` and the shipped markdown, with fixtures in both directions.
66
+
67
+ ## [3.0.0] — 2026-09-06
68
+
69
+ Fleetless shows an app user **no page**. The developer's own UI owns every
70
+ screen — login, registration, verification, invitation acceptance, password
71
+ reset, the provider buttons, the MCP consent — and this release replaces the
72
+ SDK's auth surface with the JSON API those screens call. The hosted,
73
+ app-branded login and consent pages are gone from the platform, so they are
74
+ gone from here.
75
+
76
+ ### Removed
77
+
78
+ - **`auth.beginHostedLogin` and `auth.completeHostedLogin`**, with
79
+ `BeginHostedLoginOptions`, `HostedLoginRequest` and
80
+ `CompleteHostedLoginOptions`. The `/oauth/authorize` + `/oauth/token` flow
81
+ they drove no longer runs for app users. Use `auth.beginOidcLogin` and
82
+ `auth.completeOidcLogin` for federated sign-in, or `auth.login` for a
83
+ password.
84
+ - **`client.grants`** (`GrantsApi`, `grants.list`, `grants.revoke`), with the
85
+ `ConsentGrantSummary` and `ConsentRevokeResponse` re-exports. The routes
86
+ behind it are gone. The MCP consents an app user can withdraw are now
87
+ `auth.listMcpGrants()` and `auth.revokeMcpGrant(clientId)`.
88
+ - **`auth.passwordResetUrl()`**. It pointed at a Fleetless-served page that is
89
+ now the developer console's own, for Fleetless users rather than app users.
90
+ An app user's reset is `auth.requestPasswordReset` and
91
+ `auth.confirmPasswordReset`, in your own UI.
92
+ - **`LogoutResult`**, and with it everything `logout()` used to report about
93
+ the identity provider behind a session. That apparatus belonged to the
94
+ hosted login, where Fleetless owned the browser; an app that wants to end a
95
+ provider session redirects there itself, knowing its own provider.
96
+ - **`no_hosted_login_attempt`** from `SDK_ERROR_CODES`. The case it named —
97
+ nothing persisted for this attempt — still throws, as `state_mismatch`, and
98
+ the message still says which of the two happened.
99
+ - `HttpClient.requestOAuth`, the SDK's only form-urlencoded call. Nothing
100
+ reaches `/oauth/token` from here any more.
101
+
102
+ ### Added
103
+
104
+ - **Registration and verification**: `auth.register({ email, password,
105
+ displayName? })`, `auth.verifyEmail(token)`,
106
+ `auth.resendVerification(email)`.
107
+ - **Recovery and invitations**: `auth.requestPasswordReset(email)`,
108
+ `auth.confirmPasswordReset(token, newPassword)`,
109
+ `auth.acceptInvitation({ token, password, displayName? })`. Every one of
110
+ these that spends a mailed token stores the session it answers with, so a
111
+ person is not asked to sign in again immediately after proving they can read
112
+ the mail.
113
+ - **Federated sign-in, per app**: `auth.listProviders()` for the buttons,
114
+ `auth.beginOidcLogin({ slug, redirectUri })` to build the start URL with
115
+ PKCE, `auth.completeOidcLogin({ code, state, expectedState, codeVerifier })`
116
+ to trade the one-time code for a session, and
117
+ `auth.oidcErrorFromCallback(params)` to read a failed sign-in off the
118
+ redirect back as a `FleetlessError`. The SDK builds the URL and **never
119
+ navigates**; the app does.
120
+ - **The MCP consent screen**: `auth.mcpInteraction(id)`,
121
+ `auth.approveMcpInteraction(id)`, `auth.denyMcpInteraction(id)`. Both
122
+ decisions answer where to send the browser, a denial included.
123
+ - **The app user's own standing consents**: `auth.listMcpGrants()` and
124
+ `auth.revokeMcpGrant(clientId)`.
125
+ - New option and result types: `RegisterOptions`, `AcceptInvitationOptions`,
126
+ `ProviderButton`, `BeginOidcLoginOptions`, `OidcLoginRequest`,
127
+ `CompleteOidcLoginOptions`, `McpInteractionDecision`. New wire re-exports:
128
+ `ClientMcpInteraction`, `McpConsentGrant`, `ClientOidcErrorCode`.
129
+
130
+ ### Changed
131
+
132
+ - **`ClientIdentity` renamed two fields**: `kind: 'end_user'` is now
133
+ `'app_user'`, and `end_user_id` is now `app_user_id`. A rename rather than a
134
+ kept key, deliberately — the old subject was a member of the org's one pool,
135
+ the new one is a row belonging to exactly one app, and a consumer reading
136
+ `.end_user_id` would have typechecked while meaning something subtly
137
+ different.
138
+ - **`logout()` resolves with `void`**, not a `LogoutResult`. It still never
139
+ rejects and still always clears the local store.
140
+ - **A `serverKey` client refuses session methods with a `FleetlessError` whose
141
+ code is `invalid_option`**, where it used to throw a bare `Error` a caller
142
+ could only catch by message. `me()`, `listProviders()`, `mcpInteraction()`
143
+ and `oidcErrorFromCallback()` still work on one: the first is what a server
144
+ key is for, the next two are reads the cloud answers without a credential,
145
+ and the last touches no network.
146
+ - `state_mismatch` is now thrown by `completeOidcLogin`, before any request.
147
+ - Pinned to `@fleetless/contracts` `48acd56`.
148
+
149
+ ### Verification
150
+
151
+ - The `auth` and OIDC suites now drive the SDK's **default** `fetch` against a
152
+ real `node:http` server (`test/local-api.ts`) rather than a `vi.fn()`. Every
153
+ assertion about a path, a method, a header or a body is made against bytes
154
+ that actually left the process — which is what shows, for instance, that the
155
+ two MCP decisions send no `content-type` on their bodyless `POST`, a header
156
+ a fake `fetch` records as absent exactly as convincingly when it is wrong.
157
+
7
158
  ## [2.1.0] — 2026-09-04
8
159
 
9
160
  ### Added
@@ -0,0 +1,83 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hello@fleetless.dev. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,130 @@
1
+ # Contributing to `@fleetless/sdk`
2
+
3
+ This package is the TypeScript client for the Fleetless API. It is what a
4
+ developer's own application calls, so a change here reaches every app built on
5
+ it, and a change to what a method *sends* reaches the platform as well.
6
+
7
+ ## Setup
8
+
9
+ Node 22 and pnpm (through corepack):
10
+
11
+ ```sh
12
+ nvm use 22
13
+ corepack enable
14
+ pnpm install
15
+ ```
16
+
17
+ There are no private dependencies. `pnpm install` works from a clean checkout
18
+ with nothing but a network connection to the npm registry — the wire schemas
19
+ come from `@fleetless/contracts`, which is a public package.
20
+
21
+ `pnpm install` runs `prepare`, which builds `dist/`. Some of the checks below
22
+ read the built bundle, so a fresh checkout is ready for them.
23
+
24
+ ## The checks
25
+
26
+ | Command | What it does |
27
+ |---|---|
28
+ | `pnpm typecheck` | `tsc --noEmit` over the whole project. |
29
+ | `pnpm test` | The vitest suite. No network beyond loopback. |
30
+ | `pnpm build` | `tsup` into `dist/` — ESM, CJS, and a declaration file for each. |
31
+ | `pnpm run test:pack` | Packs the tarball, asserts what is and is not inside it, then installs it into a scratch project and both typechecks and runs real code against it. |
32
+
33
+ To run one test file, use `pnpm vitest run test/<name>.test.ts`.
34
+
35
+ ## The rule this repository is most serious about: a real server, not a mocked `fetch`
36
+
37
+ **The auth suites drive the SDK's own default `fetch` against a real
38
+ `node:http` server** (`test/local-api.ts`), and no `fetch` option is passed to
39
+ `createClient` in them.
40
+
41
+ That is not ceremony. A suite that passes its own `fetch` never enters the code
42
+ that actually ships: `client.ts` resolves `globalThis.fetch.bind(globalThis)`,
43
+ and every assertion about "what the SDK sends" becomes an assertion about what
44
+ a `vi.fn()` was asked to pretend to send. The two most expensive defects this
45
+ package has had were both invisible to a mocked `fetch` and both obvious to a
46
+ socket:
47
+
48
+ - `createClient` defaulted to a **detached** `globalThis.fetch`. A real
49
+ browser's `fetch` is a Web IDL method that throws "Illegal invocation" unless
50
+ its receiver is the global object. Node's undici does not enforce that check,
51
+ so every test passed and every browser failed on the first call.
52
+ - A path segment shaped like `../../../admin` reached a real server as a
53
+ traversal, because the encoding was asserted against a double that never
54
+ parsed the URL.
55
+
56
+ So: **if your change is about what leaves the process, test it against
57
+ `test/local-api.ts`.** A double is fine for testing branching, refcounting,
58
+ timers and error mapping, and most of the suite uses one for exactly that.
59
+
60
+ `test/client.test.ts` carries a test named for this property on its own, so
61
+ that removing it is visible in a diff rather than silent.
62
+
63
+ ## Licence headers
64
+
65
+ Every source file carries the SPDX header `// SPDX-License-Identifier: MIT` as
66
+ its first line — a `#!` shebang is the only thing allowed above it.
67
+ `test/license-headers.test.ts` asserts this over the whole set, and it takes
68
+ that set from `git ls-files` rather than from a list of directories, so a file
69
+ added anywhere in the repository is swept the day it exists.
70
+
71
+ ## Nothing internal reaches the published bytes
72
+
73
+ `tsup` bundles `@fleetless/contracts` **into** `dist/index.js` and
74
+ `dist/index.cjs`, doc comments and all, and it writes the path each inlined
75
+ module came from as a comment beside it. A comment written for the people who
76
+ build this is therefore a comment an editor shows to somebody who installed it —
77
+ and for four published versions that included German paragraphs, internal
78
+ defect ids and an internal hostname, none of which appeared anywhere in this
79
+ repository's source.
80
+
81
+ Write a comment as what the code does for a caller. Never as how the behaviour
82
+ was found, on which machine, under which internal ticket, or in which language
83
+ the team happened to be thinking that day.
84
+
85
+ `test/published-prose.test.ts` enforces it over `dist/`, `src/`, `test/`,
86
+ `scripts/` and the shipped markdown, and it will tell you which class of thing
87
+ came back and on which line.
88
+
89
+ ## Pull requests
90
+
91
+ **Pull requests are welcome on GitHub**, at
92
+ <https://github.com/fleetless/sdk>. Open an issue first for anything that
93
+ changes an existing method signature or what a method sends, so we can say what
94
+ else has to move with it.
95
+
96
+ **CI runs on GitLab.** This repository is mirrored from an internal GitLab
97
+ instance, which is where the pipeline that verifies and publishes it lives. You
98
+ will not see a check run on your GitHub pull request; a maintainer runs the
99
+ same checks, and the result comes back as a review comment. Run
100
+ `pnpm typecheck && pnpm test && pnpm run test:pack` yourself before you open the
101
+ pull request and you will have seen everything CI would tell you.
102
+
103
+ ## The CLA
104
+
105
+ The first pull request you open will ask you to sign a Contributor Licence
106
+ Agreement. It grants Dehne Robotik GmbH the right to license your contribution
107
+ under terms other than MIT in future — that is the whole of what it is for, and
108
+ it is why the project can relicense its own code later without having to find
109
+ every past contributor. It does not take your copyright away and it does not
110
+ stop you from using your own contribution however you like.
111
+
112
+ ## Commit messages
113
+
114
+ [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/):
115
+ `feat:`, `fix:`, `docs:`, `chore:`, `ci:`, `refactor:`, `test:`. A change that
116
+ alters an existing method's signature or what it sends is a breaking change;
117
+ say so with a `!` and a `BREAKING CHANGE:` footer, because it decides the next
118
+ version number.
119
+
120
+ Everything in this repository is written in **English** — code, comments,
121
+ commit messages, documentation.
122
+
123
+ ## Code of conduct
124
+
125
+ By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
126
+
127
+ ## Releasing (maintainers)
128
+
129
+ See [RELEASING.md](RELEASING.md). The pipeline publishes; `npm publish` from a
130
+ working tree is not how a version gets to the registry.