@descix/platform-api 5.1.1 → 5.3.0
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/LICENSE.md +80 -71
- package/README.md +71 -0
- package/package.json +7 -4
- package/src/account-admin/conformance.js +526 -0
- package/src/account-admin/contract.js +513 -0
- package/src/account-admin/index.js +913 -0
- package/src/email/index.js +50 -5
- package/src/fabric/vocab.js +12 -12
- package/src/index.js +64 -0
- package/src/manifest/index.js +1 -1
- package/src/mcp-tools/chatMedia.js +1 -1
- package/src/mcp-tools/cli-verbs.generated.json +101 -26
- package/src/mcp-tools/cli-verbs.js +2 -2
- package/src/mcp-tools/evidence-contract.js +7 -7
- package/src/mcp-tools/handshake.js +2 -3
- package/src/mcp-tools/index.js +7 -7
- package/src/mcp-tools/nativeTools.js +24 -24
- package/src/mcp-tools/paramValidation.js +4 -5
- package/src/mcp-tools/platform-basics.js +1 -1
- package/src/mcp-tools/setup-playbook.js +6 -6
- package/src/models/index.js +1231 -33
- package/src/naming/index.js +1 -1
- package/src/operator/booted-database.js +48 -0
- package/src/operator/index.js +142 -0
- package/src/permissions/index.js +1 -1
- package/src/service-bootstrap/index.js +1 -1
package/src/email/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @descix/platform-api - Email Infrastructure
|
|
3
3
|
*
|
|
4
4
|
* Gmail API email sending using service account with domain-wide delegation.
|
|
5
|
-
* Used by both
|
|
5
|
+
* Used by both Cloud and Powch microservices.
|
|
6
6
|
*
|
|
7
7
|
* Config values are loaded at call time via getCloudConfig() from @descix/cloud-core.
|
|
8
8
|
* All config must be bootstrapped before calling any function here.
|
|
@@ -58,6 +58,36 @@ export function isValidEmail(email) {
|
|
|
58
58
|
return /^[^\s@]+@[^\s@.]+(\.[^\s@.]+)+$/.test(email.trim());
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* The extra headers sendEmail accepts, by exact name (RFC 2369 / RFC 8058 one-click unsubscribe).
|
|
63
|
+
* The ONE allow-list; a caller passing any other header name is refused by name.
|
|
64
|
+
*/
|
|
65
|
+
export const EMAIL_EXTRA_HEADERS = Object.freeze(['List-Unsubscribe', 'List-Unsubscribe-Post']);
|
|
66
|
+
|
|
67
|
+
function emailError(code, message) {
|
|
68
|
+
const err = new Error(`${code}: ${message}`);
|
|
69
|
+
err.code = code;
|
|
70
|
+
return err;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Validate the `headers` option into header lines; [] when absent. Throws before anything is sent. */
|
|
74
|
+
function emailExtraHeaderLines(headers) {
|
|
75
|
+
if (headers === null || headers === undefined) return [];
|
|
76
|
+
if (typeof headers !== 'object' || Array.isArray(headers)) {
|
|
77
|
+
throw emailError('EMAIL_HEADERS_INVALID', 'headers must be an object of { name: value }.');
|
|
78
|
+
}
|
|
79
|
+
return Object.entries(headers).map(([name, value]) => {
|
|
80
|
+
if (!EMAIL_EXTRA_HEADERS.includes(name)) {
|
|
81
|
+
throw emailError('EMAIL_HEADER_NOT_ALLOWED',
|
|
82
|
+
`header '${name}' is not allowed; sendEmail accepts only ${EMAIL_EXTRA_HEADERS.join(', ')}.`);
|
|
83
|
+
}
|
|
84
|
+
if (typeof value !== 'string' || value.trim() === '' || /[\r\n]/.test(value)) {
|
|
85
|
+
throw emailError('EMAIL_HEADER_VALUE_INVALID', `header '${name}' must be a non-empty single-line string.`);
|
|
86
|
+
}
|
|
87
|
+
return `${name}: ${value}`;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
61
91
|
/**
|
|
62
92
|
* Core Gmail email sending function using service account with domain-wide delegation.
|
|
63
93
|
*
|
|
@@ -69,13 +99,20 @@ export function isValidEmail(email) {
|
|
|
69
99
|
* @param {string} body - Email body (plain text)
|
|
70
100
|
* @param {string} [fromEmail] - Optional sender email (defaults to DESCIX_ROUTER_COMMUNITY_MANAGER)
|
|
71
101
|
* @param {Object} [options]
|
|
72
|
-
* @param {string} [options.html] - Optional HTML body
|
|
102
|
+
* @param {string} [options.html] - Optional HTML body When
|
|
73
103
|
* present the message is multipart/alternative: the plain `body` is the text part, `html`
|
|
74
104
|
* the html part (last = preferred). Absent, the message is the same single-part text/plain
|
|
75
105
|
* it has always been — no existing caller changes.
|
|
76
|
-
* @
|
|
106
|
+
* @param {Object<string,string>} [options.headers] - Optional extra headers, by name. Only the
|
|
107
|
+
* names in EMAIL_EXTRA_HEADERS are accepted (any other is refused by name, code
|
|
108
|
+
* EMAIL_HEADER_NOT_ALLOWED); a value must be a non-empty single-line string
|
|
109
|
+
* (EMAIL_HEADER_VALUE_INVALID). They are written after Subject. Absent, the message is
|
|
110
|
+
* byte-for-byte what it was before this option existed.
|
|
111
|
+
* @returns {Promise<{message_id: string}>} the provider's message id; a provider answer without
|
|
112
|
+
* one is thrown (EMAIL_PROVIDER_NO_MESSAGE_ID), never returned as undefined
|
|
77
113
|
*/
|
|
78
|
-
export async function sendEmail(toEmail, subject, body, fromEmail = null, { html = null } = {}) {
|
|
114
|
+
export async function sendEmail(toEmail, subject, body, fromEmail = null, { html = null, headers: extraHeaders = null } = {}) {
|
|
115
|
+
const extraHeaderLines = emailExtraHeaderLines(extraHeaders);
|
|
79
116
|
const utils = getCloudConfig();
|
|
80
117
|
|
|
81
118
|
// The sender/impersonated user - must be a real user in the domain with Gmail access
|
|
@@ -111,6 +148,7 @@ export async function sendEmail(toEmail, subject, body, fromEmail = null, { html
|
|
|
111
148
|
`To: ${toEmail}`,
|
|
112
149
|
`Reply-To: ${replyToEmail}`,
|
|
113
150
|
`Subject: ${subject}`,
|
|
151
|
+
...extraHeaderLines,
|
|
114
152
|
];
|
|
115
153
|
let message;
|
|
116
154
|
if (html) {
|
|
@@ -142,8 +180,9 @@ export async function sendEmail(toEmail, subject, body, fromEmail = null, { html
|
|
|
142
180
|
const raw = base64UrlEncode(message);
|
|
143
181
|
|
|
144
182
|
// Use impersonated user's email as userId
|
|
183
|
+
let response;
|
|
145
184
|
try {
|
|
146
|
-
await gmail.users.messages.send({
|
|
185
|
+
response = await gmail.users.messages.send({
|
|
147
186
|
userId: impersonatedUser,
|
|
148
187
|
requestBody: { raw }
|
|
149
188
|
});
|
|
@@ -160,6 +199,12 @@ export async function sendEmail(toEmail, subject, body, fromEmail = null, { html
|
|
|
160
199
|
}
|
|
161
200
|
throw error;
|
|
162
201
|
}
|
|
202
|
+
const message_id = response?.data?.id;
|
|
203
|
+
if (typeof message_id !== 'string' || message_id === '') {
|
|
204
|
+
throw emailError('EMAIL_PROVIDER_NO_MESSAGE_ID',
|
|
205
|
+
`Gmail accepted the message to ${toEmail} but answered without a message id; the send cannot be recorded as sent.`);
|
|
206
|
+
}
|
|
207
|
+
return { message_id };
|
|
163
208
|
}
|
|
164
209
|
|
|
165
210
|
/**
|
package/src/fabric/vocab.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* those rules are written against.
|
|
7
7
|
*
|
|
8
8
|
* WHY IT LIVES IN @descix/platform-api AND NOT IN THE CLOUD MICROSERVICE. There are two consumers
|
|
9
|
-
* in two repositories:
|
|
10
|
-
*
|
|
9
|
+
* in two repositories: Cloud's `fabricStore.js` (which enforces the vocabulary) and
|
|
10
|
+
* Core's `mcp-tools/nativeTools.js` (which PUBLISHES it as tool-schema enums and prose). A
|
|
11
11
|
* copy in each is the mirror-drift bug class — the enum a caller is SHOWN and the enum the server
|
|
12
12
|
* ACCEPTS would disagree silently, and the caller would be refused against a contract it was never
|
|
13
13
|
* given. One export, two importers, and `fabric-vocabulary-conformance.test.js` fails CI if a tool
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* imported by a package whose other entry points pull in Firestore.
|
|
19
19
|
*
|
|
20
20
|
* The `fabric_vocabulary` verb returns this module's contents over the wire, so a CLIENT (the
|
|
21
|
-
*
|
|
21
|
+
* coordination plugin's `hooks/lib/vocab.py`) can GENERATE its copy instead of hand-keeping one.
|
|
22
22
|
* A hand-kept client mirror was measured writing four statuses the server refuses and defining a
|
|
23
23
|
* `liveness` model the server did not know (2026-08-24).
|
|
24
24
|
*/
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
//
|
|
28
28
|
// A record addressed to a seat (`to_agent`) on any OTHER app/kb reaches no sweeper: every sweep
|
|
29
29
|
// reads THIS collection and the store answers success:true either way (measured twice on
|
|
30
|
-
// 2026-08-23 — a CEO ruling addressed to VISION sat unread in
|
|
30
|
+
// 2026-08-23 — a CEO ruling addressed to VISION sat unread in another app's KB for three hours). The
|
|
31
31
|
// fabric verbs do not take app_id/kb_id from the caller for exactly that reason.
|
|
32
32
|
export const FABRIC_APP = 'egpt-frqtl';
|
|
33
33
|
export const FABRIC_KB = 'coordination';
|
|
@@ -174,7 +174,7 @@ export const LIVENESS_VALUES = Object.freeze([LIVENESS_MODEL, LIVENESS_PROCESS])
|
|
|
174
174
|
// ── WHICH WRITER MUST CARRY `wake` ───────────────────────────────────────────────────────────
|
|
175
175
|
//
|
|
176
176
|
// ONE OWNER OF THE RULE, consumed by the descriptor that PUBLISHES it (nativeTools.js
|
|
177
|
-
// `fabric_beat`) and by the verb that ENFORCES it (
|
|
177
|
+
// `fabric_beat`) and by the verb that ENFORCES it (Cloud fabricStore.js). Under
|
|
178
178
|
// CEO-D-2026-08-22-PROTOCOL-TRUTH-IS-THE-MCP-DESCRIPTOR the served descriptor IS the protocol, so
|
|
179
179
|
// a server enforcing one rule while its descriptor states another has two truths and callers build
|
|
180
180
|
// against the wrong one. Both read this constant; neither restates it.
|
|
@@ -205,7 +205,7 @@ export function isWakeRequiredFor(liveness) {
|
|
|
205
205
|
// ── WHICH WRITER OWNS `status` ───────────────────────────────────────────────────────────────
|
|
206
206
|
//
|
|
207
207
|
// ONE OWNER OF THE RULE, consumed by the descriptor that PUBLISHES it (nativeTools.js
|
|
208
|
-
// `fabric_beat`) and by the verb that ENFORCES it (
|
|
208
|
+
// `fabric_beat`) and by the verb that ENFORCES it (Cloud fabricStore.js), exactly as
|
|
209
209
|
// WAKE_REQUIRED_LIVENESS is. Under CEO-D-2026-08-22-PROTOCOL-TRUTH-IS-THE-MCP-DESCRIPTOR the
|
|
210
210
|
// served descriptor IS the protocol, so a server enforcing one rule while its descriptor states
|
|
211
211
|
// another has two truths and callers build against the wrong one.
|
|
@@ -383,7 +383,7 @@ export const ENVELOPE_SECTIONS = Object.freeze([
|
|
|
383
383
|
/**
|
|
384
384
|
* WHAT `text` IS — stated ONCE, quoted by every surface that describes or enforces it.
|
|
385
385
|
*
|
|
386
|
-
* THE DEFECT THIS REPLACES
|
|
386
|
+
* THE DEFECT THIS REPLACES:
|
|
387
387
|
* `fabric_envelope_put` stated this fact in THREE places — its tool `description`, its
|
|
388
388
|
* `properties.text.description`, and the server's refusal in fabricStore's assertSectionedText —
|
|
389
389
|
* and they had drifted. The tool description said "`text` is a JSON OBJECT whose keys are the
|
|
@@ -935,10 +935,10 @@ export const VERDICT = Object.freeze({
|
|
|
935
935
|
// `liveness` REMAINS, and it still means what it meant: WHO wrote the most recent beat. It is no
|
|
936
936
|
// longer the model's clock and no reader may use it as one.
|
|
937
937
|
//
|
|
938
|
-
// THIS TABLE IS THE CONTRACT. It is exported so the plugin reader (
|
|
939
|
-
// `hooks/lib/fabric_read.py`), the secretary definition and
|
|
940
|
-
// ONE description instead of three hand-listed field sets — the schema-mirror-drift rule
|
|
941
|
-
//
|
|
938
|
+
// THIS TABLE IS THE CONTRACT. It is exported so the plugin reader (the coordination plugin's
|
|
939
|
+
// `hooks/lib/fabric_read.py`), the secretary definition and Cloud's `fabricStore.js` consume
|
|
940
|
+
// ONE description instead of three hand-listed field sets — the schema-mirror-drift rule (one exported owner,
|
|
941
|
+
// no hand-listed mirrors). `projectable: true` is load-bearing: both fields are
|
|
942
942
|
// FLAT top-level record fields, so a raw reader may name them in a `fields` projection. A nested
|
|
943
943
|
// clock block would be unprojectable AND unfilterable, and the raw reader would have to fetch the
|
|
944
944
|
// whole record to answer one question.
|
|
@@ -1033,7 +1033,7 @@ export function normalizeBeatClocks(record) {
|
|
|
1033
1033
|
* `normalizeBeatClocks(record)` into it (`{...clocks, now, threshold_s}`) rather than pick
|
|
1034
1034
|
* `model_beat_at` out and re-label it. Extra keys from the bag are ignored. That is not cosmetic:
|
|
1035
1035
|
* a call site that names the field is a second place the string lives, which is the drift this
|
|
1036
|
-
* whole contract exists to close —
|
|
1036
|
+
* whole contract exists to close — Cloud's conformance gate refuses a hand-typed clock name
|
|
1037
1037
|
* in `fabricStore.js` on exactly that ground.
|
|
1038
1038
|
*
|
|
1039
1039
|
* @param {{model_beat_at: ?string, now: string, threshold_s: number}} args
|
package/src/index.js
CHANGED
|
@@ -31,10 +31,73 @@ export {
|
|
|
31
31
|
count_tokens,
|
|
32
32
|
matrix_to_bigquery,
|
|
33
33
|
sanitizeCredentialId,
|
|
34
|
+
PASSKEY_FIELDS,
|
|
35
|
+
PasskeyState,
|
|
36
|
+
PasskeySource,
|
|
37
|
+
PasskeyRecordError,
|
|
38
|
+
PasskeyRecordRefusal,
|
|
39
|
+
normalizePasskey,
|
|
40
|
+
recoveredPasskeyDifferences,
|
|
41
|
+
userAccountOwner,
|
|
34
42
|
get_default_community,
|
|
35
43
|
getUserEntitlements
|
|
36
44
|
} from './models/index.js';
|
|
37
45
|
|
|
46
|
+
// Operator guards: THE operator email rule, the operator envs and the Firestore target check
|
|
47
|
+
// (also at @descix/platform-api/operator).
|
|
48
|
+
export {
|
|
49
|
+
OPERATOR_ENVS,
|
|
50
|
+
OperatorGuardRefusal,
|
|
51
|
+
OperatorGuardError,
|
|
52
|
+
normalizeOperatorEmailRule,
|
|
53
|
+
operatorEmailAllowed,
|
|
54
|
+
operatorEmailRuleForAddress,
|
|
55
|
+
operatorEmailRulePrefixes,
|
|
56
|
+
assertOperatorTarget
|
|
57
|
+
} from './operator/index.js';
|
|
58
|
+
// The database an operator run on an env must target, measured from the booted cloud-core config.
|
|
59
|
+
export { bootedEnvDatabaseId } from './operator/booted-database.js';
|
|
60
|
+
|
|
61
|
+
// Operator account admin: delete and merge, in-process only (also at @descix/platform-api/account-admin).
|
|
62
|
+
export {
|
|
63
|
+
createAccountAdmin,
|
|
64
|
+
ACCOUNT_PLAN_TTL_SECONDS,
|
|
65
|
+
AccountAdminRefusal,
|
|
66
|
+
AccountAdminError,
|
|
67
|
+
accountAdminBlocker,
|
|
68
|
+
DELETE_OUTCOME,
|
|
69
|
+
MERGE_OUTCOME,
|
|
70
|
+
MERGE_ROLLBACK_OUTCOME,
|
|
71
|
+
RESTORE_OUTCOME,
|
|
72
|
+
ACCOUNT_READ_LIMIT,
|
|
73
|
+
STORE_OWNER_METHODS,
|
|
74
|
+
STORE_OWNER_MERGE_METHODS,
|
|
75
|
+
STORE_OWNER_RESTORE_METHOD,
|
|
76
|
+
USER_OWNER_METHODS,
|
|
77
|
+
deletePlanHash,
|
|
78
|
+
mergePlanHash,
|
|
79
|
+
REDACTED,
|
|
80
|
+
redactCredentials,
|
|
81
|
+
encodeStoreValue,
|
|
82
|
+
decodeStoreTimestamp,
|
|
83
|
+
receiptData,
|
|
84
|
+
canonicalJson,
|
|
85
|
+
accountAdminHash,
|
|
86
|
+
nonJsonValuePath,
|
|
87
|
+
unredactedCredentialPaths,
|
|
88
|
+
footprintViolation,
|
|
89
|
+
moveKey,
|
|
90
|
+
credentialValues,
|
|
91
|
+
secretPath,
|
|
92
|
+
isSecretPath,
|
|
93
|
+
entryDataHash,
|
|
94
|
+
deleteExpectations,
|
|
95
|
+
assertDeletePlanCurrent,
|
|
96
|
+
assertDocumentAsPlanned,
|
|
97
|
+
assertAccountStoreOwnerConforms,
|
|
98
|
+
AccountStoreOwnerNonConformance
|
|
99
|
+
} from './account-admin/index.js';
|
|
100
|
+
|
|
38
101
|
// Auth
|
|
39
102
|
export {
|
|
40
103
|
createUserSession,
|
|
@@ -48,6 +111,7 @@ export {
|
|
|
48
111
|
// Email
|
|
49
112
|
export {
|
|
50
113
|
sendEmail,
|
|
114
|
+
EMAIL_EXTRA_HEADERS,
|
|
51
115
|
sendVerificationEmail,
|
|
52
116
|
renderMigrationQueuedEmail,
|
|
53
117
|
sendMigrationQueued,
|
package/src/manifest/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* would be a second owner for as long as the companion repoint takes; a pointer is the same
|
|
7
7
|
* owner reached by an older name.
|
|
8
8
|
*
|
|
9
|
-
* It exists only until
|
|
9
|
+
* It exists only until Cloud's imports are repointed at `@descix/cloud-core/manifest`,
|
|
10
10
|
* after which this file and its subpath export are DELETED. That repoint is a companion row
|
|
11
11
|
* and is deliberately NOT part of this change.
|
|
12
12
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* chatMedia — THE canonical contract for MEDIA entering a chat turn.
|
|
3
3
|
*
|
|
4
|
-
* ONE OWNER RULE
|
|
4
|
+
* ONE OWNER RULE:
|
|
5
5
|
* text contributions enter a turn through `chatIngress` (descix-app-sdk); MEDIA
|
|
6
6
|
* contributions carry bytes, and bytes need a wire shape, a MIME vocabulary, a size
|
|
7
7
|
* policy and a provider-block encoder. All four live HERE, once. No consumer
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
"verbPath": "admin-login",
|
|
4
|
-
"description": "Bootstrap CLI credentials for platform admins (requires admin group membership)",
|
|
5
|
-
"arguments": [],
|
|
6
|
-
"options": [
|
|
7
|
-
{
|
|
8
|
-
"flags": "-e, --email <email>",
|
|
9
|
-
"description": "Admin email (must be in platform admin Google Group)",
|
|
10
|
-
"required": true
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"flags": "-u, --url <url>",
|
|
14
|
-
"description": "API URL override",
|
|
15
|
-
"required": false
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"runbookAnchor": null
|
|
19
|
-
},
|
|
20
2
|
{
|
|
21
3
|
"verbPath": "app delete",
|
|
22
4
|
"description": "Delete an app with full cascade cleanup (Pinecone, GCS, Firestore, Products)",
|
|
@@ -118,9 +100,92 @@
|
|
|
118
100
|
"options": [],
|
|
119
101
|
"runbookAnchor": null
|
|
120
102
|
},
|
|
103
|
+
{
|
|
104
|
+
"verbPath": "app media-delete",
|
|
105
|
+
"description": "Delete uploaded media from an app's assets/ prefix, one path per server call; a path that does not exist is reported and the rest still run (exit 1 only when a call fails)",
|
|
106
|
+
"arguments": [
|
|
107
|
+
{
|
|
108
|
+
"name": "path",
|
|
109
|
+
"required": true,
|
|
110
|
+
"variadic": true,
|
|
111
|
+
"description": "One or more object paths relative to the app assets/ prefix, as media-list prints them"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"options": [
|
|
115
|
+
{
|
|
116
|
+
"flags": "-a, --app <id>",
|
|
117
|
+
"description": "App ID (community is resolved server-side from Products)",
|
|
118
|
+
"required": true
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"flags": "--dry-run",
|
|
122
|
+
"description": "Ask the server what would be deleted; nothing is deleted",
|
|
123
|
+
"required": false
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"flags": "--private",
|
|
127
|
+
"description": "Use the app's PRIVATE media space instead of the public one (visibility is always sent to the server explicitly)",
|
|
128
|
+
"required": false
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"flags": "--json",
|
|
132
|
+
"description": "Print every per-path server result and the summary as JSON (for scripting)",
|
|
133
|
+
"required": false
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"runbookAnchor": null
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"verbPath": "app media-link",
|
|
140
|
+
"description": "Print a read link valid for 300 seconds for a private media object by its asset:<app_id>/<path> ref; for an app admin or a user the app owner granted access to; never stored",
|
|
141
|
+
"arguments": [
|
|
142
|
+
{
|
|
143
|
+
"name": "ref",
|
|
144
|
+
"required": true,
|
|
145
|
+
"variadic": false,
|
|
146
|
+
"description": "The private object reference, as `media-upload --private` / `media-list --private` print it (asset:<app_id>/<path>)"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"options": [
|
|
150
|
+
{
|
|
151
|
+
"flags": "--json",
|
|
152
|
+
"description": "Print the server's { ref, url, expires_at } object unchanged (for scripting)",
|
|
153
|
+
"required": false
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"runbookAnchor": null
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"verbPath": "app media-list",
|
|
160
|
+
"description": "List an app's uploaded media (path, size, content type, updated, public_url, or ref with --private) and its storage total against the quota",
|
|
161
|
+
"arguments": [],
|
|
162
|
+
"options": [
|
|
163
|
+
{
|
|
164
|
+
"flags": "-a, --app <id>",
|
|
165
|
+
"description": "App ID (community is resolved server-side from Products)",
|
|
166
|
+
"required": true
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"flags": "--prefix <relPath>",
|
|
170
|
+
"description": "Only objects under this sub-path of the app assets/ prefix (e.g. \"shows/myshow\")",
|
|
171
|
+
"required": false
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"flags": "--private",
|
|
175
|
+
"description": "Use the app's PRIVATE media space instead of the public one (visibility is always sent to the server explicitly)",
|
|
176
|
+
"required": false
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"flags": "--json",
|
|
180
|
+
"description": "Print the server's listing object unchanged (for scripting)",
|
|
181
|
+
"required": false
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"runbookAnchor": null
|
|
185
|
+
},
|
|
121
186
|
{
|
|
122
187
|
"verbPath": "app media-upload",
|
|
123
|
-
"description": "Upload media/asset files to an app's GCS assets prefix (200 MB per app today; app owners, community admins and platform admins may upload — returns
|
|
188
|
+
"description": "Upload media/asset files to an app's GCS assets prefix (200 MB per app today across both spaces; app owners, community admins and platform admins may upload — returns public_url, or ref with --private)",
|
|
124
189
|
"arguments": [],
|
|
125
190
|
"options": [
|
|
126
191
|
{
|
|
@@ -138,6 +203,11 @@
|
|
|
138
203
|
"description": "Optional sub-path under the app assets/ prefix (e.g. \"shows/myshow\")",
|
|
139
204
|
"required": false
|
|
140
205
|
},
|
|
206
|
+
{
|
|
207
|
+
"flags": "--private",
|
|
208
|
+
"description": "Use the app's PRIVATE media space instead of the public one (visibility is always sent to the server explicitly)",
|
|
209
|
+
"required": false
|
|
210
|
+
},
|
|
141
211
|
{
|
|
142
212
|
"flags": "--json",
|
|
143
213
|
"description": "Print the asset references as JSON (for scripting)",
|
|
@@ -778,7 +848,7 @@
|
|
|
778
848
|
"name": "old_community_id",
|
|
779
849
|
"required": true,
|
|
780
850
|
"variadic": false,
|
|
781
|
-
"description": "Current community_id (e.g.
|
|
851
|
+
"description": "Current community_id (e.g. my-community)"
|
|
782
852
|
},
|
|
783
853
|
{
|
|
784
854
|
"name": "new_community_id",
|
|
@@ -1713,18 +1783,23 @@
|
|
|
1713
1783
|
},
|
|
1714
1784
|
{
|
|
1715
1785
|
"verbPath": "referral create",
|
|
1716
|
-
"description": "
|
|
1786
|
+
"description": "Get your share link to a page: <page>?ref=<code> (the same link each time you ask)",
|
|
1717
1787
|
"arguments": [],
|
|
1718
1788
|
"options": [
|
|
1719
1789
|
{
|
|
1720
|
-
"flags": "
|
|
1721
|
-
"description": "
|
|
1790
|
+
"flags": "--url <page>",
|
|
1791
|
+
"description": "The page to share: an https URL on the platform domain (the query is dropped)",
|
|
1722
1792
|
"required": true
|
|
1723
1793
|
},
|
|
1724
1794
|
{
|
|
1725
|
-
"flags": "
|
|
1726
|
-
"description": "
|
|
1727
|
-
"required":
|
|
1795
|
+
"flags": "--channel <channel>",
|
|
1796
|
+
"description": "How the link travels, e.g. web_share or email (the server names the accepted values)",
|
|
1797
|
+
"required": true
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
"flags": "-c, --community <id>",
|
|
1801
|
+
"description": "The community the referral credits",
|
|
1802
|
+
"required": true
|
|
1728
1803
|
}
|
|
1729
1804
|
],
|
|
1730
1805
|
"runbookAnchor": null
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @descix/platform-api/mcp-tools — the CLI VERB LIST
|
|
2
|
+
* @descix/platform-api/mcp-tools — the CLI VERB LIST.
|
|
3
3
|
*
|
|
4
4
|
* cli-verbs.generated.json is GENERATED from the live commander tree of
|
|
5
5
|
* @descix/cli bin/descix.js by `npm run generate:cli-verbs` in descix-cli — never hand-edit it.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* runbookAnchor is the app-developer runbook heading anchor ('#_5-run-it-locally-descix-serve')
|
|
10
10
|
* declared beside the verb's definition, or null when the runbook has no section for it.
|
|
11
11
|
* descix-cli/tests/cli-verbs-generated.test.js fails when this file is stale or an anchor names
|
|
12
|
-
* no runbook heading. Consumer:
|
|
12
|
+
* no runbook heading. Consumer: Cloud tell_me_how (the cli_verbs section).
|
|
13
13
|
*
|
|
14
14
|
* RUNBOOK_URL is the ONE spelling of the published app-developer runbook page; a runbookAnchor is a
|
|
15
15
|
* fragment of it (RUNBOOK_URL + runbookAnchor is the section link). descix-cli/tests/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @descix/platform-api/mcp-tools — THE Evidence Contract (canonical owner module).
|
|
3
3
|
*
|
|
4
|
-
* v2
|
|
4
|
+
* v2:
|
|
5
5
|
* the contract is now FRAME + PER-APP SETTLEMENT PROFILES. The platform-level FRAME is
|
|
6
6
|
* universal (claims settled by evidence not authority/memory; no-priors rule; citation
|
|
7
7
|
* discipline scoped to an app's OWN evidence domain). HOW a claim is settled is per
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* ── OWNER-LOCATION JUSTIFICATION (unchanged from v1) ────────────────────────────
|
|
32
32
|
* The MCP surface is the primary consumer and hits this before any repo exists;
|
|
33
33
|
* handshake.js lives in this same dependency-free leaf and consumes SCIENCE_DEX_STORY by
|
|
34
|
-
* IMPORT (zero drift). Downstream repos (great-debate-kit,
|
|
34
|
+
* IMPORT (zero drift). Downstream repos (great-debate-kit, the private research repo, public EGPT
|
|
35
35
|
* seed) are CONSUMERS: they vendor the rendered markdown between sentinels and
|
|
36
36
|
* scripts/verify-evidence-contract.mjs byte-checks it. Dependency-free leaf — imports
|
|
37
37
|
* nothing. Do NOT hand-mirror the text elsewhere; import EVIDENCE_CONTRACT_FRAME /
|
|
@@ -85,14 +85,14 @@ export const EVIDENCE_CONTRACT_FRAME = Object.freeze({
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* The ONE owner of the EGPT public seed repo URL (GitHub transfer 2026-10-09:
|
|
88
|
-
*
|
|
88
|
+
* the old private location moved to DeSciX/egpt-lean, old URLs 301). Every repo field below consumes it.
|
|
89
89
|
*/
|
|
90
90
|
const EGPT_SEED_REPO = 'https://github.com/DeSciX/egpt-lean';
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* PER-APP SETTLEMENT PROFILES, keyed by app_id/community_id. EGPT (the formal-mathematics
|
|
94
94
|
* community) is the first instance — it settles on the Lean 4 kernel. Every field is
|
|
95
|
-
* grounded in
|
|
95
|
+
* grounded in the private research repo (cited inline).
|
|
96
96
|
*/
|
|
97
97
|
export const SETTLEMENT_PROFILES = Object.freeze({
|
|
98
98
|
egpt: Object.freeze({
|
|
@@ -102,7 +102,7 @@ export const SETTLEMENT_PROFILES = Object.freeze({
|
|
|
102
102
|
'The Lean 4 kernel typechecking the proof chains sorry-free, plus an axiom-closure audit on the capstone theorems.',
|
|
103
103
|
// The PUBLIC contributable seed users clone (the Lean/EGPT tree; measured 2026-10-09
|
|
104
104
|
// post-transfer: the EGPTMath tree is NOT in this repo — see egpt_tests below).
|
|
105
|
-
// The private research remote
|
|
105
|
+
// The private research remote is intentionally NOT surfaced here.
|
|
106
106
|
repo: EGPT_SEED_REPO,
|
|
107
107
|
burden_of_proof: Object.freeze({
|
|
108
108
|
// R3 (voice round 2): LEAD with the verifiability invitation — you can check this
|
|
@@ -124,7 +124,7 @@ export const SETTLEMENT_PROFILES = Object.freeze({
|
|
|
124
124
|
maxim: "When intuition conflicts with the proof chain, update the intuition, not the proof.",
|
|
125
125
|
}),
|
|
126
126
|
// Enumerated inline (test2 friction #3): the three P=NP capstones the axiom rule
|
|
127
|
-
// turns on. Source:
|
|
127
|
+
// turns on. Source: the private research repo, Lean/PROOF_CHAINS.md:8,125-127,214-216; axiom
|
|
128
128
|
// closure {propext, Quot.sound} at Lean/EGPT_PROOFS_VALIDATION.md:197,230,245.
|
|
129
129
|
capstone_theorems: Object.freeze([
|
|
130
130
|
Object.freeze({ name: 'InformationTheory.P_eq_NP', file: 'Lean/EGPT/InformationTheory/Complexity/SetRFL.lean' }),
|
|
@@ -163,7 +163,7 @@ export const SETTLEMENT_PROFILES = Object.freeze({
|
|
|
163
163
|
// egpt-dse — the FRQTL double-slit experiment (DSE), a DISCRETE-PHYSICS render-settlement
|
|
164
164
|
// profile: the second published settlement lane and the first NPM-settled, repo-less domain.
|
|
165
165
|
// A user does NOT clone anything — the check runs from the published registry in ~1 min.
|
|
166
|
-
// Ratified facts
|
|
166
|
+
// Ratified facts: package
|
|
167
167
|
// @descix/frqtl-sdk@0.1.2, the golden parameter tuple, and the exact-bin-match χ² criterion.
|
|
168
168
|
// This is the schema's anticipated non-Lean profile: settles_on names an objective numeric
|
|
169
169
|
// criterion; verification_commands run a benchmark whose expected_when_green is that number.
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @descix/platform-api/mcp-tools — external-consumer handshake + bootstrap SSOT
|
|
3
|
-
* (WS-MVP-FIRSTCONTACT F1/F3, CEO-D-2026-07-06-MVP-FIRSTCONTACT-INSERTION).
|
|
4
3
|
*
|
|
5
4
|
* THE single source for the operating manual an EXTERNAL MCP consumer receives at
|
|
6
5
|
* `initialize` (F1) and for the deterministic platform summary `tell_me_how
|
|
7
6
|
* scope:"bootstrap"` returns (F3). Dependency-free leaf (same contract as
|
|
8
7
|
* nativeTools.js) so BOTH transports consume it without re-authoring the text:
|
|
9
|
-
* -
|
|
8
|
+
* - Cloud apiFront.js `initialize` (HTTP /mcp — Claude.ai connector)
|
|
10
9
|
* - descix-cli/bin/mcp-server.js (stdio transport)
|
|
11
10
|
*
|
|
12
11
|
* Content contract: aligned with `unk-cos/MustKnow` (platform-must-know-briefer).
|
|
13
12
|
* Three-audience rule: this text is for the EXTERNAL consumer — no org/agent internals,
|
|
14
13
|
* no platform plumbing beyond what the consumer must operate.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
15
|
+
* the science-DEX one-liner is consumed from
|
|
17
16
|
* evidence-contract.js SCIENCE_DEX_STORY (one owner, no hand-mirror). The Evidence
|
|
18
17
|
* Contract PAYLOAD itself rides on the bootstrap response (tellMeHowBootstrap serves the
|
|
19
18
|
* frame + caller-relevant settlement profiles via getEvidenceContract) and is addressable
|
package/src/mcp-tools/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @descix/platform-api/mcp-tools — shared MCP tool-definition SSOT
|
|
2
|
+
* @descix/platform-api/mcp-tools — shared MCP tool-definition SSOT.
|
|
3
3
|
* Dependency-free leaf so the CLI stdio server can import it without GCP infra.
|
|
4
4
|
*/
|
|
5
5
|
export {
|
|
6
6
|
NATIVE_MCP_TOOLS,
|
|
7
7
|
// The (model, thinking) precedence chain, in words. ONE owner for the sentence: the served
|
|
8
|
-
// tool docstrings interpolate it and
|
|
8
|
+
// tool docstrings interpolate it and Cloud's get_model_config serves it back as its
|
|
9
9
|
// `chain` field instead of keeping a second hand-typed copy that drifts.
|
|
10
10
|
MODEL_THINKING_CHAIN,
|
|
11
11
|
toMcpToolList,
|
|
@@ -43,10 +43,10 @@ export {
|
|
|
43
43
|
PLATFORM_BASICS_SUMMARY,
|
|
44
44
|
PLATFORM_BASICS_DOC,
|
|
45
45
|
} from './platform-basics.js';
|
|
46
|
-
//
|
|
46
|
+
// The CLI verb list, GENERATED from the live commander tree
|
|
47
47
|
// of @descix/cli (descix-cli: npm run generate:cli-verbs). Cloud tell_me_how consumes it.
|
|
48
48
|
export { CLI_VERBS, RUNBOOK_URL } from './cli-verbs.js';
|
|
49
|
-
//
|
|
49
|
+
// THE canonical media-on-a-chat-turn contract: kinds, MIME
|
|
50
50
|
// vocabulary, byte policy, normalize(partial)->bag, and the ONE provider-block encoder. Both
|
|
51
51
|
// the Cloud chat pipeline and the advertised nativeTools schema consume this; nobody
|
|
52
52
|
// re-enumerates a MIME list or re-derives a cap.
|
|
@@ -69,7 +69,7 @@ export {
|
|
|
69
69
|
buildProviderInput,
|
|
70
70
|
mediaParamSchema,
|
|
71
71
|
} from './chatMedia.js';
|
|
72
|
-
//
|
|
72
|
+
// strict fail-loud param validation.
|
|
73
73
|
// The schema stopped being advertising-only: unknown/missing params are rejected AT the MCP
|
|
74
74
|
// boundary, naming the offender and suggesting the canonical key. One owner; the Cloud MCP
|
|
75
75
|
// router, the execute_remote_command gateway and the CLI stdio server all consume this.
|
|
@@ -92,7 +92,7 @@ export {
|
|
|
92
92
|
validateToolParams,
|
|
93
93
|
toolAcceptsParam,
|
|
94
94
|
} from './paramValidation.js';
|
|
95
|
-
//
|
|
95
|
+
// canonical Evidence Contract: FRAME +
|
|
96
96
|
// per-app SETTLEMENT PROFILES, addressability (getEvidenceContract), the compaction-proof
|
|
97
97
|
// echo, the agent-led install block, and the vendored-copy render/sentinels. One owner;
|
|
98
98
|
// the MCP surface consumes by import.
|
|
@@ -109,7 +109,7 @@ export {
|
|
|
109
109
|
EVIDENCE_CONTRACT_END,
|
|
110
110
|
renderEvidenceContractMarkdown,
|
|
111
111
|
} from './evidence-contract.js';
|
|
112
|
-
//
|
|
112
|
+
// D4 "Set up DeSciX" setup-playbook:
|
|
113
113
|
// the structured onboarding return contract + the setup-intent detector consumed as an
|
|
114
114
|
// additive tell_me_how route. Dependency-free leaf; project_instructions is the single-source
|
|
115
115
|
// D3-AI stance text.
|