@ai-matrx/agents 0.35.0 → 0.37.0

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/content-transfer/index.cjs +12 -12
  3. package/dist/content-transfer/index.cjs.map +1 -1
  4. package/dist/content-transfer/index.d.cts +1 -1
  5. package/dist/content-transfer/index.d.ts +1 -1
  6. package/dist/content-transfer/index.js +12 -12
  7. package/dist/content-transfer/index.js.map +1 -1
  8. package/dist/content-transfer/react/index.cjs +12 -12
  9. package/dist/content-transfer/react/index.cjs.map +1 -1
  10. package/dist/content-transfer/react/index.d.cts +1 -1
  11. package/dist/content-transfer/react/index.d.ts +1 -1
  12. package/dist/content-transfer/react/index.js +12 -12
  13. package/dist/content-transfer/react/index.js.map +1 -1
  14. package/dist/index.cjs +1458 -1220
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +1461 -1223
  19. package/dist/index.js.map +1 -1
  20. package/dist/{keys.generated-BLDTm66e.d.cts → keys.generated-klzs6I1T.d.cts} +4 -4
  21. package/dist/{keys.generated-BLDTm66e.d.ts → keys.generated-klzs6I1T.d.ts} +4 -4
  22. package/dist/mandates/index.cjs +2 -2
  23. package/dist/mandates/index.cjs.map +1 -1
  24. package/dist/mandates/index.d.cts +2 -2
  25. package/dist/mandates/index.d.ts +2 -2
  26. package/dist/mandates/index.js +2 -2
  27. package/dist/mandates/index.js.map +1 -1
  28. package/dist/matrx/index.cjs +1721 -1483
  29. package/dist/matrx/index.cjs.map +1 -1
  30. package/dist/matrx/index.d.cts +376 -211
  31. package/dist/matrx/index.d.ts +376 -211
  32. package/dist/matrx/index.js +1724 -1486
  33. package/dist/matrx/index.js.map +1 -1
  34. package/dist/message-parts/index.cjs +27 -0
  35. package/dist/message-parts/index.cjs.map +1 -0
  36. package/dist/message-parts/index.d.cts +105 -0
  37. package/dist/message-parts/index.d.ts +105 -0
  38. package/dist/message-parts/index.js +6 -0
  39. package/dist/message-parts/index.js.map +1 -0
  40. package/dist/portable/mcp.cjs +99 -11
  41. package/dist/portable/mcp.cjs.map +1 -1
  42. package/dist/portable/mcp.js +99 -11
  43. package/dist/portable/mcp.js.map +1 -1
  44. package/dist/react/index.cjs +145 -57
  45. package/dist/react/index.cjs.map +1 -1
  46. package/dist/react/index.d.cts +3 -1
  47. package/dist/react/index.d.ts +3 -1
  48. package/dist/react/index.js +145 -57
  49. package/dist/react/index.js.map +1 -1
  50. package/mandates/snapshots/keys.0.36.0.json +653 -0
  51. package/mandates/snapshots/keys.0.37.0.json +653 -0
  52. package/package.json +13 -3
  53. package/dist/{operations-BT5kKMHl.d.cts → operations-DqOe2zob.d.cts} +34 -34
  54. package/dist/{operations-BT5kKMHl.d.ts → operations-DqOe2zob.d.ts} +34 -34
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // message-parts/index.ts
21
+ var message_parts_exports = {};
22
+ __export(message_parts_exports, {
23
+ USER_INPUT_PART_DRIFT_GUARD: () => USER_INPUT_PART_DRIFT_GUARD
24
+ });
25
+ module.exports = __toCommonJS(message_parts_exports);
26
+ var USER_INPUT_PART_DRIFT_GUARD = true;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../message-parts/index.ts"],"sourcesContent":["/**\n * `@ai-matrx/agents/message-parts` — the user-input parts every agent route accepts.\n *\n * Every export is derived from the generated OpenAPI `UserInputPart` union\n * (`./generated/api-types`). It contains no hand-authored wire fields, literals,\n * or allowlists: regenerate the API types and every consumer changes with the\n * server contract. Moved from matrx-frontend `packages/chat/src/agents/types/\n * message-types.ts` + `request.types.ts` (`UserInputPart`) by chat package\n * independence P15 so chat and the files feature both depend on agents.\n */\n\nimport type { components } from \"../generated/api-types\";\n\n/** One structured item accepted by every generated agent user-input route. */\ntype OpenApiUserInputElement = Exclude<\n NonNullable<components[\"schemas\"][\"AgentStartRequest\"][\"user_input\"]>,\n string\n>[number];\n\n/** Exact request-side union generated from the authoritative OpenAPI schema. */\nexport type UserInputPart = OpenApiUserInputElement;\n\ntype _UserInputPartDriftGuard =\n Extract<UserInputPart, { type: \"text\" }> extends { type: \"text\" }\n ? true\n : never;\nexport const USER_INPUT_PART_DRIFT_GUARD: _UserInputPartDriftGuard = true;\n\nexport type TextBlock = Extract<UserInputPart, { type: \"text\" }>;\n\ntype MediaBlock = Extract<UserInputPart, { type: \"media\" }>;\nexport type ImageBlock = Extract<MediaBlock, { kind: \"image\" }>;\nexport type AudioBlock = Extract<MediaBlock, { kind: \"audio\" }>;\nexport type VideoBlock = Extract<MediaBlock, { kind: \"video\" }>;\nexport type DocumentBlock = Extract<MediaBlock, { kind: \"document\" }>;\nexport type YouTubeVideoBlock = Extract<MediaBlock, { kind: \"youtube\" }>;\n\nexport type WebpageInputBlock = Extract<\n UserInputPart,\n { type: \"input_webpage\" }\n>;\nexport type NotesInputBlock = Extract<UserInputPart, { type: \"input_notes\" }>;\nexport type TaskInputBlock = Extract<UserInputPart, { type: \"input_task\" }>;\nexport type TableInputBlock = Extract<UserInputPart, { type: \"input_table\" }>;\nexport type ListInputBlock = Extract<UserInputPart, { type: \"input_list\" }>;\nexport type DataInputBlock = Extract<UserInputPart, { type: \"input_data\" }>;\n\nexport type TableBookmark = NonNullable<TableInputBlock[\"bookmarks\"]>[number];\nexport type FullTableBookmark = Extract<TableBookmark, { type: \"full_table\" }>;\nexport type TableSchemaBookmark = Extract<\n TableBookmark,\n { type: \"table_schema\" }\n>;\nexport type TableColumnBookmark = Extract<\n TableBookmark,\n { type: \"table_column\" }\n>;\nexport type TableRowBookmark = Extract<TableBookmark, { type: \"table_row\" }>;\nexport type TableCellBookmark = Extract<TableBookmark, { type: \"table_cell\" }>;\n\nexport type ListBookmark = NonNullable<ListInputBlock[\"bookmarks\"]>[number];\nexport type FullListBookmark = Extract<ListBookmark, { type: \"full_list\" }>;\nexport type ListGroupBookmark = Extract<ListBookmark, { type: \"list_group\" }>;\nexport type ListItemBookmark = Extract<ListBookmark, { type: \"list_item\" }>;\n\nexport type DataRef = NonNullable<DataInputBlock[\"refs\"]>[number];\nexport type DbRecordRef = Extract<DataRef, { ref_type: \"db_record\" }>;\nexport type DbQueryRef = Extract<DataRef, { ref_type: \"db_query\" }>;\nexport type DbFieldRef = Extract<DataRef, { ref_type: \"db_field\" }>;\nexport type DataRefTable = DataRef[\"table\"];\n\n/** Every structured input shares only fields that exist on the generated union. */\nexport type StructuredInputBase = Pick<\n WebpageInputBlock,\n | \"convert_to_text\"\n | \"optional_context\"\n | \"keep_fresh\"\n | \"editable\"\n | \"metadata\"\n>;\n\nexport type ContentBlock = UserInputPart;\nexport type UserInput = string | UserInputPart[];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BO,IAAM,8BAAwD;","names":[]}
@@ -0,0 +1,105 @@
1
+ import { components } from '../generated/api-types.cjs';
2
+
3
+ /**
4
+ * `@ai-matrx/agents/message-parts` — the user-input parts every agent route accepts.
5
+ *
6
+ * Every export is derived from the generated OpenAPI `UserInputPart` union
7
+ * (`./generated/api-types`). It contains no hand-authored wire fields, literals,
8
+ * or allowlists: regenerate the API types and every consumer changes with the
9
+ * server contract. Moved from matrx-frontend `packages/chat/src/agents/types/
10
+ * message-types.ts` + `request.types.ts` (`UserInputPart`) by chat package
11
+ * independence P15 so chat and the files feature both depend on agents.
12
+ */
13
+
14
+ /** One structured item accepted by every generated agent user-input route. */
15
+ type OpenApiUserInputElement = Exclude<NonNullable<components["schemas"]["AgentStartRequest"]["user_input"]>, string>[number];
16
+ /** Exact request-side union generated from the authoritative OpenAPI schema. */
17
+ type UserInputPart = OpenApiUserInputElement;
18
+ type _UserInputPartDriftGuard = Extract<UserInputPart, {
19
+ type: "text";
20
+ }> extends {
21
+ type: "text";
22
+ } ? true : never;
23
+ declare const USER_INPUT_PART_DRIFT_GUARD: _UserInputPartDriftGuard;
24
+ type TextBlock = Extract<UserInputPart, {
25
+ type: "text";
26
+ }>;
27
+ type MediaBlock = Extract<UserInputPart, {
28
+ type: "media";
29
+ }>;
30
+ type ImageBlock = Extract<MediaBlock, {
31
+ kind: "image";
32
+ }>;
33
+ type AudioBlock = Extract<MediaBlock, {
34
+ kind: "audio";
35
+ }>;
36
+ type VideoBlock = Extract<MediaBlock, {
37
+ kind: "video";
38
+ }>;
39
+ type DocumentBlock = Extract<MediaBlock, {
40
+ kind: "document";
41
+ }>;
42
+ type YouTubeVideoBlock = Extract<MediaBlock, {
43
+ kind: "youtube";
44
+ }>;
45
+ type WebpageInputBlock = Extract<UserInputPart, {
46
+ type: "input_webpage";
47
+ }>;
48
+ type NotesInputBlock = Extract<UserInputPart, {
49
+ type: "input_notes";
50
+ }>;
51
+ type TaskInputBlock = Extract<UserInputPart, {
52
+ type: "input_task";
53
+ }>;
54
+ type TableInputBlock = Extract<UserInputPart, {
55
+ type: "input_table";
56
+ }>;
57
+ type ListInputBlock = Extract<UserInputPart, {
58
+ type: "input_list";
59
+ }>;
60
+ type DataInputBlock = Extract<UserInputPart, {
61
+ type: "input_data";
62
+ }>;
63
+ type TableBookmark = NonNullable<TableInputBlock["bookmarks"]>[number];
64
+ type FullTableBookmark = Extract<TableBookmark, {
65
+ type: "full_table";
66
+ }>;
67
+ type TableSchemaBookmark = Extract<TableBookmark, {
68
+ type: "table_schema";
69
+ }>;
70
+ type TableColumnBookmark = Extract<TableBookmark, {
71
+ type: "table_column";
72
+ }>;
73
+ type TableRowBookmark = Extract<TableBookmark, {
74
+ type: "table_row";
75
+ }>;
76
+ type TableCellBookmark = Extract<TableBookmark, {
77
+ type: "table_cell";
78
+ }>;
79
+ type ListBookmark = NonNullable<ListInputBlock["bookmarks"]>[number];
80
+ type FullListBookmark = Extract<ListBookmark, {
81
+ type: "full_list";
82
+ }>;
83
+ type ListGroupBookmark = Extract<ListBookmark, {
84
+ type: "list_group";
85
+ }>;
86
+ type ListItemBookmark = Extract<ListBookmark, {
87
+ type: "list_item";
88
+ }>;
89
+ type DataRef = NonNullable<DataInputBlock["refs"]>[number];
90
+ type DbRecordRef = Extract<DataRef, {
91
+ ref_type: "db_record";
92
+ }>;
93
+ type DbQueryRef = Extract<DataRef, {
94
+ ref_type: "db_query";
95
+ }>;
96
+ type DbFieldRef = Extract<DataRef, {
97
+ ref_type: "db_field";
98
+ }>;
99
+ type DataRefTable = DataRef["table"];
100
+ /** Every structured input shares only fields that exist on the generated union. */
101
+ type StructuredInputBase = Pick<WebpageInputBlock, "convert_to_text" | "optional_context" | "keep_fresh" | "editable" | "metadata">;
102
+ type ContentBlock = UserInputPart;
103
+ type UserInput = string | UserInputPart[];
104
+
105
+ export { type AudioBlock, type ContentBlock, type DataInputBlock, type DataRef, type DataRefTable, type DbFieldRef, type DbQueryRef, type DbRecordRef, type DocumentBlock, type FullListBookmark, type FullTableBookmark, type ImageBlock, type ListBookmark, type ListGroupBookmark, type ListInputBlock, type ListItemBookmark, type NotesInputBlock, type StructuredInputBase, type TableBookmark, type TableCellBookmark, type TableColumnBookmark, type TableInputBlock, type TableRowBookmark, type TableSchemaBookmark, type TaskInputBlock, type TextBlock, USER_INPUT_PART_DRIFT_GUARD, type UserInput, type UserInputPart, type VideoBlock, type WebpageInputBlock, type YouTubeVideoBlock };
@@ -0,0 +1,105 @@
1
+ import { components } from '../generated/api-types.js';
2
+
3
+ /**
4
+ * `@ai-matrx/agents/message-parts` — the user-input parts every agent route accepts.
5
+ *
6
+ * Every export is derived from the generated OpenAPI `UserInputPart` union
7
+ * (`./generated/api-types`). It contains no hand-authored wire fields, literals,
8
+ * or allowlists: regenerate the API types and every consumer changes with the
9
+ * server contract. Moved from matrx-frontend `packages/chat/src/agents/types/
10
+ * message-types.ts` + `request.types.ts` (`UserInputPart`) by chat package
11
+ * independence P15 so chat and the files feature both depend on agents.
12
+ */
13
+
14
+ /** One structured item accepted by every generated agent user-input route. */
15
+ type OpenApiUserInputElement = Exclude<NonNullable<components["schemas"]["AgentStartRequest"]["user_input"]>, string>[number];
16
+ /** Exact request-side union generated from the authoritative OpenAPI schema. */
17
+ type UserInputPart = OpenApiUserInputElement;
18
+ type _UserInputPartDriftGuard = Extract<UserInputPart, {
19
+ type: "text";
20
+ }> extends {
21
+ type: "text";
22
+ } ? true : never;
23
+ declare const USER_INPUT_PART_DRIFT_GUARD: _UserInputPartDriftGuard;
24
+ type TextBlock = Extract<UserInputPart, {
25
+ type: "text";
26
+ }>;
27
+ type MediaBlock = Extract<UserInputPart, {
28
+ type: "media";
29
+ }>;
30
+ type ImageBlock = Extract<MediaBlock, {
31
+ kind: "image";
32
+ }>;
33
+ type AudioBlock = Extract<MediaBlock, {
34
+ kind: "audio";
35
+ }>;
36
+ type VideoBlock = Extract<MediaBlock, {
37
+ kind: "video";
38
+ }>;
39
+ type DocumentBlock = Extract<MediaBlock, {
40
+ kind: "document";
41
+ }>;
42
+ type YouTubeVideoBlock = Extract<MediaBlock, {
43
+ kind: "youtube";
44
+ }>;
45
+ type WebpageInputBlock = Extract<UserInputPart, {
46
+ type: "input_webpage";
47
+ }>;
48
+ type NotesInputBlock = Extract<UserInputPart, {
49
+ type: "input_notes";
50
+ }>;
51
+ type TaskInputBlock = Extract<UserInputPart, {
52
+ type: "input_task";
53
+ }>;
54
+ type TableInputBlock = Extract<UserInputPart, {
55
+ type: "input_table";
56
+ }>;
57
+ type ListInputBlock = Extract<UserInputPart, {
58
+ type: "input_list";
59
+ }>;
60
+ type DataInputBlock = Extract<UserInputPart, {
61
+ type: "input_data";
62
+ }>;
63
+ type TableBookmark = NonNullable<TableInputBlock["bookmarks"]>[number];
64
+ type FullTableBookmark = Extract<TableBookmark, {
65
+ type: "full_table";
66
+ }>;
67
+ type TableSchemaBookmark = Extract<TableBookmark, {
68
+ type: "table_schema";
69
+ }>;
70
+ type TableColumnBookmark = Extract<TableBookmark, {
71
+ type: "table_column";
72
+ }>;
73
+ type TableRowBookmark = Extract<TableBookmark, {
74
+ type: "table_row";
75
+ }>;
76
+ type TableCellBookmark = Extract<TableBookmark, {
77
+ type: "table_cell";
78
+ }>;
79
+ type ListBookmark = NonNullable<ListInputBlock["bookmarks"]>[number];
80
+ type FullListBookmark = Extract<ListBookmark, {
81
+ type: "full_list";
82
+ }>;
83
+ type ListGroupBookmark = Extract<ListBookmark, {
84
+ type: "list_group";
85
+ }>;
86
+ type ListItemBookmark = Extract<ListBookmark, {
87
+ type: "list_item";
88
+ }>;
89
+ type DataRef = NonNullable<DataInputBlock["refs"]>[number];
90
+ type DbRecordRef = Extract<DataRef, {
91
+ ref_type: "db_record";
92
+ }>;
93
+ type DbQueryRef = Extract<DataRef, {
94
+ ref_type: "db_query";
95
+ }>;
96
+ type DbFieldRef = Extract<DataRef, {
97
+ ref_type: "db_field";
98
+ }>;
99
+ type DataRefTable = DataRef["table"];
100
+ /** Every structured input shares only fields that exist on the generated union. */
101
+ type StructuredInputBase = Pick<WebpageInputBlock, "convert_to_text" | "optional_context" | "keep_fresh" | "editable" | "metadata">;
102
+ type ContentBlock = UserInputPart;
103
+ type UserInput = string | UserInputPart[];
104
+
105
+ export { type AudioBlock, type ContentBlock, type DataInputBlock, type DataRef, type DataRefTable, type DbFieldRef, type DbQueryRef, type DbRecordRef, type DocumentBlock, type FullListBookmark, type FullTableBookmark, type ImageBlock, type ListBookmark, type ListGroupBookmark, type ListInputBlock, type ListItemBookmark, type NotesInputBlock, type StructuredInputBase, type TableBookmark, type TableCellBookmark, type TableColumnBookmark, type TableInputBlock, type TableRowBookmark, type TableSchemaBookmark, type TaskInputBlock, type TextBlock, USER_INPUT_PART_DRIFT_GUARD, type UserInput, type UserInputPart, type VideoBlock, type WebpageInputBlock, type YouTubeVideoBlock };
@@ -0,0 +1,6 @@
1
+ // message-parts/index.ts
2
+ var USER_INPUT_PART_DRIFT_GUARD = true;
3
+ export {
4
+ USER_INPUT_PART_DRIFT_GUARD
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../message-parts/index.ts"],"sourcesContent":["/**\n * `@ai-matrx/agents/message-parts` — the user-input parts every agent route accepts.\n *\n * Every export is derived from the generated OpenAPI `UserInputPart` union\n * (`./generated/api-types`). It contains no hand-authored wire fields, literals,\n * or allowlists: regenerate the API types and every consumer changes with the\n * server contract. Moved from matrx-frontend `packages/chat/src/agents/types/\n * message-types.ts` + `request.types.ts` (`UserInputPart`) by chat package\n * independence P15 so chat and the files feature both depend on agents.\n */\n\nimport type { components } from \"../generated/api-types\";\n\n/** One structured item accepted by every generated agent user-input route. */\ntype OpenApiUserInputElement = Exclude<\n NonNullable<components[\"schemas\"][\"AgentStartRequest\"][\"user_input\"]>,\n string\n>[number];\n\n/** Exact request-side union generated from the authoritative OpenAPI schema. */\nexport type UserInputPart = OpenApiUserInputElement;\n\ntype _UserInputPartDriftGuard =\n Extract<UserInputPart, { type: \"text\" }> extends { type: \"text\" }\n ? true\n : never;\nexport const USER_INPUT_PART_DRIFT_GUARD: _UserInputPartDriftGuard = true;\n\nexport type TextBlock = Extract<UserInputPart, { type: \"text\" }>;\n\ntype MediaBlock = Extract<UserInputPart, { type: \"media\" }>;\nexport type ImageBlock = Extract<MediaBlock, { kind: \"image\" }>;\nexport type AudioBlock = Extract<MediaBlock, { kind: \"audio\" }>;\nexport type VideoBlock = Extract<MediaBlock, { kind: \"video\" }>;\nexport type DocumentBlock = Extract<MediaBlock, { kind: \"document\" }>;\nexport type YouTubeVideoBlock = Extract<MediaBlock, { kind: \"youtube\" }>;\n\nexport type WebpageInputBlock = Extract<\n UserInputPart,\n { type: \"input_webpage\" }\n>;\nexport type NotesInputBlock = Extract<UserInputPart, { type: \"input_notes\" }>;\nexport type TaskInputBlock = Extract<UserInputPart, { type: \"input_task\" }>;\nexport type TableInputBlock = Extract<UserInputPart, { type: \"input_table\" }>;\nexport type ListInputBlock = Extract<UserInputPart, { type: \"input_list\" }>;\nexport type DataInputBlock = Extract<UserInputPart, { type: \"input_data\" }>;\n\nexport type TableBookmark = NonNullable<TableInputBlock[\"bookmarks\"]>[number];\nexport type FullTableBookmark = Extract<TableBookmark, { type: \"full_table\" }>;\nexport type TableSchemaBookmark = Extract<\n TableBookmark,\n { type: \"table_schema\" }\n>;\nexport type TableColumnBookmark = Extract<\n TableBookmark,\n { type: \"table_column\" }\n>;\nexport type TableRowBookmark = Extract<TableBookmark, { type: \"table_row\" }>;\nexport type TableCellBookmark = Extract<TableBookmark, { type: \"table_cell\" }>;\n\nexport type ListBookmark = NonNullable<ListInputBlock[\"bookmarks\"]>[number];\nexport type FullListBookmark = Extract<ListBookmark, { type: \"full_list\" }>;\nexport type ListGroupBookmark = Extract<ListBookmark, { type: \"list_group\" }>;\nexport type ListItemBookmark = Extract<ListBookmark, { type: \"list_item\" }>;\n\nexport type DataRef = NonNullable<DataInputBlock[\"refs\"]>[number];\nexport type DbRecordRef = Extract<DataRef, { ref_type: \"db_record\" }>;\nexport type DbQueryRef = Extract<DataRef, { ref_type: \"db_query\" }>;\nexport type DbFieldRef = Extract<DataRef, { ref_type: \"db_field\" }>;\nexport type DataRefTable = DataRef[\"table\"];\n\n/** Every structured input shares only fields that exist on the generated union. */\nexport type StructuredInputBase = Pick<\n WebpageInputBlock,\n | \"convert_to_text\"\n | \"optional_context\"\n | \"keep_fresh\"\n | \"editable\"\n | \"metadata\"\n>;\n\nexport type ContentBlock = UserInputPart;\nexport type UserInput = string | UserInputPart[];\n"],"mappings":";AA0BO,IAAM,8BAAwD;","names":[]}
@@ -31,6 +31,43 @@ module.exports = __toCommonJS(mcp_exports);
31
31
  // matrx/client.ts
