10 changed files with 668 additions and 163 deletions
@ -0,0 +1,183 @@ |
|||
/** |
|||
* 文件作用: |
|||
* SuperAgent 新版业务资源请求。 |
|||
* |
|||
* 职责: |
|||
* 1. 按默认模块 OpenAPI / live 8000 路径请求 tasksets、conversations、附件、产物和 thread 命令。 |
|||
* 2. 统一走 requestAgentJson,自动带 Agent JWT 与创建类 Idempotency-Key。 |
|||
* |
|||
* 不负责: |
|||
* 1. 侧栏 UI、消息渲染或章节编辑器状态。 |
|||
* 2. 失败时回退旧 session/folder/checkpoint 接口。 |
|||
*/ |
|||
"use strict"; |
|||
|
|||
import { superAgentServiceApiTable } from "../../../utils/superAgentApiTable"; |
|||
import { requestAgentJson } from "../utils/agentApi"; |
|||
import { parseAgentPage } from "../utils/agentApiParse"; |
|||
|
|||
const jsonAction = (options) => requestAgentJson(options); |
|||
|
|||
export const listTasksets = (query = {}) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.tasksets, |
|||
query, |
|||
fallbackMessage: "获取任务集失败", |
|||
}).then(parseAgentPage); |
|||
|
|||
export const createTaskset = (body, options = {}) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.tasksets, |
|||
body, |
|||
idempotencyKey: options.idempotencyKey, |
|||
fallbackMessage: "创建任务集失败", |
|||
}); |
|||
|
|||
export const updateTaskset = (tasksetId, body) => |
|||
jsonAction({ |
|||
method: "PUT", |
|||
path: superAgentServiceApiTable.tasksetDetail, |
|||
params: { tasksetId }, |
|||
body, |
|||
fallbackMessage: "更新任务集失败", |
|||
}); |
|||
|
|||
export const deleteTaskset = (tasksetId) => |
|||
jsonAction({ |
|||
method: "DELETE", |
|||
path: superAgentServiceApiTable.tasksetDetail, |
|||
params: { tasksetId }, |
|||
fallbackMessage: "删除任务集失败", |
|||
}); |
|||
|
|||
export const listConversations = (query = {}) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.conversations, |
|||
query, |
|||
fallbackMessage: "获取会话失败", |
|||
}).then(parseAgentPage); |
|||
|
|||
export const createConversation = (body, options = {}) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.conversations, |
|||
body, |
|||
idempotencyKey: options.idempotencyKey, |
|||
fallbackMessage: "创建会话失败", |
|||
}); |
|||
|
|||
export const getConversation = (conversationId) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.conversationDetail, |
|||
params: { conversationId }, |
|||
fallbackMessage: "获取会话失败", |
|||
}); |
|||
|
|||
export const updateConversation = (conversationId, body) => |
|||
jsonAction({ |
|||
method: "PUT", |
|||
path: superAgentServiceApiTable.conversationDetail, |
|||
params: { conversationId }, |
|||
body, |
|||
fallbackMessage: "更新会话失败", |
|||
}); |
|||
|
|||
export const deleteConversation = (conversationId) => |
|||
jsonAction({ |
|||
method: "DELETE", |
|||
path: superAgentServiceApiTable.conversationDetail, |
|||
params: { conversationId }, |
|||
fallbackMessage: "删除会话失败", |
|||
}); |
|||
|
|||
export const createAttachmentUploadIntent = (conversationId, body, options = {}) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.attachmentUploadIntents, |
|||
params: { conversationId }, |
|||
body, |
|||
idempotencyKey: options.idempotencyKey, |
|||
fallbackMessage: "创建附件上传意图失败", |
|||
}); |
|||
|
|||
export const completeAttachmentUpload = (attachmentId) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.attachmentComplete, |
|||
params: { attachmentId }, |
|||
fallbackMessage: "确认附件上传失败", |
|||
}); |
|||
|
|||
export const listAttachments = (conversationId, query = {}) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.attachments, |
|||
params: { conversationId }, |
|||
query, |
|||
fallbackMessage: "获取附件失败", |
|||
}).then(parseAgentPage); |
|||
|
|||
export const listArtifacts = (conversationId, query = {}) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.artifacts, |
|||
params: { conversationId }, |
|||
query, |
|||
fallbackMessage: "获取文档产物失败", |
|||
}).then(parseAgentPage); |
|||
|
|||
export const getArtifact = (artifactId, version) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.artifactDetail, |
|||
params: { artifactId, version }, |
|||
fallbackMessage: "获取文档产物详情失败", |
|||
}); |
|||
|
|||
export const listArtifactChapters = (artifactId, version) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.artifactChapters, |
|||
params: { artifactId, version }, |
|||
fallbackMessage: "获取章节列表失败", |
|||
}); |
|||
|
|||
export const getArtifactChapter = (artifactId, version, outlineNodeId) => |
|||
jsonAction({ |
|||
method: "GET", |
|||
path: superAgentServiceApiTable.artifactChapter, |
|||
params: { artifactId, version, outlineNodeId }, |
|||
fallbackMessage: "获取章节失败", |
|||
}); |
|||
|
|||
export const updateArtifactChapter = (artifactId, version, outlineNodeId, body, etag) => |
|||
jsonAction({ |
|||
method: "PUT", |
|||
path: superAgentServiceApiTable.artifactChapter, |
|||
params: { artifactId, version, outlineNodeId }, |
|||
body, |
|||
headers: etag ? { "If-Match": etag } : {}, |
|||
fallbackMessage: "保存章节失败", |
|||
}); |
|||
|
|||
export const sendThreadCommand = (threadId, body) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.threadCommands, |
|||
params: { threadId }, |
|||
body, |
|||
fallbackMessage: "发送线程命令失败", |
|||
}); |
|||
|
|||
export const cancelThreadRun = (threadId, runId, query = { wait: false, action: "interrupt" }) => |
|||
jsonAction({ |
|||
method: "POST", |
|||
path: superAgentServiceApiTable.threadCancel, |
|||
params: { threadId, runId }, |
|||
query, |
|||
fallbackMessage: "取消运行失败", |
|||
}); |
|||
@ -0,0 +1,217 @@ |
|||
/** |
|||
* 文件作用: |
|||
* SuperAgent 新版 Agent API 适配层。 |
|||
* |
|||
* 职责: |
|||
* 1. 通过 query api 换取 Agent JWT,并只把它放进 Authorization。 |
|||
* 2. 拼接 /_super-agent 同源代理 URL、Idempotency-Key 和统一错误解析。 |
|||
* |
|||
* 不负责: |
|||
* 1. 把 ai-center token 或 X-User-Id 当作 Agent 身份。 |
|||
* 2. 失败时回退旧 /api/v1/tasks、/api/chat 或 /_api/super-agent 业务代理。 |
|||
*/ |
|||
"use strict"; |
|||
|
|||
import { superAgentServiceProxyMatch } from "../../../utils/superAgentApiTable"; |
|||
import { getCompatibleToken } from "../../../utils/authCompat"; |
|||
import { |
|||
SuperAgentApiError, |
|||
createIdempotencyKey, |
|||
parseAgentErrorPayload, |
|||
shouldSendIdempotencyKey, |
|||
} from "./agentApiParse"; |
|||
|
|||
const ACCESS_TOKEN_PATH = "/_api/super-agent/access-token"; |
|||
const TOKEN_REFRESH_SKEW_MS = 30 * 1000; |
|||
|
|||
let cachedAccessToken = { |
|||
loginToken: "", |
|||
token: "", |
|||
expiresAt: 0, |
|||
}; |
|||
|
|||
export { |
|||
SuperAgentApiError, |
|||
assertAgentUuid, |
|||
createIdempotencyKey, |
|||
isAgentUuid, |
|||
parseAgentPage, |
|||
} from "./agentApiParse"; |
|||
|
|||
export const buildSuperAgentServiceUrl = (path = "") => { |
|||
const rawPath = String(path || ""); |
|||
const servicePath = rawPath && !rawPath.startsWith("/") ? `/${rawPath}` : rawPath; |
|||
const origin = typeof window !== "undefined" ? window.location.origin : ""; |
|||
return `${origin}${superAgentServiceProxyMatch}${servicePath}`; |
|||
}; |
|||
|
|||
export const getSuperAgentApiUrl = () => buildSuperAgentServiceUrl(""); |
|||
|
|||
export const buildSuperAgentPath = (path, params = {}) => { |
|||
let nextPath = String(path || ""); |
|||
Object.keys(params || {}).forEach((key) => { |
|||
nextPath = nextPath.replace(`:${key}`, encodeURIComponent(String(params[key]))); |
|||
}); |
|||
return nextPath; |
|||
}; |
|||
|
|||
export const clearSuperAgentAccessToken = () => { |
|||
cachedAccessToken = { |
|||
loginToken: "", |
|||
token: "", |
|||
expiresAt: 0, |
|||
}; |
|||
}; |
|||
|
|||
const readJsonSafe = async (response) => { |
|||
const text = await response.text(); |
|||
if (!text) return {}; |
|||
try { |
|||
return JSON.parse(text); |
|||
} catch (error) { |
|||
throw new SuperAgentApiError({ |
|||
status: response.status, |
|||
message: text || "超级智能体响应不是 JSON", |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const buildAiCenterAuthHeaders = () => { |
|||
const loginToken = String(getCompatibleToken() || "").trim(); |
|||
if (!loginToken) { |
|||
throw new SuperAgentApiError({ |
|||
status: 401, |
|||
code: "AUTHENTICATION_REQUIRED", |
|||
message: "请先登录", |
|||
}); |
|||
} |
|||
return { |
|||
loginToken, |
|||
headers: { |
|||
Accept: "application/json", |
|||
Authorization: `Bearer ${loginToken}`, |
|||
token: loginToken, |
|||
}, |
|||
}; |
|||
}; |
|||
|
|||
export const issueSuperAgentAccessToken = async ({ force = false } = {}) => { |
|||
const { loginToken, headers } = buildAiCenterAuthHeaders(); |
|||
const now = Date.now(); |
|||
if ( |
|||
!force && |
|||
cachedAccessToken.token && |
|||
cachedAccessToken.loginToken === loginToken && |
|||
cachedAccessToken.expiresAt - TOKEN_REFRESH_SKEW_MS > now |
|||
) { |
|||
return cachedAccessToken.token; |
|||
} |
|||
|
|||
const origin = typeof window !== "undefined" ? window.location.origin : ""; |
|||
const response = await fetch(`${origin}${ACCESS_TOKEN_PATH}`, { |
|||
method: "POST", |
|||
headers, |
|||
}); |
|||
const data = await readJsonSafe(response); |
|||
if (!response.ok || !data?.token) { |
|||
clearSuperAgentAccessToken(); |
|||
throw parseAgentErrorPayload(data, response.status, "签发 Agent 访问令牌失败"); |
|||
} |
|||
|
|||
const expiresAt = data.expires_at |
|||
? Number(data.expires_at) * 1000 |
|||
: now + Number(data.expires_in || 3600) * 1000; |
|||
cachedAccessToken = { |
|||
loginToken, |
|||
token: String(data.token), |
|||
expiresAt, |
|||
}; |
|||
return cachedAccessToken.token; |
|||
}; |
|||
|
|||
export const buildSuperAgentHeaders = async (extraHeaders = {}) => { |
|||
const token = await issueSuperAgentAccessToken(); |
|||
return { |
|||
Authorization: `Bearer ${token}`, |
|||
...extraHeaders, |
|||
}; |
|||
}; |
|||
|
|||
const parseAgentResponse = async (response, fallbackMessage) => { |
|||
if (response.status === 204) return null; |
|||
const data = await readJsonSafe(response); |
|||
if (!response.ok) { |
|||
throw parseAgentErrorPayload(data, response.status, fallbackMessage); |
|||
} |
|||
return data; |
|||
}; |
|||
|
|||
export const requestAgentJson = async ({ |
|||
method, |
|||
path, |
|||
params = {}, |
|||
query = {}, |
|||
body, |
|||
headers: extraHeaders = {}, |
|||
fallbackMessage = "超级智能体请求失败", |
|||
keepalive = false, |
|||
idempotencyKey, |
|||
retryOnUnauthorized = true, |
|||
} = {}) => { |
|||
const resolvedPath = buildSuperAgentPath(path, params); |
|||
const search = new URLSearchParams(); |
|||
Object.entries(query || {}).forEach(([key, value]) => { |
|||
if (value === undefined || value === null || value === "") return; |
|||
search.set(key, String(value)); |
|||
}); |
|||
const queryString = search.toString(); |
|||
const methodName = String(method || "GET").toUpperCase(); |
|||
const key = idempotencyKey === undefined && methodName === "POST" |
|||
? createIdempotencyKey() |
|||
: idempotencyKey; |
|||
const headers = await buildSuperAgentHeaders({ |
|||
...(body !== undefined ? { "Content-Type": "application/json" } : {}), |
|||
...(shouldSendIdempotencyKey(methodName, key) ? { "Idempotency-Key": key } : {}), |
|||
...extraHeaders, |
|||
}); |
|||
|
|||
const response = await fetch( |
|||
buildSuperAgentServiceUrl(`${resolvedPath}${queryString ? `?${queryString}` : ""}`), |
|||
{ |
|||
method: methodName, |
|||
headers, |
|||
body: body !== undefined ? JSON.stringify(body) : undefined, |
|||
keepalive, |
|||
} |
|||
); |
|||
|
|||
if (response.status === 401 && retryOnUnauthorized) { |
|||
clearSuperAgentAccessToken(); |
|||
return requestAgentJson({ |
|||
method: methodName, |
|||
path, |
|||
params, |
|||
query, |
|||
body, |
|||
headers: extraHeaders, |
|||
fallbackMessage, |
|||
keepalive, |
|||
idempotencyKey: key, |
|||
retryOnUnauthorized: false, |
|||
}); |
|||
} |
|||
|
|||
return parseAgentResponse(response, fallbackMessage); |
|||
}; |
|||
|
|||
export const withAgentAuthorization = async (init = {}) => { |
|||
const token = await issueSuperAgentAccessToken(); |
|||
const headers = new Headers(init.headers || {}); |
|||
headers.set("Authorization", `Bearer ${token}`); |
|||
headers.delete("X-User-Id"); |
|||
headers.delete("X-Search-Token"); |
|||
return { |
|||
...init, |
|||
headers, |
|||
}; |
|||
}; |
|||
@ -0,0 +1,76 @@ |
|||
/** |
|||
* 文件作用: |
|||
* SuperAgent 新版接口的纯解析与校验,不发网络请求。 |
|||
* |
|||
* 职责: |
|||
* 1. 归一化 UUID、分页 items/next_cursor、204 和 ErrorResponse。 |
|||
* 2. 生成创建类请求的 Idempotency-Key。 |
|||
* |
|||
* 不负责: |
|||
* 1. 签发 JWT 或拼接代理 URL。 |
|||
* 2. 调用旧 /api/v1/tasks 或回退旧聊天接口。 |
|||
*/ |
|||
"use strict"; |
|||
|
|||
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; |
|||
|
|||
export class SuperAgentApiError extends Error { |
|||
constructor({ |
|||
message, |
|||
status = 0, |
|||
code = "", |
|||
requestId = "", |
|||
details, |
|||
fallbackMessage = "超级智能体请求失败", |
|||
} = {}) { |
|||
super(String(message || fallbackMessage)); |
|||
this.name = "SuperAgentApiError"; |
|||
this.status = status; |
|||
this.code = code || ""; |
|||
this.requestId = requestId || ""; |
|||
this.details = details; |
|||
} |
|||
} |
|||
|
|||
export const isAgentUuid = (value) => UUID_PATTERN.test(String(value || "").trim()); |
|||
|
|||
export const assertAgentUuid = (value, label = "id") => { |
|||
const text = String(value || "").trim(); |
|||
if (!isAgentUuid(text)) { |
|||
throw new SuperAgentApiError({ |
|||
status: 422, |
|||
code: "INVALID_REQUEST", |
|||
message: `${label} 不是有效的 UUID`, |
|||
}); |
|||
} |
|||
return text; |
|||
}; |
|||
|
|||
export const parseAgentPage = (data) => ({ |
|||
items: Array.isArray(data?.items) ? data.items : [], |
|||
nextCursor: data?.next_cursor == null ? null : String(data.next_cursor), |
|||
}); |
|||
|
|||
export const parseAgentErrorPayload = (data, status, fallbackMessage) => { |
|||
const payload = data && typeof data === "object" ? data : {}; |
|||
return new SuperAgentApiError({ |
|||
status, |
|||
code: payload.code || "", |
|||
requestId: payload.request_id || "", |
|||
details: payload.details, |
|||
message: payload.message || payload.error || fallbackMessage, |
|||
fallbackMessage, |
|||
}); |
|||
}; |
|||
|
|||
export const createIdempotencyKey = () => { |
|||
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") { |
|||
return crypto.randomUUID(); |
|||
} |
|||
return `idemp-${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`; |
|||
}; |
|||
|
|||
export const shouldSendIdempotencyKey = (method, idempotencyKey) => { |
|||
const verb = String(method || "").toUpperCase(); |
|||
return Boolean(idempotencyKey) && (verb === "POST" || verb === "PUT"); |
|||
}; |
|||
@ -0,0 +1,39 @@ |
|||
"use strict"; |
|||
|
|||
export const superAgentApiBaseEnvKey = "FS_SUPER_AGENT_API"; |
|||
export const superAgentServiceProxyMatch = "/_super-agent"; |
|||
|
|||
export const superAgentServiceApiTable = { |
|||
tasksets: "/tasksets", |
|||
tasksetDetail: "/tasksets/:tasksetId", |
|||
conversations: "/conversations", |
|||
conversationDetail: "/conversations/:conversationId", |
|||
attachmentUploadIntents: "/conversations/:conversationId/attachments/upload-intents", |
|||
attachmentComplete: "/attachments/:attachmentId/complete", |
|||
attachments: "/conversations/:conversationId/attachments", |
|||
artifacts: "/conversations/:conversationId/artifacts", |
|||
artifactDetail: "/artifacts/:artifactId/:version", |
|||
artifactChapters: "/artifacts/:artifactId/:version/chapters", |
|||
artifactChapter: "/artifacts/:artifactId/:version/chapters/:outlineNodeId", |
|||
threadCommands: "/threads/:threadId/commands", |
|||
threadEvents: "/threads/:threadId/stream/events", |
|||
threadCancel: "/threads/:threadId/runs/:runId/cancel", |
|||
}; |
|||
|
|||
export const superAgentProxyApiTable = { |
|||
sessions: "/api/sessions", |
|||
sessionDetail: "/api/sessions/:sessionId", |
|||
sessionHistory: "/api/sessions/:sessionId/history", |
|||
sessionState: "/api/sessions/:sessionId/state", |
|||
sessionSections: "/api/sessions/:sessionId/sections", |
|||
sessionSection: "/api/sessions/:sessionId/sections/:sectionId", |
|||
sessionDownload: "/api/sessions/:sessionId/download", |
|||
sessionCancel: "/api/sessions/:sessionId/cancel", |
|||
sidebar: "/api/sidebar", |
|||
folders: "/api/folders", |
|||
folderDetail: "/api/folders/:folderId", |
|||
chat: "/api/chat", |
|||
checkpointRespond: "/api/checkpoint/respond", |
|||
upload: "/api/upload", |
|||
download: "/api/download", |
|||
}; |
|||
@ -0,0 +1,79 @@ |
|||
import assert from "node:assert/strict"; |
|||
import fs from "node:fs"; |
|||
import path from "node:path"; |
|||
import test from "node:test"; |
|||
|
|||
const root = path.resolve(import.meta.dirname, ".."); |
|||
const read = (...parts) => fs.readFileSync(path.join(root, ...parts), "utf8"); |
|||
|
|||
const { |
|||
SuperAgentApiError, |
|||
assertAgentUuid, |
|||
isAgentUuid, |
|||
parseAgentErrorPayload, |
|||
parseAgentPage, |
|||
shouldSendIdempotencyKey, |
|||
} = await import("../client/src/sections/superAgent/utils/agentApiParse.js"); |
|||
const { superAgentServiceApiTable } = await import("../client/src/utils/superAgentApiTable.js"); |
|||
|
|||
test("new api table uses live agent paths", () => { |
|||
assert.equal(superAgentServiceApiTable.tasksets, "/tasksets"); |
|||
assert.equal(superAgentServiceApiTable.conversations, "/conversations"); |
|||
assert.equal( |
|||
superAgentServiceApiTable.attachmentUploadIntents, |
|||
"/conversations/:conversationId/attachments/upload-intents", |
|||
); |
|||
assert.equal(superAgentServiceApiTable.threadCommands, "/threads/:threadId/commands"); |
|||
assert.equal(superAgentServiceApiTable.threadEvents, "/threads/:threadId/stream/events"); |
|||
assert.equal(superAgentServiceApiTable.threadCancel, "/threads/:threadId/runs/:runId/cancel"); |
|||
assert.equal(superAgentServiceApiTable.artifacts, "/conversations/:conversationId/artifacts"); |
|||
assert.doesNotMatch(JSON.stringify(superAgentServiceApiTable), /\/api\/v1/); |
|||
}); |
|||
|
|||
test("uuid and page helpers normalize agent payloads", () => { |
|||
assert.equal(isAgentUuid("2c1f3c0e-1a2b-4c5d-8e9f-0123456789ab"), true); |
|||
assert.equal(isAgentUuid("task-1"), false); |
|||
assert.equal(assertAgentUuid("2c1f3c0e-1a2b-4c5d-8e9f-0123456789ab"), "2c1f3c0e-1a2b-4c5d-8e9f-0123456789ab"); |
|||
assert.throws( |
|||
() => assertAgentUuid("task-1", "conversation_id"), |
|||
(error) => error instanceof SuperAgentApiError && error.status === 422, |
|||
); |
|||
assert.deepEqual(parseAgentPage({ items: [{ id: "a" }], next_cursor: "c1" }), { |
|||
items: [{ id: "a" }], |
|||
nextCursor: "c1", |
|||
}); |
|||
assert.deepEqual(parseAgentPage({}), { items: [], nextCursor: null }); |
|||
const error = parseAgentErrorPayload( |
|||
{ code: "AUTHENTICATION_REQUIRED", message: "missing", request_id: "req_1" }, |
|||
401, |
|||
"fallback", |
|||
); |
|||
assert.equal(error.code, "AUTHENTICATION_REQUIRED"); |
|||
assert.equal(error.requestId, "req_1"); |
|||
assert.equal(shouldSendIdempotencyKey("POST", "k"), true); |
|||
assert.equal(shouldSendIdempotencyKey("GET", "k"), false); |
|||
}); |
|||
|
|||
test("adapter source exchanges login token for agent jwt and omits identity headers", () => { |
|||
const table = read("client", "src", "utils", "superAgentApiTable.js"); |
|||
const agentApi = read("client", "src", "sections", "superAgent", "utils", "agentApi.js"); |
|||
const streamHook = read("client", "src", "sections", "superAgent", "hooks", "useSuperAgentStream.js"); |
|||
const protocol = read("..", "api", "app", "controllers", "superAgentProtocol.js"); |
|||
const actions = read("client", "src", "sections", "superAgent", "actions", "api.js"); |
|||
const resources = read("client", "src", "sections", "superAgent", "actions", "agentResources.js"); |
|||
assert.doesNotMatch(table, /\/api\/v1\/tasks/); |
|||
assert.match(agentApi, /ACCESS_TOKEN_PATH = "\/_api\/super-agent\/access-token"/); |
|||
assert.match(agentApi, /Authorization: `Bearer \$\{token\}`/); |
|||
assert.match(agentApi, /headers\.delete\("X-User-Id"\)/); |
|||
assert.match(agentApi, /headers\.delete\("X-Search-Token"\)/); |
|||
assert.match(agentApi, /Idempotency-Key/); |
|||
assert.match(streamHook, /withAgentAuthorization/); |
|||
assert.doesNotMatch(streamHook, /X-User-Id/); |
|||
assert.doesNotMatch(streamHook, /\/api\/v1/); |
|||
assert.match(protocol, /issueAgentAccessToken/); |
|||
assert.doesNotMatch(protocol, /'X-User-Id'/); |
|||
assert.match(protocol, /\/threads\/\$\{encodeURIComponent/); |
|||
assert.match(actions, /requestAgentJson/); |
|||
assert.match(resources, /createAttachmentUploadIntent/); |
|||
assert.match(resources, /cancelThreadRun/); |
|||
}); |
|||
Loading…
Reference in new issue