@sentropic/artifacts 0.2.7 → 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 +38 -0
- package/README.md +20 -8
- package/dist/content/handler.js +33 -22
- package/dist/content/routing.d.ts +2 -5
- package/dist/content/routing.js +7 -11
- package/dist/http.d.ts +2 -2
- package/dist/mcp-core.d.ts +12 -2
- package/dist/mcp-core.js +110 -20
- package/dist/server/result-schema.js +1 -1
- package/dist/server/source-read.d.ts +2 -2
- package/dist/server/summary.d.ts +2 -2
- package/dist/server/summary.js +1 -1
- package/dist/server/templates.js +6 -0
- package/dist/server/versions.d.ts +2 -2
- package/dist/server/versions.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
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
|
+
|
|
20
|
+
## 0.2.8
|
|
21
|
+
|
|
22
|
+
- Content hosts use a single UUID label: `https://<id>.<base>/` resolves server-side,
|
|
23
|
+
either an artifact id (serves its current release) or a release id (serves that
|
|
24
|
+
frozen version). `parseContentHost` now returns `{ kind: 'id', id }` for exactly one
|
|
25
|
+
UUID label and nothing else; the former `<id>.pinned.<base>` form, two-label hosts and
|
|
26
|
+
foreign bases do not route.
|
|
27
|
+
- Unknown ids return a uniform 404: the artifact and release lookups always both run,
|
|
28
|
+
and "no such artifact" and "no such release" share the same response body and timing
|
|
29
|
+
class, without revealing which kind exists. Digest verification and the deny rules
|
|
30
|
+
(service workers, traversal) are unchanged.
|
|
31
|
+
- One wildcard per base at the edge: the `*.pinned.<base>` TLS host and ingress rule are
|
|
32
|
+
removed from the prod and preprod artifact-content overlays. No legacy fallback; immo
|
|
33
|
+
handles 301 redirects for its old hosts on its side.
|
|
34
|
+
- Rename decision (recorded): the `pinnedUrl` field is renamed to `versionUrl` in the
|
|
35
|
+
`publicationUrls` hook, the summary, versions and source-read outputs and the result
|
|
36
|
+
schema, now holding `https://<releaseId>.<base>/`. The converged contract allows the
|
|
37
|
+
rename: no consumer outside `packages/artifacts` references `pinnedUrl`/`stableUrl`
|
|
38
|
+
(verified by grep over ui/contracts/e2e/api/cluster-mesh), and every in-package
|
|
39
|
+
consumer is updated atomically in this release.
|
|
40
|
+
|
|
3
41
|
## 0.2.7
|
|
4
42
|
|
|
5
43
|
- Fix the `artifacts_get_source` wire payload that broke page editing in claude.ai:
|
package/README.md
CHANGED
|
@@ -386,8 +386,10 @@ a registrable domain. Assets within the same artifact origin remain loadable.
|
|
|
386
386
|
- `src/content/grants.ts` — 55s HMAC content grants (60s cutoff budget) and
|
|
387
387
|
single-use activation tickets bound to subject, artifact, exact release
|
|
388
388
|
and channel (`stable` or `pinned`); secrets and clocks are injected.
|
|
389
|
-
- `src/content/routing.ts` —
|
|
390
|
-
|
|
389
|
+
- `src/content/routing.ts` — one wildcard per base with a single UUID label
|
|
390
|
+
`<id>.<base>`, resolved server-side as an artifact (current release) or a
|
|
391
|
+
release (frozen version); the former `<id>.pinned.<base>` form no longer
|
|
392
|
+
routes; safe path resolution.
|
|
391
393
|
- `src/content/headers.ts` — no-store/nosniff/frame-denial/CSP headers and
|
|
392
394
|
the host-only `__Host-artifacts_grant` cookie.
|
|
393
395
|
- `src/content/handler.ts` — transport-free content serving: per-version
|
|
@@ -399,16 +401,26 @@ a registrable domain. Assets within the same artifact origin remain loadable.
|
|
|
399
401
|
- `src/mcp-core.ts` — the platform-free `sentropic.artifacts` MCP provider: 15 exact
|
|
400
402
|
`artifacts_*` tools with closed schemas, a host-bindable invocation
|
|
401
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.
|
|
402
412
|
- `src/mcp.ts` — the compatible `@sentropic/mcp-platform` kernel registry
|
|
403
413
|
definition wrapper (the optional peer is required here and by the root barrel).
|
|
404
414
|
|
|
405
415
|
Ticket issuance and redemption both require `subjectId`, `artifactId`,
|
|
406
|
-
`releaseId` and `channel`. The handler
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
416
|
+
`releaseId` and `channel`. The handler resolves the single UUID label
|
|
417
|
+
server-side — an artifact id serves its current release, a release id serves
|
|
418
|
+
that frozen version — and checks the resolved release and its channel before
|
|
419
|
+
minting a grant. A stable ticket issued for r1 cannot activate r2 after
|
|
420
|
+
republish, and a stable ticket cannot activate a release id (or vice versa).
|
|
421
|
+
Mismatches return 401 without a grant cookie and preserve the ticket for a
|
|
422
|
+
matching request. Tickets expire at `expiresAt` (120 seconds by default) and
|
|
423
|
+
can be redeemed only once.
|
|
412
424
|
|
|
413
425
|
## First publish (bootstrap)
|
|
414
426
|
|
package/dist/content/handler.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* L-5d — transport-free content handler (
|
|
3
|
-
* release bytes on the separate content domain (never HTML on
|
|
4
|
-
* control origin).
|
|
5
|
-
*
|
|
6
|
-
* release
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
2
|
+
* L-5d — transport-free content handler (owner decision relayed by immo).
|
|
3
|
+
* Serves raw release bytes on the separate content domain (never HTML on
|
|
4
|
+
* the control origin). One wildcard per base: the single UUID label
|
|
5
|
+
* `<id>.<base>` is resolved server-side — an artifact id serves its
|
|
6
|
+
* current release, a release id serves that frozen version; an unknown id
|
|
7
|
+
* gets the same 404 response and timing class whatever kind it would be.
|
|
8
|
+
* Per-version activation: a single-use ticket redeemed by the
|
|
9
|
+
* host-authenticated subject mints a short subject+artifact+release grant
|
|
10
|
+
* as a host-only cookie. Every request re-verifies the grant AND live
|
|
11
|
+
* ACL/lifecycle state, so withdrawal cuts readers at the next request
|
|
12
|
+
* (inside the 60s budget, no cache reliance). Republish demands fresh
|
|
13
|
+
* consent on an artifact id (401); a release id keeps its release.
|
|
14
|
+
* Unknown/unreadable → same 404; bad grants → 401.
|
|
11
15
|
*/
|
|
12
16
|
import { errorBody } from '../http.js';
|
|
13
17
|
import { CONTENT_GRANT_TTL_SECONDS } from './grants.js';
|
|
@@ -65,29 +69,36 @@ export function createContentHandler(deps) {
|
|
|
65
69
|
const origin = parseContentHost(request.host, deps.baseDomain);
|
|
66
70
|
if (origin === undefined)
|
|
67
71
|
return fail(404);
|
|
72
|
+
// One label, resolved server-side: an artifact id serves its current
|
|
73
|
+
// release, a release id serves that frozen version. Both lookups
|
|
74
|
+
// always run, so an unknown id gets the same 404 and timing class
|
|
75
|
+
// whether it is a missing artifact or a missing release.
|
|
76
|
+
const [current, byRelease] = await Promise.all([
|
|
77
|
+
deps.publication.getCurrent(origin.id),
|
|
78
|
+
deps.publication.getRelease(origin.id),
|
|
79
|
+
]);
|
|
68
80
|
let artifactId;
|
|
69
81
|
let release;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
let channel;
|
|
83
|
+
if (current !== undefined) {
|
|
84
|
+
artifactId = origin.id;
|
|
85
|
+
release = current;
|
|
86
|
+
channel = 'stable';
|
|
73
87
|
}
|
|
74
|
-
else {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const owner = JSON.parse(release.manifest).artifactId;
|
|
79
|
-
if (typeof owner !== 'string')
|
|
80
|
-
return fail(404);
|
|
81
|
-
artifactId = owner;
|
|
88
|
+
else if (byRelease !== undefined) {
|
|
89
|
+
artifactId = byRelease.artifactId;
|
|
90
|
+
release = byRelease;
|
|
91
|
+
channel = 'pinned';
|
|
82
92
|
}
|
|
83
|
-
|
|
93
|
+
else {
|
|
84
94
|
return fail(404);
|
|
95
|
+
}
|
|
85
96
|
if (request.ticket !== undefined) {
|
|
86
97
|
if (request.actorId === undefined || request.actorId.length === 0)
|
|
87
98
|
return fail(401);
|
|
88
99
|
try {
|
|
89
100
|
await deps.tickets.redeem(request.ticket, {
|
|
90
|
-
subjectId: request.actorId, artifactId, releaseId: release.releaseId, channel
|
|
101
|
+
subjectId: request.actorId, artifactId, releaseId: release.releaseId, channel,
|
|
91
102
|
});
|
|
92
103
|
}
|
|
93
104
|
catch {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export type ContentOrigin = {
|
|
2
|
-
kind: '
|
|
3
|
-
|
|
4
|
-
} | {
|
|
5
|
-
kind: 'pinned';
|
|
6
|
-
releaseId: string;
|
|
2
|
+
kind: 'id';
|
|
3
|
+
id: string;
|
|
7
4
|
};
|
|
8
5
|
/** Parse a content Host header against the configured base domain. */
|
|
9
6
|
export declare function parseContentHost(host: string, baseDomain: string): ContentOrigin | undefined;
|
package/dist/content/routing.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* L-5d — content routing (
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* never route. Paths normalize to manifest file paths with an
|
|
2
|
+
* L-5d — content routing (owner decision relayed by immo): one wildcard
|
|
3
|
+
* per base with a single UUID label `<id>.<base>`. The label is resolved
|
|
4
|
+
* server-side by the handler — an artifact id serves its current release,
|
|
5
|
+
* a release id serves that frozen version. The former `<id>.pinned.<base>`
|
|
6
|
+
* form, two labels, foreign bases and non-UUID labels never route (no
|
|
7
|
+
* legacy fallback). Paths normalize to manifest file paths with an
|
|
9
8
|
* `index.html` default; traversal, empty segments, backslashes and
|
|
10
9
|
* encoded traversal never resolve (no history fallback hiding missing
|
|
11
10
|
* assets). Service workers are detectable so the handler can deny them.
|
|
@@ -21,10 +20,7 @@ export function parseContentHost(host, baseDomain) {
|
|
|
21
20
|
return undefined;
|
|
22
21
|
const labels = normalized.slice(0, normalized.length - base.length - 1).split('.');
|
|
23
22
|
if (labels.length === 1 && isArtifactId(labels[0])) {
|
|
24
|
-
return { kind: '
|
|
25
|
-
}
|
|
26
|
-
if (labels.length === 2 && labels[1] === 'pinned' && isArtifactId(labels[0])) {
|
|
27
|
-
return { kind: 'pinned', releaseId: labels[0] };
|
|
23
|
+
return { kind: 'id', id: labels[0] };
|
|
28
24
|
}
|
|
29
25
|
return undefined;
|
|
30
26
|
}
|
package/dist/http.d.ts
CHANGED
|
@@ -51,10 +51,10 @@ export interface HttpAppDeps {
|
|
|
51
51
|
acls: AclStore;
|
|
52
52
|
lifecycle: Pick<LifecycleService, 'stateOf' | 'canRead' | 'getReleaseState'>;
|
|
53
53
|
isApprovedAccount?: (principalId: string) => boolean;
|
|
54
|
-
/** One trusted URL policy shared by HTTP and MCP receipts. */
|
|
54
|
+
/** One trusted URL policy shared by HTTP and MCP receipts: the artifact page and the exact version page. */
|
|
55
55
|
publicationUrls?: (artifactId: string, releaseId: string) => {
|
|
56
56
|
stableUrl: string;
|
|
57
|
-
|
|
57
|
+
versionUrl: string;
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
export interface ArtifactApp {
|
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: {},
|
|
@@ -19,7 +19,7 @@ const pointer = object({ variant: { enum: ['pointer_conflict'] }, artifactId: st
|
|
|
19
19
|
expectedCurrentReleaseId: nullable, currentReleaseId: nullable, currentDigest: nullable,
|
|
20
20
|
currentSource: object({ artifactId: string, releaseId: string, digest: nullable,
|
|
21
21
|
manifest: string, files: { type: 'array', items: sourceFile }, sourceRef: { type: ['object', 'null'] },
|
|
22
|
-
guideRef, stableUrl: string,
|
|
22
|
+
guideRef, stableUrl: string, versionUrl: string }, ['artifactId', 'releaseId', 'digest', 'manifest', 'files', 'sourceRef', 'guideRef']),
|
|
23
23
|
}, ['variant', 'artifactId', 'expectedCurrentReleaseId', 'currentReleaseId', 'currentDigest']);
|
|
24
24
|
const common = { invocationId: string,
|
|
25
25
|
commitState: { enum: ['not_committed', 'committed', 'unknown'] } };
|
|
@@ -9,7 +9,7 @@ export interface SourceReadPorts {
|
|
|
9
9
|
getBlob(key: string): Promise<Uint8Array | undefined>;
|
|
10
10
|
urls?: (artifactId: string, releaseId: string) => {
|
|
11
11
|
stableUrl: string;
|
|
12
|
-
|
|
12
|
+
versionUrl: string;
|
|
13
13
|
};
|
|
14
14
|
/** Guide reference returned instead of embedding the guide body. */
|
|
15
15
|
guideRef?: {
|
|
@@ -27,7 +27,7 @@ export interface SourceReadInput {
|
|
|
27
27
|
/** Read author bytes only. Provenance never substitutes for a stored snapshot. */
|
|
28
28
|
export declare function readArtifactSource(ports: SourceReadPorts, input: SourceReadInput): Promise<{
|
|
29
29
|
stableUrl?: string | undefined;
|
|
30
|
-
|
|
30
|
+
versionUrl?: string | undefined;
|
|
31
31
|
artifactId: string;
|
|
32
32
|
releaseId: string;
|
|
33
33
|
digest: string;
|
package/dist/server/summary.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function artifactSummary(input: {
|
|
|
10
10
|
};
|
|
11
11
|
urls?: (artifactId: string, releaseId: string) => {
|
|
12
12
|
stableUrl: string;
|
|
13
|
-
|
|
13
|
+
versionUrl: string;
|
|
14
14
|
};
|
|
15
15
|
approved?: (principalId: string) => boolean;
|
|
16
16
|
}): {
|
|
@@ -33,7 +33,7 @@ export declare function artifactSummary(input: {
|
|
|
33
33
|
currentReleaseId: string | null;
|
|
34
34
|
digest: string | null;
|
|
35
35
|
stableUrl: string | null;
|
|
36
|
-
|
|
36
|
+
versionUrl: string | null;
|
|
37
37
|
title: string;
|
|
38
38
|
description: string;
|
|
39
39
|
icon: string | null;
|
package/dist/server/summary.js
CHANGED
|
@@ -8,7 +8,7 @@ export function artifactSummary(input) {
|
|
|
8
8
|
storageScopeId: acl.storageScopeId, state, isPublic: acl.isPublic, withdrawn: state === 'withdrawn',
|
|
9
9
|
createdAt: acl.createdAt ?? null, updatedAt: acl.updatedAt ?? null,
|
|
10
10
|
currentReleaseId: current?.releaseId ?? null, digest: current ? parseManifest(current.manifest).digest ?? null : null,
|
|
11
|
-
stableUrl: urls?.stableUrl ?? null,
|
|
11
|
+
stableUrl: urls?.stableUrl ?? null, versionUrl: current ? urls?.versionUrl ?? null : null,
|
|
12
12
|
title: acl.metadata?.title ?? acl.title ?? acl.bindingName ?? artifactId,
|
|
13
13
|
description: acl.metadata?.description ?? acl.description ?? '',
|
|
14
14
|
icon: acl.metadata?.icon !== undefined ? acl.metadata.icon : acl.icon ?? null,
|
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() {
|
|
@@ -9,7 +9,7 @@ export declare function artifactVersions(input: {
|
|
|
9
9
|
cursor?: string;
|
|
10
10
|
state(releaseId: string): Promise<string>;
|
|
11
11
|
urls?: (artifactId: string, releaseId: string) => {
|
|
12
|
-
|
|
12
|
+
versionUrl: string;
|
|
13
13
|
};
|
|
14
14
|
}): Promise<{
|
|
15
15
|
artifactId: string;
|
|
@@ -23,7 +23,7 @@ export declare function artifactVersions(input: {
|
|
|
23
23
|
revertedFromReleaseId: string | null;
|
|
24
24
|
digest: string;
|
|
25
25
|
isCurrent: boolean;
|
|
26
|
-
|
|
26
|
+
versionUrl: string | null;
|
|
27
27
|
}[];
|
|
28
28
|
nextCursor: string | null;
|
|
29
29
|
}>;
|
package/dist/server/versions.js
CHANGED
|
@@ -29,7 +29,7 @@ export async function artifactVersions(input) {
|
|
|
29
29
|
authorPrincipalId: release.authorPrincipalId ?? null, parentReleaseId: release.parentReleaseId ?? null,
|
|
30
30
|
revertedFromReleaseId: release.revertedFromReleaseId ?? null, digest: release.manifestDigest,
|
|
31
31
|
isCurrent: release.releaseId === input.currentReleaseId,
|
|
32
|
-
|
|
32
|
+
versionUrl: state === 'purged' ? null : input.urls?.(input.artifactId, release.releaseId).versionUrl ?? null };
|
|
33
33
|
}));
|
|
34
34
|
const last = page.at(-1);
|
|
35
35
|
const position = (value) => ({ createdAt: value.createdAt, releaseId: value.releaseId });
|
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",
|