Skip to content

Commit 4641ccc

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-qv9odd
2 parents 30d0bed + 5e250a6 commit 4641ccc

41 files changed

Lines changed: 2263 additions & 290 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/mcp': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
fix(mcp,runtime): `describe_object` serves `readonly: true` where a write never sets the value
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
`describe_object` and the `objectstack://objects/{name}` resource served each field's `readonly` from the declared flag alone, so an agent was told it could write fields whose sent value the engine drops or replaces. Both transports now also answer `readonly: true` for a runtime-owned type (`autonumber`, including a hand-written field literal with no flag), for a `formula` field, and for a stored field that declares an `expression`. On the HTTP transport, `readonly` is judged on the field as declared, so a stored expression the caller is not shown (it names a field they cannot read) still answers `true`, and the expression itself stays hidden. Over stdio and on the resource, which hold only the object as the caller is served it, the expression case answers `true` where the caller is shown the expression. An ordinary field still answers `readonly: false`, and a declared `readonly` still answers `true`.
12+
13+
`readonly` is the schema's answer, not the caller's field edit permission: a field the caller may read but not edit still answers `readonly: false`, and a write naming it is refused as before. The tool description now says so, and it also says that a `defaultValue` may be a token the server resolves (`NOW()`, `current_user`) or an expression object, so an agent omits the field instead of copying the value.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/service-storage': patch
3+
'@objectstack/mcp': patch
4+
'@objectstack/runtime': patch
5+
---
6+
7+
feat(storage,mcp): one upload link takes several files on a multi-file field
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
A link `create_upload_link` makes for a file field declared `multiple: true` now takes several files in its one use: the user picks up to 10 on the link's page and sends them together, and each file gets its own file id. "Here are my three invoices" is one link and one pick instead of three. A single-file field link and an attachments link take one file, as before.
13+
14+
On a multi-file field's link, one send spends the link once, and every file in it, however many the send carries, is checked before that: the workspace's maximum upload size, and the field's own `accept` and `maxSize`. One file the field cannot take, or more than 10 files (`400` `VALIDATION_ERROR`), refuses the whole send, stores nothing and leaves the link usable. After that the field gains all the files in one write, or none: a failure storing any of them, or the record's write refusing (a pending approval's lock, say), discards every file of the send, so the record shows what it held before and no file of the send is left.
15+
16+
For a record not yet created, `create_upload_link` takes `count` (how many files, up to 10) with a multi-file field, and answers that many `fileIds` at once; the user picks exactly that many, and the agent creates the record with the field set to `fileIds`. Each id keeps the rules a single upload's id has: only that user's own write, into that field of that object, in one record, within an hour of the upload. Before the upload, every write naming one of the ids is refused, the uploader's own included, and nothing serves it.
17+
18+
The link's page takes several files where the link does, in every language it is served in. The send is one form (`multipart/form-data`, marked by the header `x-upload-link-form: several`) carrying `count` and `file0` … `fileN-1`, and only a link that takes several files reads it. Any other body, on any link (a multipart one without that header included), is the file itself, whatever its content type, under the same limit and with the same checks as before. Every successful answer now also carries `fileIds`.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/i18n': patch
3+
---
4+
5+
fix(i18n): the Connect page says an AI assistant connected with an API key works with records and actions only and cannot build apps
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The API-keys section of the Connect page (`connectAgent.apiKey.body`) and the four client hints that fall back to an API key when a client offers no browser sign-in (`connectAgent.codex.hint`, `connectAgent.workbuddy.hint`, `connectAgent.doubao.hint`, `connectAgent.qwenwork.hint`) now say, in all eleven platform locales, that an assistant connected with a key works with records and actions only and cannot build apps. That is what the server does: an API key's grant never admits the authoring tools, on every deployment. The copy promises building nowhere, so it stays true on a deployment that mounts no build door. Only values of existing keys change; zh-Hant is regenerated from zh-Hans.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/cli': patch
3+
'@objectstack/mcp': patch
4+
---
5+
6+
fix(cli): with the stdio MCP transport on, what a host plugin writes to the console while serving a call reaches stderr
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
An MCP client that spawns `os serve` or `os start` over stdio writes `initialize` at once and its first `tools/call` as soon as that is answered, so those calls are served while the server is still finishing its boot. `serve` holds back boot output during that time so the startup banner stays readable, and it held back the calls' output with it: a host plugin's `console.log`, `console.info` and `console.debug` from a tool-call interceptor or a hook reached neither stdout nor stderr. `console.warn` and `console.error` were not affected.
12+
13+
The stdio transport now marks stdout when it claims it, and from that moment `serve` stops holding back console output: it goes to stderr, never to stdout, which still carries only JSON-RPC frames. Under stdio, the part of the boot that runs after the transport starts now prints its own console lines to stderr too, instead of dropping them. A boot without the stdio transport is unchanged.

‎content/docs/ai/connect-mcp.mdx‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ storage service is installed:
275275
| `list_actions` / `run_action` | Discover and invoke your business actions by name |
276276
| `resume_run` | Finish a flow action that paused on a screen, by submitting the screen's values |
277277
| `read_file` | Read a file a record carries: its text (text files, PDF, Word `.docx`) or the image itself, with its size, the byte cap and a short-lived download link |
278-
| `create_upload_link` | Hand the user a single-use link that uploads one file onto a record's file field or its attachments |
278+
| `create_upload_link` | Hand the user a single-use link that uploads a file onto a record's file field or its attachments (up to 10 files, sent together, for a multi-file field) |
279279

280280
### Files: `read_file` and `create_upload_link`
281281

@@ -301,7 +301,15 @@ record means no file**, refused with the same `RECORD_NOT_FOUND`.
301301
write). It answers a link and its expiry (ten minutes). The user opens the
302302
link in a browser where they are signed in to this deployment, picks one
303303
file, and it lands on exactly that record and field, or as an attachment of
304-
that record. On a phone, they sign in there first. The link works only for
304+
that record. On a phone, they sign in there first. A link for a
305+
`multiple: true` file field takes several files in its one use: the user
306+
picks up to 10 and sends them together, every file of the send, however
307+
many, is checked (the maximum upload size, and the field's own `accept` and
308+
`maxSize`) before the link is spent, and the field gains all of them in one write, or none: one file the
309+
field cannot take, or more than 10 (`400` `VALIDATION_ERROR`), refuses the
310+
whole send with the link still usable, and a failure after that leaves the
311+
record as it was. A single-file field link and an attachments link take one
312+
file. The link works only for
305313
the user it was made for, and only once: without a session it answers
306314
`401`, and a second use, an expired link, an unknown link and another user's
307315
link all get the same `404`. The upload is stored as that user, with their
@@ -326,10 +334,13 @@ record means no file**, refused with the same `RECORD_NOT_FOUND`.
326334
`recordId`. That needs a user who may create records of the object and
327335
write the field, and a field that is not `readonly`; an attachments link
328336
still needs its record. The answer carries `fileIds`, the id the upload is
329-
stored under. Once the user has uploaded (the page says the file was
337+
stored under. For several files into a multi-file field, the agent sends
338+
`count` (up to 10): `fileIds` then holds that many ids, and the user must
339+
pick exactly that many. Once the user has uploaded (the page says the file was
330340
received), the agent calls `create_record` with the field set to
331341
`fileIds[0]`, or the array for a multi-file field; before the upload that
332-
create is refused as an upload that never completed. The field's own
342+
create is refused as an upload that never completed, as is every other
343+
write naming one of the ids. The field's own
333344
`accept` and `maxSize` are checked when the file arrives, before the link is
334345
spent. Until a record holds the file, the id works only for that user's own
335346
`create_record` or `update_record` into that field of that object, within

‎content/docs/permissions/system-context.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ One of the largest consumers of the flag;
193193
| 47c | The inbound-mail IMAP sync: `syncMailbox` and `syncAll` admit the system context ALONE | service-mailbox | Get: the sync job reads every mailbox row (its organization, address and IMAP cursor), writes the cursor back, and hands each fetched message to `ingest` under the system context. Lose: nothing a user held — every other caller is refused (`PERMISSION_DENIED`), because a sync stores a mailbox's mail and moves its cursor | `syncMailbox`, `syncAll` |
194194
| 47d | The print service REFUSES the system context: `printRecordToFile` admits a human user acting for themselves alone | service-print | Get: nothing — a system caller is refused (`PERMISSION_DENIED`) before any page is read, session minted or browser started. Lose: nothing a user held — the PDF is rendered as the requesting user and never as the system, so a record is archived only by someone who could read it | `refuseUnlessHumanCaller` |
195195
| 47e | The caller-scoped attach verbs REFUSE the system context: `attachFileAs` and `assertMayAttach` admit a signed-in user alone, and so do the caller-scoped record-file verbs the MCP `read_file` and `create_upload_link` tools call (`listRecordFilesAs`, `readRecordFileAs`, `createUploadLinkAs`, `createUploadLinkForNewRecordAs`) | service-storage | Get: nothing — a system caller is refused (`PERMISSION_DENIED`); the system attaches through `attachFile`, whose rows name no user. Lose: nothing a user held — the caller-scoped verbs insert the attachment under the caller's context so every insert gate judges that user and both rows name them, and the record-file verbs read the record and judge the file as that user, and bind an upload link to them; `createUploadLinkForNewRecordAs` names no record, so it asks the object's create verdict and the field's writability as that user instead | `packages/services/service-storage/src/file-attachment-service.ts#requireUserContext`, `packages/services/service-storage/src/record-file-access.ts#requireUserContext` |
196-
| 47f | The file-reference claim path asks no read verdict of a system write: a record write claims or copies a referenced file only as its caller may read it (the download door's verdict), and a system write carries no caller to ask | service-storage | Get: a system write claims or copies any file the organization-scoped lookup reaches, as before #25692; a deliberate server-side copy between records runs this way. The exception is a file uploaded through an upload link that names no record (#32686), and the id such a link answers before its upload: until a record has held the file, only its uploader's own write takes it, so a system write naming it is refused at the field. Once a record holds it, a system write copies it as any; once a record lets it go, it is judged as any released file. Lose: nothing a user held — a user write is judged by the download door's verdict, and a context-less programmatic write is not asked either | `referencingCallerOf` |
196+
| 47f | The file-reference claim path asks no read verdict of a system write: a record write claims or copies a referenced file only as its caller may read it (the download door's verdict), and a system write carries no caller to ask | service-storage | Get: a system write claims or copies any file the organization-scoped lookup reaches, as before #25692; a deliberate server-side copy between records runs this way. The exception is a file uploaded through an upload link that names no record (#32686), and the ids such a link answers before its upload (its own, and those it reserves for a several-file upload): until a record has held the file, only its uploader's own write takes it, so a system write naming it is refused at the field. Once a record holds it, a system write copies it as any; once a record lets it go, it is judged as any released file. Lose: nothing a user held — a user write is judged by the download door's verdict, and a context-less programmatic write is not asked either | `referencingCallerOf` |
197197
| 47g | The `sys_file` storage-owned columns guard returns early on create: a system insert keeps the `key`, `mime_type`, `size`, `status` and `etag` it writes | service-storage | Get: the storage service's own inserts (the upload doors, the field-file copy and backfill) write those five columns. Lose: nothing a user held — a non-system create has them dropped and starts `pending`, and on update the same columns are `readonly`, so the UPDATE `readonly` strip keeps them for every non-system caller | `installSysFileStorageOwnedColumnsGuard` |
198198

199199
### 5. Actions, metadata plane, provenance, the organization wall

‎packages/cli/src/commands/serve.ts‎

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,25 @@ type PortProbe = (port: number) => Promise<boolean>;
415415
* skip**. ⚠️ Nearby cards have described this search as hopping over ports; it
416416
* does not, and a diagnostic written from that reading would be wrong.
417417
*/
418+
/**
419+
* The mark `@objectstack/mcp` leaves on `process.stdout` when its stdio
420+
* transport claims the stream (`PROTOCOL_STDOUT_CLAIM`,
421+
* `packages/mcp/src/protocol-stdout.ts`, which says why it is a `Symbol.for`
422+
* key). Read here by key rather than imported, so the boot-quiet window does
423+
* not load the MCP package to ask; the same key on both sides is pinned by
424+
* `serve-stdio-stdout-purity.e2e.test.ts`, which boots the real transport.
425+
*/
426+
const PROTOCOL_STDOUT_CLAIM = Symbol.for('@objectstack/mcp:protocol-stdout-claimed');
427+
428+
/**
429+
* Whether a stdio MCP transport has claimed this process's stdout — i.e.
430+
* whether this process has started serving calls over stdio. `serve`'s
431+
* boot-quiet window stops holding back the console from that moment.
432+
*/
433+
export function isProtocolStdoutClaimed(stream: NodeJS.WriteStream = process.stdout): boolean {
434+
return (stream as unknown as Record<symbol, unknown>)[PROTOCOL_STDOUT_CLAIM] === true;
435+
}
436+
418437
export class PortSearchExhaustedError extends Error {
419438
/** The first port probed — the walk's own record of it, not the caller's. */
420439
readonly startPort: number;
@@ -2784,6 +2803,30 @@ export default class Serve extends Command {
27842803
return lines.length > 0 ? { lines, dropped: bootLogs.droppedCount } : undefined;
27852804
};
27862805

2806+
/**
2807+
* Whether the boot-quiet window still holds back what is written to the
2808+
* console and to `process.stdout` — the window is open AND nothing is being
2809+
* served yet.
2810+
*
2811+
* The second half is the stdio MCP transport. Its client writes `initialize`
2812+
* at spawn and its first `tools/call` the moment that is answered, and the
2813+
* transport attaches inside `runtime.start()` — so those calls are served
2814+
* while this window is still open. Everything a host plugin
2815+
* `console.log`ged from one (an interceptor's audit line, a hook's trace)
2816+
* was dropped as boot chatter, and reached neither stream. So the window
2817+
* ends for the console once the transport has claimed stdout
2818+
* ({@link isProtocolStdoutClaimed}): from that moment a line may be a call's
2819+
* output, and the stream cannot tell it from the rest of the boot, so
2820+
* nothing is held back. It still goes to stderr — `origStdoutWrite` is the
2821+
* stderr forwarder — never to stdout, which carries the protocol only.
2822+
*
2823+
* Read per write, never once: the claim happens during the window. An
2824+
* HTTP-only boot never claims, so its window is exactly as before, and the
2825+
* console output of the boot up to the claim (every plugin's `init()`, the
2826+
* starts ahead of the MCP plugin's) is still held back under stdio too.
2827+
*/
2828+
const quietHolds = () => bootQuiet && !isProtocolStdoutClaimed();
2829+
27872830
const restoreOutput = () => {
27882831
bootQuiet = false;
27892832
process.stdout.write = origStdoutWrite;
@@ -2808,7 +2851,7 @@ export default class Serve extends Command {
28082851
bootQuiet = !verboseBoot;
28092852
if (!verboseBoot) {
28102853
process.stdout.write = (chunk: any, ...rest: any[]) => {
2811-
if (bootQuiet) {
2854+
if (quietHolds()) {
28122855
bootLogs.write(chunk, typeof rest[0] === 'string' ? rest[0] : undefined);
28132856
// Honor the write callback so a caller awaiting drain still resumes.
28142857
const cb = rest.find((a) => typeof a === 'function');
@@ -2817,8 +2860,8 @@ export default class Serve extends Command {
28172860
}
28182861
return (origStdoutWrite as any)(chunk, ...rest);
28192862
};
2820-
console.log = (...args: any[]) => { if (!bootQuiet) originalConsoleLog(...args); };
2821-
console.debug = (...args: any[]) => { if (!bootQuiet) originalConsoleDebug(...args); };
2863+
console.log = (...args: any[]) => { if (!quietHolds()) originalConsoleLog(...args); };
2864+
console.debug = (...args: any[]) => { if (!quietHolds()) originalConsoleDebug(...args); };
28222865
}
28232866

28242867
// Load configuration

0 commit comments

Comments
 (0)