@hex4c59/pi-ext-qoder 0.0.0-stage → 0.1.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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/NOTICE +9 -0
- package/README.md +152 -3
- package/THIRD_PARTY.md +13 -0
- package/extensions/qoder.ts +960 -0
- package/lib/account.ts +129 -0
- package/lib/catalog.ts +228 -0
- package/lib/credit-report.ts +112 -0
- package/lib/model-report.ts +107 -0
- package/lib/qoder-core.mjs +864 -0
- package/lib/request-body.ts +48 -0
- package/lib/sse.ts +63 -0
- package/lib/types.ts +100 -0
- package/lib/usage-ui.ts +353 -0
- package/lib/web-search.ts +171 -0
- package/package.json +57 -6
- package/scripts/prepare-signing.mjs +51 -0
- package/vendor/LICENSE.qoder +202 -0
- package/vendor/PROVENANCE.md +42 -0
- package/vendor/auth_glue.mjs +14 -0
- package/vendor/auth_wasm.wasm +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qoder 网页搜索(`/algo/api/v1/webSearch/oneSearch`)。
|
|
3
|
+
*
|
|
4
|
+
* 该接口由 Qoder 客户端内置的 `WebSearch` 工具使用,与模型能力无关:
|
|
5
|
+
* 客户端自己请求搜索网关,把 `pageItems` 作为工具结果回填给模型。
|
|
6
|
+
*
|
|
7
|
+
* 请求要求登录与 WASM 签名,body 是加密信封:
|
|
8
|
+
* `{ payload: "<json string>", encodeVersion: "1" }`。
|
|
9
|
+
*/
|
|
10
|
+
import { CONFIG, ensureAuthWasm, signChatRequest } from './qoder-core.mjs'
|
|
11
|
+
import type { QoderCredential } from './types.ts'
|
|
12
|
+
|
|
13
|
+
/** CN 网关自带的搜索路径;国际版同一路径挂在 `api*.qoder.sh`。 */
|
|
14
|
+
export const SEARCH_PATH = '/api/v1/webSearch/oneSearch?Encode=1'
|
|
15
|
+
const SEARCH_TIMEOUT_MS = 20_000
|
|
16
|
+
|
|
17
|
+
export interface SearchHit {
|
|
18
|
+
title: string
|
|
19
|
+
link: string
|
|
20
|
+
snippet: string
|
|
21
|
+
publishedTime?: string
|
|
22
|
+
hostname?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SearchResult {
|
|
26
|
+
query: string
|
|
27
|
+
hits: SearchHit[]
|
|
28
|
+
errorCode: number
|
|
29
|
+
errorMessage?: string
|
|
30
|
+
requestId?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
34
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function text(value: unknown): string {
|
|
38
|
+
return typeof value === 'string' ? value : ''
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** 请求体与 Qoder 客户端的 `search()` 保持一致;关闭正文抓取以控制上下文体积。 */
|
|
42
|
+
export function searchBody(query: string, options: {
|
|
43
|
+
allowedDomains?: string[]
|
|
44
|
+
blockedDomains?: string[]
|
|
45
|
+
requestSetId?: string
|
|
46
|
+
} = {}): Record<string, unknown> {
|
|
47
|
+
const payload = {
|
|
48
|
+
query,
|
|
49
|
+
...(options.allowedDomains?.length ? { allowed_domains: options.allowedDomains } : {}),
|
|
50
|
+
...(options.blockedDomains?.length ? { blocked_domains: options.blockedDomains } : {}),
|
|
51
|
+
timeRange: 'NoLimit',
|
|
52
|
+
contents: { mainText: false, markdownText: false, summary: false },
|
|
53
|
+
...(options.requestSetId ? { request_set_id: options.requestSetId } : {}),
|
|
54
|
+
}
|
|
55
|
+
return { payload: JSON.stringify(payload), encodeVersion: '1' }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** 兼容 pageItems/page_items 与 camelCase/snake_case 字段。 */
|
|
59
|
+
export function parseSearchResult(body: unknown, query: string): SearchResult {
|
|
60
|
+
const data = isRecord(body) && isRecord(body.data) ? body.data : body
|
|
61
|
+
if (!isRecord(data)) throw new Error('Qoder web search response is not an object')
|
|
62
|
+
const items = Array.isArray(data.pageItems)
|
|
63
|
+
? data.pageItems
|
|
64
|
+
: Array.isArray(data.page_items) ? data.page_items : []
|
|
65
|
+
const hits: SearchHit[] = []
|
|
66
|
+
for (const item of items) {
|
|
67
|
+
if (!isRecord(item)) continue
|
|
68
|
+
const link = text(item.link)
|
|
69
|
+
if (link === '') continue
|
|
70
|
+
hits.push({
|
|
71
|
+
title: text(item.title),
|
|
72
|
+
link,
|
|
73
|
+
snippet: text(item.snippet),
|
|
74
|
+
...(text(item.publishedTime ?? item.published_time) ? { publishedTime: text(item.publishedTime ?? item.published_time) } : {}),
|
|
75
|
+
...(text(item.hostname) ? { hostname: text(item.hostname) } : {}),
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
const errorCode = typeof data.errorCode === 'number' ? data.errorCode
|
|
79
|
+
: typeof data.error_code === 'number' ? data.error_code : 0
|
|
80
|
+
return {
|
|
81
|
+
query,
|
|
82
|
+
hits,
|
|
83
|
+
errorCode,
|
|
84
|
+
...(text(data.errorMsg ?? data.error_msg) ? { errorMessage: text(data.errorMsg ?? data.error_msg) } : {}),
|
|
85
|
+
...(text(data.requestId ?? data.request_id) ? { requestId: text(data.requestId ?? data.request_id) } : {}),
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** 用与对话相同的 WASM 上下文签名搜索请求,避免另写一套加密逻辑。 */
|
|
90
|
+
export async function signSearchRequest(body: unknown, credential: QoderCredential, {
|
|
91
|
+
endpoint = CONFIG.endpoint,
|
|
92
|
+
cliVersion = CONFIG.cliVersion,
|
|
93
|
+
}: { endpoint?: string; cliVersion?: string } = {}) {
|
|
94
|
+
const signed = await signChatRequest(body as Record<string, unknown>, {
|
|
95
|
+
machineId: credential.machineId ?? '',
|
|
96
|
+
...(credential.uid === undefined ? {} : { uid: credential.uid }),
|
|
97
|
+
...(credential.encryptUserInfo === undefined ? {} : { encryptUserInfo: credential.encryptUserInfo }),
|
|
98
|
+
...(credential.signingKey === undefined ? {} : { signingKey: credential.signingKey }),
|
|
99
|
+
...(credential.dataPolicy === undefined ? {} : { dataPolicy: credential.dataPolicy }),
|
|
100
|
+
}, {
|
|
101
|
+
endpoint,
|
|
102
|
+
apiPath: SEARCH_PATH,
|
|
103
|
+
cliVersion,
|
|
104
|
+
})
|
|
105
|
+
// 搜索返回 JSON,不是 SSE;去掉对话专用的流式头。
|
|
106
|
+
for (const name of ['accept', 'cache-control', 'x-model-key', 'x-model-source']) {
|
|
107
|
+
for (const key of Object.keys(signed.headers)) {
|
|
108
|
+
if (key.toLowerCase() === name) delete signed.headers[key]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
signed.headers.accept = 'application/json'
|
|
112
|
+
return signed
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export async function searchWeb(
|
|
116
|
+
query: string,
|
|
117
|
+
credential: QoderCredential,
|
|
118
|
+
options: {
|
|
119
|
+
signal?: AbortSignal
|
|
120
|
+
fetchImpl?: typeof fetch
|
|
121
|
+
endpoint?: string
|
|
122
|
+
allowedDomains?: string[]
|
|
123
|
+
blockedDomains?: string[]
|
|
124
|
+
requestSetId?: string
|
|
125
|
+
} = {},
|
|
126
|
+
): Promise<SearchResult> {
|
|
127
|
+
const trimmed = query.trim()
|
|
128
|
+
if (trimmed === '') throw new Error('Qoder web search needs a non-empty query')
|
|
129
|
+
options.signal?.throwIfAborted()
|
|
130
|
+
const signed = await signSearchRequest(searchBody(trimmed, options), credential, {
|
|
131
|
+
...(options.endpoint === undefined ? {} : { endpoint: options.endpoint }),
|
|
132
|
+
})
|
|
133
|
+
const timeout = AbortSignal.timeout(SEARCH_TIMEOUT_MS)
|
|
134
|
+
const signal = options.signal === undefined ? timeout : AbortSignal.any([options.signal, timeout])
|
|
135
|
+
const response = await (options.fetchImpl ?? globalThis.fetch)(signed.url, {
|
|
136
|
+
method: 'POST',
|
|
137
|
+
headers: signed.headers,
|
|
138
|
+
body: signed.body,
|
|
139
|
+
signal,
|
|
140
|
+
})
|
|
141
|
+
if (!response.ok) {
|
|
142
|
+
await response.body?.cancel()
|
|
143
|
+
throw new Error(`Qoder web search returned HTTP ${response.status}`)
|
|
144
|
+
}
|
|
145
|
+
const raw = await response.text()
|
|
146
|
+
let parsed: unknown
|
|
147
|
+
try {
|
|
148
|
+
parsed = JSON.parse(raw)
|
|
149
|
+
} catch {
|
|
150
|
+
// 部分区域返回 WASM 加密响应,复用同一套解密逻辑。
|
|
151
|
+
const wasm = await ensureAuthWasm()
|
|
152
|
+
parsed = JSON.parse(wasm.decrypt_server_response(raw))
|
|
153
|
+
}
|
|
154
|
+
const result = parseSearchResult(parsed, trimmed)
|
|
155
|
+
if (result.errorCode !== 0) {
|
|
156
|
+
throw new Error(`Qoder web search failed (code ${result.errorCode})${result.errorMessage ? `: ${result.errorMessage}` : ''}`)
|
|
157
|
+
}
|
|
158
|
+
return result
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** 工具结果文本:标题、链接、摘要,控制长度避免撑爆上下文。 */
|
|
162
|
+
export function formatSearchResult(result: SearchResult, limit = 8): string {
|
|
163
|
+
if (result.hits.length === 0) return `No web results for "${result.query}".`
|
|
164
|
+
const lines = [`Web results for "${result.query}" (${Math.min(limit, result.hits.length)} shown):`]
|
|
165
|
+
for (const hit of result.hits.slice(0, limit)) {
|
|
166
|
+
lines.push('', `${hit.title || hit.hostname || hit.link}`, hit.link)
|
|
167
|
+
if (hit.snippet) lines.push(hit.snippet.replace(/\s+/g, ' ').slice(0, 400))
|
|
168
|
+
if (hit.publishedTime) lines.push(`Published: ${hit.publishedTime}`)
|
|
169
|
+
}
|
|
170
|
+
return lines.join('\n')
|
|
171
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hex4c59/pi-ext-qoder",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@hex4c59/pi-ext-qoder",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Qoder international provider for pi: device login, signed streaming, live models and credits",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Hex4C59/my-pi-extensions",
|
|
9
|
+
"directory": "qoder"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public" },
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22.19.0"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
18
|
+
"@earendil-works/pi-ai": "*",
|
|
19
|
+
"@earendil-works/pi-tui": "*"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@hex4c59/pi-ext-ui-kit": "^0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"pi": {
|
|
25
|
+
"extensions": [
|
|
26
|
+
"./extensions/qoder.ts"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
31
|
+
"@earendil-works/pi-ai": "1.5.0",
|
|
32
|
+
"@earendil-works/pi-tui": "1.5.0",
|
|
33
|
+
"@types/node": "^22.19.0",
|
|
34
|
+
"typescript": "^6.0.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "node tests/offline.mjs",
|
|
39
|
+
"test:process": "node tests/process.mjs",
|
|
40
|
+
"test:tui": "node tests/tui.mjs",
|
|
41
|
+
"prepare:signing": "node scripts/prepare-signing.mjs"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"extensions",
|
|
45
|
+
"lib",
|
|
46
|
+
"scripts",
|
|
47
|
+
"vendor/PROVENANCE.md",
|
|
48
|
+
"vendor/LICENSE.qoder",
|
|
49
|
+
"vendor/auth_glue.mjs",
|
|
50
|
+
"vendor/auth_wasm.wasm",
|
|
51
|
+
"THIRD_PARTY.md",
|
|
52
|
+
"CHANGELOG.md",
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"NOTICE",
|
|
55
|
+
"README.md"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** 从固定版本官方 CLI 静态提取本机签名资源;不执行 CLI,也不读取登录态。 */
|
|
3
|
+
import { createHash } from 'node:crypto'
|
|
4
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
|
5
|
+
import { dirname, join, resolve } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
9
|
+
const BUNDLE_SHA256 = 'ca132c21eb2eec93d41138a6911009ef1f8a1e92b3cb372793e36c98fa1ea688'
|
|
10
|
+
const WASM_SHA256 = 'c7a14b11d6c23b94ac39f6868ebd3dd6a70492efe87c864c33857adadb9f0951'
|
|
11
|
+
const digest = bytes => createHash('sha256').update(bytes).digest('hex')
|
|
12
|
+
|
|
13
|
+
const args = process.argv.slice(2)
|
|
14
|
+
if (args.length !== 2 || args[0] !== '--bundle') {
|
|
15
|
+
console.error('Usage: node scripts/prepare-signing.mjs --bundle <qodercli-1.1.85/package/bundle/qoder-worker-runtime.mjs>')
|
|
16
|
+
process.exitCode = 1
|
|
17
|
+
} else {
|
|
18
|
+
const bytes = await readFile(resolve(args[1]))
|
|
19
|
+
if (digest(bytes) !== BUNDLE_SHA256) throw new Error('Expected the unmodified @qoder-ai/qodercli@1.1.85 worker bundle; SHA-256 mismatch')
|
|
20
|
+
const source = bytes.toString('utf8')
|
|
21
|
+
let wasm
|
|
22
|
+
for (const match of source.matchAll(/['"](AGFzbQ[A-Za-z0-9+/=]{200,})['"]/g)) {
|
|
23
|
+
const candidate = Buffer.from(match[1], 'base64')
|
|
24
|
+
if (digest(candidate) === WASM_SHA256) { wasm = candidate; break }
|
|
25
|
+
}
|
|
26
|
+
if (!wasm) throw new Error('Pinned Qoder signing WASM not found')
|
|
27
|
+
// 此版本的 glue 是连续的顶层声明,边界由整个 bundle 的哈希固定。
|
|
28
|
+
const start = source.indexOf('var Api={};HA(Api,')
|
|
29
|
+
const end = source.indexOf('import*as WVA from"node:fs/promises";', start)
|
|
30
|
+
if (start < 0 || end <= start) throw new Error('Pinned Qoder signing glue boundaries not found')
|
|
31
|
+
const glue = `/** 从 Qoder CLI 1.1.85 提取;仅增加 ESM 导出、打包器辅助函数与 Node require 兼容。 */
|
|
32
|
+
import { createRequire } from 'node:module'
|
|
33
|
+
const module = { require: createRequire(import.meta.url) }
|
|
34
|
+
const HA = (target, getters) => {
|
|
35
|
+
for (const [key, get] of Object.entries(getters)) Object.defineProperty(target, key, { get, enumerable: true })
|
|
36
|
+
}
|
|
37
|
+
const C = initialize => {
|
|
38
|
+
let ready = false
|
|
39
|
+
return () => { if (!ready) { ready = true; initialize() } }
|
|
40
|
+
}
|
|
41
|
+
${source.slice(start, end)}
|
|
42
|
+
tpi()
|
|
43
|
+
export { Api as sUi }
|
|
44
|
+
export const initAuthWasm = Api.default
|
|
45
|
+
`
|
|
46
|
+
const vendor = join(ROOT, 'vendor')
|
|
47
|
+
await mkdir(vendor, { recursive: true })
|
|
48
|
+
await writeFile(join(vendor, 'auth_wasm.wasm'), wasm)
|
|
49
|
+
await writeFile(join(vendor, 'auth_glue.mjs'), glue)
|
|
50
|
+
console.log(`Prepared local Qoder 1.1.85 signing resources: WASM ${wasm.length} bytes, SHA-256 ${digest(wasm)}; glue SHA-256 ${digest(glue)}`)
|
|
51
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 国际版签名资源来源
|
|
2
|
+
|
|
3
|
+
`auth_wasm.wasm` 与 `auth_glue.mjs` 从官方 npm 包 **`@qoder-ai/qodercli@1.1.85`** 的 `package/bundle/qoder-worker-runtime.mjs` 静态提取。提取不启动 CLI、不访问登录态、不发送请求。未采用社区 provider 的签名实现。
|
|
4
|
+
|
|
5
|
+
| 输入或产物 | 大小 | SHA-256 |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| 官方 `qoder-worker-runtime.mjs` | 35,359,286 B | `ca132c21eb2eec93d41138a6911009ef1f8a1e92b3cb372793e36c98fa1ea688` |
|
|
8
|
+
| `auth_wasm.wasm` | 320,863 B | `c7a14b11d6c23b94ac39f6868ebd3dd6a70492efe87c864c33857adadb9f0951` |
|
|
9
|
+
| `auth_glue.mjs` | 17,957 B | `7aff75d30beffeda2861d4161d8a750d7d42b8e6deeb9745786d3796375e9511` |
|
|
10
|
+
|
|
11
|
+
官方包地址:`https://registry.npmjs.org/@qoder-ai/qodercli/-/qodercli-1.1.85.tgz`。
|
|
12
|
+
|
|
13
|
+
下载包的 npm integrity 为:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
sha512-Dzzt1g/LaajyK0tjvg3bsFve/x4VfRyWYpa4RKUENi5/ojnKTqdOsWvN+T9btbrsVqb+bu6lH80UlpgqVYG7/w==
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`auth_wasm.wasm` 保持官方原始字节;glue 保留官方绑定代码,仅增加 ESM 导出、打包器的惰性初始化/导出辅助函数和 Node `require` 兼容。使用 `QoderContext`、`generate_runtime_auth_fields` 和 `decrypt_server_response`,不调用模块中的 HTTPDNS 或其他外部服务功能。
|
|
20
|
+
|
|
21
|
+
## 分发包内容
|
|
22
|
+
|
|
23
|
+
npm 包的 `files` 白名单包含本目录的 `auth_wasm.wasm` 与 `auth_glue.mjs`,安装后即可生成签名。运行时按 `lib/qoder-core.mjs` 的 `AUTH_WASM_SHA256` 重新校验 WASM 字节,不匹配则拒绝加载。
|
|
24
|
+
|
|
25
|
+
官方包附带的原始许可证保存在 [LICENSE.qoder](LICENSE.qoder)。它是上游 npm 包随附的许可证原文,不构成本项目对嵌入资源独立分发权的额外判断;使用者需同时遵守上游许可证。
|
|
26
|
+
|
|
27
|
+
## 重新提取
|
|
28
|
+
|
|
29
|
+
新工作区需要重建这两个文件时,从 npm 官方 registry 下载固定版本并解压,压缩包及解压目录放在仓库外:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
npm pack @qoder-ai/qodercli@1.1.85 --ignore-scripts --pack-destination <temporary-directory>
|
|
33
|
+
tar -xzf <temporary-directory>/qoder-ai-qodercli-1.1.85.tgz -C <temporary-directory>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
然后在 `qoder/` 中运行:
|
|
37
|
+
|
|
38
|
+
```powershell
|
|
39
|
+
npm run prepare:signing -- --bundle <temporary-directory>/package/bundle/qoder-worker-runtime.mjs
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
脚本先核对整个官方 bundle 的 SHA-256,再核对内嵌 WASM 的 SHA-256;版本或字节不匹配就终止。输出资源存入本目录。升级时先复核官方协议、绑定边界和哈希,再更新脚本与本清单,不能仅改哈希绕过检查。来源及本地改动说明同时见 [THIRD_PARTY.md](../THIRD_PARTY.md)。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** 从 Qoder CLI 1.1.85 提取;仅增加 ESM 导出、打包器辅助函数与 Node require 兼容。 */
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
const module = { require: createRequire(import.meta.url) }
|
|
4
|
+
const HA = (target, getters) => {
|
|
5
|
+
for (const [key, get] of Object.entries(getters)) Object.defineProperty(target, key, { get, enumerable: true })
|
|
6
|
+
}
|
|
7
|
+
const C = initialize => {
|
|
8
|
+
let ready = false
|
|
9
|
+
return () => { if (!ready) { ready = true; initialize() } }
|
|
10
|
+
}
|
|
11
|
+
var Api={};HA(Api,{ClientContext:()=>glA,ProfileEncryptor:()=>flA,QoderContext:()=>plA,RequestResult:()=>D0e,build_httpdns_url:()=>c0c,credential_storage_decrypt:()=>l0c,credential_storage_encrypt:()=>u0c,decrypt_server_response:()=>d0c,default:()=>P0c,generate_runtime_auth_fields:()=>g0c,get_external_providers_feature_gate_fallback:()=>f0c,get_httpdns_account_id:()=>p0c,get_httpdns_config:()=>m0c,get_httpdns_secret_key:()=>E0c,get_profile_key_fingerprint:()=>h0c,initSync:()=>x0c,model_cache_decrypt:()=>I0c,model_cache_encrypt:()=>B0c,profile_encrypt:()=>Q0c});function c0c(A){let e,t;try{let o=Mt.__wbindgen_add_to_stack_pointer(-16),s=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),a=Qg;Mt.build_httpdns_url(o,s,a);var n=lo().getInt32(o+4*0,!0),r=lo().getInt32(o+4*1,!0);return e=n,t=r,lD(n,r)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(e,t,1)}}function l0c(A,e){let t,n;try{let u=Mt.__wbindgen_add_to_stack_pointer(-16),d=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),g=Qg,f=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg;Mt.credential_storage_decrypt(u,d,g,f,p);var r=lo().getInt32(u+4*0,!0),o=lo().getInt32(u+4*1,!0),s=lo().getInt32(u+4*2,!0),a=lo().getInt32(u+4*3,!0),c=r,l=o;if(a)throw c=0,l=0,lk(s);return t=c,n=l,lD(c,l)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(t,n,1)}}function u0c(A,e){let t,n;try{let u=Mt.__wbindgen_add_to_stack_pointer(-16),d=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),g=Qg,f=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg;Mt.credential_storage_encrypt(u,d,g,f,p);var r=lo().getInt32(u+4*0,!0),o=lo().getInt32(u+4*1,!0),s=lo().getInt32(u+4*2,!0),a=lo().getInt32(u+4*3,!0),c=r,l=o;if(a)throw c=0,l=0,lk(s);return t=c,n=l,lD(c,l)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(t,n,1)}}function d0c(A){let e,t;try{let l=Mt.__wbindgen_add_to_stack_pointer(-16),u=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),d=Qg;Mt.decrypt_server_response(l,u,d);var n=lo().getInt32(l+4*0,!0),r=lo().getInt32(l+4*1,!0),o=lo().getInt32(l+4*2,!0),s=lo().getInt32(l+4*3,!0),a=n,c=r;if(s)throw a=0,c=0,lk(o);return e=a,t=c,lD(a,c)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(e,t,1)}}function g0c(A){let e,t;try{let l=Mt.__wbindgen_add_to_stack_pointer(-16),u=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),d=Qg;Mt.generate_runtime_auth_fields(l,u,d);var n=lo().getInt32(l+4*0,!0),r=lo().getInt32(l+4*1,!0),o=lo().getInt32(l+4*2,!0),s=lo().getInt32(l+4*3,!0),a=n,c=r;if(s)throw a=0,c=0,lk(o);return e=a,t=c,lD(a,c)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(e,t,1)}}function f0c(){let A,e;try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.get_external_providers_feature_gate_fallback(r);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);return A=t,e=n,lD(t,n)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(A,e,1)}}function p0c(){let A,e;try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.get_httpdns_account_id(r);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);return A=t,e=n,lD(t,n)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(A,e,1)}}function m0c(){let A,e;try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.get_httpdns_config(r);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);return A=t,e=n,lD(t,n)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(A,e,1)}}function E0c(){let A,e;try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.get_httpdns_secret_key(r);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);return A=t,e=n,lD(t,n)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(A,e,1)}}function h0c(){let A,e;try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.get_profile_key_fingerprint(r);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);return A=t,e=n,lD(t,n)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(A,e,1)}}function I0c(A,e){let t,n;try{let u=Mt.__wbindgen_add_to_stack_pointer(-16),d=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),g=Qg,f=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg;Mt.model_cache_decrypt(u,d,g,f,p);var r=lo().getInt32(u+4*0,!0),o=lo().getInt32(u+4*1,!0),s=lo().getInt32(u+4*2,!0),a=lo().getInt32(u+4*3,!0),c=r,l=o;if(a)throw c=0,l=0,lk(s);return t=c,n=l,lD(c,l)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(t,n,1)}}function B0c(A,e){let t,n;try{let u=Mt.__wbindgen_add_to_stack_pointer(-16),d=qm(A,Mt.__wbindgen_export2,Mt.__wbindgen_export3),g=Qg,f=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg;Mt.model_cache_encrypt(u,d,g,f,p);var r=lo().getInt32(u+4*0,!0),o=lo().getInt32(u+4*1,!0),s=lo().getInt32(u+4*2,!0),a=lo().getInt32(u+4*3,!0),c=r,l=o;if(a)throw c=0,l=0,lk(s);return t=c,n=l,lD(c,l)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(t,n,1)}}function Q0c(A){try{let s=Mt.__wbindgen_add_to_stack_pointer(-16),a=vln(A,Mt.__wbindgen_export2),c=Qg;Mt.profile_encrypt(s,a,c);var e=lo().getInt32(s+4*0,!0),t=lo().getInt32(s+4*1,!0),n=lo().getInt32(s+4*2,!0),r=lo().getInt32(s+4*3,!0);if(r)throw lk(n);var o=S9e(e,t).slice();return Mt.__wbindgen_export4(e,t*1,1),o}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}function $fi(){return{__proto__:null,"./qoder_auth_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){let n=Error(lD(e,t));return ew(n)},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof CI(e)=="function"},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=CI(e);return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof CI(e)=="string"},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return CI(e)===void 0},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw new Error(lD(e,t))},__wbg_call_d578befcc3145dee:function(){return clA(function(e,t,n){let r=CI(e).call(CI(t),CI(n));return ew(r)},arguments)},__wbg_crypto_38df2bab126b63dc:function(e){let t=CI(e).crypto;return ew(t)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return clA(function(e,t){CI(e).getRandomValues(CI(t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return clA(function(e,t){globalThis.crypto.getRandomValues(S9e(e,t))},arguments)},__wbg_length_0c32cb8543c8e4c8:function(e){return CI(e).length},__wbg_msCrypto_bd5a034af96bcba6:function(e){let t=CI(e).msCrypto;return ew(t)},__wbg_new_99cabae501c0a8a0:function(){return ew(new Map)},__wbg_new_with_length_9cedd08484b73942:function(e){let t=new Uint8Array(e>>>0);return ew(t)},__wbg_node_84ea875411254db1:function(e){let t=CI(e).node;return ew(t)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){let t=CI(e).process;return ew(t)},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(S9e(e,t),CI(n))},__wbg_randomFillSync_6c25eac9869eb53c:function(){return clA(function(e,t){CI(e).randomFillSync(lk(t))},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return clA(function(){let e=module.require;return ew(e)},arguments)},__wbg_set_08463b1df38a7e29:function(e,t,n){let r=CI(e).set(CI(t),CI(n));return ew(r)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>"u"?null:globalThis;return h$(e)?0:ew(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof global>"u"?null:global;return h$(e)?0:ew(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>"u"?null:self;return h$(e)?0:ew(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>"u"?null:window;return h$(e)?0:ew(e)},__wbg_subarray_0f98d3fb634508ad:function(e,t,n){let r=CI(e).subarray(t>>>0,n>>>0);return ew(r)},__wbg_versions_276b2795b1c6a219:function(e){let t=CI(e).versions;return ew(t)},__wbindgen_cast_0000000000000001:function(e,t){let n=S9e(e,t);return ew(n)},__wbindgen_cast_0000000000000002:function(e,t){let n=lD(e,t);return ew(n)},__wbindgen_object_clone_ref:function(e){let t=CI(e);return ew(t)},__wbindgen_object_drop_ref:function(e){lk(e)}}}}function ew(A){ulA===E$.length&&E$.push(E$.length+1);let e=ulA;return ulA=E$[e],E$[e]=A,e}function C0c(A){A<1028||(E$[A]=ulA,ulA=A)}function S9e(A,e){return A=A>>>0,D9e().subarray(A/1,A/1+e)}function lo(){return(S0e===null||S0e.buffer.detached===!0||S0e.buffer.detached===void 0&&S0e.buffer!==Mt.memory.buffer)&&(S0e=new DataView(Mt.memory.buffer)),S0e}function lD(A,e){return A=A>>>0,S0c(A,e)}function D9e(){return(llA===null||llA.byteLength===0)&&(llA=new Uint8Array(Mt.memory.buffer)),llA}function CI(A){return E$[A]}function clA(A,e){try{return A.apply(this,e)}catch(t){Mt.__wbindgen_export(ew(t))}}function h$(A){return A==null}function vln(A,e){let t=e(A.length*1,1)>>>0;return D9e().set(A,t/1),Qg=A.length,t}function qm(A,e,t){if(t===void 0){let a=dlA.encode(A),c=e(a.length,1)>>>0;return D9e().subarray(c,c+a.length).set(a),Qg=a.length,c}let n=A.length,r=e(n,1)>>>0,o=D9e(),s=0;for(;s<n;s++){let a=A.charCodeAt(s);if(a>127)break;o[r+s]=a}if(s!==n){s!==0&&(A=A.slice(s)),r=t(r,n,n=s+A.length*3,1)>>>0;let a=D9e().subarray(r+s,r+n),c=dlA.encodeInto(A,a);s+=c.written,r=t(r,n,s,1)>>>0}return Qg=s,r}function lk(A){let e=CI(A);return C0c(A),e}function S0c(A,e){return bln+=e,bln>=w0c&&(qVA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),qVA.decode(),bln=e),qVA.decode(D9e().subarray(A,A+e))}function epi(A,e){return Mt=A.exports,D0c=e,S0e=null,llA=null,Mt}async function y0c(A,e){if(typeof Response=="function"&&A instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(A,e)}catch(r){if(A.ok&&t(A.type)&&A.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await A.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(A,e);return n instanceof WebAssembly.Instance?{instance:n,module:A}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function x0c(A){if(Mt!==void 0)return Mt;A!==void 0&&(Object.getPrototypeOf(A)===Object.prototype?{module:A}=A:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=$fi();A instanceof WebAssembly.Module||(A=new WebAssembly.Module(A));let t=new WebAssembly.Instance(A,e);return epi(t,A)}async function P0c(A){if(Mt!==void 0)return Mt;A!==void 0&&(Object.getPrototypeOf(A)===Object.prototype?{module_or_path:A}=A:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),A===void 0&&(A=new URL("qoder_auth_wasm_bg.wasm",import.meta.url));let e=$fi();(typeof A=="string"||typeof Request=="function"&&A instanceof Request||typeof URL=="function"&&A instanceof URL)&&(A=fetch(A));let{instance:t,module:n}=await y0c(await A,e);return epi(t,n)}var glA,flA,plA,D0e,Kfi,Xfi,zfi,_fi,S0e,llA,E$,ulA,qVA,w0c,bln,dlA,Qg,D0c,Mt,tpi=C(()=>{glA=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Kfi.unregister(this),e}free(){let e=this.__destroy_into_raw();Mt.__wbg_clientcontext_free(e,0)}constructor(e){let t=vln(e,Mt.__wbindgen_export2),n=Qg,r=Mt.clientcontext_new(t,n);return this.__wbg_ptr=r>>>0,Kfi.register(this,this.__wbg_ptr,this),this}state(){return Mt.clientcontext_state(this.__wbg_ptr)>>>0}};Symbol.dispose&&(glA.prototype[Symbol.dispose]=glA.prototype.free);flA=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Xfi.unregister(this),e}free(){let e=this.__destroy_into_raw();Mt.__wbg_profileencryptor_free(e,0)}encryptChunk(e,t){try{let c=Mt.__wbindgen_add_to_stack_pointer(-16),l=vln(e,Mt.__wbindgen_export2),u=Qg;Mt.profileencryptor_encryptChunk(c,this.__wbg_ptr,l,u,t);var n=lo().getInt32(c+4*0,!0),r=lo().getInt32(c+4*1,!0),o=lo().getInt32(c+4*2,!0),s=lo().getInt32(c+4*3,!0);if(s)throw lk(o);var a=S9e(n,r).slice();return Mt.__wbindgen_export4(n,r*1,1),a}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}header(){try{let r=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.profileencryptor_header(r,this.__wbg_ptr);var e=lo().getInt32(r+4*0,!0),t=lo().getInt32(r+4*1,!0),n=S9e(e,t).slice();return Mt.__wbindgen_export4(e,t*1,1),n}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}constructor(e){try{let o=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.profileencryptor_new(o,e);var t=lo().getInt32(o+4*0,!0),n=lo().getInt32(o+4*1,!0),r=lo().getInt32(o+4*2,!0);if(r)throw lk(n);return this.__wbg_ptr=t>>>0,Xfi.register(this,this.__wbg_ptr,this),this}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(flA.prototype[Symbol.dispose]=flA.prototype.free);plA=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,zfi.unregister(this),e}free(){let e=this.__destroy_into_raw();Mt.__wbg_qodercontext_free(e,0)}get_external_providers_access(){let e,t;try{let o=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.qodercontext_get_external_providers_access(o,this.__wbg_ptr);var n=lo().getInt32(o+4*0,!0),r=lo().getInt32(o+4*1,!0);return e=n,t=r,lD(n,r)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(e,t,1)}}constructor(e,t,n,r){try{let u=Mt.__wbindgen_add_to_stack_pointer(-16),d=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),g=Qg,f=qm(t,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg,m=qm(n,Mt.__wbindgen_export2,Mt.__wbindgen_export3),E=Qg;var o=h$(r)?0:qm(r,Mt.__wbindgen_export2,Mt.__wbindgen_export3),s=Qg;Mt.qodercontext_new(u,d,g,f,p,m,E,o,s);var a=lo().getInt32(u+4*0,!0),c=lo().getInt32(u+4*1,!0),l=lo().getInt32(u+4*2,!0);if(l)throw lk(c);return this.__wbg_ptr=a>>>0,zfi.register(this,this.__wbg_ptr,this),this}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}prepareInferRequest(e,t,n,r){try{let g=Mt.__wbindgen_add_to_stack_pointer(-16),f=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),p=Qg,m=qm(t,Mt.__wbindgen_export2,Mt.__wbindgen_export3),E=Qg;var o=h$(n)?0:qm(n,Mt.__wbindgen_export2,Mt.__wbindgen_export3),s=Qg,a=h$(r)?0:qm(r,Mt.__wbindgen_export2,Mt.__wbindgen_export3),c=Qg;Mt.qodercontext_prepareInferRequest(g,this.__wbg_ptr,f,p,m,E,o,s,a,c);var l=lo().getInt32(g+4*0,!0),u=lo().getInt32(g+4*1,!0),d=lo().getInt32(g+4*2,!0);if(d)throw lk(u);return D0e.__wrap(l)}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}prepareRequest(e,t,n,r,o,s){try{let p=Mt.__wbindgen_add_to_stack_pointer(-16),m=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),E=Qg,h=qm(t,Mt.__wbindgen_export2,Mt.__wbindgen_export3),I=Qg,B=qm(n,Mt.__wbindgen_export2,Mt.__wbindgen_export3),Q=Qg,S=qm(r,Mt.__wbindgen_export2,Mt.__wbindgen_export3),D=Qg;var a=h$(o)?0:qm(o,Mt.__wbindgen_export2,Mt.__wbindgen_export3),c=Qg,l=h$(s)?0:qm(s,Mt.__wbindgen_export2,Mt.__wbindgen_export3),u=Qg;Mt.qodercontext_prepareRequest(p,this.__wbg_ptr,m,E,h,I,B,Q,S,D,a,c,l,u);var d=lo().getInt32(p+4*0,!0),g=lo().getInt32(p+4*1,!0),f=lo().getInt32(p+4*2,!0);if(f)throw lk(g);return D0e.__wrap(d)}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}refreshAuthFields(e){try{let r=Mt.__wbindgen_add_to_stack_pointer(-16),o=qm(e,Mt.__wbindgen_export2,Mt.__wbindgen_export3),s=Qg;Mt.qodercontext_refreshAuthFields(r,this.__wbg_ptr,o,s);var t=lo().getInt32(r+4*0,!0),n=lo().getInt32(r+4*1,!0);if(n)throw lk(t)}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(plA.prototype[Symbol.dispose]=plA.prototype.free);D0e=class A{static __wrap(e){e=e>>>0;let t=Object.create(A.prototype);return t.__wbg_ptr=e,_fi.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,_fi.unregister(this),e}free(){let e=this.__destroy_into_raw();Mt.__wbg_requestresult_free(e,0)}get body(){try{let n=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.requestresult_body(n,this.__wbg_ptr);var e=lo().getInt32(n+4*0,!0),t=lo().getInt32(n+4*1,!0);let r;return e!==0&&(r=lD(e,t).slice(),Mt.__wbindgen_export4(e,t*1,1)),r}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}get headerCount(){return Mt.requestresult_headerCount(this.__wbg_ptr)>>>0}get headers(){let e=Mt.requestresult_headers(this.__wbg_ptr);return lk(e)}get url(){let e,t;try{let o=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.requestresult_url(o,this.__wbg_ptr);var n=lo().getInt32(o+4*0,!0),r=lo().getInt32(o+4*1,!0);return e=n,t=r,lD(n,r)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_export4(e,t,1)}}};Symbol.dispose&&(D0e.prototype[Symbol.dispose]=D0e.prototype.free);Kfi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(A=>Mt.__wbg_clientcontext_free(A>>>0,1)),Xfi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(A=>Mt.__wbg_profileencryptor_free(A>>>0,1)),zfi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(A=>Mt.__wbg_qodercontext_free(A>>>0,1)),_fi=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(A=>Mt.__wbg_requestresult_free(A>>>0,1));S0e=null;llA=null;E$=new Array(1024).fill(void 0);E$.push(void 0,null,!0,!1);ulA=E$.length;qVA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});qVA.decode();w0c=2146435072,bln=0;dlA=new TextEncoder;"encodeInto"in dlA||(dlA.encodeInto=function(A,e){let t=dlA.encode(A);return e.set(t),{read:A.length,written:t.length}});Qg=0});
|
|
12
|
+
tpi()
|
|
13
|
+
export { Api as sUi }
|
|
14
|
+
export const initAuthWasm = Api.default
|
|
Binary file
|