@sentropic/artifacts 0.2.12 → 0.2.14
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 +93 -0
- package/README.md +45 -10
- package/dist/adapters/local-blob.d.ts +3 -0
- package/dist/adapters/local-blob.js +93 -0
- package/dist/adapters/postgres-management.js +3 -2
- package/dist/adapters/postgres-reader-consent.d.ts +11 -0
- package/dist/adapters/postgres-reader-consent.js +109 -0
- package/dist/adapters/postgres-uploads.d.ts +14 -0
- package/dist/adapters/postgres-uploads.js +174 -0
- package/dist/adapters/postgres.js +4 -3
- package/dist/adapters/s3-uploads.d.ts +33 -0
- package/dist/adapters/s3-uploads.js +105 -0
- package/dist/adapters/s3.js +23 -0
- package/dist/adapters/sqlite-activation.d.ts +20 -0
- package/dist/adapters/sqlite-activation.js +205 -0
- package/dist/adapters/sqlite-commit.d.ts +15 -0
- package/dist/adapters/sqlite-commit.js +89 -0
- package/dist/adapters/sqlite-management.d.ts +10 -0
- package/dist/adapters/sqlite-management.js +60 -0
- package/dist/adapters/sqlite-sql.d.ts +32 -0
- package/dist/adapters/sqlite-sql.js +36 -0
- package/dist/adapters/sqlite-store.d.ts +12 -0
- package/dist/adapters/sqlite-store.js +410 -0
- package/dist/adapters/sqlite.d.ts +33 -0
- package/dist/adapters/sqlite.js +95 -0
- package/dist/content/handler.d.ts +5 -0
- package/dist/content/handler.js +80 -9
- package/dist/content/headers.js +12 -0
- package/dist/http.d.ts +32 -2
- package/dist/http.js +615 -13
- package/dist/mcp-core.d.ts +3 -3
- package/dist/mcp-core.js +90 -4
- package/dist/profile/contracts.d.ts +1 -1
- package/dist/profile/contracts.js +7 -0
- package/dist/profile/index.js +43 -2
- package/dist/profile/radar.js +7 -0
- package/dist/profile/schemas.js +119 -0
- package/dist/profile/validation.d.ts +11 -0
- package/dist/profile/validation.js +98 -6
- package/dist/server/access.d.ts +2 -0
- package/dist/server/command-identity.d.ts +1 -1
- package/dist/server/command-identity.js +6 -3
- package/dist/server/consent.d.ts +65 -0
- package/dist/server/consent.js +42 -0
- package/dist/server/gc.d.ts +42 -0
- package/dist/server/gc.js +98 -0
- package/dist/server/management.d.ts +3 -1
- package/dist/server/management.js +48 -7
- package/dist/server/metrics.d.ts +21 -0
- package/dist/server/metrics.js +6 -0
- package/dist/server/mime.d.ts +26 -2
- package/dist/server/mime.js +124 -2
- package/dist/server/ports.d.ts +29 -0
- package/dist/server/ports.js +11 -0
- package/dist/server/publication-limits.d.ts +20 -0
- package/dist/server/publication-limits.js +27 -1
- package/dist/server/publication.d.ts +14 -0
- package/dist/server/publication.js +10 -2
- package/dist/server/reader-store.d.ts +58 -0
- package/dist/server/reader-store.js +109 -0
- package/dist/server/source-read.d.ts +12 -9
- package/dist/server/source-read.js +17 -5
- package/dist/server/templates.js +50 -2
- package/dist/server/upload-page.d.ts +157 -0
- package/dist/server/upload-page.js +438 -0
- package/dist/server/uploads.d.ts +229 -19
- package/dist/server/uploads.js +387 -80
- package/migrations/0007_uploads.sql +43 -0
- package/migrations/0008_reader_consent.sql +48 -0
- package/migrations/0009_upload_pages.sql +25 -0
- package/package.json +34 -1
- package/sql/reader-consent.sql +47 -0
- package/sql/sqlite/0001_artifacts.sql +156 -0
- package/sql/sqlite/0002_activation.sql +73 -0
package/dist/mcp-core.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export { createRadarKeyDerivation } from './server/command-identity.js';
|
|
|
10
10
|
export type { ArtifactKeyDerivationBinding } from './server/command-identity.js';
|
|
11
11
|
export declare const ARTIFACTS_PROVIDER_ID = "sentropic.artifacts";
|
|
12
12
|
export declare const ARTIFACTS_APP_ID = "sentropic-artifacts";
|
|
13
|
-
export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.
|
|
14
|
-
export declare const ARTIFACTS_TOOL_NAMES: readonly ["artifacts_get_template", "artifacts_get_api_guide", "artifacts_ensure", "artifacts_publish", "artifacts_create_upload", "artifacts_commit_upload", "artifacts_list", "artifacts_get", "artifacts_get_source", "artifacts_fork", "artifacts_set_access", "artifacts_promote", "artifacts_renew", "artifacts_delete", "artifacts_restore", "artifacts_list_versions", "artifacts_revert"];
|
|
13
|
+
export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.14";
|
|
14
|
+
export declare const ARTIFACTS_TOOL_NAMES: readonly ["artifacts_get_template", "artifacts_get_api_guide", "artifacts_ensure", "artifacts_publish", "artifacts_create_upload", "artifacts_commit_upload", "artifacts_list", "artifacts_get", "artifacts_get_source", "artifacts_fork", "artifacts_set_access", "artifacts_promote", "artifacts_renew", "artifacts_delete", "artifacts_restore", "artifacts_list_versions", "artifacts_revert", "artifacts_lookup_people", "artifacts_list_access", "artifacts_publish_bundle", "artifacts_revoke_reader_consent", "artifacts_create_upload_page", "artifacts_list_assets", "artifacts_publish_bundle_v2"];
|
|
15
15
|
export type ArtifactsToolName = (typeof ARTIFACTS_TOOL_NAMES)[number];
|
|
16
16
|
export interface ArtifactsToolDefinition {
|
|
17
17
|
readonly description: string;
|
|
@@ -24,7 +24,7 @@ export interface ArtifactsToolDefinition {
|
|
|
24
24
|
/** Static wire definitions for every artifacts tool; identical across deployments and profiles. */
|
|
25
25
|
export declare const ARTIFACTS_TOOL_DEFINITIONS: Readonly<Record<ArtifactsToolName, ArtifactsToolDefinition>>;
|
|
26
26
|
export declare const ARTIFACTS_TOOL_SPECS: {
|
|
27
|
-
name: "artifacts_ensure" | "artifacts_publish" | "
|
|
27
|
+
name: "artifacts_get_template" | "artifacts_get_api_guide" | "artifacts_ensure" | "artifacts_publish" | "artifacts_create_upload" | "artifacts_commit_upload" | "artifacts_list" | "artifacts_get" | "artifacts_get_source" | "artifacts_fork" | "artifacts_set_access" | "artifacts_promote" | "artifacts_renew" | "artifacts_delete" | "artifacts_restore" | "artifacts_list_versions" | "artifacts_revert" | "artifacts_lookup_people" | "artifacts_list_access" | "artifacts_publish_bundle" | "artifacts_revoke_reader_consent" | "artifacts_create_upload_page" | "artifacts_list_assets" | "artifacts_publish_bundle_v2";
|
|
28
28
|
description: string;
|
|
29
29
|
mutability: import("@sentropic/mcp-platform").Mutability;
|
|
30
30
|
}[];
|
package/dist/mcp-core.js
CHANGED
|
@@ -6,7 +6,7 @@ export * from './profile/index.js';
|
|
|
6
6
|
export { createRadarKeyDerivation } from './server/command-identity.js';
|
|
7
7
|
export const ARTIFACTS_PROVIDER_ID = 'sentropic.artifacts';
|
|
8
8
|
export const ARTIFACTS_APP_ID = 'sentropic-artifacts';
|
|
9
|
-
export const ARTIFACTS_PROVIDER_VERSION = '0.2.
|
|
9
|
+
export const ARTIFACTS_PROVIDER_VERSION = '0.2.14';
|
|
10
10
|
export const ARTIFACTS_TOOL_NAMES = ARTIFACT_CAPABILITY_NAMES;
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
// Byte-stable tool definitions (MCP tool-definition stability rule).
|
|
@@ -46,16 +46,20 @@ const edit = obj({ path, oldStr: str, newStr: { type: 'string' } }, ['path', 'ol
|
|
|
46
46
|
const idOnly = obj({ artifactId: id }, ['artifactId']);
|
|
47
47
|
const ARTIFACTS_OUTPUT_SCHEMA = { type: 'object', additionalProperties: true };
|
|
48
48
|
const READ_ONLY_TOOLS = ['artifacts_list', 'artifacts_get',
|
|
49
|
-
'artifacts_get_template', 'artifacts_get_api_guide', 'artifacts_get_source', 'artifacts_list_versions'
|
|
49
|
+
'artifacts_get_template', 'artifacts_get_api_guide', 'artifacts_get_source', 'artifacts_list_versions',
|
|
50
|
+
'artifacts_lookup_people', 'artifacts_list_access', 'artifacts_list_assets'];
|
|
50
51
|
const IDEMPOTENT_WRITERS = ['artifacts_ensure', 'artifacts_publish',
|
|
51
|
-
'artifacts_commit_upload', '
|
|
52
|
+
'artifacts_commit_upload', 'artifacts_publish_bundle', 'artifacts_publish_bundle_v2',
|
|
53
|
+
'artifacts_set_access', 'artifacts_delete', 'artifacts_revert',
|
|
54
|
+
'artifacts_revoke_reader_consent'];
|
|
52
55
|
function staticTool(name, inputSchema, description) {
|
|
53
56
|
return {
|
|
54
57
|
description: description ?? `Artifacts ${name.slice('artifacts_'.length).replaceAll('_', ' ')}.`,
|
|
55
58
|
inputSchema,
|
|
56
59
|
outputSchema: ARTIFACTS_OUTPUT_SCHEMA,
|
|
57
60
|
mutability: READ_ONLY_TOOLS.includes(name) ? 'read-only'
|
|
58
|
-
: name === 'artifacts_publish'
|
|
61
|
+
: name === 'artifacts_publish' || name === 'artifacts_publish_bundle' ||
|
|
62
|
+
name === 'artifacts_publish_bundle_v2' ? 'append' : 'state-transition',
|
|
59
63
|
idempotency: IDEMPOTENT_WRITERS.includes(name) ? { required: true, scope: 'principal' } : { required: false },
|
|
60
64
|
gates: { requiresElicitation: false, requiresHumanConfirmation: name === 'artifacts_delete',
|
|
61
65
|
requiresPrincipalGate: false },
|
|
@@ -82,6 +86,9 @@ export const ARTIFACTS_TOOL_DEFINITIONS = {
|
|
|
82
86
|
artifacts_list: staticTool('artifacts_list', obj({ limit: integer(1), offset: integer(0) })),
|
|
83
87
|
artifacts_get: staticTool('artifacts_get', idOnly),
|
|
84
88
|
artifacts_get_source: staticTool('artifacts_get_source', obj({ artifactId: id, releaseId: id,
|
|
89
|
+
// Frozen ceiling (review finding 5): maxItems 32 is part of this frozen
|
|
90
|
+
// definition and must NOT change. Server-side caps only move BELOW the
|
|
91
|
+
// frozen schema; larger listings belong to the new listing tools.
|
|
85
92
|
paths: { type: 'array', minItems: 1, maxItems: 32, items: str } }, ['artifactId']), 'Artifacts get source: verified files of the current or a selected release as `text` (encoding "utf8") '
|
|
86
93
|
+ 'or `base64` (encoding "base64"), never an integer array, plus a guideRef instead of the guide body.'),
|
|
87
94
|
artifacts_fork: staticTool('artifacts_fork', idOnly),
|
|
@@ -100,6 +107,58 @@ export const ARTIFACTS_TOOL_DEFINITIONS = {
|
|
|
100
107
|
limit: integer(1, 100), cursor: { ...str, maxLength: 4096 } }, ['artifactId'])),
|
|
101
108
|
artifacts_revert: staticTool('artifacts_revert', obj({ artifactId: id, releaseId: id, targetReleaseId: id,
|
|
102
109
|
expectedCurrentReleaseId, idempotencyKey }, ['artifactId', 'idempotencyKey'])),
|
|
110
|
+
artifacts_lookup_people: staticTool('artifacts_lookup_people', obj({ query: str, limit: integer(1) }, ['query']), 'Artifacts lookup people: search the host directory by name or email and return opaque userRefs with '
|
|
111
|
+
+ 'masked email hints (approved callers only; homonyms are returned, never silently resolved). '
|
|
112
|
+
+ 'Use the returned userRef as principalId of artifacts_set_access.'),
|
|
113
|
+
artifacts_list_access: staticTool('artifacts_list_access', idOnly, 'Artifacts list access: sharing mode, owner and grant list of one artifact, projected to userRefs. '
|
|
114
|
+
+ 'The owner and platform admins see every entry; a simple reader sees the mode and its own entry only.'),
|
|
115
|
+
// Files parity LOT 1 — appended last; frozen at birth like every definition above.
|
|
116
|
+
artifacts_publish_bundle: staticTool('artifacts_publish_bundle', { ...obj({
|
|
117
|
+
artifactId: id, idempotencyKey,
|
|
118
|
+
files: { type: 'array', items: file, minItems: 1,
|
|
119
|
+
description: 'Inline files (bytes travel through the model, inline budget); at least one of files/assets is required.' },
|
|
120
|
+
assets: { type: 'array', minItems: 1,
|
|
121
|
+
items: { oneOf: [
|
|
122
|
+
obj({ path, uploadId: id }, ['path', 'uploadId']),
|
|
123
|
+
obj({ path, digest: { type: 'string', pattern: '^sha256:[0-9a-f]{64}$' }, size: integer(1), mimeType: str }, ['path', 'digest', 'size', 'mimeType']),
|
|
124
|
+
] },
|
|
125
|
+
description: 'Assets whose bytes already left the model: an uploadId staged via artifacts_create_upload/artifacts_commit_upload, or a sha256 digest of an already-pinned blob in the same scope. The release budget applies to the union of files and assets; duplicate paths are refused.' },
|
|
126
|
+
expectedCurrentReleaseId, profile: primitiveRecord, ...metadata
|
|
127
|
+
}, ['artifactId', 'idempotencyKey', 'expectedCurrentReleaseId']),
|
|
128
|
+
anyOf: [{ required: ['files'] }, { required: ['assets'] }] }, 'Artifacts publish bundle: one atomic release combining inline files with assets whose bytes already left the model '
|
|
129
|
+
+ '(an uploadId staged via artifacts_create_upload + signed PUT + artifacts_commit_upload, or a sha256:<hex> digest '
|
|
130
|
+
+ 'of an already-pinned blob). expectedCurrentReleaseId is always required (CAS); null requires an unpublished artifact.'),
|
|
131
|
+
artifacts_revoke_reader_consent: staticTool('artifacts_revoke_reader_consent', obj({ artifactId: id,
|
|
132
|
+
scope: { type: 'string', minLength: 1, maxLength: 128 }, idempotencyKey }, ['artifactId', 'idempotencyKey']), 'Artifacts revoke reader consent: withdraw persistent consent of the caller for one scope of one artifact, '
|
|
133
|
+
+ 'or for every scope when scope is omitted. Self-revocation only; the next call asks again.'),
|
|
134
|
+
// Files parity LOT 2 — appended last; frozen at birth like every definition above.
|
|
135
|
+
artifacts_create_upload_page: staticTool('artifacts_create_upload_page', obj({ artifactId: id,
|
|
136
|
+
maxFiles: integer(1, 255) }, ['artifactId']), 'Artifacts create upload page: mint a short-lived browser upload page for one artifact. '
|
|
137
|
+
+ 'The user provides files from their own disk; bytes travel browser to S3 directly and never cross the model. '
|
|
138
|
+
+ 'List staged files with artifacts_list_assets, then publish with artifacts_publish_bundle.'),
|
|
139
|
+
artifacts_list_assets: staticTool('artifacts_list_assets', obj({ artifactId: id, releaseId: id,
|
|
140
|
+
state: { type: 'string', enum: ['staged', 'released', 'all'] }, pageSessionId: id,
|
|
141
|
+
limit: integer(1, 255), cursor: { ...str, maxLength: 4096 } }, ['artifactId']), 'Artifacts list assets: released assets from a manifest, staged assets from committed uploads, '
|
|
142
|
+
+ 'optionally filtered by browser upload page. Released listing needs the source read right; '
|
|
143
|
+
+ 'staged listing is owner-only.'),
|
|
144
|
+
artifacts_publish_bundle_v2: staticTool('artifacts_publish_bundle_v2', { ...obj({
|
|
145
|
+
artifactId: id, idempotencyKey,
|
|
146
|
+
files: { type: 'array', items: file, minItems: 1,
|
|
147
|
+
description: 'Inline files (bytes travel through the model, inline budget); at least one of files/assets is required.' },
|
|
148
|
+
assets: { type: 'array', minItems: 1,
|
|
149
|
+
items: { oneOf: [
|
|
150
|
+
obj({ path, uploadId: id }, ['path', 'uploadId']),
|
|
151
|
+
obj({ path, digest: { type: 'string', pattern: '^sha256:[0-9a-f]{64}$' }, size: integer(1), mimeType: str }, ['path', 'digest', 'size', 'mimeType']),
|
|
152
|
+
obj({ path, sourceArtifactId: id, sourcePath: path, sourceReleaseId: id }, ['path', 'sourceArtifactId']),
|
|
153
|
+
obj({ path, carryFromReleaseId: id, sourcePath: path }, ['path', 'carryFromReleaseId']),
|
|
154
|
+
] },
|
|
155
|
+
description: 'Assets whose bytes already left the model: a staged uploadId, a CAS digest, a copy from the same scope, or a carry from a release of this artifact. Set keepUnmodifiedPaths to carry every other path of the expected release.' },
|
|
156
|
+
keepUnmodifiedPaths: { type: 'boolean' },
|
|
157
|
+
expectedCurrentReleaseId, profile: primitiveRecord, ...metadata
|
|
158
|
+
}, ['artifactId', 'idempotencyKey', 'expectedCurrentReleaseId']),
|
|
159
|
+
anyOf: [{ required: ['files'] }, { required: ['assets'] }] }, 'Artifacts publish bundle v2: like artifacts_publish_bundle, plus copies from other artifacts of the same scope '
|
|
160
|
+
+ 'and carries from releases of this artifact, with optional keep-unmodified carry. expectedCurrentReleaseId '
|
|
161
|
+
+ 'is always required (CAS); null requires an unpublished artifact.'),
|
|
103
162
|
};
|
|
104
163
|
export const ARTIFACTS_TOOL_SPECS = ARTIFACTS_TOOL_NAMES.map((name) => ({ name,
|
|
105
164
|
description: ARTIFACTS_TOOL_DEFINITIONS[name].description,
|
|
@@ -155,6 +214,24 @@ export function createArtifactsToolExecutor(deps) {
|
|
|
155
214
|
case 'artifacts_publish':
|
|
156
215
|
request = { method: 'POST', path: '/publish', body: args };
|
|
157
216
|
break;
|
|
217
|
+
case 'artifacts_publish_bundle':
|
|
218
|
+
request = { method: 'POST', path: '/publish_bundle', body: args };
|
|
219
|
+
break;
|
|
220
|
+
case 'artifacts_publish_bundle_v2':
|
|
221
|
+
request = { method: 'POST', path: '/publish_bundle_v2', body: args };
|
|
222
|
+
break;
|
|
223
|
+
case 'artifacts_list_assets':
|
|
224
|
+
request = { method: 'POST', path: '/list_assets', body: args };
|
|
225
|
+
break;
|
|
226
|
+
case 'artifacts_create_upload_page':
|
|
227
|
+
request = { method: 'POST', path: '/uploads/page', body: args };
|
|
228
|
+
break;
|
|
229
|
+
case 'artifacts_create_upload':
|
|
230
|
+
request = { method: 'POST', path: '/uploads/create', body: args };
|
|
231
|
+
break;
|
|
232
|
+
case 'artifacts_commit_upload':
|
|
233
|
+
request = { method: 'POST', path: '/uploads/commit', body: args };
|
|
234
|
+
break;
|
|
158
235
|
case 'artifacts_list':
|
|
159
236
|
request = { method: 'POST', path: '/list', body: args };
|
|
160
237
|
break;
|
|
@@ -167,6 +244,12 @@ export function createArtifactsToolExecutor(deps) {
|
|
|
167
244
|
case 'artifacts_set_access':
|
|
168
245
|
request = { method: 'POST', path: '/set_access', body: args };
|
|
169
246
|
break;
|
|
247
|
+
case 'artifacts_lookup_people':
|
|
248
|
+
request = { method: 'POST', path: '/lookup_people', body: args };
|
|
249
|
+
break;
|
|
250
|
+
case 'artifacts_list_access':
|
|
251
|
+
request = { method: 'POST', path: '/list_access', body: args };
|
|
252
|
+
break;
|
|
170
253
|
case 'artifacts_delete':
|
|
171
254
|
request = { method: 'POST', path: '/delete', body: args };
|
|
172
255
|
break;
|
|
@@ -176,6 +259,9 @@ export function createArtifactsToolExecutor(deps) {
|
|
|
176
259
|
case 'artifacts_revert':
|
|
177
260
|
request = { method: 'POST', path: '/revert', body: args };
|
|
178
261
|
break;
|
|
262
|
+
case 'artifacts_revoke_reader_consent':
|
|
263
|
+
request = { method: 'POST', path: '/revoke_reader_consent', body: args };
|
|
264
|
+
break;
|
|
179
265
|
default: throw new ArtifactProfileInputError(true);
|
|
180
266
|
}
|
|
181
267
|
return await deps.app.execute({ ...request, actorId: input.invocation.actorId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JsonValue } from '../contracts.js';
|
|
2
2
|
import type { EffectiveArtifactCommand } from '../server/command-identity.js';
|
|
3
3
|
export declare const PROFILE_CONTRACT_VERSION: "artifacts-profile/v1";
|
|
4
|
-
export declare const ARTIFACT_CAPABILITY_NAMES: readonly ["artifacts_get_template", "artifacts_get_api_guide", "artifacts_ensure", "artifacts_publish", "artifacts_create_upload", "artifacts_commit_upload", "artifacts_list", "artifacts_get", "artifacts_get_source", "artifacts_fork", "artifacts_set_access", "artifacts_promote", "artifacts_renew", "artifacts_delete", "artifacts_restore", "artifacts_list_versions", "artifacts_revert"];
|
|
4
|
+
export declare const ARTIFACT_CAPABILITY_NAMES: readonly ["artifacts_get_template", "artifacts_get_api_guide", "artifacts_ensure", "artifacts_publish", "artifacts_create_upload", "artifacts_commit_upload", "artifacts_list", "artifacts_get", "artifacts_get_source", "artifacts_fork", "artifacts_set_access", "artifacts_promote", "artifacts_renew", "artifacts_delete", "artifacts_restore", "artifacts_list_versions", "artifacts_revert", "artifacts_lookup_people", "artifacts_list_access", "artifacts_publish_bundle", "artifacts_revoke_reader_consent", "artifacts_create_upload_page", "artifacts_list_assets", "artifacts_publish_bundle_v2"];
|
|
5
5
|
export type ArtifactCapabilityName = (typeof ARTIFACT_CAPABILITY_NAMES)[number];
|
|
6
6
|
export type ArtifactSchema = Readonly<Record<string, unknown>>;
|
|
7
7
|
export interface OperationProfile {
|
|
@@ -5,6 +5,13 @@ export const ARTIFACT_CAPABILITY_NAMES = [
|
|
|
5
5
|
'artifacts_list', 'artifacts_get', 'artifacts_get_source', 'artifacts_fork',
|
|
6
6
|
'artifacts_set_access', 'artifacts_promote', 'artifacts_renew',
|
|
7
7
|
'artifacts_delete', 'artifacts_restore', 'artifacts_list_versions', 'artifacts_revert',
|
|
8
|
+
'artifacts_lookup_people', 'artifacts_list_access',
|
|
9
|
+
'artifacts_publish_bundle',
|
|
10
|
+
'artifacts_revoke_reader_consent',
|
|
11
|
+
// Files parity LOT 2 — appended last; frozen at birth like every definition above.
|
|
12
|
+
'artifacts_create_upload_page',
|
|
13
|
+
'artifacts_list_assets',
|
|
14
|
+
'artifacts_publish_bundle_v2',
|
|
8
15
|
];
|
|
9
16
|
/** Projection fields are data-only; invocation correlation is added by L6. */
|
|
10
17
|
export const PRECONDITION_REQUIRED_MESSAGE = 'expectedCurrentReleaseId is required by the active artifact profile. Re-read this artifact with artifacts_get or artifacts_list, then send expectedCurrentReleaseId using the currentReleaseId returned by that read. Send null only if the read confirms that there is no current release. Before editing an existing release, read it with artifacts_get_source and use that releaseId. The server will not infer this value.';
|
package/dist/profile/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isArtifactId } from '../contracts.js';
|
|
2
|
+
import { isWithinMimeCeiling } from '../server/mime.js';
|
|
3
|
+
import { SERVER_MAX_FILE_BYTES, SERVER_MAX_FILES_PER_RELEASE, SERVER_MAX_SOURCE_FILES, SERVER_MAX_SOURCE_INLINE_BYTES, SERVER_MAX_SOURCE_TOTAL_BYTES, SERVER_MAX_TOTAL_BYTES } from '../server/publication-limits.js';
|
|
2
4
|
import { ARTIFACT_CAPABILITY_NAMES, ArtifactProfileInputError, PROFILE_CONTRACT_VERSION } from './contracts.js';
|
|
3
5
|
import { copyJson, freezeDeep, isRecord, orderedDigest } from './json.js';
|
|
4
6
|
import { assertCompleteOperation, capabilitySchema } from './schemas.js';
|
|
@@ -38,7 +40,7 @@ export function compileArtifactsProfile(input) {
|
|
|
38
40
|
throw new Error('invalid publication precondition policy');
|
|
39
41
|
}
|
|
40
42
|
if (profile.requireExpectedCurrentReleaseId && requested.some(name => [
|
|
41
|
-
'artifacts_promote', 'artifacts_restore', '
|
|
43
|
+
'artifacts_promote', 'artifacts_restore', 'artifacts_fork',
|
|
42
44
|
].includes(name)))
|
|
43
45
|
throw new Error('strict profile contains a writer without CAS');
|
|
44
46
|
if (new Set(requested).size !== requested.length ||
|
|
@@ -62,6 +64,24 @@ export function compileArtifactsProfile(input) {
|
|
|
62
64
|
if (op.limits[minimum] > op.limits[maximum])
|
|
63
65
|
throw new Error('inconsistent profile bounds');
|
|
64
66
|
}
|
|
67
|
+
// Server maxima are hard ceilings: profile limit keys may only move BELOW
|
|
68
|
+
// them (255 files / 16 MiB per file / 64 MiB per release), never above.
|
|
69
|
+
const limitCeilings = {
|
|
70
|
+
publishFilesMax: SERVER_MAX_FILES_PER_RELEASE,
|
|
71
|
+
releaseFilesMax: SERVER_MAX_FILES_PER_RELEASE,
|
|
72
|
+
maxDecodedFileBytes: SERVER_MAX_FILE_BYTES,
|
|
73
|
+
releaseFileBytesMax: SERVER_MAX_FILE_BYTES,
|
|
74
|
+
maxDecodedTotalBytes: SERVER_MAX_TOTAL_BYTES,
|
|
75
|
+
releaseTotalBytesMax: SERVER_MAX_TOTAL_BYTES,
|
|
76
|
+
sourceFilesMax: SERVER_MAX_SOURCE_FILES,
|
|
77
|
+
sourceInlineFileBytesMax: SERVER_MAX_SOURCE_INLINE_BYTES,
|
|
78
|
+
sourceTotalBytesMax: SERVER_MAX_SOURCE_TOTAL_BYTES,
|
|
79
|
+
};
|
|
80
|
+
for (const [key, ceiling] of Object.entries(limitCeilings)) {
|
|
81
|
+
if (op.limits[key] !== undefined && op.limits[key] > ceiling) {
|
|
82
|
+
throw new Error(`profile limit above the server maximum: ${key}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
65
85
|
operations.add(op.operation);
|
|
66
86
|
}
|
|
67
87
|
const rules = profile.rules;
|
|
@@ -75,6 +95,8 @@ export function compileArtifactsProfile(input) {
|
|
|
75
95
|
typeof rules.keyDerivationAlgorithm !== 'string' || !rules.keyDerivationAlgorithm ||
|
|
76
96
|
!Number.isSafeInteger(rules.pathMaxBytes) || rules.pathMaxBytes < 1 || rules.pathMaxBytes > 1024 ||
|
|
77
97
|
!Array.isArray(rules.mimeTypes) || !rules.mimeTypes.length || rules.mimeTypes.some((v) => typeof v !== 'string' || !v) ||
|
|
98
|
+
// The profile MIME allowlist may only narrow the server MIME ceiling.
|
|
99
|
+
rules.mimeTypes.some((v) => !isWithinMimeCeiling(v)) ||
|
|
78
100
|
!Array.isArray(rules.reservedFirstSegments) || rules.reservedFirstSegments.some((v) => typeof v !== 'string' || !v) ||
|
|
79
101
|
rules.forbiddenPathPattern !== '[\\\\%?#:\\u0000-\\u001f\\u007f]')
|
|
80
102
|
throw new Error('invalid profile semantics');
|
|
@@ -102,7 +124,8 @@ export function compileArtifactsProfile(input) {
|
|
|
102
124
|
if (!Object.hasOwn(props, key) || !matchesSchema(value, props[key]))
|
|
103
125
|
throw new Error('profile/schema default mismatch');
|
|
104
126
|
}
|
|
105
|
-
if (['artifacts_ensure', 'artifacts_publish', 'artifacts_commit_upload', '
|
|
127
|
+
if (['artifacts_ensure', 'artifacts_publish', 'artifacts_commit_upload', 'artifacts_publish_bundle',
|
|
128
|
+
'artifacts_publish_bundle_v2', 'artifacts_set_access', 'artifacts_delete', 'artifacts_revert'].includes(name)) {
|
|
106
129
|
idempotency[name] = { required: true, scope: 'principal' };
|
|
107
130
|
}
|
|
108
131
|
}
|
|
@@ -127,18 +150,36 @@ export function compileArtifactsProfile(input) {
|
|
|
127
150
|
name = 'artifacts_ensure';
|
|
128
151
|
if (method === 'POST' && path === '/publish')
|
|
129
152
|
name = 'artifacts_publish';
|
|
153
|
+
if (method === 'POST' && path === '/publish_bundle')
|
|
154
|
+
name = 'artifacts_publish_bundle';
|
|
155
|
+
if (method === 'POST' && path === '/publish_bundle_v2')
|
|
156
|
+
name = 'artifacts_publish_bundle_v2';
|
|
157
|
+
if (method === 'POST' && path === '/uploads/create')
|
|
158
|
+
name = 'artifacts_create_upload';
|
|
159
|
+
if (method === 'POST' && path === '/uploads/commit')
|
|
160
|
+
name = 'artifacts_commit_upload';
|
|
161
|
+
if (method === 'POST' && path === '/uploads/page')
|
|
162
|
+
name = 'artifacts_create_upload_page';
|
|
163
|
+
if (method === 'POST' && path === '/list_assets')
|
|
164
|
+
name = 'artifacts_list_assets';
|
|
130
165
|
if (method === 'POST' && path === '/list')
|
|
131
166
|
name = 'artifacts_list';
|
|
132
167
|
if (method === 'POST' && path === '/get_source')
|
|
133
168
|
name = 'artifacts_get_source';
|
|
134
169
|
if (method === 'POST' && path === '/set_access')
|
|
135
170
|
name = 'artifacts_set_access';
|
|
171
|
+
if (method === 'POST' && path === '/lookup_people')
|
|
172
|
+
name = 'artifacts_lookup_people';
|
|
173
|
+
if (method === 'POST' && path === '/list_access')
|
|
174
|
+
name = 'artifacts_list_access';
|
|
136
175
|
if (method === 'POST' && path === '/delete')
|
|
137
176
|
name = 'artifacts_delete';
|
|
138
177
|
if (method === 'POST' && path === '/revert')
|
|
139
178
|
name = 'artifacts_revert';
|
|
140
179
|
if (method === 'POST' && path === '/list_versions')
|
|
141
180
|
name = 'artifacts_list_versions';
|
|
181
|
+
if (method === 'POST' && path === '/revoke_reader_consent')
|
|
182
|
+
name = 'artifacts_revoke_reader_consent';
|
|
142
183
|
if (method === 'GET' && path.startsWith('/meta/') && isArtifactId(path.slice(6)))
|
|
143
184
|
name = 'artifacts_get';
|
|
144
185
|
if (method === 'GET' && path.startsWith('/versions/') && isArtifactId(path.slice(10)))
|
package/dist/profile/radar.js
CHANGED
|
@@ -13,6 +13,13 @@ export const RADAR_ARTIFACTS_PROFILE = freezeDeep({
|
|
|
13
13
|
{ operation: 'list_versions', limits: {}, defaults: {} },
|
|
14
14
|
{ operation: 'get_source', limits: {}, defaults: {} },
|
|
15
15
|
{ operation: 'revert', limits: { idempotencyKeyMaxUnits: 256 }, defaults: {} },
|
|
16
|
+
// G2 sharing operations shipped with the profile (the radar tool selection
|
|
17
|
+
// itself stays the frozen four-tool L0 vector; hosts opt in by selecting
|
|
18
|
+
// the corresponding capabilities).
|
|
19
|
+
{ operation: 'set_access', limits: { idempotencyKeyMaxUnits: 256 }, defaults: {} },
|
|
20
|
+
{ operation: 'lookup_people', limits: { lookupQueryMinUnits: 2, lookupQueryMaxUnits: 120, lookupLimitMax: 10 },
|
|
21
|
+
defaults: { limit: 10 } },
|
|
22
|
+
{ operation: 'list_access', limits: {}, defaults: {} },
|
|
16
23
|
],
|
|
17
24
|
rules: { lengthUnit: 'utf16', textEncoding: 'utf8', callerKeyNormalization: 'none',
|
|
18
25
|
rejectLoneSurrogates: true, provenance: 'inline-original', keyDerivationAlgorithm: 'radar-derive-idempotency-v1', pathMaxBytes: 1024,
|
package/dist/profile/schemas.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SERVER_MAX_FILE_BYTES, SERVER_MAX_FILES_PER_RELEASE, SERVER_MAX_TOTAL_BYTES } from '../server/publication-limits.js';
|
|
1
2
|
const str = { type: 'string', minLength: 1 };
|
|
2
3
|
const integer = (minimum, maximum) => ({ type: 'integer', minimum,
|
|
3
4
|
...(maximum === undefined ? {} : { maximum }) });
|
|
@@ -17,13 +18,24 @@ export function assertCompleteOperation(config) {
|
|
|
17
18
|
const required = {
|
|
18
19
|
ensure: { limits: ['bindingNameMinUnits', 'bindingNameMaxUnits', 'idempotencyKeyMaxUnits'],
|
|
19
20
|
defaults: ['parameters'] },
|
|
21
|
+
// publish additionally accepts the optional release-budget keys
|
|
22
|
+
// releaseFilesMax / releaseFileBytesMax / releaseTotalBytesMax (files parity
|
|
23
|
+
// LOT 1): they bound the final release however its files arrived and default
|
|
24
|
+
// to the inline values below when absent.
|
|
20
25
|
publish: { limits: ['idempotencyKeyMaxUnits', 'publishFilesMin', 'publishFilesMax',
|
|
21
26
|
'maxDecodedFileBytes', 'maxDecodedTotalBytes'], defaults: ['profile'] },
|
|
22
27
|
list: { limits: ['listLimitMin', 'listLimitMax'], defaults: ['limit', 'offset'] },
|
|
23
28
|
commit_upload: { limits: ['idempotencyKeyMaxUnits'], defaults: ['profile'] },
|
|
29
|
+
publish_bundle: { limits: ['idempotencyKeyMaxUnits'], defaults: ['profile'] },
|
|
30
|
+
create_upload_page: { limits: [], defaults: [] },
|
|
31
|
+
list_assets: { limits: ['listAssetsLimitMin', 'listAssetsLimitMax'], defaults: ['limit'] },
|
|
32
|
+
publish_bundle_v2: { limits: ['idempotencyKeyMaxUnits'], defaults: ['profile'] },
|
|
24
33
|
set_access: { limits: ['idempotencyKeyMaxUnits'], defaults: [] },
|
|
34
|
+
lookup_people: { limits: ['lookupQueryMinUnits', 'lookupQueryMaxUnits', 'lookupLimitMax'], defaults: ['limit'] },
|
|
35
|
+
list_access: { limits: [], defaults: [] },
|
|
25
36
|
delete: { limits: ['idempotencyKeyMaxUnits'], defaults: [] },
|
|
26
37
|
revert: { limits: ['idempotencyKeyMaxUnits'], defaults: [] },
|
|
38
|
+
revoke_reader_consent: { limits: ['idempotencyKeyMaxUnits'], defaults: [] },
|
|
27
39
|
};
|
|
28
40
|
const fields = required[config.operation];
|
|
29
41
|
if (fields && (fields.limits.some((key) => !Object.hasOwn(config.limits, key)) ||
|
|
@@ -86,6 +98,10 @@ export function capabilitySchema(name, profile) {
|
|
|
86
98
|
case 'list_versions': return profile.resultEnvelopeVersion !== 2 ? idOnly : obj({ artifactId: id,
|
|
87
99
|
limit: { ...integer(1, 100), default: 20 }, cursor: { ...str, maxLength: 4096 } }, ['artifactId']);
|
|
88
100
|
case 'get_source': return obj({ artifactId: id, releaseId: id,
|
|
101
|
+
// Frozen ceiling (review finding 5): maxItems 32 and the 256 KiB decoded
|
|
102
|
+
// budget are part of the frozen get_source definition and must NOT move.
|
|
103
|
+
// Server-side caps may only move BELOW this frozen schema; larger listings
|
|
104
|
+
// belong to the new listing tools, not to this one.
|
|
89
105
|
paths: { type: 'array', minItems: 1, maxItems: 32, items: { ...str, maxLength: profile.rules.pathMaxBytes },
|
|
90
106
|
description: 'Unique manifest paths; omit to read the whole snapshot (max 32 files, 256 KiB decoded). ' +
|
|
91
107
|
'Result files are `text` with encoding "utf8" or `base64` with encoding "base64" (never an integer ' +
|
|
@@ -99,14 +115,117 @@ export function capabilitySchema(name, profile) {
|
|
|
99
115
|
case 'get_template': return obj({ templateId: str }, ['templateId']);
|
|
100
116
|
case 'get_api_guide': return obj({ version: str });
|
|
101
117
|
case 'create_upload': return obj({ artifactId: id, mimeType: str, maxSize: integer(1) }, ['artifactId', 'mimeType']);
|
|
118
|
+
case 'create_upload_page': return obj({ artifactId: id,
|
|
119
|
+
maxFiles: { type: 'integer', minimum: 1, maximum: 255,
|
|
120
|
+
description: 'Files the page may stage; capped by the release budget (min asked, profile releaseFilesMax).' },
|
|
121
|
+
}, ['artifactId']);
|
|
122
|
+
case 'list_assets': return obj({ artifactId: id, releaseId: id,
|
|
123
|
+
state: { type: 'string', enum: ['staged', 'released', 'all'], default: 'all',
|
|
124
|
+
description: 'Released assets come from the release manifest; staged assets from committed uploads.' },
|
|
125
|
+
pageSessionId: { ...id, description: 'Only staged files committed through this browser page.' },
|
|
126
|
+
limit: { ...integer(limits.listAssetsLimitMin, limits.listAssetsLimitMax), default: config.defaults.limit },
|
|
127
|
+
cursor: { ...str, maxLength: 4096, description: 'Opaque paging cursor from a previous response.' },
|
|
128
|
+
}, ['artifactId']);
|
|
102
129
|
case 'commit_upload': return obj({ artifactId: id, uploadId: str, path: str, mimeType: str,
|
|
103
130
|
digest: str, size: integer(0), profile: primitiveRecord, idempotencyKey: key }, ['artifactId', 'uploadId', 'path', 'mimeType', 'digest', 'size', 'idempotencyKey']);
|
|
131
|
+
case 'publish_bundle': {
|
|
132
|
+
// Release budgets come from the publish operation (release* keys override the
|
|
133
|
+
// inline values; absent keys default to them, never above the server maxima).
|
|
134
|
+
const publishLimits = profile.operations.find((entry) => entry.operation === 'publish')?.limits;
|
|
135
|
+
const filesMax = publishLimits?.releaseFilesMax ?? publishLimits?.publishFilesMax ?? SERVER_MAX_FILES_PER_RELEASE;
|
|
136
|
+
const fileBytesMax = publishLimits?.releaseFileBytesMax ?? publishLimits?.maxDecodedFileBytes ?? SERVER_MAX_FILE_BYTES;
|
|
137
|
+
const totalBytesMax = publishLimits?.releaseTotalBytesMax ?? publishLimits?.maxDecodedTotalBytes ?? SERVER_MAX_TOTAL_BYTES;
|
|
138
|
+
const inlineFileBytesMax = publishLimits?.maxDecodedFileBytes ?? SERVER_MAX_FILE_BYTES;
|
|
139
|
+
const inlineTotalBytesMax = publishLimits?.maxDecodedTotalBytes ?? SERVER_MAX_TOTAL_BYTES;
|
|
140
|
+
const reserved = profile.rules.reservedFirstSegments.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
|
|
141
|
+
const bundlePath = { type: 'string', minLength: 1, maxLength: profile.rules.pathMaxBytes,
|
|
142
|
+
allOf: [{ not: { pattern: profile.rules.forbiddenPathPattern } },
|
|
143
|
+
{ not: { pattern: '(^|/)(\\.\\.?|)(/|$)' } },
|
|
144
|
+
{ not: { pattern: `^(?:${reserved})(?:/|$)` } }],
|
|
145
|
+
description: `At most ${profile.rules.pathMaxBytes} UTF-8 bytes; no empty/dot segments, colon or DEL.` };
|
|
146
|
+
const inlineFile = { ...obj({ path: bundlePath, mimeType: { type: 'string', enum: profile.rules.mimeTypes },
|
|
147
|
+
text: { type: 'string', maxLength: inlineFileBytesMax, description: 'UTF-8 decoded-byte budget applies.' },
|
|
148
|
+
bytes: { type: 'array', maxItems: inlineFileBytesMax, items: integer(0, 255) } }, ['path', 'mimeType']),
|
|
149
|
+
oneOf: [{ required: ['text'], not: { required: ['bytes'] } },
|
|
150
|
+
{ required: ['bytes'], not: { required: ['text'] } }] };
|
|
151
|
+
const uploadAsset = obj({ path: bundlePath, uploadId: id,
|
|
152
|
+
description: 'Staged file committed via artifacts_commit_upload; the server re-reads and re-verifies it.' }, ['path', 'uploadId']);
|
|
153
|
+
const casAsset = obj({ path: bundlePath,
|
|
154
|
+
digest: { type: 'string', pattern: '^sha256:[0-9a-f]{64}$',
|
|
155
|
+
description: 'Canonical sha256:<hex> digest of an already-pinned blob in the same scope.' },
|
|
156
|
+
size: integer(1), mimeType: { type: 'string', enum: profile.rules.mimeTypes } }, ['path', 'digest', 'size', 'mimeType']);
|
|
157
|
+
return { ...obj({ artifactId: id, idempotencyKey: key,
|
|
158
|
+
files: { type: 'array', items: inlineFile, minItems: 1, maxItems: filesMax,
|
|
159
|
+
description: `Inline files (bytes travel through the model, inline budget ${inlineFileBytesMax}/${inlineTotalBytesMax} bytes); at least one of files/assets is required.` },
|
|
160
|
+
assets: { type: 'array', minItems: 1, maxItems: filesMax,
|
|
161
|
+
items: { oneOf: [uploadAsset, casAsset] },
|
|
162
|
+
description: `Assets whose bytes already left the model: an uploadId staged via create_upload/commit_upload, or a CAS reference to an already-pinned blob. Release budget (max ${filesMax} files, ${fileBytesMax} bytes/file, ${totalBytesMax} bytes total) applies to the union of files and assets.` },
|
|
163
|
+
expectedCurrentReleaseId: { ...id, type: ['string', 'null'],
|
|
164
|
+
description: 'Compare the current release atomically; null requires an unpublished artifact. Always required for this tool.' },
|
|
165
|
+
profile: { ...primitiveRecord, default: config.defaults.profile },
|
|
166
|
+
...(part1 ? metadata : {}) }, ['artifactId', 'idempotencyKey', 'expectedCurrentReleaseId']),
|
|
167
|
+
anyOf: [{ required: ['files'] }, { required: ['assets'] }] };
|
|
168
|
+
}
|
|
169
|
+
case 'publish_bundle_v2': {
|
|
170
|
+
// V2 carries everything v1 has, plus copy/carry asset forms and the
|
|
171
|
+
// keep-unmodified carry of the expected current release. V1 is untouched.
|
|
172
|
+
const publishLimits = profile.operations.find((entry) => entry.operation === 'publish')?.limits;
|
|
173
|
+
const filesMax = publishLimits?.releaseFilesMax ?? publishLimits?.publishFilesMax ?? SERVER_MAX_FILES_PER_RELEASE;
|
|
174
|
+
const fileBytesMax = publishLimits?.releaseFileBytesMax ?? publishLimits?.maxDecodedFileBytes ?? SERVER_MAX_FILE_BYTES;
|
|
175
|
+
const totalBytesMax = publishLimits?.releaseTotalBytesMax ?? publishLimits?.maxDecodedTotalBytes ?? SERVER_MAX_TOTAL_BYTES;
|
|
176
|
+
const inlineFileBytesMax = publishLimits?.maxDecodedFileBytes ?? SERVER_MAX_FILE_BYTES;
|
|
177
|
+
const inlineTotalBytesMax = publishLimits?.maxDecodedTotalBytes ?? SERVER_MAX_TOTAL_BYTES;
|
|
178
|
+
const reserved = profile.rules.reservedFirstSegments.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
|
|
179
|
+
const bundlePath = { type: 'string', minLength: 1, maxLength: profile.rules.pathMaxBytes,
|
|
180
|
+
allOf: [{ not: { pattern: profile.rules.forbiddenPathPattern } },
|
|
181
|
+
{ not: { pattern: '(^|/)(\\.\\.?|)(/|$)' } },
|
|
182
|
+
{ not: { pattern: `^(?:${reserved})(?:/|$)` } }],
|
|
183
|
+
description: `At most ${profile.rules.pathMaxBytes} UTF-8 bytes; no empty/dot segments, colon or DEL.` };
|
|
184
|
+
const inlineFile = { ...obj({ path: bundlePath, mimeType: { type: 'string', enum: profile.rules.mimeTypes },
|
|
185
|
+
text: { type: 'string', maxLength: inlineFileBytesMax, description: 'UTF-8 decoded-byte budget applies.' },
|
|
186
|
+
bytes: { type: 'array', maxItems: inlineFileBytesMax, items: integer(0, 255) } }, ['path', 'mimeType']),
|
|
187
|
+
oneOf: [{ required: ['text'], not: { required: ['bytes'] } },
|
|
188
|
+
{ required: ['bytes'], not: { required: ['text'] } }] };
|
|
189
|
+
const uploadAsset = obj({ path: bundlePath, uploadId: id,
|
|
190
|
+
description: 'Staged file committed via artifacts_commit_upload; the server re-reads and re-verifies it.' }, ['path', 'uploadId']);
|
|
191
|
+
const casAsset = obj({ path: bundlePath,
|
|
192
|
+
digest: { type: 'string', pattern: '^sha256:[0-9a-f]{64}$',
|
|
193
|
+
description: 'Canonical sha256:<hex> digest of an already-pinned blob in the same scope.' },
|
|
194
|
+
size: integer(1), mimeType: { type: 'string', enum: profile.rules.mimeTypes } }, ['path', 'digest', 'size', 'mimeType']);
|
|
195
|
+
const copyAsset = obj({ path: bundlePath, sourceArtifactId: id,
|
|
196
|
+
sourcePath: bundlePath, sourceReleaseId: id,
|
|
197
|
+
description: 'Copy one manifest file from another artifact of the same scope (MIME taken from the source manifest).' }, ['path', 'sourceArtifactId']);
|
|
198
|
+
const carryAsset = obj({ path: bundlePath, carryFromReleaseId: id,
|
|
199
|
+
sourcePath: bundlePath,
|
|
200
|
+
description: 'Carry one manifest file from a release of this artifact (defaults to the same path).' }, ['path', 'carryFromReleaseId']);
|
|
201
|
+
return { ...obj({ artifactId: id, idempotencyKey: key,
|
|
202
|
+
files: { type: 'array', items: inlineFile, minItems: 1, maxItems: filesMax,
|
|
203
|
+
description: `Inline files (bytes travel through the model, inline budget ${inlineFileBytesMax}/${inlineTotalBytesMax} bytes); at least one of files/assets is required.` },
|
|
204
|
+
assets: { type: 'array', minItems: 1, maxItems: filesMax,
|
|
205
|
+
items: { oneOf: [uploadAsset, casAsset, copyAsset, carryAsset] },
|
|
206
|
+
description: `Assets whose bytes already left the model: a staged uploadId, a CAS digest, a copy from another artifact of the same scope, or a carry from a release of this artifact. Release budget (max ${filesMax} files, ${fileBytesMax} bytes/file, ${totalBytesMax} bytes total) applies to the union.` },
|
|
207
|
+
expectedCurrentReleaseId: { ...id, type: ['string', 'null'],
|
|
208
|
+
description: 'Compare the current release atomically; null requires an unpublished artifact. Always required for this tool.' },
|
|
209
|
+
keepUnmodifiedPaths: { type: 'boolean', default: false,
|
|
210
|
+
description: 'Carry every path of expectedCurrentReleaseId not overridden by an explicit file or asset.' },
|
|
211
|
+
profile: { ...primitiveRecord, default: config.defaults.profile },
|
|
212
|
+
...(part1 ? metadata : {}) }, ['artifactId', 'idempotencyKey', 'expectedCurrentReleaseId']),
|
|
213
|
+
anyOf: [{ required: ['files'] }, { required: ['assets'] }] };
|
|
214
|
+
}
|
|
104
215
|
case 'set_access': return { ...obj({ artifactId: id, action: { type: 'string', enum: ['grant', 'revoke'] },
|
|
105
216
|
principalId: { ...str, maxLength: 256 }, grant: { type: 'string', enum: ['read'] }, idempotencyKey: key }, ['artifactId', 'action', 'principalId', 'idempotencyKey']), oneOf: [
|
|
106
217
|
{ properties: { action: { enum: ['grant'] } }, required: ['grant'] },
|
|
107
218
|
{ properties: { action: { enum: ['revoke'] } }, not: { required: ['grant'] } },
|
|
108
219
|
] };
|
|
220
|
+
case 'lookup_people': return obj({ query: { type: 'string', minLength: limits.lookupQueryMinUnits,
|
|
221
|
+
maxLength: limits.lookupQueryMaxUnits, description: 'Name or email fragment; matched case- and accent-insensitively against approved accounts of the scope.' },
|
|
222
|
+
limit: { ...integer(1, limits.lookupLimitMax), default: config.defaults.limit } }, ['query']);
|
|
223
|
+
case 'list_access': return idOnly;
|
|
109
224
|
case 'promote': return obj({ artifactId: id, releaseId: id, expectedCurrent: id }, ['artifactId', 'releaseId', 'expectedCurrent']);
|
|
225
|
+
case 'revoke_reader_consent': return obj({ artifactId: id,
|
|
226
|
+
scope: { type: 'string', minLength: 1, maxLength: 128,
|
|
227
|
+
description: 'One consent scope of this artifact; omitted revokes every scope of the artifact.' },
|
|
228
|
+
idempotencyKey: key }, ['artifactId', 'idempotencyKey']);
|
|
110
229
|
default: throw new Error(`unsupported operation profile: ${operation}`);
|
|
111
230
|
}
|
|
112
231
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { type JsonValue } from '../contracts.js';
|
|
2
2
|
import { type EffectiveArtifactProfile, type ArtifactSchema } from './contracts.js';
|
|
3
|
+
/** Release budget of a bundle publication: the publish operation's release* keys
|
|
4
|
+
* override its inline values; absent keys default to the inline values, and the
|
|
5
|
+
* server maxima are hard ceilings either way (profile/index.ts enforces them).
|
|
6
|
+
* Exported for the HTTP layer (create_upload/commit_upload/publish_bundle). */
|
|
7
|
+
export declare function releaseBudget(profile: EffectiveArtifactProfile): {
|
|
8
|
+
filesMax: number;
|
|
9
|
+
fileBytesMax: number;
|
|
10
|
+
totalBytesMax: number;
|
|
11
|
+
inlineFileBytesMax: number;
|
|
12
|
+
inlineTotalBytesMax: number;
|
|
13
|
+
};
|
|
3
14
|
/** The generated schema vocabulary, evaluated without a platform dependency. */
|
|
4
15
|
export declare function matchesSchema(value: unknown, schema: ArtifactSchema): boolean;
|
|
5
16
|
export declare function normalizeArguments(profile: EffectiveArtifactProfile, name: string, input: unknown, schema: ArtifactSchema, envelopeKey?: string, options?: {
|