@sentropic/artifacts 0.2.29 → 0.2.30

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.30
4
+
5
+ - Fix the Postgres uploads adapter: staged files now carry the `pageSessionId` of their upload
6
+ session (`artifacts.uploads.page_session_id`, migration 0009). Before, `getStagedFile`,
7
+ `listStagedFiles` and `listExpiredStaged` dropped it, so `artifacts_list_assets {pageSessionId}`
8
+ and the upload page « Review files » list returned no file on Postgres hosts. No migration.
9
+
3
10
  ## 0.2.29
4
11
 
5
12
  - Fix the browser upload script syntax and authorize the inline scripts and style with a fresh
@@ -16,6 +16,13 @@ async function tx(pool, work) {
16
16
  client.release();
17
17
  }
18
18
  }
19
+ /**
20
+ * A staged file's page is the page of its upload session: `uploads.page_session_id`
21
+ * (0009) is the persisted source, and `staged_files.upload_id` cascades from it.
22
+ */
23
+ const STAGED_SELECT = `SELECT s.upload_id, s.artifact_id, s.path, s.mime_type, s.digest, s.size,
24
+ s.created_at, u.page_session_id
25
+ FROM artifacts.staged_files s JOIN artifacts.uploads u ON u.id = s.upload_id`;
19
26
  const toSession = (row) => ({
20
27
  uploadId: row.id,
21
28
  artifactId: row.artifact_id ?? '',
@@ -36,6 +43,7 @@ const toStaged = (row) => ({
36
43
  digest: row.digest,
37
44
  size: row.size,
38
45
  createdAt: row.created_at.toISOString(),
46
+ ...(row.page_session_id === null ? {} : { pageSessionId: row.page_session_id }),
39
47
  });
40
48
  function using(pool, db, inTx) {
41
49
  return {
@@ -78,11 +86,11 @@ function using(pool, db, inTx) {
78
86
  record.digest, record.size, record.createdAt]);
79
87
  },
80
88
  async getStagedFile(uploadId) {
81
- const { rows } = await db.query('SELECT * FROM artifacts.staged_files WHERE upload_id = $1', [uploadId]);
89
+ const { rows } = await db.query(`${STAGED_SELECT} WHERE s.upload_id = $1`, [uploadId]);
82
90
  return rows[0] === undefined ? undefined : toStaged(rows[0]);
83
91
  },
84
92
  async listStagedFiles(artifactId) {
85
- const { rows } = await db.query('SELECT * FROM artifacts.staged_files WHERE artifact_id = $1 ORDER BY path', [artifactId]);
93
+ const { rows } = await db.query(`${STAGED_SELECT} WHERE s.artifact_id = $1 ORDER BY s.path`, [artifactId]);
86
94
  return rows.map(toStaged);
87
95
  },
88
96
  async sumOpenMaxSize(storageScopeId) {
@@ -111,7 +119,7 @@ function using(pool, db, inTx) {
111
119
  },
112
120
  async listExpiredStaged(at, ttlMs) {
113
121
  const cutoff = new Date(at.getTime() - ttlMs).toISOString();
114
- const { rows } = await db.query('SELECT * FROM artifacts.staged_files WHERE created_at <= $1 ORDER BY created_at', [cutoff]);
122
+ const { rows } = await db.query(`${STAGED_SELECT} WHERE s.created_at <= $1 ORDER BY s.created_at`, [cutoff]);
115
123
  return rows.map(toStaged);
116
124
  },
117
125
  async deleteStagedFile(uploadId) {
@@ -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.29";
13
+ export declare const ARTIFACTS_PROVIDER_VERSION = "0.2.30";
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", "artifacts_list_app_sources", "artifacts_fetch_app_source", "artifacts_git_attach", "artifacts_git_commit", "artifacts_git_publish", "artifacts_git_live", "artifacts_live_write", "artifacts_live_read", "artifacts_live_reset", "artifacts_live_status", "artifacts_live_control", "artifacts_live_invite", "artifacts_live_accept_invitation", "artifacts_live_revoke_invitation", "artifacts_live_invitations"];
15
15
  export type ArtifactsToolName = (typeof ARTIFACTS_TOOL_NAMES)[number];
16
16
  export interface ArtifactsToolDefinition {
package/dist/mcp-core.js CHANGED
@@ -7,7 +7,7 @@ export * from './profile/index.js';
7
7
  export { createRadarKeyDerivation } from './server/command-identity.js';
8
8
  export const ARTIFACTS_PROVIDER_ID = 'sentropic.artifacts';
9
9
  export const ARTIFACTS_APP_ID = 'sentropic-artifacts';
10
- export const ARTIFACTS_PROVIDER_VERSION = '0.2.29';
10
+ export const ARTIFACTS_PROVIDER_VERSION = '0.2.30';
11
11
  export const ARTIFACTS_TOOL_NAMES = ARTIFACT_CAPABILITY_NAMES;
12
12
  // ---------------------------------------------------------------------------
13
13
  // Byte-stable tool definitions (MCP tool-definition stability rule).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentropic/artifacts",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
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",