@sentropic/artifacts 0.2.8 → 0.2.9
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 +17 -0
- package/README.md +8 -0
- package/dist/mcp-core.d.ts +12 -2
- package/dist/mcp-core.js +110 -20
- package/dist/server/templates.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.9
|
|
4
|
+
|
|
5
|
+
- Make every `artifacts_*` MCP tool definition byte-stable across deployments,
|
|
6
|
+
package versions and profile switches: descriptions, input schemas, output
|
|
7
|
+
schemas, idempotency and gates are compile-time constants in
|
|
8
|
+
`ARTIFACTS_TOOL_DEFINITIONS` (`src/mcp-core.ts`). The active profile still
|
|
9
|
+
selects the exposed tool set and constrains every invocation server-side,
|
|
10
|
+
and stays visible in manifest audit metadata and typed result details — never
|
|
11
|
+
inside a tool definition. Hosts such as claude.ai key per-tool "Always allow"
|
|
12
|
+
permissions on definition bytes, so approvals now survive upgrades and profile
|
|
13
|
+
switches. The APP-P1 manifest pin still covers the definitions, so the pin
|
|
14
|
+
is stable too.
|
|
15
|
+
- Add tools/list snapshot tests (`packages/artifacts/tests/tools-list-snapshot.test.ts`,
|
|
16
|
+
`packages/mcp-platform/tests/tools-list-snapshot.test.ts`) that fail on any
|
|
17
|
+
tool-definition change unless the checked-in snapshot is deliberately
|
|
18
|
+
regenerated.
|
|
19
|
+
|
|
3
20
|
## 0.2.8
|
|
4
21
|
|
|
5
22
|
- Content hosts use a single UUID label: `https://<id>.<base>/` resolves server-side,
|
package/README.md
CHANGED
|
@@ -401,6 +401,14 @@ a registrable domain. Assets within the same artifact origin remain loadable.
|
|
|
401
401
|
- `src/mcp-core.ts` — the platform-free `sentropic.artifacts` MCP provider: 15 exact
|
|
402
402
|
`artifacts_*` tools with closed schemas, a host-bindable invocation
|
|
403
403
|
scope, an executor over the same HTTP app and a platform adapter.
|
|
404
|
+
Tool definitions are byte-stable compile-time constants
|
|
405
|
+
(`ARTIFACTS_TOOL_DEFINITIONS`): no version, profile revision, digest or
|
|
406
|
+
limit ever appears in a description, schema, annotation or `_meta`, so host
|
|
407
|
+
per-tool permissions (claude.ai "Always allow") survive upgrades and profile
|
|
408
|
+
switches. The active profile selects the exposed tools and constrains
|
|
409
|
+
invocations server-side; it stays visible in manifest audit metadata and
|
|
410
|
+
typed result details. `tests/tools-list-snapshot.test.ts` pins the full
|
|
411
|
+
tools/list catalogue.
|
|
404
412
|
- `src/mcp.ts` — the compatible `@sentropic/mcp-platform` kernel registry
|
|
405
413
|
definition wrapper (the optional peer is required here and by the root barrel).
|
|
406
414
|
|
package/dist/mcp-core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Platform-free provider composition over the shared typed HTTP application. */
|
|
2
|
-
import type { AppConnectorProviderAdapter, AppMcpProviderManifest, AppToolInvocation } from '@sentropic/mcp-platform';
|
|
2
|
+
import type { AppConnectorProviderAdapter, AppMcpProviderManifest, AppToolInvocation, CapabilityTool } from '@sentropic/mcp-platform';
|
|
3
3
|
import type { ProviderParameterSchema } from '@sentropic/mcp-platform/registry';
|
|
4
4
|
import type { ArtifactApp, HttpResponse } from './http.js';
|
|
5
5
|
import { type CompiledArtifactsProfile } from './profile/index.js';
|
|
@@ -10,9 +10,19 @@ 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.
|
|
13
|
+
export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.9";
|
|
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"];
|
|
15
15
|
export type ArtifactsToolName = (typeof ARTIFACTS_TOOL_NAMES)[number];
|
|
16
|
+
export interface ArtifactsToolDefinition {
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly inputSchema: Record<string, unknown>;
|
|
19
|
+
readonly outputSchema: Record<string, unknown>;
|
|
20
|
+
readonly mutability: CapabilityTool['mutability'];
|
|
21
|
+
readonly idempotency: CapabilityTool['idempotency'];
|
|
22
|
+
readonly gates: CapabilityTool['gates'];
|
|
23
|
+
}
|
|
24
|
+
/** Static wire definitions for every artifacts tool; identical across deployments and profiles. */
|
|
25
|
+
export declare const ARTIFACTS_TOOL_DEFINITIONS: Readonly<Record<ArtifactsToolName, ArtifactsToolDefinition>>;
|
|
16
26
|
export declare const ARTIFACTS_TOOL_SPECS: {
|
|
17
27
|
name: "artifacts_ensure" | "artifacts_publish" | "artifacts_set_access" | "artifacts_delete" | "artifacts_revert" | "artifacts_get_template" | "artifacts_get_api_guide" | "artifacts_create_upload" | "artifacts_commit_upload" | "artifacts_list" | "artifacts_get" | "artifacts_get_source" | "artifacts_fork" | "artifacts_promote" | "artifacts_renew" | "artifacts_restore" | "artifacts_list_versions";
|
|
18
28
|
description: string;
|
package/dist/mcp-core.js
CHANGED
|
@@ -2,21 +2,108 @@ import { assertArtifactsTransportProfile } from './http.js';
|
|
|
2
2
|
import { ARTIFACT_CAPABILITY_NAMES, ArtifactProfileInputError } from './profile/index.js';
|
|
3
3
|
import { ArtifactOperationError, classifyArtifactFailure } from './server/failures.js';
|
|
4
4
|
import { projectArtifactHttpOutcome, projectArtifactMcpOutcome } from './server/outcome-projection.js';
|
|
5
|
-
import { ARTIFACT_RESULT_SCHEMA } from './server/result-schema.js';
|
|
6
5
|
export * from './profile/index.js';
|
|
7
6
|
export { createRadarKeyDerivation } from './server/command-identity.js';
|
|
8
7
|
export const ARTIFACTS_PROVIDER_ID = 'sentropic.artifacts';
|
|
9
8
|
export const ARTIFACTS_APP_ID = 'sentropic-artifacts';
|
|
10
|
-
export const ARTIFACTS_PROVIDER_VERSION = '0.2.
|
|
9
|
+
export const ARTIFACTS_PROVIDER_VERSION = '0.2.9';
|
|
11
10
|
export const ARTIFACTS_TOOL_NAMES = ARTIFACT_CAPABILITY_NAMES;
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Byte-stable tool definitions (MCP tool-definition stability rule).
|
|
13
|
+
//
|
|
14
|
+
// MCP hosts such as claude.ai reset per-tool "Always allow" permissions
|
|
15
|
+
// whenever a tool definition (description, inputSchema, outputSchema,
|
|
16
|
+
// annotations, _meta) changes between sessions. Every value below is a
|
|
17
|
+
// compile-time constant: no profile revision, provider version, digest,
|
|
18
|
+
// limit, default or date may appear in a definition. The active profile
|
|
19
|
+
// still constrains invocations server-side (profile.validate) and stays
|
|
20
|
+
// visible in manifest audit metadata and typed result details — never in a
|
|
21
|
+
// tool definition. The APP-P1 manifest pin keeps covering these
|
|
22
|
+
// definitions, so the pin is stable across profile switches as well.
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const str = { type: 'string', minLength: 1 };
|
|
25
|
+
const integer = (minimum, maximum) => ({ type: 'integer', minimum,
|
|
26
|
+
...(maximum === undefined ? {} : { maximum }) });
|
|
27
|
+
const obj = (properties, required = []) => ({ type: 'object', properties, required, additionalProperties: false });
|
|
28
|
+
const id = { type: 'string',
|
|
29
|
+
pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' };
|
|
30
|
+
const idempotencyKey = { type: 'string', minLength: 1, description: 'Nonblank by JavaScript trim(); the active profile bounds its length in UTF-16 units; original bytes retained.' };
|
|
31
|
+
const expectedCurrentReleaseId = { ...id, type: ['string', 'null'], description: 'Compare the current release atomically; null requires an unpublished artifact.' };
|
|
32
|
+
const primitiveRecord = { type: 'object',
|
|
33
|
+
additionalProperties: { type: ['string', 'number', 'boolean', 'null'] } };
|
|
34
|
+
const metadata = {
|
|
35
|
+
title: { type: 'string', minLength: 1, maxLength: 160, description: 'Artifact display title.' },
|
|
36
|
+
description: { type: 'string', maxLength: 2000, description: 'Short artifact description.' },
|
|
37
|
+
icon: { type: ['string', 'null'], pattern: '^[a-z][a-z0-9-]{0,31}$',
|
|
38
|
+
description: 'One short lowercase word.' },
|
|
39
|
+
};
|
|
40
|
+
const path = { type: 'string', minLength: 1, description: 'Manifest path; the active profile bounds its byte length and forbids reserved or dot segments, enforced server-side with typed errors.' };
|
|
41
|
+
const file = { ...obj({ path, mimeType: str, text: { type: 'string' },
|
|
42
|
+
bytes: { type: 'array', items: integer(0, 255) } }, ['path', 'mimeType']),
|
|
43
|
+
oneOf: [{ required: ['text'], not: { required: ['bytes'] } },
|
|
44
|
+
{ required: ['bytes'], not: { required: ['text'] } }] };
|
|
45
|
+
const edit = obj({ path, oldStr: str, newStr: { type: 'string' } }, ['path', 'oldStr', 'newStr']);
|
|
46
|
+
const idOnly = obj({ artifactId: id }, ['artifactId']);
|
|
47
|
+
const ARTIFACTS_OUTPUT_SCHEMA = { type: 'object', additionalProperties: true };
|
|
48
|
+
const READ_ONLY_TOOLS = ['artifacts_list', 'artifacts_get',
|
|
49
|
+
'artifacts_get_template', 'artifacts_get_api_guide', 'artifacts_get_source', 'artifacts_list_versions'];
|
|
50
|
+
const IDEMPOTENT_WRITERS = ['artifacts_ensure', 'artifacts_publish',
|
|
51
|
+
'artifacts_commit_upload', 'artifacts_set_access', 'artifacts_delete', 'artifacts_revert'];
|
|
52
|
+
function staticTool(name, inputSchema, description) {
|
|
53
|
+
return {
|
|
54
|
+
description: description ?? `Artifacts ${name.slice('artifacts_'.length).replaceAll('_', ' ')}.`,
|
|
55
|
+
inputSchema,
|
|
56
|
+
outputSchema: ARTIFACTS_OUTPUT_SCHEMA,
|
|
57
|
+
mutability: READ_ONLY_TOOLS.includes(name) ? 'read-only'
|
|
58
|
+
: name === 'artifacts_publish' ? 'append' : 'state-transition',
|
|
59
|
+
idempotency: IDEMPOTENT_WRITERS.includes(name) ? { required: true, scope: 'principal' } : { required: false },
|
|
60
|
+
gates: { requiresElicitation: false, requiresHumanConfirmation: name === 'artifacts_delete',
|
|
61
|
+
requiresPrincipalGate: false },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Static wire definitions for every artifacts tool; identical across deployments and profiles. */
|
|
65
|
+
export const ARTIFACTS_TOOL_DEFINITIONS = {
|
|
66
|
+
artifacts_get_template: staticTool('artifacts_get_template', obj({ templateId: str }, ['templateId'])),
|
|
67
|
+
artifacts_get_api_guide: staticTool('artifacts_get_api_guide', obj({ version: str })),
|
|
68
|
+
artifacts_ensure: staticTool('artifacts_ensure', obj({ bindingName: str, parameters: obj({}),
|
|
69
|
+
idempotencyKey, ...metadata }, ['bindingName', 'idempotencyKey'])),
|
|
70
|
+
artifacts_publish: staticTool('artifacts_publish', { ...obj({ artifactId: id, idempotencyKey,
|
|
71
|
+
files: { type: 'array', items: file, minItems: 1,
|
|
72
|
+
description: 'Full file set; required unless edits is supplied.' },
|
|
73
|
+
edits: { type: 'array', items: edit, minItems: 1, maxItems: 100,
|
|
74
|
+
description: 'Small old/new edits applied to the current release text files; required unless files is supplied.' },
|
|
75
|
+
expectedCurrentReleaseId, profile: primitiveRecord, ...metadata }, ['artifactId', 'idempotencyKey']),
|
|
76
|
+
oneOf: [{ required: ['files'], not: { required: ['edits'] } },
|
|
77
|
+
{ required: ['edits'], not: { required: ['files'] } }] }),
|
|
78
|
+
artifacts_create_upload: staticTool('artifacts_create_upload', obj({ artifactId: id, mimeType: str,
|
|
79
|
+
maxSize: integer(1) }, ['artifactId', 'mimeType'])),
|
|
80
|
+
artifacts_commit_upload: staticTool('artifacts_commit_upload', obj({ artifactId: id, uploadId: str,
|
|
81
|
+
path, mimeType: str, digest: str, size: integer(0), profile: primitiveRecord, idempotencyKey }, ['artifactId', 'uploadId', 'path', 'mimeType', 'digest', 'size', 'idempotencyKey'])),
|
|
82
|
+
artifacts_list: staticTool('artifacts_list', obj({ limit: integer(1), offset: integer(0) })),
|
|
83
|
+
artifacts_get: staticTool('artifacts_get', idOnly),
|
|
84
|
+
artifacts_get_source: staticTool('artifacts_get_source', obj({ artifactId: id, releaseId: id,
|
|
85
|
+
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
|
+
+ 'or `base64` (encoding "base64"), never an integer array, plus a guideRef instead of the guide body.'),
|
|
87
|
+
artifacts_fork: staticTool('artifacts_fork', idOnly),
|
|
88
|
+
artifacts_set_access: staticTool('artifacts_set_access', { ...obj({ artifactId: id,
|
|
89
|
+
action: { type: 'string', enum: ['grant', 'revoke'] }, principalId: { ...str, maxLength: 256 },
|
|
90
|
+
grant: { type: 'string', enum: ['read'] }, idempotencyKey }, ['artifactId', 'action', 'principalId', 'idempotencyKey']), oneOf: [
|
|
91
|
+
{ properties: { action: { enum: ['grant'] } }, required: ['grant'] },
|
|
92
|
+
{ properties: { action: { enum: ['revoke'] } }, not: { required: ['grant'] } },
|
|
93
|
+
] }),
|
|
94
|
+
artifacts_promote: staticTool('artifacts_promote', obj({ artifactId: id, releaseId: id, expectedCurrent: id }, ['artifactId', 'releaseId', 'expectedCurrent'])),
|
|
95
|
+
artifacts_renew: staticTool('artifacts_renew', idOnly),
|
|
96
|
+
artifacts_delete: staticTool('artifacts_delete', obj({ artifactId: id, expectedCurrentReleaseId,
|
|
97
|
+
idempotencyKey, confirmationRef: { ...str, maxLength: 4096 } }, ['artifactId', 'idempotencyKey'])),
|
|
98
|
+
artifacts_restore: staticTool('artifacts_restore', idOnly),
|
|
99
|
+
artifacts_list_versions: staticTool('artifacts_list_versions', obj({ artifactId: id,
|
|
100
|
+
limit: integer(1, 100), cursor: { ...str, maxLength: 4096 } }, ['artifactId'])),
|
|
101
|
+
artifacts_revert: staticTool('artifacts_revert', obj({ artifactId: id, releaseId: id, targetReleaseId: id,
|
|
102
|
+
expectedCurrentReleaseId, idempotencyKey }, ['artifactId', 'idempotencyKey'])),
|
|
103
|
+
};
|
|
12
104
|
export const ARTIFACTS_TOOL_SPECS = ARTIFACTS_TOOL_NAMES.map((name) => ({ name,
|
|
13
|
-
description: name
|
|
14
|
-
|
|
15
|
-
+ 'or `base64` (encoding "base64"), never an integer array, plus a guideRef instead of the guide body.'
|
|
16
|
-
: `Artifacts ${name.slice('artifacts_'.length).replaceAll('_', ' ')}.`,
|
|
17
|
-
mutability: (['artifacts_list', 'artifacts_get', 'artifacts_get_template', 'artifacts_get_api_guide',
|
|
18
|
-
'artifacts_get_source', 'artifacts_list_versions'].includes(name) ? 'read-only' : name === 'artifacts_publish' ? 'append' : 'state-transition'),
|
|
19
|
-
}));
|
|
105
|
+
description: ARTIFACTS_TOOL_DEFINITIONS[name].description,
|
|
106
|
+
mutability: ARTIFACTS_TOOL_DEFINITIONS[name].mutability }));
|
|
20
107
|
export const ARTIFACTS_PARAMETER_SCHEMA = { properties: {}, required: [] };
|
|
21
108
|
export function createArtifactsManifest(options) {
|
|
22
109
|
assertArtifactsTransportProfile(options?.profile);
|
|
@@ -26,17 +113,20 @@ export function createArtifactsManifest(options) {
|
|
|
26
113
|
appId: ARTIFACTS_APP_ID, providerId: ARTIFACTS_PROVIDER_ID, version: ARTIFACTS_PROVIDER_VERSION,
|
|
27
114
|
displayName: options.displayName ?? 'Sentropic Artifacts',
|
|
28
115
|
resources: [], prompts: [],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
116
|
+
// Tool definitions come only from ARTIFACTS_TOOL_DEFINITIONS: the profile selects
|
|
117
|
+
// which tools exist, but never what a definition says.
|
|
118
|
+
tools: ARTIFACTS_TOOL_NAMES.filter((name) => profile.selectedCapabilities.includes(name)).map((name) => {
|
|
119
|
+
const definition = ARTIFACTS_TOOL_DEFINITIONS[name];
|
|
120
|
+
return {
|
|
121
|
+
kind: 'tool', name,
|
|
122
|
+
description: definition.description,
|
|
123
|
+
inputSchema: definition.inputSchema, outputSchema: definition.outputSchema,
|
|
124
|
+
requiredScopes: [...scopes], requiredClaims: [], redactionClass: 'low',
|
|
125
|
+
mutability: definition.mutability, mutatesExternalSystem: definition.mutability !== 'read-only',
|
|
126
|
+
idempotency: definition.idempotency,
|
|
127
|
+
gates: definition.gates,
|
|
128
|
+
};
|
|
129
|
+
}),
|
|
40
130
|
authz: { requiredClaims: [], scopes, tenantResolution: 'custom-resolver' },
|
|
41
131
|
// The existing manifest codec includes audit metadata, including for an empty tool set.
|
|
42
132
|
audit: { eventKinds: ['invoke'], artifactsProfileDigest: profile.profileDigest }, durability: {},
|
package/dist/server/templates.js
CHANGED
|
@@ -86,6 +86,12 @@ const GUIDE_V1 = [
|
|
|
86
86
|
'right. Pages never receive credentials; reader data access goes through',
|
|
87
87
|
'the host reader profile bound to the artifact and release.',
|
|
88
88
|
'',
|
|
89
|
+
'Tool definitions are stable: names, descriptions and schemas never change',
|
|
90
|
+
'between versions or profiles, so host permissions (for example claude.ai',
|
|
91
|
+
'"Always allow") survive upgrades. The active profile revision and result',
|
|
92
|
+
'envelope version appear in results and audit metadata, not in the tool',
|
|
93
|
+
'definitions themselves.',
|
|
94
|
+
'',
|
|
89
95
|
].join('\n');
|
|
90
96
|
/** Generic in-package catalog; hosts override with approved local assets. */
|
|
91
97
|
export function createDefaultTemplateCatalog() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/artifacts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Generic configurable artifacts MCP and artifact service: StorageScope/Artifact/Binding/Release model, canonical manifests, object authorization, idempotent intents (spec-v8 §9).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|