@openviking/react 0.1.1 → 0.1.3
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/README.md +18 -15
- package/dist/1~0.js +506 -0
- package/dist/2~0.js +122 -0
- package/dist/30~0.js +1332 -0
- package/dist/3~0.js +2113 -4
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/c7~0.js +24 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/paths.d.ts +64 -0
- package/dist/client/response.d.ts +31 -0
- package/dist/client/sse.d.ts +39 -0
- package/dist/client/stream.d.ts +26 -0
- package/dist/client/types.d.ts +104 -0
- package/dist/client.js +1 -239
- package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
- package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect.d.ts +3 -3
- package/dist/components/agent-connect/content-en.d.ts +137 -0
- package/dist/components/agent-connect/content-zh.d.ts +137 -0
- package/dist/components/agent-connect/style.css +495 -6
- package/dist/components/agent-connect/types.d.ts +20 -166
- package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
- package/dist/components/file-browser-entries/index.d.ts +1 -0
- package/dist/components/file-browser-entries/style.css +155 -0
- package/dist/components/file-browser-entries/types.d.ts +45 -0
- package/dist/components/file-browser-entries.js +1 -0
- package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
- package/dist/components/file-preview/file-preview-body.d.ts +24 -12
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
- package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
- package/dist/components/file-preview/file-preview-directory.d.ts +32 -0
- package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
- package/dist/components/file-preview/file-preview-header.d.ts +41 -14
- package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +41 -0
- package/dist/components/file-preview/file-preview-path.d.ts +30 -0
- package/dist/components/file-preview/file-preview-source.d.ts +24 -0
- package/dist/components/file-preview/file-preview-state.d.ts +35 -0
- package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
- package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
- package/dist/components/file-preview/file-preview.d.ts +9 -11
- package/dist/components/file-preview/level-selection.d.ts +25 -0
- package/dist/components/file-preview/style.css +4055 -126
- package/dist/components/file-preview/types.d.ts +350 -170
- package/dist/components/file-preview/use-directory-level.d.ts +30 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +27 -0
- package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
- package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -442
- package/dist/components/file-tree/file-tree-body.d.ts +8 -4
- package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
- package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
- package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
- package/dist/components/file-tree/file-tree-info.d.ts +29 -0
- package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
- package/dist/components/file-tree/file-tree-row-context.d.ts +29 -12
- package/dist/components/file-tree/file-tree-row-shared.d.ts +18 -0
- package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
- package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
- package/dist/components/file-tree/file-tree.d.ts +12 -1
- package/dist/components/file-tree/style.css +280 -75
- package/dist/components/file-tree/types.d.ts +203 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
- package/dist/components/file-tree.js +1 -1
- package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
- package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +282 -76
- package/dist/components/scope-switcher/types.d.ts +230 -108
- package/dist/components/style.css +14128 -390
- package/dist/components/tui/command-catalog.d.ts +58 -0
- package/dist/components/tui/command-completion.d.ts +19 -0
- package/dist/components/tui/command-definitions.d.ts +10 -0
- package/dist/components/tui/command-input.d.ts +16 -0
- package/dist/components/tui/style.css +1543 -5
- package/dist/components/tui/tui-assist.d.ts +15 -0
- package/dist/components/tui/tui-code-block.d.ts +8 -0
- package/dist/components/tui/tui-command-help.d.ts +9 -0
- package/dist/components/tui/tui-command-text.d.ts +6 -0
- package/dist/components/tui/tui-composer.d.ts +24 -0
- package/dist/components/tui/tui-copy-button.d.ts +9 -0
- package/dist/components/tui/tui-input-mirror.d.ts +14 -0
- package/dist/components/tui/tui-labels-zh.d.ts +2 -0
- package/dist/components/tui/tui-labels.d.ts +5 -0
- package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
- package/dist/components/tui/tui-markdown.d.ts +6 -0
- package/dist/components/tui/tui-param-hint.d.ts +7 -0
- package/dist/components/tui/tui-record-time.d.ts +11 -0
- package/dist/components/tui/tui-record.d.ts +13 -0
- package/dist/components/tui/tui-resource-preview.d.ts +10 -0
- package/dist/components/tui/tui-resource-tree.d.ts +10 -0
- package/dist/components/tui/tui-result-header.d.ts +7 -0
- package/dist/components/tui/tui-result-text.d.ts +5 -0
- package/dist/components/tui/tui-search-list.d.ts +8 -0
- package/dist/components/tui/tui-skeleton.d.ts +6 -0
- package/dist/components/tui/tui-status-card.d.ts +7 -0
- package/dist/components/tui/tui-text.d.ts +10 -0
- package/dist/components/tui/tui-uri-text.d.ts +19 -0
- package/dist/components/tui/tui-write-result.d.ts +7 -0
- package/dist/components/tui/tui.d.ts +10 -2
- package/dist/components/tui/types.d.ts +57 -15
- package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
- package/dist/components/tui/use-tui-completion.d.ts +14 -0
- package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
- package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
- package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
- package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
- package/dist/components/viking-bot/index.d.ts +10 -0
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
- package/dist/components/viking-bot/interaction/index.d.ts +4 -0
- package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
- package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
- package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
- package/dist/components/viking-bot/interaction/style.css +189 -0
- package/dist/components/viking-bot/interaction/style.js +0 -0
- package/dist/components/viking-bot/interaction/types.d.ts +188 -0
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
- package/dist/components/viking-bot/interaction.js +2 -0
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
- package/dist/components/viking-bot/message-groups.d.ts +12 -0
- package/dist/components/viking-bot/model.d.ts +252 -0
- package/dist/components/viking-bot/render-part.d.ts +12 -0
- package/dist/components/viking-bot/style.css +7135 -0
- package/dist/components/viking-bot/style.js +0 -0
- package/dist/components/viking-bot/types.d.ts +140 -0
- package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
- package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
- package/dist/components/viking-bot/viking-bot.d.ts +16 -0
- package/dist/components/viking-bot.js +4 -0
- package/dist/c~0.js +201 -0
- package/dist/file-preview-viewer~0.js +191 -0
- package/dist/f~0.js +149 -77
- package/dist/h~0.js +58 -0
- package/dist/icons/file-type-icon.d.ts +31 -0
- package/dist/icons/index.d.ts +33 -23
- package/dist/icons/nextjs-icon.d.ts +19 -0
- package/dist/icons.js +1 -25
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +25 -12
- package/dist/l~0.js +1464 -25
- package/dist/modules/console/style.css +83 -1
- package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +33 -0
- package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
- package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
- package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-labels.d.ts +28 -0
- package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +30 -0
- package/dist/modules/file-browser/file-browser.d.ts +14 -5
- package/dist/modules/file-browser/find-result.d.ts +24 -0
- package/dist/modules/file-browser/fs-directories.d.ts +33 -0
- package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
- package/dist/modules/file-browser/fs-icon.d.ts +17 -0
- package/dist/modules/file-browser/fs-model.d.ts +106 -0
- package/dist/modules/file-browser/fs-page.d.ts +16 -0
- package/dist/modules/file-browser/fs-path.d.ts +16 -0
- package/dist/modules/file-browser/fs-read-directory.d.ts +20 -0
- package/dist/modules/file-browser/fs-scope.d.ts +22 -0
- package/dist/modules/file-browser/fs-stat.d.ts +25 -0
- package/dist/modules/file-browser/index.d.ts +3 -1
- package/dist/modules/file-browser/style.css +5009 -34
- package/dist/modules/file-browser/tree-info-copy.d.ts +15 -0
- package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +15 -0
- package/dist/modules/file-browser/types.d.ts +189 -44
- package/dist/modules/file-browser/use-container-width.d.ts +17 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +49 -0
- package/dist/modules/file-browser/use-fs-preview.d.ts +51 -0
- package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
- package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
- package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
- package/dist/modules/file-browser.js +1 -1
- package/dist/modules/scope-cascade/style.css +282 -76
- package/dist/modules/style.css +5445 -130
- package/dist/n~0.js +568 -236
- package/dist/o~0.js +103 -0
- package/dist/shared/components/divider/divider.d.ts +18 -0
- package/dist/shared/components/divider/index.d.ts +1 -0
- package/dist/shared/components/divider/types.d.ts +35 -0
- package/dist/shared/components/overlay/types.d.ts +7 -0
- package/dist/shared/components/overlay/use-overlay-position.d.ts +38 -0
- package/dist/shared/components/popover/index.d.ts +1 -0
- package/dist/shared/components/popover/popover.d.ts +23 -0
- package/dist/shared/components/popover/types.d.ts +50 -0
- package/dist/shared/components/resizable/clamp.d.ts +13 -0
- package/dist/shared/components/resizable/index.d.ts +2 -0
- package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
- package/dist/shared/components/resizable/types.d.ts +48 -0
- package/dist/shared/components/tooltip/index.d.ts +1 -0
- package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
- package/dist/shared/components/tooltip/types.d.ts +42 -0
- package/dist/style.css +19664 -530
- package/dist/u~0.js +1597 -4
- package/dist/viking-bot-composer~0.js +164 -0
- package/dist/viking-bot-interaction~0.js +284 -0
- package/dist/w~0.js +19 -0
- package/package.json +23 -10
- package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
- package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
- package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
- package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
- package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
- package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -11
- package/dist/i~0.js +0 -21
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
- package/dist/modules/task-center/columns.d.ts +0 -129
- package/dist/modules/task-center/index.d.ts +0 -1
- package/dist/modules/task-center/style.css +0 -29
- package/dist/modules/task-center/task-center.d.ts +0 -4
- package/dist/modules/task-center/types.d.ts +0 -168
- package/dist/modules/task-center.js +0 -1
- /package/dist/{modules/task-center → components/file-browser-entries}/style.js +0 -0
package/dist/client.js
CHANGED
|
@@ -1,239 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { createContext, useContext as external_react_useContext, useMemo } from "react";
|
|
3
|
-
class OvClientError extends Error {
|
|
4
|
-
code;
|
|
5
|
-
statusCode;
|
|
6
|
-
details;
|
|
7
|
-
requestId;
|
|
8
|
-
responseBody;
|
|
9
|
-
constructor(options){
|
|
10
|
-
super(options.message, void 0 === options.cause ? void 0 : {
|
|
11
|
-
cause: options.cause
|
|
12
|
-
});
|
|
13
|
-
this.name = 'OvClientError';
|
|
14
|
-
this.code = options.code;
|
|
15
|
-
this.statusCode = options.statusCode;
|
|
16
|
-
this.details = options.details;
|
|
17
|
-
this.requestId = options.requestId;
|
|
18
|
-
this.responseBody = options.responseBody;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function isOvClientError(value) {
|
|
22
|
-
return value instanceof OvClientError;
|
|
23
|
-
}
|
|
24
|
-
const IDENTITY_HEADERS = {
|
|
25
|
-
apiKey: 'X-API-Key',
|
|
26
|
-
accountId: 'X-OpenViking-Account',
|
|
27
|
-
userId: 'X-OpenViking-User',
|
|
28
|
-
resourceId: 'V-Resource-Id'
|
|
29
|
-
};
|
|
30
|
-
async function evaluate(value) {
|
|
31
|
-
if (void 0 === value) return;
|
|
32
|
-
return 'function' == typeof value ? await value() : value;
|
|
33
|
-
}
|
|
34
|
-
async function resolveIdentityLayer(options) {
|
|
35
|
-
const layer = {};
|
|
36
|
-
for (const field of Object.keys(IDENTITY_HEADERS)){
|
|
37
|
-
const value = await evaluate(options?.[field]);
|
|
38
|
-
if (void 0 !== value) layer[field] = value;
|
|
39
|
-
}
|
|
40
|
-
return layer;
|
|
41
|
-
}
|
|
42
|
-
function mergeIdentityLayers(far, near) {
|
|
43
|
-
return {
|
|
44
|
-
...far,
|
|
45
|
-
...near
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function toHeaders(layer) {
|
|
49
|
-
const out = {};
|
|
50
|
-
for (const field of Object.keys(IDENTITY_HEADERS)){
|
|
51
|
-
const value = layer[field]?.trim();
|
|
52
|
-
if (value) out[IDENTITY_HEADERS[field].toLowerCase()] = value;
|
|
53
|
-
}
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
function resolveClientOptions(options, identity) {
|
|
57
|
-
return {
|
|
58
|
-
baseURL: options.baseURL ?? '',
|
|
59
|
-
credentials: options.credentials ?? 'same-origin',
|
|
60
|
-
headers: toHeaders(identity),
|
|
61
|
-
signal: options.signal
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function resolveRequestOptions(local, parent, mergedLayer) {
|
|
65
|
-
const headers = {
|
|
66
|
-
...parent.headers
|
|
67
|
-
};
|
|
68
|
-
for (const field of Object.keys(IDENTITY_HEADERS)){
|
|
69
|
-
const value = mergedLayer[field];
|
|
70
|
-
if (void 0 === value) continue;
|
|
71
|
-
const name = IDENTITY_HEADERS[field].toLowerCase();
|
|
72
|
-
if (value.trim()) headers[name] = value;
|
|
73
|
-
else delete headers[name];
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
baseURL: local?.baseURL ?? parent.baseURL,
|
|
77
|
-
credentials: parent.credentials,
|
|
78
|
-
headers,
|
|
79
|
-
signal: local?.signal ?? parent.signal
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function joinUrl(baseURL, path) {
|
|
83
|
-
const prefix = baseURL.replace(/\/+$/, '');
|
|
84
|
-
return `${prefix}${path.startsWith('/') ? path : `/${path}`}`;
|
|
85
|
-
}
|
|
86
|
-
function buildQuery(query) {
|
|
87
|
-
if (!query) return '';
|
|
88
|
-
const params = new URLSearchParams();
|
|
89
|
-
for (const [key, value] of Object.entries(query))if (null != value) {
|
|
90
|
-
if (Array.isArray(value)) {
|
|
91
|
-
for (const item of value)params.append(key, String(item));
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
params.set(key, String(value));
|
|
95
|
-
}
|
|
96
|
-
const text = params.toString();
|
|
97
|
-
return text ? `?${text}` : '';
|
|
98
|
-
}
|
|
99
|
-
function mergeProviderConfig(inherited, local) {
|
|
100
|
-
const declared = {};
|
|
101
|
-
if (void 0 !== local.apiKey) declared.apiKey = local.apiKey;
|
|
102
|
-
if (void 0 !== local.accountId) declared.accountId = local.accountId;
|
|
103
|
-
if (void 0 !== local.userId) declared.userId = local.userId;
|
|
104
|
-
if (void 0 !== local.resourceId) declared.resourceId = local.resourceId;
|
|
105
|
-
return {
|
|
106
|
-
baseURL: local.baseURL ?? inherited?.baseURL,
|
|
107
|
-
credentials: local.credentials ?? inherited?.credentials,
|
|
108
|
-
signal: local.signal ?? inherited?.signal,
|
|
109
|
-
fetch: local.fetch ?? inherited?.fetch,
|
|
110
|
-
identity: {
|
|
111
|
-
...inherited?.identity,
|
|
112
|
-
...declared
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function isRecord(value) {
|
|
117
|
-
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
118
|
-
}
|
|
119
|
-
function readEnvelope(value) {
|
|
120
|
-
return isRecord(value) ? value : {};
|
|
121
|
-
}
|
|
122
|
-
function isAbortError(error) {
|
|
123
|
-
return isRecord(error) && ('AbortError' === error.name || 'ABORT_ERR' === error.code);
|
|
124
|
-
}
|
|
125
|
-
function normalizeTransportError(error, signal) {
|
|
126
|
-
if (isAbortError(error) || signal?.aborted) throw error;
|
|
127
|
-
throw new OvClientError({
|
|
128
|
-
code: 'NETWORK_ERROR',
|
|
129
|
-
message: error instanceof Error ? error.message : 'Network request failed',
|
|
130
|
-
cause: error
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function createOvClient(options = {}) {
|
|
134
|
-
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
135
|
-
if (!fetchImpl) throw new Error('createOvClient needs a fetch implementation. Pass `fetch` on platforms without a global one.');
|
|
136
|
-
const defaults = options;
|
|
137
|
-
const client = {
|
|
138
|
-
get baseURL () {
|
|
139
|
-
return defaults.baseURL ?? '';
|
|
140
|
-
},
|
|
141
|
-
async request (spec) {
|
|
142
|
-
const baseLayer = await resolveIdentityLayer(defaults);
|
|
143
|
-
const localLayer = await resolveIdentityLayer(spec.options);
|
|
144
|
-
const parent = resolveClientOptions(defaults, baseLayer);
|
|
145
|
-
const effective = resolveRequestOptions(spec.options, parent, mergeIdentityLayers(baseLayer, localLayer));
|
|
146
|
-
const url = joinUrl(effective.baseURL, spec.path) + buildQuery(spec.query);
|
|
147
|
-
const hasBody = void 0 !== spec.body;
|
|
148
|
-
const headers = hasBody ? {
|
|
149
|
-
'content-type': 'application/json',
|
|
150
|
-
...effective.headers
|
|
151
|
-
} : effective.headers;
|
|
152
|
-
let response;
|
|
153
|
-
try {
|
|
154
|
-
response = await fetchImpl(url, {
|
|
155
|
-
method: spec.method,
|
|
156
|
-
headers,
|
|
157
|
-
body: hasBody ? JSON.stringify(spec.body) : void 0,
|
|
158
|
-
credentials: effective.credentials,
|
|
159
|
-
signal: effective.signal
|
|
160
|
-
});
|
|
161
|
-
} catch (error) {
|
|
162
|
-
normalizeTransportError(error, effective.signal);
|
|
163
|
-
}
|
|
164
|
-
let raw;
|
|
165
|
-
try {
|
|
166
|
-
raw = await response.text();
|
|
167
|
-
} catch (error) {
|
|
168
|
-
normalizeTransportError(error, effective.signal);
|
|
169
|
-
}
|
|
170
|
-
let body;
|
|
171
|
-
if (raw.trim()) try {
|
|
172
|
-
body = JSON.parse(raw);
|
|
173
|
-
} catch {
|
|
174
|
-
body = raw;
|
|
175
|
-
}
|
|
176
|
-
const envelope = readEnvelope(body);
|
|
177
|
-
const requestId = response.headers.get('x-request-id') ?? void 0;
|
|
178
|
-
if (!response.ok) throw new OvClientError({
|
|
179
|
-
code: envelope.error?.code ?? `HTTP_${response.status}`,
|
|
180
|
-
message: envelope.error?.message ?? response.statusText,
|
|
181
|
-
statusCode: response.status,
|
|
182
|
-
details: envelope.error?.details,
|
|
183
|
-
requestId,
|
|
184
|
-
responseBody: body
|
|
185
|
-
});
|
|
186
|
-
if ('error' === envelope.status) throw new OvClientError({
|
|
187
|
-
code: envelope.error?.code ?? 'UNKNOWN',
|
|
188
|
-
message: envelope.error?.message ?? 'Request failed',
|
|
189
|
-
statusCode: response.status,
|
|
190
|
-
details: envelope.error?.details,
|
|
191
|
-
requestId,
|
|
192
|
-
responseBody: body
|
|
193
|
-
});
|
|
194
|
-
return 'result' in envelope ? envelope.result : body;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
return client;
|
|
198
|
-
}
|
|
199
|
-
const OvClientContext = /*#__PURE__*/ createContext(null);
|
|
200
|
-
function OpenVikingProvider({ baseURL, apiKey, accountId, userId, resourceId, credentials, signal, fetch, children }) {
|
|
201
|
-
const parent = external_react_useContext(OvClientContext);
|
|
202
|
-
const value = useMemo(()=>{
|
|
203
|
-
const base = mergeProviderConfig(parent?.base, {
|
|
204
|
-
baseURL,
|
|
205
|
-
apiKey,
|
|
206
|
-
accountId,
|
|
207
|
-
userId,
|
|
208
|
-
resourceId,
|
|
209
|
-
credentials,
|
|
210
|
-
signal,
|
|
211
|
-
fetch
|
|
212
|
-
});
|
|
213
|
-
return {
|
|
214
|
-
base,
|
|
215
|
-
client: createOvClient({
|
|
216
|
-
...base.identity,
|
|
217
|
-
baseURL: base.baseURL,
|
|
218
|
-
credentials: base.credentials,
|
|
219
|
-
signal: base.signal,
|
|
220
|
-
fetch: base.fetch
|
|
221
|
-
})
|
|
222
|
-
};
|
|
223
|
-
}, [
|
|
224
|
-
parent,
|
|
225
|
-
baseURL,
|
|
226
|
-
apiKey,
|
|
227
|
-
accountId,
|
|
228
|
-
userId,
|
|
229
|
-
resourceId,
|
|
230
|
-
credentials,
|
|
231
|
-
signal,
|
|
232
|
-
fetch
|
|
233
|
-
]);
|
|
234
|
-
return /*#__PURE__*/ jsx(OvClientContext.Provider, {
|
|
235
|
-
value: value,
|
|
236
|
-
children: children
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
export { OpenVikingProvider, OvClientError, createOvClient, isOvClientError };
|
|
1
|
+
export { OV_PATHS, OV_PATH_BUILDERS, OpenVikingProvider, OvClientError, createOvClient, isOvClientError } from "./1~0.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const AGENT_CONNECT_COPY: {
|
|
2
|
+
zh: {
|
|
3
|
+
title: string;
|
|
4
|
+
mainstream: string;
|
|
5
|
+
custom: string;
|
|
6
|
+
integration: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
copy: string;
|
|
9
|
+
copyMarkdown: string;
|
|
10
|
+
copied: string;
|
|
11
|
+
failed: string;
|
|
12
|
+
notice: string;
|
|
13
|
+
seeAgreement: string;
|
|
14
|
+
agreement: string;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
overseas: string;
|
|
17
|
+
};
|
|
18
|
+
en: {
|
|
19
|
+
title: string;
|
|
20
|
+
mainstream: string;
|
|
21
|
+
custom: string;
|
|
22
|
+
integration: string;
|
|
23
|
+
instructions: string;
|
|
24
|
+
copy: string;
|
|
25
|
+
copyMarkdown: string;
|
|
26
|
+
copied: string;
|
|
27
|
+
failed: string;
|
|
28
|
+
notice: string;
|
|
29
|
+
seeAgreement: string;
|
|
30
|
+
agreement: string;
|
|
31
|
+
apiKey: string;
|
|
32
|
+
overseas: string;
|
|
33
|
+
};
|
|
34
|
+
};
|