elmax-ai 0.4.0__tar.gz
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.
- elmax_ai-0.4.0/LICENSE +21 -0
- elmax_ai-0.4.0/PKG-INFO +468 -0
- elmax_ai-0.4.0/README.md +454 -0
- elmax_ai-0.4.0/elmax_ai.egg-info/PKG-INFO +468 -0
- elmax_ai-0.4.0/elmax_ai.egg-info/SOURCES.txt +27 -0
- elmax_ai-0.4.0/elmax_ai.egg-info/dependency_links.txt +1 -0
- elmax_ai-0.4.0/elmax_ai.egg-info/requires.txt +2 -0
- elmax_ai-0.4.0/elmax_ai.egg-info/top_level.txt +1 -0
- elmax_ai-0.4.0/pyproject.toml +21 -0
- elmax_ai-0.4.0/setup.cfg +4 -0
- elmax_ai-0.4.0/src/elmax_api/__init__.py +11 -0
- elmax_ai-0.4.0/src/elmax_api/_operations_v1.py +598 -0
- elmax_ai-0.4.0/src/elmax_api/activity.py +511 -0
- elmax_ai-0.4.0/src/elmax_api/capabilities.py +53 -0
- elmax_ai-0.4.0/src/elmax_api/client.py +147 -0
- elmax_ai-0.4.0/src/elmax_api/code.py +53 -0
- elmax_ai-0.4.0/src/elmax_api/contract_data.py +3 -0
- elmax_ai-0.4.0/src/elmax_api/credentials.py +444 -0
- elmax_ai-0.4.0/src/elmax_api/domains.py +193 -0
- elmax_ai-0.4.0/src/elmax_api/events.py +17 -0
- elmax_ai-0.4.0/src/elmax_api/models.py +3187 -0
- elmax_ai-0.4.0/src/elmax_api/operations.py +689 -0
- elmax_ai-0.4.0/src/elmax_api/py.typed +1 -0
- elmax_ai-0.4.0/src/elmax_api/resources.py +9 -0
- elmax_ai-0.4.0/src/elmax_api/sentry_schedule.py +44 -0
- elmax_ai-0.4.0/src/elmax_api/teams.py +525 -0
- elmax_ai-0.4.0/src/elmax_api/transport.py +47 -0
- elmax_ai-0.4.0/src/elmax_api/types.py +22 -0
- elmax_ai-0.4.0/src/elmax_api/web_operations.py +15 -0
elmax_ai-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Max SDK contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
elmax_ai-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: elmax-ai
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Synchronous and asynchronous Max API clients
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Documentation, https://docs.elmax.ai/
|
|
7
|
+
Project-URL: Source, https://github.com/everlabs-git/el-max/tree/dev/max-original/packages/max-api
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: httpx<1,>=0.27
|
|
12
|
+
Requires-Dist: typing-extensions>=4.6
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Max API SDKs (0.4.0)
|
|
16
|
+
|
|
17
|
+
The generated personal workspace overview describes the signed-in user's
|
|
18
|
+
confirmed personal deployments and table inventory. It requires a first-party
|
|
19
|
+
session and workspace ownership. Authenticated app control accepts guest
|
|
20
|
+
email addresses and the public audience setting under the existing owner check.
|
|
21
|
+
The first-party authenticated publication request accepts `initial_audience`
|
|
22
|
+
and `guest_emails` for a new app. A group author can choose a public link while
|
|
23
|
+
they own the source and remain a member. The group owner controls guest email
|
|
24
|
+
lists. Version updates use the deployment's existing audience.
|
|
25
|
+
|
|
26
|
+
Authenticated Group deployment history includes `last_failure`, with a safe
|
|
27
|
+
code, display message and optional failed stage.
|
|
28
|
+
|
|
29
|
+
The first-party Sentry `trace-view` operation accepts an optional zero-based
|
|
30
|
+
`page`. Omission loads the newest durable receipt page; the response advertises
|
|
31
|
+
page direction, total and returned receipts, and execution revision. Clients must
|
|
32
|
+
retain loaded pages, reconcile same-turn fragments and reject stale revisions.
|
|
33
|
+
This additive transport option does not grant API-key access to Sentry routes.
|
|
34
|
+
|
|
35
|
+
The Groups profile, shared Notes and group app operations require first-party
|
|
36
|
+
sign-in. The server checks current group membership and owner privileges on
|
|
37
|
+
each applicable request.
|
|
38
|
+
|
|
39
|
+
The first-party Group role operation is `PATCH /groups/{group_id}/members/{user_id}/role`.
|
|
40
|
+
It accepts Owner, Admin and Member values in lowercase and uses the current
|
|
41
|
+
`roles_revision`. Only the current owner can assign roles. Assigning Owner
|
|
42
|
+
transfers ownership and makes the previous owner an admin.
|
|
43
|
+
Group creation accepts one new starter (`park` or `commons`) and optional
|
|
44
|
+
`space_settings` for call rooms and games. Existing group configurations also
|
|
45
|
+
work. The group Park home read and update and game lobby operations require
|
|
46
|
+
first-party member credentials. Home changes use the current version and game
|
|
47
|
+
launches carry a shared identifier for the ready participants.
|
|
48
|
+
Group creation and owner room settings accept `break-garden` for the outdoor
|
|
49
|
+
layout alongside the existing `garden-lounge` for the covered layout.
|
|
50
|
+
The injected MaxData runtime includes `workspace_reviewed` for intake
|
|
51
|
+
submissions. Admitted nonmembers can insert and read their own submissions.
|
|
52
|
+
Workspace members can review all submissions. The app's audience controls
|
|
53
|
+
admission separately.
|
|
54
|
+
Use `workspace_owner_reviewed` with `workspace_owner_shared` for intake and
|
|
55
|
+
review records when review is restricted to the owning workspace's current
|
|
56
|
+
owner. The submitter's own answer access stays available.
|
|
57
|
+
|
|
58
|
+
AI Teams conversation, progress streams and one-time Sentry task status are first-party operations. The generated transport describes their wire contract. A new conversation proposal lists its exact deliverables. Older conversation records can return a null list. SDK API keys and app grants cannot access those routes.
|
|
59
|
+
|
|
60
|
+
The two workspace agent conversation operations are first-party as well. The
|
|
61
|
+
signed-in Group member can see only their own thread with an enabled Group agent.
|
|
62
|
+
When retrying an uncertain send, use the same `operation_id` and message text.
|
|
63
|
+
|
|
64
|
+
The generated team task history contract lists durable runs for a signed-in
|
|
65
|
+
member's selected workspace. It returns a cursor for older tasks and uses the
|
|
66
|
+
same first-party access boundary as the team conversation.
|
|
67
|
+
|
|
68
|
+
AI Team deliverables are listed newest first by `GET .../ai-teams/{team_id}/outputs` (`before` cursor, `limit` up to the server maximum, optional `kind`),
|
|
69
|
+
in both the Group and Workspace forms. It returns metadata only (use the files routes for bytes), needs the `teams:read` scope and keeps the live membership or
|
|
70
|
+
ownership check. `GET /groups/{group_id}/outputs` (combined feed, adds `source`) and `GET /groups/{group_id}/presence` are first-party only: API keys and app grants
|
|
71
|
+
cannot call them. Team task history items now include an `agents` list (`TeamTaskAgent`) naming the participating agents and their deliverables.
|
|
72
|
+
|
|
73
|
+
Team role contracts can explicitly select `max_code` for specialist document,
|
|
74
|
+
spreadsheet, presentation, PDF or website deliverables. This capability is
|
|
75
|
+
environment-gated and remains bounded by the published role, Group workspace,
|
|
76
|
+
task grants and shared run budget. The enum addition creates no new route,
|
|
77
|
+
credential scope or personal Code access; publishing and acceptance retain
|
|
78
|
+
their existing first-party requirements.
|
|
79
|
+
|
|
80
|
+
Independent JavaScript/TypeScript and Python distributions in the Max monorepo.
|
|
81
|
+
This package generates transport and types from the server's HTTP contract, with
|
|
82
|
+
user identity providers, named SSE, binary/text responses and domain helpers.
|
|
83
|
+
An operation appearing in the SDK does not grant access: the server enforces its
|
|
84
|
+
credential, scope, owner and role requirements. See `contracts/capabilities.json`
|
|
85
|
+
for the classified surface and MOBILE-PARITY.md for client adoption. Version
|
|
86
|
+
0.4.0 is prepared and unpublished; device acceptance is a separate release gate.
|
|
87
|
+
|
|
88
|
+
## JavaScript / TypeScript
|
|
89
|
+
|
|
90
|
+
Install the built tarball or, after publication, `npm install @elmax/api`.
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import { MaxClient } from '@elmax/api';
|
|
94
|
+
const max = new MaxClient({baseURL: process.env.MAX_API_URL, apiKey: process.env.MAX_API_KEY});
|
|
95
|
+
const reply = await max.chat.completions.create({
|
|
96
|
+
model: 'agt_your_agent', messages: [{role: 'user', content: 'Hello'}]
|
|
97
|
+
});
|
|
98
|
+
for await (const chunk of max.chat.completions.stream({
|
|
99
|
+
model: 'agt_your_agent', messages: [{role: 'user', content: 'Hello'}]
|
|
100
|
+
})) console.log(chunk.choices);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The core uses Fetch, Web Streams and AbortSignal (Node 20+ or a compatible web
|
|
104
|
+
runtime). Use `tokenProvider` and/or an injected authenticated `fetch` in a host
|
|
105
|
+
application. API-key completions currently require a server API key: a Firebase
|
|
106
|
+
token is not automatically accepted on that endpoint. Never bundle permanent
|
|
107
|
+
API keys in browser/mobile/generated apps. Generated apps use an explicitly
|
|
108
|
+
consented, short-lived project/audience grant or a trusted host bridge. A grant
|
|
109
|
+
only permits its listed state/asset operations; it cannot run paid agents or
|
|
110
|
+
manage credentials. See the scoped credential examples before integration.
|
|
111
|
+
|
|
112
|
+
## Python
|
|
113
|
+
|
|
114
|
+
Install the wheel or, after publication, `pip install elmax-ai`.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import os
|
|
118
|
+
from elmax_ai import MaxClient, AsyncMaxClient
|
|
119
|
+
with MaxClient(base_url=os.environ['MAX_API_URL'], api_key=os.environ['MAX_API_KEY']) as max:
|
|
120
|
+
reply = max.chat.completions.create({'model': 'agt_your_agent', 'messages': [{'role': 'user', 'content': 'Hello'}]})
|
|
121
|
+
for chunk in max.chat.completions.stream({'model': 'agt_your_agent', 'messages': [{'role': 'user', 'content': 'Hello'}]}):
|
|
122
|
+
print(chunk['choices'])
|
|
123
|
+
# AsyncMaxClient: async with, await .create(...), async for over .stream(...).
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Both clients accept an explicit origin or proxy base URL (including `/api/max`
|
|
127
|
+
when appropriate). `model` identifies a Max agent. The lower-level
|
|
128
|
+
`request(method, '/v1/...', ...)` interface accepts JSON bodies and query values;
|
|
129
|
+
it does not grant extra server permissions. Legacy identity parameters and each
|
|
130
|
+
route's authentication requirements must still be satisfied. Uploads using the
|
|
131
|
+
existing JSON/base64 API can use this interface; multipart/binary transfer
|
|
132
|
+
helpers are not part of this release.
|
|
133
|
+
|
|
134
|
+
Errors expose status, request ID and server detail. Error messages omit server
|
|
135
|
+
content. No automatic retries or event replay occur. Stream errors, invalid
|
|
136
|
+
JSON and missing `[DONE]` termination fail explicitly. Close a stream iterator
|
|
137
|
+
when leaving it early. Closing a stream is not a durable server cancellation
|
|
138
|
+
protocol. Python supports context managers and explicit close/aclose; JavaScript
|
|
139
|
+
accepts AbortSignal and a timeout covering ordinary responses. For SSE, the
|
|
140
|
+
timeout bounds the wait for response headers only; observation continues until
|
|
141
|
+
completion or caller cancellation. RequestOptions.timeout overrides the default
|
|
142
|
+
in milliseconds. Execution snapshots include optional created_at/updated_at UTC
|
|
143
|
+
timestamps and optional owner-checked project_id alongside session_id and agent_id.
|
|
144
|
+
|
|
145
|
+
JavaScript also provides `client.usage.summary()` for authenticated
|
|
146
|
+
`GET /account/usage`, typed as `AccountUsage`. Monetary values are decimal
|
|
147
|
+
strings; the response separates settled allowance cost, pending reservations and
|
|
148
|
+
incomplete usage, and unlimited accounts use a null allowance/percentage. See
|
|
149
|
+
[account usage operations](../../../max-mcp/docs/ACCOUNT_USAGE.md).
|
|
150
|
+
|
|
151
|
+
Completion streams and named SSE share one parser (`readEvents` in JavaScript,
|
|
152
|
+
`EventParser` in Python): fragmented UTF-8/CRLF input is assembled once, large
|
|
153
|
+
frames yield to the event loop, and 8 MiB line/event limits apply. Completion
|
|
154
|
+
streams additionally require a final `[DONE]`; EOF without it is an explicit
|
|
155
|
+
error. Nothing reconnects or replays automatically, and chat/build calls that can
|
|
156
|
+
spend credits are never retried by the SDK.
|
|
157
|
+
|
|
158
|
+
## Development and release
|
|
159
|
+
|
|
160
|
+
From this folder:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
node --test --experimental-test-coverage javascript/test/client.test.js
|
|
164
|
+
PYTHONPATH=python/src python -m pytest python/tests
|
|
165
|
+
python scripts/export-contract.py --check
|
|
166
|
+
cd javascript && npm pack
|
|
167
|
+
cd python && python -m pip wheel --no-deps --no-build-isolation .
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Set PYTHONPATH using the syntax of your shell. The contract exporter requires the
|
|
171
|
+
backend's Pydantic environment; runtime SDKs do not import the backend. Review
|
|
172
|
+
type declarations whenever exported schemas change. JavaScript declarations are
|
|
173
|
+
currently maintained manually; full SDK type generation is future work.
|
|
174
|
+
|
|
175
|
+
The public packages use MIT. Publication requires registry namespace ownership
|
|
176
|
+
and a verified candidate from the release workflow.
|
|
177
|
+
Mobile UI parity, persistent runs, offline queues, native auth/storage and app
|
|
178
|
+
adoption remain tracked in the Max API proposal. No production deployment is
|
|
179
|
+
required for this standalone package addition.
|
|
180
|
+
|
|
181
|
+
Document helpers wrap `/v1/documents` with the existing JSON/base64 schema.
|
|
182
|
+
For example `max.documents.list({firebase_uid: uid})` in JavaScript, or
|
|
183
|
+
`max.documents.list(firebase_uid=uid)` in Python. Use authenticated user transport;
|
|
184
|
+
the UID is a legacy route parameter, never an authentication credential.
|
|
185
|
+
Python async document calls return awaitables. A permanent API key alone does not
|
|
186
|
+
authenticate these legacy document routes. Responses are unmodified server JSON.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Max Code products without npm
|
|
190
|
+
|
|
191
|
+
Authenticated published apps receive `globalThis.MaxData` from the release
|
|
192
|
+
runtime. Type definitions live in `javascript/src/app-data.d.ts`. The runtime
|
|
193
|
+
supports manifest-backed table queries, mutations, transactions and table grants.
|
|
194
|
+
See [the app data contract](../../../max-code/docs/app-databases.md).
|
|
195
|
+
|
|
196
|
+
### App viewer state
|
|
197
|
+
|
|
198
|
+
`createAppViewerState().get(key)` reads the signed-in viewer's own saved state
|
|
199
|
+
for the current published app. It resolves
|
|
200
|
+
`{key, exists, data, version, updated_at}`; `exists` is `false` when nothing is
|
|
201
|
+
saved. Keys match `APP_VIEWER_STATE_KEY` (1 to 64 characters from `a-z`, `0-9`,
|
|
202
|
+
`.`, `_`, `-`), and an invalid key rejects with status 400 before any request.
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
import {createAppViewerState} from '@elmax/api';
|
|
206
|
+
const saved = await createAppViewerState().get('signup-draft');
|
|
207
|
+
// Classic script: MaxAPI.createAppViewerState().get('signup-draft')
|
|
208
|
+
// Release runtime global: MaxSDK.viewerState.get('signup-draft')
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The helper sends one same-origin `GET /_max/api/state/{key}` with the browser's
|
|
212
|
+
app session. It takes no base URL, API key, token, project or user, so it works
|
|
213
|
+
only on a Max Code app origin and reaches no other operation. When the release
|
|
214
|
+
runtime or the Max Code preview has installed `globalThis.MaxSDK`, the helper
|
|
215
|
+
uses that surface: a release renews an expired app session once, and the
|
|
216
|
+
preview answers from the project's `max-preview.json` fixtures without a
|
|
217
|
+
request. A signed-out viewer gets an error with status 401. The helper never
|
|
218
|
+
retries. Types are in `javascript/src/app-runtime.d.ts`. This helper is
|
|
219
|
+
JavaScript only.
|
|
220
|
+
|
|
221
|
+
The generated `javascript/browser/max-api.js` exposes `globalThis.MaxAPI` for
|
|
222
|
+
standalone static sites with a trusted backend. Serve it beside the site:
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<script src="./max-api.js"></script>
|
|
226
|
+
<script>
|
|
227
|
+
const max = MaxAPI.createClient({baseURL: location.origin + '/max-api'});
|
|
228
|
+
</script>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The `examples/no-npm` sample expects the browser file beside its HTML and a
|
|
232
|
+
trusted product backend at `/max-api`. The full browser file exceeds the
|
|
233
|
+
single-file limit for Max Code projects. Use its runtime globals and keep
|
|
234
|
+
scoped API credentials in a backend. When the app-agent capability is enabled,
|
|
235
|
+
`window.MaxAgents` invokes the connections approved by the project owner.
|
|
236
|
+
See [Max agents in apps](../../../max-code/docs/app-agents.md).
|
|
237
|
+
|
|
238
|
+
Install the pinned build tool with `npm ci --prefix javascript` from the SDK root.
|
|
239
|
+
Regenerate with `node scripts/build-browser.mjs` and check reproducibility with
|
|
240
|
+
`node scripts/build-browser.mjs --check`. Copy the exact tested browser file into
|
|
241
|
+
each product release; version 0.4.0 is embedded in its header and `MaxAPI.version`.
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
## Complete HTTP operations for non-3D mobile work
|
|
245
|
+
|
|
246
|
+
The SDK now includes `client.api` generated from the reviewed full server
|
|
247
|
+
OpenAPI contract. TypeScript models and exact
|
|
248
|
+
operation signatures live in `src/operations.d.ts`; Python schema TypedDicts live
|
|
249
|
+
in `elmax_ai.models` and generated operations use snake_case. Python operation
|
|
250
|
+
results remain ordinary server dictionaries (or async awaitables), not model
|
|
251
|
+
instances. Specialized `.chat.completions` and `.documents` helpers remain.
|
|
252
|
+
|
|
253
|
+
Configure `tokenProvider`/`token_provider` for user bearer authentication and
|
|
254
|
+
`identityProvider`/`identity_provider` for the current user metadata needed by
|
|
255
|
+
legacy web routes. The server still verifies tokens, ownership and roles. This
|
|
256
|
+
does not grant generated apps the host's identity. See MOBILE-PARITY.md in the
|
|
257
|
+
source tree for the non-3D workflow map, usage examples and acceptance gaps.
|
|
258
|
+
|
|
259
|
+
For verified admin model discovery, `GET /v1/models?admin_catalog=true` returns
|
|
260
|
+
`max_code_model_ids` alongside the general `model_ids` list. Max Code uses the
|
|
261
|
+
former to offer text-generation candidates in its global model setting.
|
|
262
|
+
|
|
263
|
+
Named SSE endpoints yield event names, IDs and data rather than assuming the
|
|
264
|
+
completion protocol's `[DONE]`. Generated stream operations return a stream
|
|
265
|
+
iterator after awaiting the call in JS/async Python. Call `.events()` directly
|
|
266
|
+
for explicit streaming methods and cursor headers. Binary/text/raw responses
|
|
267
|
+
are available through request responseType (JS) or response_type (Python).
|
|
268
|
+
|
|
269
|
+
Regenerate operations: `python scripts/generate-operations.py`.
|
|
270
|
+
Check generated bytes: `python scripts/generate-operations.py --check`.
|
|
271
|
+
Check complete route coverage: `python scripts/check-route-coverage.py`.
|
|
272
|
+
The generated Group member role update requires the signed-in group owner and
|
|
273
|
+
the current roster revision. API keys and app grants cannot change group roles
|
|
274
|
+
or transfer ownership.
|
|
275
|
+
|
|
276
|
+
Riverside Putting uses first-party group access. The submitted card carries a
|
|
277
|
+
course version and bounded aim and power samples. The server computes the stroke
|
|
278
|
+
total and returns the group's current records.
|
|
279
|
+
|
|
280
|
+
The nine-hole Riverside Golf course uses the first-party Group
|
|
281
|
+
`GET /groups/{group_id}/golf/rounds` and `POST /groups/{group_id}/golf/rounds`
|
|
282
|
+
operations. Group members read standings by tee and pin. A complete scorecard
|
|
283
|
+
records the tee, pin, and bounded shot inputs so the server can replay the round
|
|
284
|
+
and save the player's best total. API keys and app grants cannot read or submit
|
|
285
|
+
these scores.
|
|
286
|
+
|
|
287
|
+
The Spaces meeting ticket, Scribe switch, microphone consent, bounded WAV
|
|
288
|
+
upload and Field Ops ticket use first-party group access. The transcription
|
|
289
|
+
upload accepts an optional `X-Space-Start-Ms` microphone offset for ordering
|
|
290
|
+
each participant's speech in the shared meeting note. Scribe status can report
|
|
291
|
+
the persisted meeting-note revision.
|
|
292
|
+
The checked-in OpenAPI artifact was exported from the current server source;
|
|
293
|
+
body/schema changes require re-export and review, not just a route inventory check.
|
|
294
|
+
All HTTP operations are included; mobile scope excludes the 3D experience.
|
|
295
|
+
|
|
296
|
+
The workspace **Ask team** and requester reply operations appear in the generated
|
|
297
|
+
transport contract and require signed-in Max user authentication. A reply
|
|
298
|
+
includes the current lead task's `expected_attempt`, a stable `operation_id`, and
|
|
299
|
+
the reply text or new input file revisions. Workspace-scoped API keys continue
|
|
300
|
+
to use the existing case manifest and run helpers.
|
|
301
|
+
|
|
302
|
+
Detailed AI Team runs can include received file revisions, task assignments,
|
|
303
|
+
usage and verification files, and the Reviewer's verdict and optional grade.
|
|
304
|
+
The existing Team Settings and Group update operations also accept explicit
|
|
305
|
+
delete actions from first-party workspace owners.
|
|
306
|
+
|
|
307
|
+
Export current-source schemas with `python scripts/export-openapi.py` in the backend dependency environment, then regenerate. `--input path/to/schema.json` accepts an isolated export. `--check` compares semantic canonical bytes and detects body/schema drift as well as routes. This command never starts the FastAPI lifespan.
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## Native mobile and detached execution (since 0.3.0)
|
|
311
|
+
|
|
312
|
+
The separate Expo application lives in `max-original/max-mobile`. Inject
|
|
313
|
+
`fetch` from `expo/fetch` and a Firebase user token provider. Use the typed
|
|
314
|
+
`client.mobile` helpers for capabilities, submit/list/get/cancel/events,
|
|
315
|
+
device registration and notification preferences. `submit(requestId, request)`
|
|
316
|
+
accepts an immutable client request ID; recover with `list({request_id})` after
|
|
317
|
+
an uncertain response. Never generate a new ID automatically on reconnection.
|
|
318
|
+
`events(id, after, {signal})` is observation only: abort/EOF is not cancellation
|
|
319
|
+
or proof of completion. Fetch the authoritative execution after interruption.
|
|
320
|
+
Legacy completion and named final event shapes are unchanged. Python generated
|
|
321
|
+
operations include the same routes and recognize mobile event streams.
|
|
322
|
+
|
|
323
|
+
The backend routes require deployment flags and an active account. Native builds,
|
|
324
|
+
physical-device tests and the other release gates are recorded in the mobile
|
|
325
|
+
README; generated contract coverage does not imply finished mobile parity.
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
## Max Code activity state (0.4.0)
|
|
329
|
+
|
|
330
|
+
`createCodeActivityState`, `reduceCodeActivity` and `codeActivityFromEvidence`
|
|
331
|
+
(Python: `create_code_activity_state`, `reduce_code_activity`,
|
|
332
|
+
`code_activity_from_evidence`) are pure, framework-neutral helpers over plain
|
|
333
|
+
JSON, shared by web, Expo and Node adapters. They keep rendering and credentials
|
|
334
|
+
out of the SDK.
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
import {createCodeActivityState, reduceCodeActivity, codeActivityFromEvidence} from '@elmax/api';
|
|
338
|
+
let state = createCodeActivityState({projectId, runId});
|
|
339
|
+
for await (const {frame, state: next} of max.code.observe(projectId, {message: 'Add a boss'}, {runId})) state = next;
|
|
340
|
+
// Persisted evidence {kind:'max_code_activity', schema_version:1, events:[...]} reconciles late receipts:
|
|
341
|
+
state = codeActivityFromEvidence(evidence, {state});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Guarantees (tested in JavaScript and Python against the shared cases in
|
|
345
|
+
`contracts/code-activity-cases.json` and `contracts/code-activity-server-cases.json`;
|
|
346
|
+
the latter is generated by `scripts/generate-activity-server-cases.py` from the
|
|
347
|
+
real server journal in `max-code/backend/runtime/activity_journal.py`, and Python
|
|
348
|
+
output is compared with JavaScript golden output):
|
|
349
|
+
|
|
350
|
+
- **Identity.** An event is `event_id` (top level, `data.event_id`, or the
|
|
351
|
+
compatibility `data.activity_event_id`) within a `run_id`; `sequence` may be
|
|
352
|
+
`sequence` or `activity_sequence`. A raw SSE `id` is a sticky per-connection
|
|
353
|
+
counter and is never identity. The same receipt seen live and in stored history
|
|
354
|
+
is applied once; distinct events that import the same asset stay visible. Events
|
|
355
|
+
without an id get a deterministic payload hash, so byte-identical legacy events
|
|
356
|
+
cannot be told apart (a compatibility limit). Malformed identity, another
|
|
357
|
+
project or another run is recorded in `rejected`, not applied.
|
|
358
|
+
- **No version fence.** A journal legitimately spans imported asset versions older
|
|
359
|
+
than the final saved version, so version numbers never reject an event. `saved`
|
|
360
|
+
is monotonic: an older save receipt is kept in `entries` (`superseded: true`) but
|
|
361
|
+
never lowers `saved`; a same-number, different-id receipt is flagged `conflict`.
|
|
362
|
+
- **Outcomes.** `generation` is `unknown|in_progress|completed|incomplete|interrupted|failed`
|
|
363
|
+
and only ever rises in that order. A `final` response is only `completed`;
|
|
364
|
+
an `error` (including nested `error.code`) or a stored `failed`/`interrupted`/
|
|
365
|
+
`incomplete` outcome outranks it, and a late `final` or save never lowers a
|
|
366
|
+
failure. `status` mirrors it (`finished` means generation ended, not that the
|
|
367
|
+
product is verified). Stored `closeout` (version, error code), `truncated` and
|
|
368
|
+
`dropped_events` are kept under `journal`.
|
|
369
|
+
- **Verification.** `verification_result` is an observed check: the state keeps its
|
|
370
|
+
validated `provenance` (version, source hash, check, source), marks it `bound`
|
|
371
|
+
only when it names the current saved version, and otherwise labels it
|
|
372
|
+
`diagnostic_unbound`. `product.status` is `unverified` unless an observed result
|
|
373
|
+
is bound to the saved version after a `completed` generation (`checks_passed`,
|
|
374
|
+
`checks_failed`, `checks_incomplete`); `trusted` is always `false` because the
|
|
375
|
+
exact-source receipt and product authorization remain server-side.
|
|
376
|
+
- **Assets.** Every asset is a card (alias, relation `imported|supplied|bound`
|
|
377
|
+
as reported, never `created`/`used`; status is only `saved`). Distinct aliases
|
|
378
|
+
bound to one asset version are distinct cards. Up to 64 per event are kept by
|
|
379
|
+
default (the project allowance); anything omitted is counted in
|
|
380
|
+
`assets_omitted`/`truncated`. Previews follow the chat policy: at most 20 MiB and
|
|
381
|
+
exactly `image/png|jpeg|webp|gif`, `model/gltf-binary`, `audio/mpeg|wav|ogg`;
|
|
382
|
+
anything else, an unknown or zero size, or a server `preview:{available:false}`
|
|
383
|
+
is `unavailable` with a reason while the card stays. `eligible` only means within
|
|
384
|
+
that policy; each host decides what it can render.
|
|
385
|
+
- **Bounds.** All lists are bounded with explicit `truncated` counters and only
|
|
386
|
+
allow-listed display fields are kept: tool output, source and URLs never enter
|
|
387
|
+
the state. Trim `seen` with `limits.maxSeen` if you persist it.
|
|
388
|
+
|
|
389
|
+
## Max Code and capability helpers
|
|
390
|
+
|
|
391
|
+
`client.code` wraps the generated Max Code operations (same auth, identity and
|
|
392
|
+
path encoding as `client.api`): `capabilities`, `projects.{list,get,versions,assets,previewAssets}`,
|
|
393
|
+
`buildRuns.{list,get,cancel}`, `chatStream` and `observe` (Python: `build_runs`,
|
|
394
|
+
`chat_stream`, `observe`; `AsyncMaxClient` is awaited/iterated asynchronously).
|
|
395
|
+
`observe` folds frames into activity state and yields `{frame, state}`. It does
|
|
396
|
+
not reconnect: ending the loop or aborting is observation only, and EOF without a
|
|
397
|
+
`final` event leaves the state `running`. Reconcile through persisted evidence.
|
|
398
|
+
|
|
399
|
+
`client.capabilities` exposes the generated contract (`contractData`,
|
|
400
|
+
`contract_version` 1): every one of the 443 operations stays discoverable with its
|
|
401
|
+
method, path, tags, `stream` and HTTP-`safe` flags. `audience`
|
|
402
|
+
(`public|user|admin|internal`), `scopes` and `credential_kinds` are `unclassified`
|
|
403
|
+
until a server-authoritative access map is supplied (`contracts/access.json`,
|
|
404
|
+
validated with `python scripts/generate-operations.py --validate-access FILE`).
|
|
405
|
+
These fields are informational: the server enforces credentials and scopes on
|
|
406
|
+
every request, and a listed operation is never a grant. There is no generic
|
|
407
|
+
server discovery route; `capabilities.discover(area)` calls the existing
|
|
408
|
+
`mobile`, `code`, `code_creations` and `storefront` capability routes and reports
|
|
409
|
+
401/403/404/501 as `available: false`.
|
|
410
|
+
|
|
411
|
+
## Versioning, changelog and artifacts
|
|
412
|
+
|
|
413
|
+
JavaScript and Python are released in lock-step with one version while 0.x:
|
|
414
|
+
additive features increment the minor version, fixes the patch, and any removal or
|
|
415
|
+
signature change of an exported name or generated operation needs a major (or,
|
|
416
|
+
before 1.0, a minor with a CHANGELOG "Breaking" entry and a deprecation period of
|
|
417
|
+
one minor). `contract_version` (capabilities) is a separate integer that changes
|
|
418
|
+
only when the contract data shape changes. `CHANGELOG.md` records each version.
|
|
419
|
+
|
|
420
|
+
The [SDK release guide](../docs/RELEASE.md) covers paired package publication,
|
|
421
|
+
exact-artifact resume, and deployment of the versioned reference. The site and
|
|
422
|
+
the Max Code authoring guide share the same tested runtime example.
|
|
423
|
+
|
|
424
|
+
`python scripts/verify-artifacts.py` packs the npm tarball and builds the wheel in
|
|
425
|
+
a temporary directory, extracts/installs them offline, and smoke-tests the
|
|
426
|
+
installed copies (it never publishes). Run `node scripts/build-browser.mjs --check`,
|
|
427
|
+
`python scripts/generate-operations.py --check` and `node scripts/activity-golden.mjs --check`
|
|
428
|
+
before release. `python scripts/sync-readmes.py` keeps the JavaScript and Python
|
|
429
|
+
package READMEs identical to this file.
|
|
430
|
+
|
|
431
|
+
## AI Teams
|
|
432
|
+
|
|
433
|
+
Use `client.teams.list(groupId)` and `client.teams.get(groupId, teamId)` to find published teams. `client.teams.files` lists and reads revisions, writes case inputs and moves files. `client.teams.runs` submits cases, reads status and receipts, observes persisted events, and cancels runs the caller controls. The Python clients expose the same helpers with positional `group_id`, `team_id` and `run_id` arguments.
|
|
434
|
+
|
|
435
|
+
```javascript
|
|
436
|
+
const run = await client.teams.runs.start(groupId, teamId, {
|
|
437
|
+
case_key: "synthetic-001",
|
|
438
|
+
submission_id: "synthetic-001-manifest-v1",
|
|
439
|
+
inputs: [{ path: `teams/${teamId}/cases/synthetic-001/input/case.txt`, revision: 1 }],
|
|
440
|
+
});
|
|
441
|
+
for await (const page of client.teams.runs.observe(groupId, teamId, run.id, { maxPolls: 30 })) {
|
|
442
|
+
console.log(page.cursor, page.events);
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Workspace-bound helpers
|
|
447
|
+
|
|
448
|
+
`client.teams.workspace(workspaceId)` (JavaScript) and `client.teams.workspace(workspace_id)` (Python) return the same helpers bound to one Workspace: `list`/`get`, `files` (`list`, `read`, `revisions`, `write`, `move`) and `runs` (`list`, `start`, `get`, `events`, `observe`, `cancel`, `receipt`). Bound methods omit the Workspace ID and call the generated Workspace operation (for example `getWorkspacesWorkspaceIdAiTeams` / `get_workspaces_workspace_id_ai_teams`). The existing `client.teams` methods still take a `group_id`. Inputs are validated by the same checks, response shapes are unchanged, and the Workspace ID is path-encoded by the transport. A refused credential or missing Workspace operation is returned as is: there is no fallback to a Group route. Paid mutations (`runs.start`, `files.write`, `files.move`) are sent once; supply the same `submission_id` or `operation_id` to replay them. Stopping `observe` does not replay anything, and a stored cursor resumes it.
|
|
449
|
+
|
|
450
|
+
```javascript
|
|
451
|
+
const workspace = client.teams.workspace(workspaceId);
|
|
452
|
+
const run = await workspace.runs.start(teamId, {
|
|
453
|
+
case_key: "synthetic-001",
|
|
454
|
+
submission_id: "synthetic-001-manifest-v1",
|
|
455
|
+
});
|
|
456
|
+
for await (const page of workspace.runs.observe(teamId, run.id, { maxPolls: 30 })) {
|
|
457
|
+
console.log(page.cursor, page.events);
|
|
458
|
+
}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
```python
|
|
462
|
+
workspace = client.teams.workspace(workspace_id)
|
|
463
|
+
run = workspace.runs.start(team_id, {"case_key": "synthetic-001", "submission_id": "synthetic-001-manifest-v1"})
|
|
464
|
+
for page in workspace.runs.observe(team_id, run["id"], max_polls=30):
|
|
465
|
+
print(page["cursor"], page["events"])
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
The Group owner can create a Group-bound key from AI Teams settings. Supply stable operation IDs for file changes and a stable submission ID for a case start. Observation ends independently of execution and resumes after a stored cursor. Human acceptance is available in the signed-in web app. See [AI Teams setup and API](../../../max-mcp/docs/AI_TEAMS.md).
|