artifactpass 0.1.11-rc.2 → 0.1.12-rc.1

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/cli.mjs CHANGED
@@ -18419,7 +18419,7 @@ var cloudflareTokenPattern = /\bcfut_[A-Za-z0-9_-]{20,}\b/gu;
18419
18419
  var shareUrlPattern = /https:\/\/[^\s/]+\/a\/[A-Za-z0-9_-]{32,256}(?:\/[^\s]*)?/gu;
18420
18420
  var redactSensitiveText = (value2) => value2.replace(bearerPattern, "Bearer [REDACTED]").replace(agentTokenPattern2, "[REDACTED]").replace(cloudflareTokenPattern, "[REDACTED]").replace(shareUrlPattern, "[REDACTED SHARE URL]");
18421
18421
 
18422
- // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
18422
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
18423
18423
  var __create2 = Object.create;
18424
18424
  var __defProp2 = Object.defineProperty;
18425
18425
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -18459,7 +18459,7 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
18459
18459
  enumerable: true
18460
18460
  }) : target, mod));
18461
18461
 
18462
- // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs
18462
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs
18463
18463
  var DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
18464
18464
  var DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
18465
18465
  var DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
@@ -18476,7 +18476,7 @@ function declaredDialect(schema, remedy) {
18476
18476
  throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${schema.$schema.slice(0, 200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${remedy}`);
18477
18477
  }
18478
18478
 
18479
- // ../../node_modules/.pnpm/@modelcontextprotocol+core@2.0.0/node_modules/@modelcontextprotocol/core/dist/auth-CUe6YdwF.mjs
18479
+ // ../../node_modules/.pnpm/@modelcontextprotocol+core@2.3.1/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs
18480
18480
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
18481
18481
  var SUPPORTED_PROTOCOL_VERSIONS = [
18482
18482
  LATEST_PROTOCOL_VERSION,
@@ -19313,7 +19313,8 @@ var OAuthMetadataSchema = looseObject({
19313
19313
  introspection_endpoint_auth_signing_alg_values_supported: array(string2()).optional(),
19314
19314
  code_challenge_methods_supported: array(string2()).optional(),
19315
19315
  client_id_metadata_document_supported: boolean2().optional(),
19316
- authorization_response_iss_parameter_supported: boolean2().optional().catch(void 0)
19316
+ authorization_response_iss_parameter_supported: boolean2().optional().catch(void 0),
19317
+ dpop_signing_alg_values_supported: array(string2()).optional()
19317
19318
  });
19318
19319
  var OpenIdProviderMetadataSchema = looseObject({
19319
19320
  issuer: string2(),
@@ -19364,7 +19365,8 @@ var OAuthTokensSchema = object({
19364
19365
  token_type: string2(),
19365
19366
  expires_in: coerce_exports.number().optional(),
19366
19367
  scope: string2().optional(),
19367
- refresh_token: string2().optional()
19368
+ refresh_token: string2().optional(),
19369
+ issuer: string2().optional().catch(void 0)
19368
19370
  }).strip();
19369
19371
  var IdJagTokenExchangeResponseSchema = object({
19370
19372
  issued_token_type: literal("urn:ietf:params:oauth:token-type:id-jag"),
@@ -19402,7 +19404,8 @@ var OAuthClientInformationSchema = object({
19402
19404
  client_id: string2(),
19403
19405
  client_secret: string2().optional(),
19404
19406
  client_id_issued_at: number2().optional(),
19405
- client_secret_expires_at: number2().optional()
19407
+ client_secret_expires_at: number2().optional(),
19408
+ issuer: string2().optional().catch(void 0)
19406
19409
  }).strip();
19407
19410
  var OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
19408
19411
  var OAuthClientRegistrationErrorSchema = object({
@@ -19414,7 +19417,7 @@ var OAuthTokenRevocationRequestSchema = object({
19414
19417
  token_type_hint: string2().optional()
19415
19418
  }).strip();
19416
19419
 
19417
- // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/src-CX2iR2pK.mjs
19420
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs
19418
19421
  var BRANDS = /* @__PURE__ */ Symbol.for("mcp.sdk.errorBrands");
19419
19422
  function stampErrorBrands(instance, ctor) {
19420
19423
  const brands = /* @__PURE__ */ new Set();
@@ -19528,8 +19531,18 @@ var SdkError = class extends Error {
19528
19531
  if (typeof this !== "function") throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");
19529
19532
  return brandedHasInstance(this, value2);
19530
19533
  }
19531
- constructor(code, message, data) {
19532
- super(message);
19534
+ /**
19535
+ * @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
19536
+ * @param message - Human-readable description.
19537
+ * @param data - Optional structured payload (for example the HTTP status carried by
19538
+ * {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
19539
+ * promoted to `Error.cause`.
19540
+ * @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
19541
+ * failure as `{ cause }` so it is reachable through the `Error.cause` chain that
19542
+ * loggers and error trackers walk.
19543
+ */
19544
+ constructor(code, message, data, options) {
19545
+ super(message, options);
19533
19546
  this.code = code;
19534
19547
  this.data = data;
19535
19548
  this.name = "SdkError";
@@ -19540,8 +19553,11 @@ var SdkHttpError = class extends SdkError {
19540
19553
  static {
19541
19554
  Object.defineProperty(this, "mcpBrand", { value: "mcp.SdkHttpError" });
19542
19555
  }
19543
- constructor(code, message, data) {
19544
- super(code, message, data);
19556
+ /**
19557
+ * @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
19558
+ */
19559
+ constructor(code, message, data, options) {
19560
+ super(code, message, data, options);
19545
19561
  this.name = "SdkHttpError";
19546
19562
  }
19547
19563
  get status() {
@@ -21643,7 +21659,8 @@ function build() {
21643
21659
  ListResourceTemplatesResultResponseSchema: wireResultResponse(ListResourceTemplatesResultSchema$1),
21644
21660
  ReadResourceResultResponseSchema: wireResultResponse(union([ReadResourceResultSchema$1, InputRequiredResultSchema])),
21645
21661
  CompleteResultResponseSchema: wireResultResponse(CompleteResultSchema$1),
21646
- DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1)
21662
+ DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1),
21663
+ SubscriptionsListenResultResponseSchema: wireResultResponse(SubscriptionsListenResultSchema$1)
21647
21664
  };
21648
21665
  }
21649
21666
  var memo;
@@ -22071,6 +22088,8 @@ var rev2026Codec = {
22071
22088
  const rawInputRequests = raw["inputRequests"];
22072
22089
  const inputRequests = isPlainObject$4(rawInputRequests) ? rawInputRequests : {};
22073
22090
  const requestState = raw["requestState"];
22091
+ const metaParse = raw["_meta"] === void 0 ? void 0 : buildSchemas2026().ResultMetaSchema.safeParse(raw["_meta"]);
22092
+ const meta3 = metaParse?.success ? metaParse.data : void 0;
22074
22093
  if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
22075
22094
  kind: "invalid",
22076
22095
  error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`, {
@@ -22081,7 +22100,8 @@ var rev2026Codec = {
22081
22100
  return {
22082
22101
  kind: "input_required",
22083
22102
  inputRequests,
22084
- ...typeof requestState === "string" && { requestState }
22103
+ ...typeof requestState === "string" && { requestState },
22104
+ ...meta3 !== void 0 && { _meta: meta3 }
22085
22105
  };
22086
22106
  }
22087
22107
  if (rawResultType !== "complete") return {
@@ -22148,6 +22168,9 @@ function isSpecRequestMethod(method) {
22148
22168
  function isSpecNotificationMethod(method) {
22149
22169
  return ALL_CODECS.some((codec2) => codec2.hasNotificationMethod(method));
22150
22170
  }
22171
+ function isExtensionReusedRequestMethod(method) {
22172
+ return method === "tasks/get" || method === "tasks/cancel";
22173
+ }
22151
22174
  var ALL_CODECS = [rev2025Codec, rev2026Codec];
22152
22175
  var schemas_exports3 = /* @__PURE__ */ __exportAll({
22153
22176
  AnnotationsSchema: () => AnnotationsSchema,
@@ -22382,7 +22405,7 @@ var INBOUND_VALIDATION_LADDER = [
22382
22405
  evaluatedAt: "pre-dispatch",
22383
22406
  codes: [HEADER_MISMATCH_ERROR_CODE],
22384
22407
  conformance: ["http-header-validation"],
22385
- rationale: "SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."
22408
+ rationale: "SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."
22386
22409
  },
22387
22410
  {
22388
22411
  rung: "client-capabilities",
@@ -22964,6 +22987,8 @@ var Protocol = class {
22964
22987
  _transport;
22965
22988
  _requestMessageId = 0;
22966
22989
  _requestHandlers = /* @__PURE__ */ new Map();
22990
+ /** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
22991
+ _customSchemaRequestMethods = /* @__PURE__ */ new Set();
22967
22992
  _requestHandlerAbortControllers = /* @__PURE__ */ new Map();
22968
22993
  _notificationHandlers = /* @__PURE__ */ new Map();
22969
22994
  _responseHandlers = /* @__PURE__ */ new Map();
@@ -23100,7 +23125,7 @@ var Protocol = class {
23100
23125
  return this._requestHandlers.get(method);
23101
23126
  }
23102
23127
  async _oncancel(notification) {
23103
- if (!notification.params.requestId) return;
23128
+ if (notification.params.requestId === void 0) return;
23104
23129
  this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
23105
23130
  }
23106
23131
  _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
@@ -23247,7 +23272,7 @@ var Protocol = class {
23247
23272
  return;
23248
23273
  }
23249
23274
  }
23250
- if (isSpecRequestMethod(request.method) && !codec2.hasRequestMethod(request.method)) {
23275
+ if (isSpecRequestMethod(request.method) && !codec2.hasRequestMethod(request.method) && !(isExtensionReusedRequestMethod(request.method) && this._customSchemaRequestMethods.has(request.method))) {
23251
23276
  sendErrorResponse(ProtocolErrorCode.MethodNotFound, "Method not found");
23252
23277
  return;
23253
23278
  }
@@ -23380,8 +23405,11 @@ var Protocol = class {
23380
23405
  }
23381
23406
  request(request, schemaOrOptions, maybeOptions) {
23382
23407
  const codec2 = this._resolveOutboundCodec(request.method);
23408
+ if (isStandardSchema(schemaOrOptions)) {
23409
+ if (!isExtensionReusedRequestMethod(request.method)) this._assertOutboundRequestInEra(codec2, request.method);
23410
+ return this._requestWithSchemaViaCodec(codec2, request, schemaOrOptions, maybeOptions);
23411
+ }
23383
23412
  this._assertOutboundRequestInEra(codec2, request.method);
23384
- if (isStandardSchema(schemaOrOptions)) return this._requestWithSchemaViaCodec(codec2, request, schemaOrOptions, maybeOptions);
23385
23413
  const validate = codecResultValidator(codec2, request.method);
23386
23414
  if (validate === void 0) throw new TypeError(`'${request.method}' is not a spec method; pass a result schema as the second argument to request().`);
23387
23415
  return this._requestWithSchemaViaCodec(codec2, request, validate, schemaOrOptions);
@@ -23499,19 +23527,20 @@ var Protocol = class {
23499
23527
  const cancel2 = (reason) => {
23500
23528
  if (responseReceived) return;
23501
23529
  this._progressHandlers.delete(messageId);
23502
- if (requestAbort === void 0) this._transport?.send(this._envelopeOutbound({
23503
- jsonrpc: "2.0",
23504
- method: "notifications/cancelled",
23505
- params: {
23506
- requestId: messageId,
23507
- reason: String(reason)
23508
- }
23509
- }), {
23510
- relatedRequestId,
23511
- resumptionToken,
23512
- onresumptiontoken
23513
- }).catch((error51) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error51}`)));
23514
- else requestAbort.abort();
23530
+ if (requestAbort === void 0) {
23531
+ if (request.method !== "initialize") this._transport?.send(this._envelopeOutbound({
23532
+ jsonrpc: "2.0",
23533
+ method: "notifications/cancelled",
23534
+ params: {
23535
+ requestId: messageId,
23536
+ reason: String(reason)
23537
+ }
23538
+ }), {
23539
+ relatedRequestId,
23540
+ resumptionToken,
23541
+ onresumptiontoken
23542
+ }).catch((error51) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error51}`)));
23543
+ } else requestAbort.abort();
23515
23544
  reject(reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason)));
23516
23545
  };
23517
23546
  this._responseHandlers.set(messageId, (response) => {
@@ -23573,7 +23602,7 @@ var Protocol = class {
23573
23602
  * Emits a notification, which is a one-way message that does not expect a response.
23574
23603
  */
23575
23604
  async notification(notification, options) {
23576
- return this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
23605
+ return await this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
23577
23606
  }
23578
23607
  /**
23579
23608
  * The notification funnel proper, keyed by the resolved era codec —
@@ -23591,7 +23620,7 @@ var Protocol = class {
23591
23620
  jsonrpc: "2.0",
23592
23621
  ...notification
23593
23622
  });
23594
- if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && !options?.relatedRequestId) {
23623
+ if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && options?.relatedRequestId === void 0) {
23595
23624
  if (this._pendingDebouncedNotifications.has(notification.method)) return;
23596
23625
  this._pendingDebouncedNotifications.add(notification.method);
23597
23626
  Promise.resolve().then(() => {
@@ -23624,6 +23653,8 @@ var Protocol = class {
23624
23653
  return maybeHandler(parsed.data, ctx);
23625
23654
  };
23626
23655
  else throw new TypeError("setRequestHandler: handler is required");
23656
+ if (typeof schemasOrHandler === "function") this._customSchemaRequestMethods.delete(method);
23657
+ else this._customSchemaRequestMethods.add(method);
23627
23658
  this._requestHandlers.set(method, this._wrapHandler(method, stored));
23628
23659
  }
23629
23660
  /**
@@ -23653,6 +23684,7 @@ var Protocol = class {
23653
23684
  */
23654
23685
  removeRequestHandler(method) {
23655
23686
  this._requestHandlers.delete(method);
23687
+ this._customSchemaRequestMethods.delete(method);
23656
23688
  }
23657
23689
  /**
23658
23690
  * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
@@ -23730,7 +23762,8 @@ function manualInputRequiredValue(decoded) {
23730
23762
  return {
23731
23763
  resultType: "input_required",
23732
23764
  inputRequests: decoded.inputRequests,
23733
- ...decoded.requestState !== void 0 && { requestState: decoded.requestState }
23765
+ ...decoded.requestState !== void 0 && { requestState: decoded.requestState },
23766
+ ...decoded._meta !== void 0 && { _meta: decoded._meta }
23734
23767
  };
23735
23768
  }
23736
23769
  var require_content_type = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -23781,7 +23814,7 @@ var require_content_type = /* @__PURE__ */ __commonJSMin(((exports) => {
23781
23814
  var import_content_type = /* @__PURE__ */ __toESM2(require_content_type(), 1);
23782
23815
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
23783
23816
 
23784
- // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs
23817
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs
23785
23818
  var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
23786
23819
  Object.defineProperty(exports, "__esModule", { value: true });
23787
23820
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
@@ -30791,7 +30824,7 @@ var AjvJsonSchemaValidator = class {
30791
30824
  };
30792
30825
  var Ajv = import_ajv.Ajv;
30793
30826
 
30794
- // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/mcp-DXXb3Vv3.mjs
30827
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs
30795
30828
  var MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
30796
30829
  var DEFAULT_LEGACY_SHIM_MAX_ROUNDS = 8;
30797
30830
  var DEFAULT_LEGACY_SHIM_ROUND_TIMEOUT_MS = 6e5;
@@ -30988,6 +31021,11 @@ var Server = class extends Protocol {
30988
31021
  if (modernProtocolVersions(this._supportedProtocolVersions).length > 0) this.setRequestHandler("server/discover", () => this._ondiscover());
30989
31022
  if (this._capabilities.logging) this._registerLoggingHandler();
30990
31023
  }
31024
+ /** Attaches to the given transport; rejects while this instance is connected to another one. */
31025
+ async connect(transport) {
31026
+ if (this.transport !== void 0) throw new SdkError(SdkErrorCode.AlreadyConnected, "Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");
31027
+ await super.connect(transport);
31028
+ }
30991
31029
  /**
30992
31030
  * Registers the built-in `logging/setLevel` request handler.
30993
31031
  *
@@ -31542,6 +31580,9 @@ function discoverAdvertisedCapabilities(capabilities) {
31542
31580
  return { ...capabilities };
31543
31581
  }
31544
31582
 
31583
+ // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/index.mjs
31584
+ var DEFAULT_MAX_REQUEST_BODY_SIZE = 4 * 1024 * 1024;
31585
+
31545
31586
  // ../agent-bridge/src/connection/device-authorization.ts
31546
31587
  import { createHash, generateKeyPairSync, randomBytes } from "node:crypto";
31547
31588
  var base64Url = (value2) => Buffer.from(value2).toString("base64url");
@@ -36585,7 +36626,7 @@ var runDoctor = async (deploymentRoot2, runner = runProcess) => {
36585
36626
  // package.json
36586
36627
  var package_default = {
36587
36628
  name: "artifactpass",
36588
- version: "0.1.11-rc.2",
36629
+ version: "0.1.12-rc.1",
36589
36630
  description: "Install and connect ArtifactPass for compatible AI agent systems.",
36590
36631
  homepage: "https://artifactpass.com",
36591
36632
  keywords: [
@@ -40049,7 +40090,7 @@ Resume: ${resumeCommand2}
40049
40090
  });
40050
40091
  /*! Bundled license information:
40051
40092
 
40052
- @modelcontextprotocol/server/dist/src-CX2iR2pK.mjs:
40093
+ @modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs:
40053
40094
  (*!
40054
40095
  * content-type
40055
40096
  * Copyright(c) 2015 Douglas Christopher Wilson
@@ -7,8 +7,8 @@
7
7
  <meta name="theme-color" content="#0b0c0e" />
8
8
  <link rel="icon" href="/artifactpass-logo.svg" type="image/svg+xml" />
9
9
  <title>ArtifactPass</title>
10
- <script type="module" crossorigin src="/assets/main-5JyN21kZ.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/main-BUhxWqWm.css">
10
+ <script type="module" crossorigin src="/assets/main-5JyN21kZ.js?v=2026-10-14"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/main-BUhxWqWm.css?v=2026-10-14">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -6240,7 +6240,7 @@ var Hono = class extends Hono$1 {
6240
6240
  };
6241
6241
  var package_default = {
6242
6242
  name: "artifactpass",
6243
- version: "0.1.11-rc.2",
6243
+ version: "0.1.12-rc.1",
6244
6244
  "private": true,
6245
6245
  type: "module",
6246
6246
  packageManager: "pnpm@10.11.0",
@@ -16913,13 +16913,13 @@ var parseApprovalBody = async (request) => {
16913
16913
  if (request.headers.get("content-type")?.startsWith("application/x-www-form-urlencoded") === true) return { user_code: (await request.formData()).get("user_code") };
16914
16914
  return parseJson(request);
16915
16915
  };
16916
- var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
16916
+ var escapeHtml$1 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
16917
16917
  var approvalPage = (userCode, nonce, approved = false, authorization, deploymentHostname) => `<!doctype html>
16918
16918
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
16919
16919
  <title>${approved ? "Connection approved" : "Approve ArtifactPass"}</title>
16920
16920
  <link rel="icon" href="/artifactpass-logo.svg" type="image/svg+xml">
16921
16921
  <style nonce="${nonce}">html{color:#24241f;background:#f7f5ef;font-family:Avenir,"Helvetica Neue",sans-serif}body{margin:0;min-height:100vh;display:grid;place-items:center}.card{width:min(520px,calc(100% - 36px));padding:42px;background:#fffefa;border:1px solid #d8d5ca;border-radius:8px}.brand{display:flex;align-items:center;margin:0 0 24px;font-size:.92rem;font-weight:700}.brand-mark{display:block;width:22px;height:22px;margin-right:9px;color:#24241f;flex:none}h1{margin:0 0 14px;font:400 2.8rem/1 Georgia,serif;letter-spacing:-.04em}p{color:#66645e;line-height:1.6}.details{margin:22px 0;padding:16px;border:1px solid #d8d5ca;border-radius:6px;background:#f7f5ef}.details div{display:grid;grid-template-columns:110px 1fr;gap:10px;padding:5px 0;color:#66645e;font-size:.86rem}.details strong{color:#24241f}.code{display:block;margin:24px 0;padding:14px;background:#f1efe8;border:1px solid #d8d5ca;font:700 1rem/1.2 ui-monospace,monospace;letter-spacing:.08em;text-align:center}button{width:100%;padding:14px;border:0;border-radius:5px;background:#24241f;color:white;font:700 .9rem Avenir,sans-serif;cursor:pointer}button:focus-visible{outline:3px solid #1f6c9f;outline-offset:3px}</style></head>
16922
- <body><main class="card"><div class="brand">${artifactPassIconMarkup$1}ArtifactPass</div><h1>${approved ? "Connected." : "Approve this agent?"}</h1><p>${approved ? "The one-time code has been approved. Return to your agent; the scoped token and device key will be stored only on that device." : "Only approve a code you just requested from your own agent. This grants artifact:create access for 30 days."}</p>${approved ? "" : `<div class="details"><div><strong>Deployment</strong><span>${escapeHtml(deploymentHostname ?? "ArtifactPass")}</span></div><div><strong>Agent</strong><span>${escapeHtml(authorization?.agent_name ?? "ArtifactPass agent")}</span></div><div><strong>Workspace</strong><span>${escapeHtml(authorization?.workspace_identity ?? "Current workspace")}</span></div><div><strong>Scope</strong><span>artifact:create</span></div>${authorization?.device_key_id === null || authorization?.device_key_id === void 0 ? "" : `<div><strong>Device key</strong><span>${escapeHtml(authorization.device_key_id.slice(0, 18))}…</span></div>`}</div><span class="code">${userCode}</span><form method="post" action="/connect/approve"><input type="hidden" name="user_code" value="${userCode}"><button type="submit">Approve connection</button></form>`}</main></body></html>`;
16922
+ <body><main class="card"><div class="brand">${artifactPassIconMarkup$1}ArtifactPass</div><h1>${approved ? "Connected." : "Approve this agent?"}</h1><p>${approved ? "The one-time code has been approved. Return to your agent; the scoped token and device key will be stored only on that device." : "Only approve a code you just requested from your own agent. This grants artifact:create access for 30 days."}</p>${approved ? "" : `<div class="details"><div><strong>Deployment</strong><span>${escapeHtml$1(deploymentHostname ?? "ArtifactPass")}</span></div><div><strong>Agent</strong><span>${escapeHtml$1(authorization?.agent_name ?? "ArtifactPass agent")}</span></div><div><strong>Workspace</strong><span>${escapeHtml$1(authorization?.workspace_identity ?? "Current workspace")}</span></div><div><strong>Scope</strong><span>artifact:create</span></div>${authorization?.device_key_id === null || authorization?.device_key_id === void 0 ? "" : `<div><strong>Device key</strong><span>${escapeHtml$1(authorization.device_key_id.slice(0, 18))}…</span></div>`}</div><span class="code">${userCode}</span><form method="post" action="/connect/approve"><input type="hidden" name="user_code" value="${userCode}"><button type="submit">Approve connection</button></form>`}</main></body></html>`;
16923
16923
  var approvalHeaders = (nonce) => ({
16924
16924
  ...RESPONSE_HEADERS$1,
16925
16925
  "Referrer-Policy": "same-origin",
@@ -17706,7 +17706,7 @@ const chooseFile=()=>{if(authBusy)return;input.value="";input.click();};
17706
17706
  const selectFile=async(file)=>{if(!file)return false;const run=++validationRun;openDialog();setAuthBusy(true,"Checking document");setStatus("Checking this document in your browser.");try{const{state,validator}=await loadPreflight();const prepared=await validator.prepareBrowserFile(file,state.policy.max_artifact_bytes);if(run!==validationRun)return false;if(prepared.error||!prepared.file){setAuthBusy(false,continuationLabel());setStatus(prepared.error||"This document could not be validated.","error");input.value="";return false;}selectedFile=prepared.file;sessionAuthenticated=state.authenticated===true;deploymentMode=state.deployment_mode==="private"?"private":"public";const extension=(selectedFile.name.split(".").pop()||"file").toUpperCase();document.querySelector("#file-kind").textContent=extension==="MARKDOWN"?"MD":extension==="HTM"?"HTML":extension;document.querySelector("#file-name").textContent=selectedFile.name;document.querySelector("#file-details").textContent=formatBytes(selectedFile.size)+" · one document selected";dropZone.hidden=true;preview.hidden=false;config.hidden=false;note.hidden=false;description.textContent="One document selected. Nothing uploads until you continue.";authCopy.textContent=sessionAuthenticated?"Continue to create the temporary link.":"Sign in, then ArtifactPass creates the temporary link.";setAuthBusy(false,continuationLabel());setStatus("");return true;}catch{if(run!==validationRun)return false;setAuthBusy(false,continuationLabel());setStatus("Document validation is unavailable. Try again.","error");input.value="";return false;}};
17707
17707
  document.querySelector("#open-upload").addEventListener("click",openDialog);closeButton.addEventListener("click",()=>{if(!authBusy)dialog.close();});dropZone.addEventListener("click",chooseFile);dropZone.addEventListener("keydown",event=>{if(event.key==="Enter"||event.key===" "){event.preventDefault();chooseFile();}});input.addEventListener("change",()=>{void selectFile(input.files&&input.files[0]);});changeButton.addEventListener("click",chooseFile);
17708
17708
  const pageParameters=new URLSearchParams(window.location.search);if(pageParameters.get("upload")==="1")openDialog();if(pageParameters.get("auth")==="cancelled"){const restoreRequest=indexedDB.open("artifactpass-pending-upload",1);restoreRequest.addEventListener("upgradeneeded",()=>{if(!restoreRequest.result.objectStoreNames.contains("uploads"))restoreRequest.result.createObjectStore("uploads",{keyPath:"key"});});restoreRequest.addEventListener("success",()=>{const db=restoreRequest.result;const readRequest=db.transaction("uploads","readonly").objectStore("uploads").get("homepage");readRequest.addEventListener("success",()=>{const record=readRequest.result;db.close();if(!record||(record.version!==1&&record.version!==2)||typeof record.name!=="string"||!(record.bytes instanceof ArrayBuffer)||record.bytes.byteLength===0||Date.now()-record.createdAt>3600000){setStatus("Sign-in cancelled. Choose your document again.","error");return;}const expiry=expiryInputs.find(option=>Number(option.value)===record.expiresInSeconds);if(expiry)expiry.checked=true;void selectFile(new File([record.bytes],record.name,{type:record.type,lastModified:record.lastModified})).then(selected=>{if(selected)setStatus("Sign-in cancelled. Your document is still selected.","info");});});readRequest.addEventListener("error",()=>{db.close();setStatus("Sign-in cancelled. Choose your document again.","error");});});restoreRequest.addEventListener("error",()=>setStatus("Sign-in cancelled. Choose your document again.","error"));}
17709
- let authWindow=null;let authPoll=null;let authCloseGrace=null;let authFlow=null;const finishAuthWindow=()=>{if(authPoll!==null)window.clearInterval(authPoll);if(authCloseGrace!==null)window.clearTimeout(authCloseGrace);authPoll=null;authCloseGrace=null;authWindow=null;authFlow=null;};const resetAuthButton=(message,tone="error")=>{setAuthBusy(false,continuationLabel());setStatus(message,tone);};const finishAuthCancellation=()=>{if(!authBusy)return;finishAuthWindow();resetAuthButton("Sign-in cancelled. Your document is still selected.","info");};const finishAuthCompletion=()=>{if(!authBusy)return;authBusy=false;finishAuthWindow();continueButton.textContent="Creating link";setStatus("Signed in. Creating the temporary link.");window.location.assign(publishPath);};let authChannel=null;if("BroadcastChannel" in window){try{authChannel=new BroadcastChannel("artifactpass-auth");authChannel.addEventListener("message",event=>{if(typeof event.data!=="object"||event.data===null||event.data.flow!==authFlow)return;if(event.data.type==="artifactpass:auth-cancelled"){finishAuthCancellation();return;}if(event.data.type==="artifactpass:auth-complete")finishAuthCompletion();});window.addEventListener("pagehide",()=>authChannel.close(),{once:true});}catch{authChannel=null;}}const watchAuthWindow=()=>{if(authPoll!==null)window.clearInterval(authPoll);const startedAt=Date.now();authPoll=window.setInterval(()=>{if(authWindow!==null&&authWindow.closed){window.clearInterval(authPoll);authPoll=null;if(authCloseGrace===null)authCloseGrace=window.setTimeout(()=>{authCloseGrace=null;finishAuthWindow();resetAuthButton("Sign-in was closed. Your document is still selected.");},1000);return;}if(Date.now()-startedAt>=600000){try{authWindow?.close();}catch{}finishAuthWindow();resetAuthButton("Sign-in took too long. Your document is still selected.");}},500);};
17709
+ let authWindow=null;let authPoll=null;let authCloseGrace=null;let authFlow=null;const finishAuthWindow=()=>{if(authPoll!==null)window.clearInterval(authPoll);if(authCloseGrace!==null)window.clearTimeout(authCloseGrace);authPoll=null;authCloseGrace=null;authWindow=null;authFlow=null;};const resetAuthButton=(message,tone="error")=>{setAuthBusy(false,continuationLabel());setStatus(message,tone);};const finishAuthCancellation=()=>{if(!authBusy)return;finishAuthWindow();resetAuthButton("Sign-in cancelled. Your document is still selected.","info");};const finishAuthCompletion=()=>{if(!authBusy)return;authBusy=false;finishAuthWindow();continueButton.textContent="Creating link";setStatus("Signed in. Creating the temporary link.");window.location.assign(publishPath);};const reconcileClosedAuth=async()=>{authCloseGrace=null;try{const latest=await fetchPreflight();sessionAuthenticated=latest.authenticated===true;deploymentMode=latest.deployment_mode==="private"?"private":"public";if(sessionAuthenticated){finishAuthCompletion();return;}}catch{}finishAuthWindow();resetAuthButton("Sign-in was closed. Your document is still selected.");};let authChannel=null;if("BroadcastChannel" in window){try{authChannel=new BroadcastChannel("artifactpass-auth");authChannel.addEventListener("message",event=>{if(typeof event.data!=="object"||event.data===null||event.data.flow!==authFlow)return;if(event.data.type==="artifactpass:auth-cancelled"){finishAuthCancellation();return;}if(event.data.type==="artifactpass:auth-complete")finishAuthCompletion();});window.addEventListener("pagehide",()=>authChannel.close(),{once:true});}catch{authChannel=null;}}const watchAuthWindow=()=>{if(authPoll!==null)window.clearInterval(authPoll);const startedAt=Date.now();authPoll=window.setInterval(()=>{if(authWindow!==null&&authWindow.closed){window.clearInterval(authPoll);authPoll=null;if(authCloseGrace===null)authCloseGrace=window.setTimeout(()=>{void reconcileClosedAuth();},1000);return;}if(Date.now()-startedAt>=600000){try{authWindow?.close();}catch{}finishAuthWindow();resetAuthButton("Sign-in took too long. Your document is still selected.");}},500);};
17710
17710
  const storePending=async(popup)=>{if(!selectedFile)return;setAuthBusy(true,sessionAuthenticated?"Creating link":"Preparing sign-in");setStatus(sessionAuthenticated?"Preparing the document for its temporary link.":"Keeping this document in your browser while sign-in opens.");const fail=()=>{popup?.close();finishAuthWindow();resetAuthButton("This browser could not keep the document for continuation. Try again.");};try{const bytes=await selectedFile.arrayBuffer();const expiry=Number(document.querySelector('input[name="expiry"]:checked').value);const request=indexedDB.open("artifactpass-pending-upload",1);request.addEventListener("upgradeneeded",()=>{if(!request.result.objectStoreNames.contains("uploads"))request.result.createObjectStore("uploads",{keyPath:"key"});});request.addEventListener("success",()=>{const db=request.result;const transaction=db.transaction("uploads","readwrite");transaction.objectStore("uploads").put({key:"homepage",version:1,name:selectedFile.name,type:selectedFile.type,lastModified:selectedFile.lastModified,bytes,expiresInSeconds:expiry,createdAt:Date.now()});transaction.addEventListener("complete",async()=>{db.close();sessionStorage.setItem("artifactpass-pending-upload","1");try{const latest=await fetchPreflight();sessionAuthenticated=latest.authenticated===true;deploymentMode=latest.deployment_mode==="private"?"private":"public";}catch{sessionAuthenticated=false;}if(sessionAuthenticated||deploymentMode==="private"){try{popup?.close();}catch{}finishAuthWindow();window.location.assign(publishPath);return;}const theme=document.documentElement.dataset.theme==="light"?"light":"dark";if(popup===null){window.location.assign("/auth/sign-in?return_to="+encodeURIComponent(publishPath)+"&theme="+theme);return;}if(popup.closed){finishAuthWindow();resetAuthButton("Sign-in was closed. Your document is still selected.");return;}const completion="/auth/popup/complete?theme="+theme+"&flow="+encodeURIComponent(authFlow);popup.location.assign("/auth/sign-in?return_to="+encodeURIComponent(completion)+"&theme="+theme);continueButton.textContent="Finish sign-in in the popup";setStatus("Finish signing in in the popup. This page will create the link automatically.");watchAuthWindow();});transaction.addEventListener("error",()=>{db.close();fail();});});request.addEventListener("error",fail);}catch{fail();}};
17711
17711
  continueButton.addEventListener("click",()=>{if(authBusy||!selectedFile)return;if(sessionAuthenticated||deploymentMode==="private"){void storePending(null);return;}if(window.matchMedia("(max-width: 640px), (pointer: coarse)").matches){void storePending(null);return;}const popup=window.open("","artifactpass-auth-"+Date.now(),"popup,width=540,height=700");if(popup===null){resetAuthButton("Allow popups for ArtifactPass, then try again. Nothing has been uploaded.");return;}authWindow=popup;authFlow=Array.from(crypto.getRandomValues(new Uint8Array(16)),byte=>byte.toString(16).padStart(2,"0")).join("");popup.document.title="ArtifactPass sign-in";popup.document.body.textContent="Preparing secure sign-in…";void storePending(popup);});
17712
17712
  window.addEventListener("message",event=>{if(event.origin!==window.location.origin||event.source!==authWindow||typeof event.data!=="object"||event.data===null||("flow" in event.data&&event.data.flow!==authFlow))return;if(event.data.type==="artifactpass:auth-cancelled"){finishAuthCancellation();return;}if(event.data.type==="artifactpass:auth-complete")finishAuthCompletion();});
@@ -17930,6 +17930,76 @@ var renderSharePage = ({ manifest, nonce, representation, sharePath }) => {
17930
17930
  })]
17931
17931
  }))}`;
17932
17932
  };
17933
+ var renderUnavailableSharePage = (nonce) => {
17934
+ return `<!doctype html>${(0, import_server_edge.renderToStaticMarkup)(/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
17935
+ lang: "en",
17936
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("head", { children: [
17937
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", { charSet: "utf-8" }),
17938
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", {
17939
+ name: "viewport",
17940
+ content: "width=device-width, initial-scale=1"
17941
+ }),
17942
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", {
17943
+ name: "referrer",
17944
+ content: "no-referrer"
17945
+ }),
17946
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", {
17947
+ name: "theme-color",
17948
+ content: "#0b0c0e"
17949
+ }),
17950
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("link", {
17951
+ rel: "icon",
17952
+ href: "/artifactpass-logo.svg",
17953
+ type: "image/svg+xml"
17954
+ }),
17955
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: "Artifact unavailable · ArtifactPass" }),
17956
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
17957
+ nonce,
17958
+ dangerouslySetInnerHTML: { __html: homepageBootScript }
17959
+ }),
17960
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
17961
+ nonce,
17962
+ dangerouslySetInnerHTML: { __html: pageStyles }
17963
+ })
17964
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("body", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
17965
+ className: "expired-shell",
17966
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
17967
+ className: "expired",
17968
+ "aria-labelledby": "unavailable-title",
17969
+ children: [
17970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
17971
+ className: "expired-label",
17972
+ children: "Temporary artifact"
17973
+ }),
17974
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
17975
+ id: "unavailable-title",
17976
+ children: "This artifact does not exist or has expired."
17977
+ }),
17978
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
17979
+ className: "expired-copy",
17980
+ children: "The link may be incorrect, revoked, or past its cutoff. Ask the sender for a new link if you still need the file."
17981
+ }),
17982
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
17983
+ className: "expired-actions",
17984
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
17985
+ className: "expired-action expired-action--primary",
17986
+ href: publicSiteUrl(),
17987
+ children: "Go to ArtifactPass"
17988
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
17989
+ className: "expired-action",
17990
+ href: "/upload",
17991
+ children: "Share a document"
17992
+ })]
17993
+ }),
17994
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
17995
+ className: "expired-note",
17996
+ children: "For privacy, ArtifactPass does not reveal whether an unavailable link previously existed."
17997
+ })
17998
+ ]
17999
+ })
18000
+ }) })]
18001
+ }))}`;
18002
+ };
17933
18003
  //#endregion
17934
18004
  //#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/schema.js
17935
18005
  /**
@@ -32026,7 +32096,7 @@ var createNonce = () => {
32026
32096
  for (const byte of bytes) binary += String.fromCharCode(byte);
32027
32097
  return btoa(binary);
32028
32098
  };
32029
- var viewerHeaders = (nonce) => ({
32099
+ var viewerHeaders = (nonce, allowEmbedding = false) => ({
32030
32100
  ...PUBLIC_RESPONSE_HEADERS,
32031
32101
  "Content-Security-Policy": [
32032
32102
  "default-src 'none'",
@@ -32039,10 +32109,17 @@ var viewerHeaders = (nonce) => ({
32039
32109
  "object-src 'none'",
32040
32110
  "base-uri 'none'",
32041
32111
  "form-action 'none'",
32042
- "frame-ancestors 'none'"
32112
+ `frame-ancestors '${allowEmbedding ? "self" : "none"}'`
32043
32113
  ].join("; "),
32044
32114
  "Content-Type": "text/html; charset=utf-8"
32045
32115
  });
32116
+ var unavailableShareResponse = (allowEmbedding = false) => {
32117
+ const nonce = createNonce();
32118
+ return new Response(renderUnavailableSharePage(nonce), {
32119
+ status: 404,
32120
+ headers: viewerHeaders(nonce, allowEmbedding)
32121
+ });
32122
+ };
32046
32123
  var representationFor = async (service, artifact, sharePath) => {
32047
32124
  if (artifact.mimeType === "application/pdf") return {
32048
32125
  kind: "pdf",
@@ -32398,6 +32475,82 @@ var R2ArtifactObjectStore = class {
32398
32475
  var capabilityPath = /^\/a\/[A-Za-z0-9_-]{32,256}(?=\/|$)/u;
32399
32476
  var redactRequestPath = (pathname) => pathname.replace(capabilityPath, "/a/:capability");
32400
32477
  //#endregion
32478
+ //#region src/server/browser-error-page.ts
32479
+ var browserSurface = (pathname) => {
32480
+ if (pathname === "/connect/approve") return "approval";
32481
+ if (/^\/auth\/(?:sign-in|login\/[^/]+|callback\/[^/]+|popup\/[^/]+)\/?$/u.test(pathname)) return "auth";
32482
+ if (pathname === "/upload") return "upload";
32483
+ if (/^\/a\/[^/]+(?:\/[^/]+)?\/?$/u.test(pathname)) return "share";
32484
+ return null;
32485
+ };
32486
+ var isBrowserNavigation = (request) => {
32487
+ const url = new URL(request.url);
32488
+ if (browserSurface(url.pathname) === null) return false;
32489
+ if (url.pathname === "/connect/approve" && request.method === "GET" && url.searchParams.get("format") === "html") return true;
32490
+ if (url.pathname === "/connect/approve" && request.method === "POST" && request.headers.get("content-type")?.startsWith("application/x-www-form-urlencoded") === true) return true;
32491
+ if (request.headers.get("sec-fetch-mode") === "navigate") return true;
32492
+ return request.headers.get("accept")?.includes("text/html") === true;
32493
+ };
32494
+ var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
32495
+ var pageContent = (surface, status) => {
32496
+ if (surface === "approval") return status >= 500 || status === 429 ? {
32497
+ title: status === 429 ? "Too many approval attempts." : "Approval is temporarily unavailable.",
32498
+ detail: "Check whether your agent connected. If it did not, wait a moment and open its approval link again. If the link no longer works, start a new connection from your agent.",
32499
+ action: "Go to ArtifactPass",
32500
+ href: "/upload"
32501
+ } : {
32502
+ title: "This approval link is no longer available.",
32503
+ detail: "It may have expired or already been used. Check whether your agent connected. If it did not, start a new connection from your agent and open the new approval link.",
32504
+ action: "Go to ArtifactPass",
32505
+ href: "/upload"
32506
+ };
32507
+ if (surface === "auth") return {
32508
+ title: status >= 500 ? "Sign-in is temporarily unavailable." : "Sign-in could not be completed.",
32509
+ detail: status >= 500 ? "Please try again in a moment. If this keeps happening, contact the ArtifactPass team." : "The sign-in link may have expired, been used, or could not be verified. Start sign-in again. If you were approving an agent, return to it and open a fresh approval link afterward.",
32510
+ action: "Start sign-in again",
32511
+ href: "/auth/sign-in"
32512
+ };
32513
+ if (surface === "share") return status === 404 || status === 410 ? {
32514
+ title: "This artifact does not exist or has expired.",
32515
+ detail: "The link may be incorrect, revoked, or past its cutoff. Ask the sender for a new link if you still need the file.",
32516
+ action: "Share a document",
32517
+ href: "/upload"
32518
+ } : {
32519
+ title: status === 429 ? "Too many requests right now." : "This artifact could not be opened right now.",
32520
+ detail: status === 429 ? "Wait a few minutes, then open the link again." : "Try opening the link again. If it still fails, ask the sender for a new link.",
32521
+ action: "ArtifactPass home",
32522
+ href: "/upload"
32523
+ };
32524
+ return {
32525
+ title: status >= 500 ? "ArtifactPass is temporarily unavailable." : "The upload page is unavailable.",
32526
+ detail: status >= 500 ? "Your file has not been uploaded. Try again in a moment; if this continues, contact the ArtifactPass team." : "Your file has not been uploaded. If this is a private deployment, ask its administrator to check the app assets. Otherwise, contact the ArtifactPass team.",
32527
+ action: status >= 500 ? "Try the upload page again" : "Open setup guides",
32528
+ href: status >= 500 ? "/upload" : "https://artifactpass.com/guides"
32529
+ };
32530
+ };
32531
+ var browserErrorResponse = (request, status, requestId) => {
32532
+ if (!isBrowserNavigation(request)) return null;
32533
+ const surface = browserSurface(new URL(request.url).pathname);
32534
+ if (surface === null) return null;
32535
+ const content = pageContent(surface, status);
32536
+ const nonce = crypto.randomUUID();
32537
+ const reference = requestId === void 0 ? "" : `<p class="reference">Reference: ${escapeHtml(requestId)}</p>`;
32538
+ const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${content.title} · ArtifactPass</title><link rel="icon" href="/artifactpass-logo.svg" type="image/svg+xml"><style nonce="${nonce}">:root{font-family:Avenir,"Helvetica Neue",sans-serif;color:#24241f;background:#f7f5ef}*{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center;padding:18px}.card{width:min(520px,100%);padding:clamp(26px,5vw,42px);background:#fffefa;border:1px solid #d8d5ca;border-radius:10px}.brand{font-size:.94rem;font-weight:700;letter-spacing:-.02em}h1{margin:36px 0 16px;font:400 clamp(2rem,7vw,2.8rem)/1.08 Georgia,serif;letter-spacing:-.04em}p{color:#66645e;line-height:1.6}.action{display:inline-block;margin-top:18px;padding:13px 18px;border-radius:5px;background:#24241f;color:#fff;text-decoration:none;font-size:.9rem;font-weight:700}.action:focus-visible{outline:3px solid #1f6c9f;outline-offset:3px}.reference{margin-top:24px;font:12px ui-monospace,monospace;overflow-wrap:anywhere}</style></head><body><main class="card"><div class="brand">ArtifactPass</div><h1>${content.title}</h1><p>${content.detail}</p><a class="action" href="${content.href}">${content.action}</a>${reference}</main></body></html>`;
32539
+ return new Response(html, {
32540
+ status,
32541
+ headers: {
32542
+ "Cache-Control": "private, no-store, max-age=0",
32543
+ "Content-Type": "text/html; charset=utf-8",
32544
+ "Content-Security-Policy": `default-src 'none'; style-src 'nonce-${nonce}'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors ${surface === "share" ? "'self'" : "'none'"}`,
32545
+ "Referrer-Policy": "no-referrer",
32546
+ "X-Content-Type-Options": "nosniff",
32547
+ "X-Robots-Tag": "noindex, nofollow, noarchive",
32548
+ ...requestId === void 0 ? {} : { "X-ArtifactPass-Request-Id": requestId },
32549
+ ...status === 429 ? { "Retry-After": "60" } : {}
32550
+ }
32551
+ });
32552
+ };
32553
+ //#endregion
32401
32554
  //#region src/server/index.ts
32402
32555
  var createService = (bindings, options) => new ArtifactApplicationService({
32403
32556
  repository: new D1ArtifactRepository(bindings.ARTIFACT_DB),
@@ -32517,13 +32670,31 @@ var createArtifactApplication = (options = {}) => {
32517
32670
  ...options.publicReadMaximumRequests === void 0 ? {} : { maximumRequests: options.publicReadMaximumRequests }
32518
32671
  }));
32519
32672
  app.onError((error, context) => {
32520
- if (error instanceof ArtifactError) return context.json({
32521
- protocol_version: 1,
32522
- error: {
32523
- code: error.code,
32524
- message: error.message
32673
+ if (error instanceof ArtifactError) {
32674
+ const pathname = new URL(context.req.url).pathname;
32675
+ const acceptsHtml = context.req.header("accept")?.includes("text/html") === true;
32676
+ if (error.code === "not_found" && context.req.method === "GET" && /^\/a\/[^/]+(?:\/[^/]+)?\/?$/u.test(pathname) && (acceptsHtml || context.req.header("sec-fetch-mode") === "navigate")) return unavailableShareResponse(/^\/a\/[^/]+\/[^/]+\/?$/u.test(pathname));
32677
+ const requestId = context.req.header("cf-ray") ?? crypto.randomUUID();
32678
+ const browserResponse = browserErrorResponse(context.req.raw, error.status, requestId);
32679
+ if (browserResponse !== null) {
32680
+ if (pathname === "/connect/approve" || pathname.startsWith("/auth/")) console.warn(JSON.stringify({
32681
+ event: "artifactpass.browser_navigation_failed",
32682
+ request_id: requestId,
32683
+ method: context.req.method,
32684
+ path: redactRequestPath(pathname),
32685
+ error_code: error.code,
32686
+ status: error.status
32687
+ }));
32688
+ return browserResponse;
32525
32689
  }
32526
- }, error.status, PUBLIC_RESPONSE_HEADERS);
32690
+ return context.json({
32691
+ protocol_version: 1,
32692
+ error: {
32693
+ code: error.code,
32694
+ message: error.message
32695
+ }
32696
+ }, error.status, PUBLIC_RESPONSE_HEADERS);
32697
+ }
32527
32698
  const requestId = context.req.header("cf-ray") ?? crypto.randomUUID();
32528
32699
  console.error(JSON.stringify({
32529
32700
  event: "artifactpass.request_failed",
@@ -32534,6 +32705,8 @@ var createArtifactApplication = (options = {}) => {
32534
32705
  error_message: error instanceof Error ? error.message : String(error),
32535
32706
  ...error instanceof Error && error.stack !== void 0 ? { stack: error.stack } : {}
32536
32707
  }));
32708
+ const browserResponse = browserErrorResponse(context.req.raw, 500, requestId);
32709
+ if (browserResponse !== null) return browserResponse;
32537
32710
  return context.json({
32538
32711
  protocol_version: 1,
32539
32712
  error: {