@sentropic/artifacts 0.2.1 → 0.2.2
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/dist/adapters/s3.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* host and injected — this module never reads env or creates connections.
|
|
11
11
|
*/
|
|
12
12
|
import { DeleteObjectCommand, GetObjectCommand, ListObjectsV2Command, PutObjectCommand, } from '@aws-sdk/client-s3';
|
|
13
|
+
import { assertBlobPrefix } from '../server/blob-prefix.js';
|
|
13
14
|
const BLOB_KEY_PATTERN = /^artifacts\/[A-Za-z0-9_-]+\/blobs\/sha256\/[0-9a-f]{64}$/;
|
|
14
15
|
/** Reject anything but digest-addressed blob keys, before any I/O. */
|
|
15
16
|
function assertBlobKey(key) {
|
|
@@ -17,12 +18,6 @@ function assertBlobKey(key) {
|
|
|
17
18
|
throw new Error(`invalid blob key (must be artifacts/<scope>/blobs/sha256/<hex>): ${key}`);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
/** Reject empty or escaping prefixes before any I/O. */
|
|
21
|
-
function assertPrefix(prefix) {
|
|
22
|
-
if (prefix.length === 0 || prefix.includes('..')) {
|
|
23
|
-
throw new Error(`invalid blob prefix: ${prefix}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
21
|
/** Create an S3-backed blob store over an injected client (no env reads). */
|
|
27
22
|
export function createS3BlobStore(options) {
|
|
28
23
|
return {
|
|
@@ -49,7 +44,7 @@ export function createS3BlobStore(options) {
|
|
|
49
44
|
}
|
|
50
45
|
},
|
|
51
46
|
async listKeys(prefix) {
|
|
52
|
-
|
|
47
|
+
assertBlobPrefix(prefix);
|
|
53
48
|
const keys = [];
|
|
54
49
|
let token;
|
|
55
50
|
do {
|
package/dist/mcp-core.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ 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.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"];
|
|
15
15
|
export type ArtifactsToolName = (typeof ARTIFACTS_TOOL_NAMES)[number];
|
|
16
16
|
export declare const ARTIFACTS_TOOL_SPECS: {
|
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.2';
|
|
10
10
|
export const ARTIFACTS_TOOL_NAMES = ARTIFACT_CAPABILITY_NAMES;
|
|
11
11
|
export const ARTIFACTS_TOOL_SPECS = ARTIFACTS_TOOL_NAMES.map((name) => ({ name,
|
|
12
12
|
description: `Artifacts ${name.slice('artifacts_'.length).replaceAll('_', ' ')}.`,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ArtifactOperationError } from './failures.js';
|
|
2
|
+
class InvalidBlobPrefixError extends ArtifactOperationError {
|
|
3
|
+
code = 'invalid_blob_prefix';
|
|
4
|
+
constructor(prefix) {
|
|
5
|
+
super('invalid_request');
|
|
6
|
+
this.message = `invalid blob prefix: ${prefix}`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Reject empty or escaping prefixes before enumeration or external I/O. */
|
|
10
|
+
export function assertBlobPrefix(prefix) {
|
|
11
|
+
if (prefix.length === 0 || prefix.includes('..')) {
|
|
12
|
+
throw new InvalidBlobPrefixError(prefix);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* serve unit tests and the Postgres/S3 adapters serve integration.
|
|
13
13
|
*/
|
|
14
14
|
import { createHash } from 'node:crypto';
|
|
15
|
+
import { assertBlobPrefix } from './blob-prefix.js';
|
|
15
16
|
import { canonicalManifest, manifestDigest } from '../codecs.js';
|
|
16
17
|
import { parseSourceRef } from './sources.js';
|
|
17
18
|
import { publicationLimits, validatePublicationFiles } from './publication-limits.js';
|
|
@@ -59,8 +60,9 @@ export function createMemoryBlobStore() {
|
|
|
59
60
|
getBlob(key) {
|
|
60
61
|
return Promise.resolve(blobs.get(key));
|
|
61
62
|
},
|
|
62
|
-
listKeys(prefix) {
|
|
63
|
-
|
|
63
|
+
async listKeys(prefix) {
|
|
64
|
+
assertBlobPrefix(prefix);
|
|
65
|
+
return [...blobs.keys()].filter((key) => key.startsWith(prefix)).sort();
|
|
64
66
|
},
|
|
65
67
|
deleteBlob(key) {
|
|
66
68
|
if (!blobs.has(key))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/artifacts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|