32
32
  var import_data = require("@ai-matrx/data");
33
33
  var import_data2 = require("@ai-matrx/data");
34
+ var import_net2 = require("@ai-matrx/data/net");
35
+
36
+ // matrx/backend-errors.ts
37
+ var BackendApiError = class extends Error {
38
+ /** Machine-readable error code */
39
+ code;
40
+ /** Developer-facing detail */
41
+ detail;
42
+ /** Safe to display directly in the UI */
43
+ userMessage;
44
+ /** Extra info (validation errors, etc.) */
45
+ details;
46
+ /** Unique request ID for support/debugging */
47
+ requestId;
48
+ /** HTTP status code (if from an HTTP response) */
49
+ status;
50
+ constructor(data) {
51
+ super(data.userMessage);
52
+ this.name = "BackendApiError";
53
+ this.code = data.code;
54
+ this.detail = data.detail;
55
+ this.userMessage = data.userMessage;
56
+ this.details = data.details ?? null;
57
+ this.requestId = data.requestId ?? "";
58
+ this.status = data.status ?? null;
59
+ }
60
+ /** Convert to the wire format for logging */
61
+ toJSON() {
62
+ return {
63
+ error: this.code,
64
+ message: this.detail,
65
+ user_message: this.userMessage,
66
+ details: this.details,
67
+ request_id: this.requestId
68
+ };
69
+ }
70
+ };
34
71
 
35
72
  // matrx/org-context.ts
36
73
  var import_uuid = require("@ai-matrx/kit/uuid");
@@ -211,40 +248,83 @@ function extractMatrxErrorCode(serverDetail) {
211
248
  return null;
212
249
  }
213
250
 
251
+ // matrx/call.ts
252
+ var BARE_TRANSPORT_CODE = /^\s*(?:HTTP|HTTP\s*Error|Status(?:\s*Code)?)?\s*[:\-]?\s*\d{3}\s*[.:!]?\s*$/i;
253
+ function isBareTransportCode(text) {
254
+ if (!text) return false;
255
+ return BARE_TRANSPORT_CODE.test(text);
256
+ }
257
+ function bareStatusSentence(status) {
258
+ if (status === 401 || status === 403) {
259
+ return "The server would not let this request through \u2014 your session may have expired, or this account may not have access here. Sign in again, and if it repeats, ask an administrator.";
260
+ }
261
+ if (status === 404) {
262
+ return "The server has nothing at that address. Reload the page; if it repeats, report it \u2014 a client asking for something that no longer exists is a defect, not your mistake.";
263
+ }
264
+ if (status === 429) {
265
+ return "The server is rate-limiting this request. Wait a few seconds and try again.";
266
+ }
267
+ if (status >= 500) {
268
+ return "The server failed while answering this, and sent no explanation. Try again in a moment; if it repeats, report it with the request id above.";
269
+ }
270
+ return "The server refused this request and sent no reason with it \u2014 the missing reason is itself a defect worth reporting. Reload the page and try once more; if it repeats, report it with the request id above.";
271
+ }
272
+ function honestTransportMessage(raw, status) {
273
+ if (raw && !isBareTransportCode(raw)) return raw;
274
+ return bareStatusSentence(status ?? 0);
275
+ }
276
+
214
277
  // matrx/client.ts
215
278
  function classifyStatus(status) {
216
279
  return status >= 400 && status < 500 ? "validation_error" : "http_error";
217
280
  }
218
281
  function normalizeMatrxError(err) {
282
+ if (err instanceof OrganizationContextError) {
283
+ return {
284
+ type: "validation_error",
285
+ message: err.message,
286
+ code: err.code,
287
+ name: err.name,
288
+ ...err.stack !== void 0 ? { stack: err.stack } : {}
289
+ };
290
+ }
291
+ if (err instanceof DOMException && err.name === "AbortError") {
292
+ return { type: "abort_error", message: "Request was cancelled." };
293
+ }
219
294
  if (err instanceof MatrxApiError) {
220
295
  return {
221
296
  type: classifyStatus(err.status),
222
- message: err.message,
297
+ message: honestTransportMessage(err.message, err.status),
223
298
  status: err.status,
224
299
  serverDetail: err.serverDetail,
225
300
  ...err.code ? { code: err.code } : {},
226
301
  name: err.name
227
302
  };
228
303
  }
229
- if (err instanceof OrganizationContextError) {
304
+ if (err instanceof BackendApiError) {
230
305
  return {
231
- type: "validation_error",
232
- message: err.message,
306
+ type: "network_error",
307
+ message: honestTransportMessage(
308
+ err.detail || err.userMessage,
309
+ err.status ?? void 0
310
+ ),
233
311
  code: err.code,
234
312
  name: err.name,
235
- ...err.stack !== void 0 ? { stack: err.stack } : {}
313
+ ...err.status !== null ? { status: err.status } : {},
314
+ ...err.details !== null ? { serverDetail: err.details } : {}
236
315
  };
237
316
  }
238
- if (err instanceof DOMException && err.name === "AbortError") {
239
- return { type: "abort_error", message: "Request was cancelled." };
240
- }
241
317
  if ((0, import_data.isNetError)(err)) {
242
318
  if (err.code === "aborted") {
243
319
  return { type: "abort_error", message: err.message };
244
320
  }
245
321
  if (err.code === "http") {
246
322
  const status = err.status ?? 0;
247
- return { type: classifyStatus(status), message: err.message, status };
323
+ return {
324
+ type: classifyStatus(status),
325
+ message: honestTransportMessage(err.message, status),
326
+ status
327
+ };
248
328
  }
249
329
  return { type: "network_error", message: err.message };
250
330
  }
@@ -254,13 +334,21 @@ function normalizeMatrxError(err) {
254
334
  const status = parseInt(httpMatch[1], 10);
255
335
  return {
256
336
  type: classifyStatus(status),
257
- message: httpMatch[2] ?? err.message,
337
+ message: honestTransportMessage(httpMatch[2] ?? err.message, status),
338
+ status
339
+ };
340
+ }
341
+ if (isBareTransportCode(err.message)) {
342
+ const status = Number.parseInt(err.message.replace(/\D+/g, ""), 10);
343
+ return {
344
+ type: classifyStatus(status),
345
+ message: bareStatusSentence(status),
258
346
  status
259
347
  };
260
348
  }
261
349
  return { type: "network_error", message: err.message };
262
350
  }
263
- return { type: "unknown", message: String(err ?? "Unknown error") };
351
+ return { type: "unknown", message: (0, import_net2.extractErrorMessage)(err) };
264
352
  }
265
353
  var PRODUCTION_CONNECT_TIMEOUT_MS = 15e3;
266
354
  function stripContentType(headers) {