@xfey/tutti 0.1.106 → 0.1.107
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 +1 -0
- package/dist/control-plane/procedure-logging.d.ts +1 -0
- package/dist/control-plane/procedure-logging.js +16 -5
- package/dist/control-plane/reference-summary-refresh.js +2 -2
- package/dist/control-plane/workflows/openai.js +1 -0
- package/dist/providers/openai/app-server/read-only-procedure.d.ts +10 -2
- package/dist/providers/openai/app-server/read-only-procedure.js +65 -15
- package/dist/server-shell/http/routes/project-api/reference-files-routes.js +19 -2
- package/node_modules/@tutti/shared/dist/schemas/api/feishu-documents.d.ts +41 -0
- package/node_modules/@tutti/shared/dist/schemas/api/feishu-documents.js +40 -0
- package/node_modules/@tutti/shared/dist/schemas/api/index.d.ts +2 -1
- package/node_modules/@tutti/shared/dist/schemas/api/index.js +2 -1
- package/node_modules/@tutti/shared/dist/schemas/api/platform-sessions.d.ts +4 -1
- package/node_modules/@tutti/shared/dist/schemas/api/platform-sessions.js +9 -1
- package/node_modules/@tutti/shared/dist/schemas/internal/feishu-documents.d.ts +38 -0
- package/node_modules/@tutti/shared/dist/schemas/internal/feishu-documents.js +31 -0
- package/node_modules/@tutti/shared/dist/schemas/internal/index.d.ts +1 -0
- package/node_modules/@tutti/shared/dist/schemas/internal/index.js +1 -0
- package/package.json +1 -1
- package/web/assets/{homepage-motion-scene-tfFEdV9Y.js → homepage-motion-scene-CFs5rMWq.js} +1 -1
- package/web/assets/index-BmiLZmaV.js +69 -0
- package/web/assets/{index-C2Mmj25S.css → index-DvfZ57Nl.css} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-B7ZGIvOv.js +0 -69
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
- `prepare-package-assets.mjs`:把 Web build output 和内部 runtime package 复制到 staging package 所需位置。
|
|
27
27
|
- `pack-dry-run.mjs`:构建 staging package 并执行 `npm pack --dry-run --json` 文件列表校验。
|
|
28
28
|
- `smoke-packed-cli.mjs`:安装并验证 packed CLI tarball 的本地 smoke,包括 CLI help / version、runtime deps 和 QR dependency。
|
|
29
|
+
- 发布时可将 `TUTTI_PACKED_CLI_ARTIFACT_DIR` 指向已存在的独立绝对目录;仅全部 smoke 成功后保留同一已测 `.tgz`,拒绝覆盖同名文件,输出 SHA-256 而不输出临时路径。默认仍清理临时产物。
|
|
29
30
|
- `smoke-desktop-protocol.mjs`:在真实 `~/Applications` 下使用唯一临时 bundle / scheme 验证 macOS 图标点击与 LaunchServices URL event,并在结束时注销、清理。
|
|
30
31
|
- `vitest.config.mjs`:默认快速 Server 测试入口,排除真实 Git、子进程、loopback Host 与 npm preview 集成套件。
|
|
31
32
|
- `vitest.integration.config.mjs`:显式 Server integration 入口;完整保留上述慢套件的行为覆盖。
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActivityRef, WorkflowInvocationRef } from "@tutti/shared/ids";
|
|
2
2
|
import type { WorkflowKind } from "@tutti/shared/domain";
|
|
3
3
|
import type { ControlPlaneLogger } from "./types.js";
|
|
4
|
+
export declare function procedureExecutionErrorFields(error: unknown): Record<string, unknown>;
|
|
4
5
|
export declare function logProcedureExecutionError(input: {
|
|
5
6
|
logger: ControlPlaneLogger | undefined;
|
|
6
7
|
workflowKind: WorkflowKind;
|
|
@@ -8,6 +8,12 @@ const SAFE_DETAIL_KEYS = [
|
|
|
8
8
|
"notification_count",
|
|
9
9
|
"server_request_methods",
|
|
10
10
|
"notification_methods",
|
|
11
|
+
"output_parse_reason",
|
|
12
|
+
"agent_output_chars",
|
|
13
|
+
"json_candidate_count",
|
|
14
|
+
"agent_message_count",
|
|
15
|
+
"completed_tool_count",
|
|
16
|
+
"file_tool_count",
|
|
11
17
|
];
|
|
12
18
|
function isRecord(value) {
|
|
13
19
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -37,16 +43,21 @@ function errorCode(error) {
|
|
|
37
43
|
}
|
|
38
44
|
return error.code;
|
|
39
45
|
}
|
|
46
|
+
export function procedureExecutionErrorFields(error) {
|
|
47
|
+
const code = errorCode(error);
|
|
48
|
+
const details = errorDetails(error);
|
|
49
|
+
return {
|
|
50
|
+
error_name: error instanceof Error ? error.name : "NonError",
|
|
51
|
+
...(code === undefined ? {} : { error_code: code }),
|
|
52
|
+
...(details === undefined ? {} : { error_details: details }),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
40
55
|
export function logProcedureExecutionError(input) {
|
|
41
56
|
input.logger?.info({
|
|
42
57
|
activity_ref: input.activityRef,
|
|
43
58
|
workflow_ref: input.workflowRef,
|
|
44
59
|
workflow_kind: input.workflowKind,
|
|
45
|
-
|
|
46
|
-
...(errorCode(input.error) === undefined ? {} : { error_code: errorCode(input.error) }),
|
|
47
|
-
...(errorDetails(input.error) === undefined
|
|
48
|
-
? {}
|
|
49
|
-
: { error_details: errorDetails(input.error) }),
|
|
60
|
+
...procedureExecutionErrorFields(input.error),
|
|
50
61
|
}, "Procedure execution error");
|
|
51
62
|
}
|
|
52
63
|
//# sourceMappingURL=procedure-logging.js.map
|
|
@@ -2,7 +2,7 @@ import { createWorkflowInvocationRef } from "@tutti/shared/ids";
|
|
|
2
2
|
import { recordProjectTimelineEvent } from "../project-timeline/index.js";
|
|
3
3
|
import { withHostStoreTransaction } from "../store/index.js";
|
|
4
4
|
import { WorkspaceOpsError, readReferenceSummaryTargets, updateReferenceSummaries, } from "../workspace-ops/index.js";
|
|
5
|
-
import { logProcedureExecutionError } from "./procedure-logging.js";
|
|
5
|
+
import { logProcedureExecutionError, procedureExecutionErrorFields } from "./procedure-logging.js";
|
|
6
6
|
import { enqueueControlPlaneIntent, readControlPlaneIntentByDedupeKey, settlePendingControlPlaneIntent, } from "./dispatch-intents.js";
|
|
7
7
|
const REFERENCE_SUMMARY_CONCURRENCY = 1;
|
|
8
8
|
const REFERENCE_SUMMARY_MAX_ATTEMPTS = 2;
|
|
@@ -255,7 +255,7 @@ async function summarizeReferenceTarget(options) {
|
|
|
255
255
|
path: options.target.path,
|
|
256
256
|
attempt,
|
|
257
257
|
retrying: attempt < REFERENCE_SUMMARY_MAX_ATTEMPTS,
|
|
258
|
-
|
|
258
|
+
...procedureExecutionErrorFields(error),
|
|
259
259
|
}, attempt < REFERENCE_SUMMARY_MAX_ATTEMPTS
|
|
260
260
|
? "Reference summary target retrying"
|
|
261
261
|
: "Reference summary target failed");
|
|
@@ -447,6 +447,7 @@ export function createOpenAiProcedureWorkflowRunner(options) {
|
|
|
447
447
|
appServerCwd: workspace.cwd,
|
|
448
448
|
validateOutput: isReferenceFileSummaryStructuredOutput,
|
|
449
449
|
readablePaths: [workspace.cwd],
|
|
450
|
+
requireFileToolUse: true,
|
|
450
451
|
networkAccess: false,
|
|
451
452
|
webSearchMode: "disabled",
|
|
452
453
|
});
|
|
@@ -11,6 +11,8 @@ export type CodexAppServerReadOnlyProcedureInput<TOutput> = {
|
|
|
11
11
|
workspaceRoot: string;
|
|
12
12
|
appServerCwd?: string;
|
|
13
13
|
readablePaths?: string[];
|
|
14
|
+
/** File-only workflows must not accept an answer produced without a filesystem tool attempt. */
|
|
15
|
+
requireFileToolUse?: boolean;
|
|
14
16
|
prompt: string;
|
|
15
17
|
outputSchema: unknown;
|
|
16
18
|
validateOutput: (value: unknown) => value is TOutput;
|
|
@@ -66,11 +68,17 @@ export type CodexAppServerReadOnlyProcedureErrorDetails = {
|
|
|
66
68
|
notification_methods?: string[];
|
|
67
69
|
agent_message_excerpt?: string;
|
|
68
70
|
stderr_excerpt?: string;
|
|
71
|
+
output_parse_reason?: "no_json_object" | "malformed_json";
|
|
72
|
+
agent_output_chars?: number;
|
|
73
|
+
json_candidate_count?: number;
|
|
74
|
+
agent_message_count?: number;
|
|
75
|
+
completed_tool_count?: number;
|
|
76
|
+
file_tool_count?: number;
|
|
69
77
|
};
|
|
70
78
|
export declare class CodexAppServerReadOnlyProcedureError extends Error {
|
|
71
|
-
readonly code: "app_server_protocol_error" | "auth_failed" | "thread_start_failed" | "turn_failed" | "turn_timeout" | "unexpected_server_request" | "skill_selection_failed" | "output_parse_failed" | "output_validation_failed" | "write_detected" | "secret_leak_detected" | "process_lifecycle_failed" | "admission_unavailable";
|
|
79
|
+
readonly code: "app_server_protocol_error" | "auth_failed" | "thread_start_failed" | "turn_failed" | "turn_timeout" | "unexpected_server_request" | "skill_selection_failed" | "output_parse_failed" | "output_validation_failed" | "file_read_not_observed" | "write_detected" | "secret_leak_detected" | "process_lifecycle_failed" | "admission_unavailable";
|
|
72
80
|
readonly details: CodexAppServerReadOnlyProcedureErrorDetails;
|
|
73
|
-
constructor(code: "app_server_protocol_error" | "auth_failed" | "thread_start_failed" | "turn_failed" | "turn_timeout" | "unexpected_server_request" | "skill_selection_failed" | "output_parse_failed" | "output_validation_failed" | "write_detected" | "secret_leak_detected" | "process_lifecycle_failed" | "admission_unavailable", message: string, details?: CodexAppServerReadOnlyProcedureErrorDetails);
|
|
81
|
+
constructor(code: "app_server_protocol_error" | "auth_failed" | "thread_start_failed" | "turn_failed" | "turn_timeout" | "unexpected_server_request" | "skill_selection_failed" | "output_parse_failed" | "output_validation_failed" | "file_read_not_observed" | "write_detected" | "secret_leak_detected" | "process_lifecycle_failed" | "admission_unavailable", message: string, details?: CodexAppServerReadOnlyProcedureErrorDetails);
|
|
74
82
|
}
|
|
75
83
|
export declare function resolveReadOnlyWebSearchMode(input: {
|
|
76
84
|
networkAccess?: boolean;
|
|
@@ -4,14 +4,14 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { buildCodexAppServerProcessPlan } from "../codex-app-server.js";
|
|
6
6
|
import { DEFAULT_OPENAI_MODEL } from "../model-config.js";
|
|
7
|
-
import { CodexAppServerJsonRpcClient, CodexAppServerProtocolError
|
|
7
|
+
import { CodexAppServerJsonRpcClient, CodexAppServerProtocolError } from "./json-rpc.js";
|
|
8
8
|
import { CodexAppServerInvocation, CodexAppServerLifecycleError, createManagedProcess, } from "./invocation-lifecycle.js";
|
|
9
9
|
import { CodexAppServerAdmissionError, } from "./invocation-coordinator.js";
|
|
10
10
|
import { createCodexAppServerRuntimeObserver, } from "./runtime-telemetry.js";
|
|
11
11
|
import { createReadOnlySandboxPolicy } from "./sandbox-policy.js";
|
|
12
12
|
import { buildCodexAppServerProviderConfigOverrides, resolveCodexAppServerModelProvider, } from "./provider-config.js";
|
|
13
13
|
import { buildCodexAppServerTurnInput, resolveCodexAppServerContextRuntimeHint, resolveCodexAppServerSkillInputs, CodexAppServerSkillSelectionError, } from "./skills.js";
|
|
14
|
-
import { containsKnownSecret, createCodexSpawnEnv, extractAgentText, extractServerRequestMethod, findJsonObjectCandidates, isApiKeyAccount, readThreadId, readTurnError, readTurnStatus, redactWithKnownValues, compactText, } from "./runtime-helpers.js";
|
|
14
|
+
import { containsKnownSecret, createCodexSpawnEnv, extractAgentText, extractServerRequestMethod, findJsonObjectCandidates, isRecord, isApiKeyAccount, readThreadId, readTurnError, readTurnStatus, redactWithKnownValues, compactText, } from "./runtime-helpers.js";
|
|
15
15
|
import { extractCodexAppServerTokenUsage } from "../token-usage.js";
|
|
16
16
|
const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
|
|
17
17
|
const DEFAULT_TURN_TIMEOUT_MS = 600_000;
|
|
@@ -65,7 +65,11 @@ function readOnlyTimeoutDetails(input) {
|
|
|
65
65
|
export function parseCodexAppServerStructuredJson(text) {
|
|
66
66
|
const candidates = findJsonObjectCandidates(text);
|
|
67
67
|
if (candidates.length === 0) {
|
|
68
|
-
throw new CodexAppServerReadOnlyProcedureError("output_parse_failed", "Codex app-server did not return a JSON object."
|
|
68
|
+
throw new CodexAppServerReadOnlyProcedureError("output_parse_failed", "Codex app-server did not return a JSON object.", {
|
|
69
|
+
output_parse_reason: "no_json_object",
|
|
70
|
+
agent_output_chars: text.length,
|
|
71
|
+
json_candidate_count: 0,
|
|
72
|
+
});
|
|
69
73
|
}
|
|
70
74
|
for (const jsonText of candidates.toReversed()) {
|
|
71
75
|
try {
|
|
@@ -75,7 +79,37 @@ export function parseCodexAppServerStructuredJson(text) {
|
|
|
75
79
|
// Earlier app-server progress can contain brace-shaped text.
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
|
-
throw new CodexAppServerReadOnlyProcedureError("output_parse_failed", "Codex app-server returned malformed JSON."
|
|
82
|
+
throw new CodexAppServerReadOnlyProcedureError("output_parse_failed", "Codex app-server returned malformed JSON.", {
|
|
83
|
+
output_parse_reason: "malformed_json",
|
|
84
|
+
agent_output_chars: text.length,
|
|
85
|
+
json_candidate_count: candidates.length,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** Counts only; model text, tool arguments and stderr never enter structured diagnostics. */
|
|
89
|
+
function structuredOutputDetails(client, text) {
|
|
90
|
+
const itemTypes = client.notifications.flatMap((notification) => {
|
|
91
|
+
const params = notification.params;
|
|
92
|
+
return notification.method === "item/completed" &&
|
|
93
|
+
isRecord(params) &&
|
|
94
|
+
isRecord(params.item) &&
|
|
95
|
+
typeof params.item.type === "string"
|
|
96
|
+
? [params.item.type]
|
|
97
|
+
: [];
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
turn_status: "completed",
|
|
101
|
+
notification_count: client.notifications.length,
|
|
102
|
+
notification_methods: client.notifications
|
|
103
|
+
.map((notification) => notification.method)
|
|
104
|
+
.slice(-20),
|
|
105
|
+
server_request_methods: client.serverRequests.map(extractServerRequestMethod),
|
|
106
|
+
agent_output_chars: text.length,
|
|
107
|
+
json_candidate_count: findJsonObjectCandidates(text).length,
|
|
108
|
+
agent_message_count: itemTypes.filter((type) => type === "agentMessage").length,
|
|
109
|
+
completed_tool_count: itemTypes.filter((type) => ["commandExecution", "mcpToolCall", "dynamicToolCall", "imageView", "webSearch"].includes(type)).length,
|
|
110
|
+
file_tool_count: itemTypes.filter((type) => ["commandExecution", "imageView"].includes(type))
|
|
111
|
+
.length,
|
|
112
|
+
};
|
|
79
113
|
}
|
|
80
114
|
export async function runCodexAppServerReadOnlyProcedure(options) {
|
|
81
115
|
if (options.invocationCoordinator !== undefined && options.invocationLease === undefined) {
|
|
@@ -102,14 +136,18 @@ export async function runCodexAppServerReadOnlyProcedure(options) {
|
|
|
102
136
|
let contextRuntimeHint;
|
|
103
137
|
try {
|
|
104
138
|
skillInputs = resolveCodexAppServerSkillInputs({
|
|
105
|
-
...(options.skillSelectionName === undefined
|
|
139
|
+
...(options.skillSelectionName === undefined
|
|
140
|
+
? {}
|
|
141
|
+
: { selectionName: options.skillSelectionName }),
|
|
106
142
|
...(options.userSkillsRoot === undefined ? {} : { userSkillsRoot: options.userSkillsRoot }),
|
|
107
143
|
...(options.builtInSkillsRoot === undefined
|
|
108
144
|
? {}
|
|
109
145
|
: { builtInSkillsRoot: options.builtInSkillsRoot }),
|
|
110
146
|
});
|
|
111
147
|
contextRuntimeHint = resolveCodexAppServerContextRuntimeHint({
|
|
112
|
-
...(options.skillSelectionName === undefined
|
|
148
|
+
...(options.skillSelectionName === undefined
|
|
149
|
+
? {}
|
|
150
|
+
: { selectionName: options.skillSelectionName }),
|
|
113
151
|
...(options.agentContext === undefined ? {} : { agentContext: options.agentContext }),
|
|
114
152
|
});
|
|
115
153
|
}
|
|
@@ -184,10 +222,7 @@ export async function runCodexAppServerReadOnlyProcedure(options) {
|
|
|
184
222
|
...(contextRuntimeHint?.sensitiveValues ?? []),
|
|
185
223
|
...skillInputs.map((skill) => skill.path),
|
|
186
224
|
];
|
|
187
|
-
const strictLeakCheckValues = [
|
|
188
|
-
options.apiKey,
|
|
189
|
-
...(contextRuntimeHint?.sensitiveValues ?? []),
|
|
190
|
-
];
|
|
225
|
+
const strictLeakCheckValues = [options.apiKey, ...(contextRuntimeHint?.sensitiveValues ?? [])];
|
|
191
226
|
let primaryError;
|
|
192
227
|
let procedureResult;
|
|
193
228
|
let lifecycleError;
|
|
@@ -249,9 +284,7 @@ export async function runCodexAppServerReadOnlyProcedure(options) {
|
|
|
249
284
|
input: buildCodexAppServerTurnInput({
|
|
250
285
|
prompt: options.prompt,
|
|
251
286
|
skills: skillInputs,
|
|
252
|
-
...(contextRuntimeHint === undefined
|
|
253
|
-
? {}
|
|
254
|
-
: { runtimeHints: [contextRuntimeHint.text] }),
|
|
287
|
+
...(contextRuntimeHint === undefined ? {} : { runtimeHints: [contextRuntimeHint.text] }),
|
|
255
288
|
}),
|
|
256
289
|
cwd: appServerCwd,
|
|
257
290
|
approvalPolicy: "never",
|
|
@@ -314,9 +347,26 @@ export async function runCodexAppServerReadOnlyProcedure(options) {
|
|
|
314
347
|
const agentText = client.notifications
|
|
315
348
|
.map((notification) => extractAgentText(notification))
|
|
316
349
|
.join("");
|
|
317
|
-
|
|
350
|
+
let parsed;
|
|
351
|
+
try {
|
|
352
|
+
parsed = parseCodexAppServerStructuredJson(agentText);
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
if (!(error instanceof CodexAppServerReadOnlyProcedureError))
|
|
356
|
+
throw error;
|
|
357
|
+
throw new CodexAppServerReadOnlyProcedureError(error.code, error.message, {
|
|
358
|
+
...structuredOutputDetails(client, agentText),
|
|
359
|
+
...error.details,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
318
362
|
if (!options.validateOutput(parsed)) {
|
|
319
|
-
throw new CodexAppServerReadOnlyProcedureError("output_validation_failed", "Codex app-server structured output did not match the expected schema.");
|
|
363
|
+
throw new CodexAppServerReadOnlyProcedureError("output_validation_failed", "Codex app-server structured output did not match the expected schema.", structuredOutputDetails(client, agentText));
|
|
364
|
+
}
|
|
365
|
+
if (options.requireFileToolUse === true) {
|
|
366
|
+
const details = structuredOutputDetails(client, agentText);
|
|
367
|
+
if (details.file_tool_count === 0) {
|
|
368
|
+
throw new CodexAppServerReadOnlyProcedureError("file_read_not_observed", "Codex app-server did not attempt to inspect the summary source file.", details);
|
|
369
|
+
}
|
|
320
370
|
}
|
|
321
371
|
const gitStatusAfter = readGitStatus(options.workspaceRoot);
|
|
322
372
|
if (gitStatusAfter !== gitStatusBefore) {
|
|
@@ -4,8 +4,9 @@ import { REFERENCE_DIRECTORY_PATH } from "../../../../workspace-ops/index.js";
|
|
|
4
4
|
import { decideCommandIdempotencyReplay, executeIdempotentCommand, readCommandIdempotencyRecord, } from "../../../command-idempotency/index.js";
|
|
5
5
|
import { HOST_PROJECT_API_BASE_PATH } from "./constants.js";
|
|
6
6
|
import { readReferenceFilesResponse, referenceSummaryProcedureInvalidates, } from "./reference-files.js";
|
|
7
|
-
import { requireControlPlane, requireHostProjectSession, requireProjectStore, requireWorkspaceRoot, } from "./session-requirements.js";
|
|
7
|
+
import { requireControlPlane, requireHostProjectSession, requireHostProjectOwnerSession, requireProjectStore, requireWorkspaceRoot, } from "./session-requirements.js";
|
|
8
8
|
import { abortDownloadedStagedUpload, cleanupDownloadedStagedUpload, downloadStagedUpload, } from "./staged-uploads.js";
|
|
9
|
+
import { HostProjectBadRequestError } from "./errors.js";
|
|
9
10
|
export function registerReferenceFilesRoutes(app, { options, workspaceEvents, }) {
|
|
10
11
|
app.get(`${HOST_PROJECT_API_BASE_PATH}/references/files`, {
|
|
11
12
|
schema: {
|
|
@@ -90,7 +91,16 @@ export function registerReferenceFilesRoutes(app, { options, workspaceEvents, })
|
|
|
90
91
|
},
|
|
91
92
|
},
|
|
92
93
|
}, (request) => {
|
|
93
|
-
|
|
94
|
+
if (options.surfaceProfile?.kind === "feishu") {
|
|
95
|
+
requireHostProjectOwnerSession(request, options);
|
|
96
|
+
const paths = request.body.payload.paths;
|
|
97
|
+
if (paths?.length !== 1 || !paths[0]?.startsWith(`${REFERENCE_DIRECTORY_PATH}/`)) {
|
|
98
|
+
throw new HostProjectBadRequestError("Select one project Reference to retry its summary");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
requireHostProjectSession(request, options);
|
|
103
|
+
}
|
|
94
104
|
const store = requireProjectStore(options);
|
|
95
105
|
const execution = executeIdempotentCommand({
|
|
96
106
|
db: store.db,
|
|
@@ -109,6 +119,13 @@ export function registerReferenceFilesRoutes(app, { options, workspaceEvents, })
|
|
|
109
119
|
if (execution.result !== undefined) {
|
|
110
120
|
response.result = execution.result;
|
|
111
121
|
}
|
|
122
|
+
request.log.info({
|
|
123
|
+
command_id: execution.command_id,
|
|
124
|
+
disposition: execution.disposition.kind,
|
|
125
|
+
activity_ref: execution.result?.activity_ref,
|
|
126
|
+
workflow_ref: execution.result?.workflow_ref,
|
|
127
|
+
target_count: execution.result?.target_count,
|
|
128
|
+
}, "Reference summary refresh requested");
|
|
112
129
|
return response;
|
|
113
130
|
});
|
|
114
131
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
|
+
export declare const FEISHU_DOCUMENT_SOURCE_LIMIT = 100;
|
|
3
|
+
export declare const FeishuDocumentSourceRefSchema: import("@sinclair/typebox").TString;
|
|
4
|
+
export declare const ConnectFeishuDocumentBodySchema: import("@sinclair/typebox").TObject<{
|
|
5
|
+
document_url: import("@sinclair/typebox").TString;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const RefreshFeishuDocumentBodySchema: import("@sinclair/typebox").TObject<{
|
|
8
|
+
expected_updated_at: import("@sinclair/typebox").TString;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const FeishuDocumentSourceSchema: import("@sinclair/typebox").TObject<{
|
|
11
|
+
source_ref: import("@sinclair/typebox").TString;
|
|
12
|
+
reference_path: import("@sinclair/typebox").TString;
|
|
13
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"syncing">, import("@sinclair/typebox").TLiteral<"current">, import("@sinclair/typebox").TLiteral<"waiting_for_host">, import("@sinclair/typebox").TLiteral<"retrying">, import("@sinclair/typebox").TLiteral<"authorization_required">, import("@sinclair/typebox").TLiteral<"permission_denied">, import("@sinclair/typebox").TLiteral<"failed">]>;
|
|
14
|
+
revision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
15
|
+
last_checked_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
16
|
+
last_synced_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
17
|
+
next_attempt_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
18
|
+
updated_at: import("@sinclair/typebox").TString;
|
|
19
|
+
reason_code: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const FeishuDocumentSourcesSchema: import("@sinclair/typebox").TObject<{
|
|
22
|
+
can_manage: import("@sinclair/typebox").TBoolean;
|
|
23
|
+
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
24
|
+
source_ref: import("@sinclair/typebox").TString;
|
|
25
|
+
reference_path: import("@sinclair/typebox").TString;
|
|
26
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"syncing">, import("@sinclair/typebox").TLiteral<"current">, import("@sinclair/typebox").TLiteral<"waiting_for_host">, import("@sinclair/typebox").TLiteral<"retrying">, import("@sinclair/typebox").TLiteral<"authorization_required">, import("@sinclair/typebox").TLiteral<"permission_denied">, import("@sinclair/typebox").TLiteral<"failed">]>;
|
|
27
|
+
revision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
28
|
+
last_checked_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
29
|
+
last_synced_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
30
|
+
next_attempt_at: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
31
|
+
updated_at: import("@sinclair/typebox").TString;
|
|
32
|
+
reason_code: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
33
|
+
}>>;
|
|
34
|
+
}>;
|
|
35
|
+
export type FeishuDocumentSource = Static<typeof FeishuDocumentSourceSchema>;
|
|
36
|
+
export type FeishuDocumentSources = Static<typeof FeishuDocumentSourcesSchema>;
|
|
37
|
+
export type ConnectFeishuDocumentBody = Static<typeof ConnectFeishuDocumentBodySchema>;
|
|
38
|
+
export type RefreshFeishuDocumentBody = Static<typeof RefreshFeishuDocumentBodySchema>;
|
|
39
|
+
/** Parse a locator, never fetch a caller-controlled URL. Wiki requires a separate adapter. */
|
|
40
|
+
export declare function parseFeishuDocxUrl(value: string): string | null;
|
|
41
|
+
//# sourceMappingURL=feishu-documents.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { IsoDateTimeStringSchema } from "../domain/index.js";
|
|
3
|
+
export const FEISHU_DOCUMENT_SOURCE_LIMIT = 100;
|
|
4
|
+
export const FeishuDocumentSourceRefSchema = Type.String({
|
|
5
|
+
pattern: "^managed_ref_[a-f0-9]{32}$",
|
|
6
|
+
maxLength: 44,
|
|
7
|
+
});
|
|
8
|
+
export const ConnectFeishuDocumentBodySchema = Type.Object({ document_url: Type.String({ minLength: 1, maxLength: 2_048 }) }, { additionalProperties: false });
|
|
9
|
+
export const RefreshFeishuDocumentBodySchema = Type.Object({ expected_updated_at: IsoDateTimeStringSchema }, { additionalProperties: false });
|
|
10
|
+
export const FeishuDocumentSourceSchema = Type.Object({
|
|
11
|
+
source_ref: FeishuDocumentSourceRefSchema,
|
|
12
|
+
reference_path: Type.String({ pattern: "^docs/reference/feishu-docx-[a-f0-9]{12}\\.txt$" }),
|
|
13
|
+
status: Type.Union([
|
|
14
|
+
Type.Literal("syncing"),
|
|
15
|
+
Type.Literal("current"),
|
|
16
|
+
Type.Literal("waiting_for_host"),
|
|
17
|
+
Type.Literal("retrying"),
|
|
18
|
+
Type.Literal("authorization_required"),
|
|
19
|
+
Type.Literal("permission_denied"),
|
|
20
|
+
Type.Literal("failed"),
|
|
21
|
+
]),
|
|
22
|
+
revision: Type.Union([Type.String({ maxLength: 512 }), Type.Null()]),
|
|
23
|
+
last_checked_at: Type.Union([IsoDateTimeStringSchema, Type.Null()]),
|
|
24
|
+
last_synced_at: Type.Union([IsoDateTimeStringSchema, Type.Null()]),
|
|
25
|
+
next_attempt_at: Type.Union([IsoDateTimeStringSchema, Type.Null()]),
|
|
26
|
+
updated_at: IsoDateTimeStringSchema,
|
|
27
|
+
reason_code: Type.Union([Type.String({ pattern: "^[a-z][a-z0-9_]{0,95}$" }), Type.Null()]),
|
|
28
|
+
}, { additionalProperties: false });
|
|
29
|
+
export const FeishuDocumentSourcesSchema = Type.Object({
|
|
30
|
+
can_manage: Type.Boolean(),
|
|
31
|
+
items: Type.Array(FeishuDocumentSourceSchema, { maxItems: FEISHU_DOCUMENT_SOURCE_LIMIT }),
|
|
32
|
+
}, { additionalProperties: false });
|
|
33
|
+
/** Parse a locator, never fetch a caller-controlled URL. Wiki requires a separate adapter. */
|
|
34
|
+
export function parseFeishuDocxUrl(value) {
|
|
35
|
+
if (value.length > 2_048 ||
|
|
36
|
+
Array.from(value).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
|
|
37
|
+
return null;
|
|
38
|
+
return (/^https:\/\/(?:[a-z0-9-]+\.)?(?:feishu\.cn|larksuite\.com)(?::443)?\/docx\/([a-z0-9]{27})\/?(?:[?#][^\s]*)?$/iu.exec(value.trim())?.[1] ?? null);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=feishu-documents.js.map
|
|
@@ -5,7 +5,7 @@ export { CompleteDesktopEntryContinuationBodySchema, CompleteDesktopEntryContinu
|
|
|
5
5
|
export type { CompleteDesktopEntryContinuationBody, CreateDesktopEntryContinuationResponse, GetDesktopEntryContinuationResponse, SealedDesktopEntryPayload, } from "./desktop-entry-continuations.js";
|
|
6
6
|
export { LOCAL_CONSOLE_ACCOUNT_HANDOFF_TOKEN_MAX_LENGTH, LOCAL_CONSOLE_ACCOUNT_HANDOFF_TOKEN_MIN_LENGTH, RegisterLocalConsoleAccountHandoffBodySchema, RegisterLocalConsoleAccountHandoffResponseSchema, } from "./local-console-account-handoffs.js";
|
|
7
7
|
export type { RegisterLocalConsoleAccountHandoffBody, RegisterLocalConsoleAccountHandoffResponse, } from "./local-console-account-handoffs.js";
|
|
8
|
-
export { FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH, FEISHU_DOCX_REQUIRED_USER_SCOPE, FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH, FEISHU_H5_REQUIRED_USER_SCOPE, FEISHU_PLATFORM_STATE_LENGTH, FeishuPlatformSessionBootstrapBodySchema, FeishuPlatformSessionBootstrapResponseSchema, FeishuBrowserHandoffResponseSchema, FeishuBrowserHandoffTokenSchema, ConsumeFeishuBrowserHandoffBodySchema, FeishuDocumentAuthorizationBootstrapResponseSchema, FeishuDocumentAuthorizationExchangeBodySchema, FeishuDocumentAuthorizationProjectionSchema, FeishuPlatformSessionExchangeBodySchema, FeishuPlatformSessionProjectionSchema, FeishuPlatformStateSchema, } from "./platform-sessions.js";
|
|
8
|
+
export { FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH, FEISHU_DOCX_READWRITE_USER_SCOPE, FEISHU_DOCX_REQUIRED_USER_SCOPE, FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH, FEISHU_H5_REQUIRED_USER_SCOPE, FEISHU_OFFLINE_ACCESS_SCOPE, FEISHU_PLATFORM_STATE_LENGTH, FeishuPlatformSessionBootstrapBodySchema, FeishuPlatformSessionBootstrapResponseSchema, FeishuBrowserHandoffResponseSchema, FeishuBrowserHandoffTokenSchema, ConsumeFeishuBrowserHandoffBodySchema, FeishuDocumentAuthorizationBootstrapResponseSchema, FeishuDocumentAuthorizationExchangeBodySchema, FeishuDocumentAuthorizationProjectionSchema, FeishuPlatformSessionExchangeBodySchema, FeishuPlatformSessionProjectionSchema, FeishuPlatformStateSchema, hasFeishuDocxReadCapability, } from "./platform-sessions.js";
|
|
9
9
|
export type { FeishuPlatformSessionBootstrapBody, FeishuPlatformSessionBootstrapResponse, FeishuBrowserHandoffResponse, ConsumeFeishuBrowserHandoffBody, FeishuDocumentAuthorizationBootstrapResponse, FeishuDocumentAuthorizationExchangeBody, FeishuDocumentAuthorizationProjection, FeishuPlatformSessionExchangeBody, FeishuPlatformSessionProjection, } from "./platform-sessions.js";
|
|
10
10
|
export { ApiErrorCodeSchema, ApiErrorResponseSchema, CommandDispositionBaseSchema, CursorPageRequestSchema, DEFAULT_SSE_REPLAY_WINDOW_POLICY, InterruptedCommandDispositionSchema, QueryInvalidationHintSchema, RelayInvalidationHintSchema, RelaySseEventTypeSchema, SseReplayWindowPolicySchema, WorkspaceSseEventTypeSchema, commandEnvelopeSchema, commandResponseSchema, commandResponseWithResultSchema, cursorPageSchema, relaySseEventSchema, timelineWindowSchema, workspaceSseEventSchema, } from "./primitives.js";
|
|
11
11
|
export { GetProviderModelsResponseSchema, MAX_PROVIDER_MODEL_NAME_LENGTH, ProviderConfigInvalidReasonCodeSchema, ProviderConfigProjectionSchema, ProviderModelDiscoveryUnavailableReasonSchema, ProviderModelNameSchema, ProviderModelValidationFailureReasonSchema, ProviderUnavailableReasonCodeSchema, ProjectProviderUnavailableReasonSchema, UpdateProviderDefaultModelBodySchema, UpdateProviderDefaultModelDispositionSchema, UpdateProviderDefaultModelPayloadSchema, UpdateProviderDefaultModelResponseSchema, } from "./provider-config.js";
|
|
@@ -22,4 +22,5 @@ export { ArtifactKindSchema, ArtifactManifestSchema, ArtifactPreviewProjectionSc
|
|
|
22
22
|
export { DeleteSkillBodySchema, DeleteSkillDispositionSchema, DeleteSkillPayloadSchema, DeleteSkillResponseSchema, GetSkillParamsSchema, GetSkillResponseSchema, GetSkillsResponseSchema, ImportSkillZipBodySchema, ImportSkillZipDispositionSchema, ImportSkillZipPayloadSchema, ImportSkillZipResponseSchema, ImportSkillZipResultSchema, SkillDetailProjectionSchema, SkillNameSchema, SkillProjectionSchema, } from "./skills.js";
|
|
23
23
|
export { ActivityEventProjectionSchema, ActivityEventSsePayloadSchema, ApprovalChangedEventPayloadSchema, ActivityProjectionSchema, ConnectionReadyEventPayloadSchema, ExecutionActivitySummarySchema, ExecutionStatusChangedEventPayloadSchema, ExecutionStatusKindSchema, ExecutionStatusProjectionSchema, ProcedureLaneSchema, ProviderConfigChangedEventPayloadSchema, QueryInvalidateEventPayloadSchema, ScratchpadUpdatedEventPayloadSchema, TaskDetailUpdatedEventPayloadSchema, TaskUpdatedEventPayloadSchema, WorklistChangedEventPayloadSchema, WorkspaceRecoveredEventPayloadSchema, } from "./runtime-events.js";
|
|
24
24
|
export { ContextSyncBodySchema, ContextSyncDispositionSchema, ContextSyncPayloadSchema, ContextSyncResponseSchema, ContextSyncResultSchema, InitializeProjectDocsBodySchema, InitializeProjectDocsDispositionSchema, InitializeProjectDocsPayloadSchema, InitializeProjectDocsResponseSchema, InitializeProjectDocsResultSchema, ProjectDocsProcedureStartResultSchema, RefreshScratchpadDispositionSchema, RefreshScratchpadResultSchema, RunSchedulerNowBodySchema, RunSchedulerNowDispositionSchema, RunSchedulerNowPayloadSchema, RunSchedulerNowResponseSchema, RetryTaskBodySchema, RetryTaskDispositionSchema, RetryTaskPayloadSchema, RetryTaskResponseSchema, SubmitWorklistBodySchema, SubmitWorklistDispositionSchema, SubmitWorklistPayloadSchema, SubmitWorklistResponseSchema, SubmitWorklistResultSchema, UpdateProjectDescriptionBodySchema, UpdateProjectDescriptionDispositionSchema, UpdateProjectDescriptionPayloadSchema, UpdateProjectDescriptionResponseSchema, UpdateProjectDescriptionResultSchema, UpdateProjectDisplayNameBodySchema, UpdateProjectDisplayNameDispositionSchema, UpdateProjectDisplayNamePayloadSchema, UpdateProjectDisplayNameResponseSchema, UpdateProjectDisplayNameResultSchema, } from "./workspace-commands.js";
|
|
25
|
+
export * from "./feishu-documents.js";
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,7 @@ export * from "./openapi.js";
|
|
|
2
2
|
export { ARTIFACT_FEEDBACK_MAX_ANNOTATIONS, ARTIFACT_FEEDBACK_MAX_AUTHORED_TEXT_LENGTH, ARTIFACT_FEEDBACK_MAX_COMMENT_LENGTH, ARTIFACT_FEEDBACK_MAX_SERIALIZED_BYTES, ARTIFACT_FEEDBACK_MAX_SUMMARY_LENGTH, ArtifactElementAnchorSchema, ArtifactElementKindSchema, ArtifactElementTargetSchema, ArtifactFeedbackAnnotationSchema, ArtifactFeedbackCommandSchema, ArtifactFeedbackRefSchema, ArtifactSemanticContextSchema, ArtifactSemanticSnapshotSchema, ArtifactSemanticStateSchema, } from "./artifact-feedback.js";
|
|
3
3
|
export { CompleteDesktopEntryContinuationBodySchema, CompleteDesktopEntryContinuationResponseSchema, CreateDesktopEntryContinuationResponseSchema, DESKTOP_ENTRY_COMPLETION_TOKEN_LENGTH, DESKTOP_ENTRY_PAYLOAD_KEY_LENGTH, DESKTOP_ENTRY_SEALED_IV_LENGTH, DesktopEntryCompletionTokenSchema, DesktopEntryContinuationPendingProjectionSchema, DesktopEntryContinuationReadyProjectionSchema, DesktopEntryPayloadKeySchema, GetDesktopEntryContinuationResponseSchema, MAX_DESKTOP_ENTRY_SEALED_CIPHERTEXT_LENGTH, SealedDesktopEntryPayloadSchema, } from "./desktop-entry-continuations.js";
|
|
4
4
|
export { LOCAL_CONSOLE_ACCOUNT_HANDOFF_TOKEN_MAX_LENGTH, LOCAL_CONSOLE_ACCOUNT_HANDOFF_TOKEN_MIN_LENGTH, RegisterLocalConsoleAccountHandoffBodySchema, RegisterLocalConsoleAccountHandoffResponseSchema, } from "./local-console-account-handoffs.js";
|
|
5
|
-
export { FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH, FEISHU_DOCX_REQUIRED_USER_SCOPE, FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH, FEISHU_H5_REQUIRED_USER_SCOPE, FEISHU_PLATFORM_STATE_LENGTH, FeishuPlatformSessionBootstrapBodySchema, FeishuPlatformSessionBootstrapResponseSchema, FeishuBrowserHandoffResponseSchema, FeishuBrowserHandoffTokenSchema, ConsumeFeishuBrowserHandoffBodySchema, FeishuDocumentAuthorizationBootstrapResponseSchema, FeishuDocumentAuthorizationExchangeBodySchema, FeishuDocumentAuthorizationProjectionSchema, FeishuPlatformSessionExchangeBodySchema, FeishuPlatformSessionProjectionSchema, FeishuPlatformStateSchema, } from "./platform-sessions.js";
|
|
5
|
+
export { FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH, FEISHU_DOCX_READWRITE_USER_SCOPE, FEISHU_DOCX_REQUIRED_USER_SCOPE, FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH, FEISHU_H5_REQUIRED_USER_SCOPE, FEISHU_OFFLINE_ACCESS_SCOPE, FEISHU_PLATFORM_STATE_LENGTH, FeishuPlatformSessionBootstrapBodySchema, FeishuPlatformSessionBootstrapResponseSchema, FeishuBrowserHandoffResponseSchema, FeishuBrowserHandoffTokenSchema, ConsumeFeishuBrowserHandoffBodySchema, FeishuDocumentAuthorizationBootstrapResponseSchema, FeishuDocumentAuthorizationExchangeBodySchema, FeishuDocumentAuthorizationProjectionSchema, FeishuPlatformSessionExchangeBodySchema, FeishuPlatformSessionProjectionSchema, FeishuPlatformStateSchema, hasFeishuDocxReadCapability, } from "./platform-sessions.js";
|
|
6
6
|
export { ApiErrorCodeSchema, ApiErrorResponseSchema, CommandDispositionBaseSchema, CursorPageRequestSchema, DEFAULT_SSE_REPLAY_WINDOW_POLICY, InterruptedCommandDispositionSchema, QueryInvalidationHintSchema, RelayInvalidationHintSchema, RelaySseEventTypeSchema, SseReplayWindowPolicySchema, WorkspaceSseEventTypeSchema, commandEnvelopeSchema, commandResponseSchema, commandResponseWithResultSchema, cursorPageSchema, relaySseEventSchema, timelineWindowSchema, workspaceSseEventSchema, } from "./primitives.js";
|
|
7
7
|
export { GetProviderModelsResponseSchema, MAX_PROVIDER_MODEL_NAME_LENGTH, ProviderConfigInvalidReasonCodeSchema, ProviderConfigProjectionSchema, ProviderModelDiscoveryUnavailableReasonSchema, ProviderModelNameSchema, ProviderModelValidationFailureReasonSchema, ProviderUnavailableReasonCodeSchema, ProjectProviderUnavailableReasonSchema, UpdateProviderDefaultModelBodySchema, UpdateProviderDefaultModelDispositionSchema, UpdateProviderDefaultModelPayloadSchema, UpdateProviderDefaultModelResponseSchema, } from "./provider-config.js";
|
|
8
8
|
export { ProviderUsageBreakdownProjectionSchema, ProviderUsageCategorySchema, ProviderUsageModelSummaryProjectionSchema, ProviderUsageProjectionSchema, ProviderUsageSourceSummaryProjectionSchema, } from "./provider-usage.js";
|
|
@@ -18,4 +18,5 @@ export { ArtifactKindSchema, ArtifactManifestSchema, ArtifactPreviewProjectionSc
|
|
|
18
18
|
export { DeleteSkillBodySchema, DeleteSkillDispositionSchema, DeleteSkillPayloadSchema, DeleteSkillResponseSchema, GetSkillParamsSchema, GetSkillResponseSchema, GetSkillsResponseSchema, ImportSkillZipBodySchema, ImportSkillZipDispositionSchema, ImportSkillZipPayloadSchema, ImportSkillZipResponseSchema, ImportSkillZipResultSchema, SkillDetailProjectionSchema, SkillNameSchema, SkillProjectionSchema, } from "./skills.js";
|
|
19
19
|
export { ActivityEventProjectionSchema, ActivityEventSsePayloadSchema, ApprovalChangedEventPayloadSchema, ActivityProjectionSchema, ConnectionReadyEventPayloadSchema, ExecutionActivitySummarySchema, ExecutionStatusChangedEventPayloadSchema, ExecutionStatusKindSchema, ExecutionStatusProjectionSchema, ProcedureLaneSchema, ProviderConfigChangedEventPayloadSchema, QueryInvalidateEventPayloadSchema, ScratchpadUpdatedEventPayloadSchema, TaskDetailUpdatedEventPayloadSchema, TaskUpdatedEventPayloadSchema, WorklistChangedEventPayloadSchema, WorkspaceRecoveredEventPayloadSchema, } from "./runtime-events.js";
|
|
20
20
|
export { ContextSyncBodySchema, ContextSyncDispositionSchema, ContextSyncPayloadSchema, ContextSyncResponseSchema, ContextSyncResultSchema, InitializeProjectDocsBodySchema, InitializeProjectDocsDispositionSchema, InitializeProjectDocsPayloadSchema, InitializeProjectDocsResponseSchema, InitializeProjectDocsResultSchema, ProjectDocsProcedureStartResultSchema, RefreshScratchpadDispositionSchema, RefreshScratchpadResultSchema, RunSchedulerNowBodySchema, RunSchedulerNowDispositionSchema, RunSchedulerNowPayloadSchema, RunSchedulerNowResponseSchema, RetryTaskBodySchema, RetryTaskDispositionSchema, RetryTaskPayloadSchema, RetryTaskResponseSchema, SubmitWorklistBodySchema, SubmitWorklistDispositionSchema, SubmitWorklistPayloadSchema, SubmitWorklistResponseSchema, SubmitWorklistResultSchema, UpdateProjectDescriptionBodySchema, UpdateProjectDescriptionDispositionSchema, UpdateProjectDescriptionPayloadSchema, UpdateProjectDescriptionResponseSchema, UpdateProjectDescriptionResultSchema, UpdateProjectDisplayNameBodySchema, UpdateProjectDisplayNameDispositionSchema, UpdateProjectDisplayNamePayloadSchema, UpdateProjectDisplayNameResponseSchema, UpdateProjectDisplayNameResultSchema, } from "./workspace-commands.js";
|
|
21
|
+
export * from "./feishu-documents.js";
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,8 +2,11 @@ import type { Static } from "@sinclair/typebox";
|
|
|
2
2
|
export declare const FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH = 2048;
|
|
3
3
|
export declare const FEISHU_H5_REQUIRED_USER_SCOPE = "im:chat.members:read";
|
|
4
4
|
export declare const FEISHU_DOCX_REQUIRED_USER_SCOPE = "docx:document:readonly";
|
|
5
|
+
export declare const FEISHU_DOCX_READWRITE_USER_SCOPE = "docx:document";
|
|
6
|
+
export declare const FEISHU_OFFLINE_ACCESS_SCOPE = "offline_access";
|
|
5
7
|
export declare const FEISHU_PLATFORM_STATE_LENGTH = 43;
|
|
6
8
|
export declare const FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH = 43;
|
|
9
|
+
export declare function hasFeishuDocxReadCapability(scopes: readonly string[]): boolean;
|
|
7
10
|
export declare const FeishuPlatformStateSchema: import("@sinclair/typebox").TString;
|
|
8
11
|
export declare const FeishuBrowserHandoffTokenSchema: import("@sinclair/typebox").TString;
|
|
9
12
|
export declare const FeishuPlatformSessionBootstrapBodySchema: import("@sinclair/typebox").TObject<{
|
|
@@ -43,7 +46,7 @@ export declare const FeishuDocumentAuthorizationBootstrapResponseSchema: import(
|
|
|
43
46
|
platform: import("@sinclair/typebox").TLiteral<"feishu">;
|
|
44
47
|
app_id: import("@sinclair/typebox").TString;
|
|
45
48
|
state: import("@sinclair/typebox").TString;
|
|
46
|
-
authorization_scopes: import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TLiteral<"docx:document:readonly">]>;
|
|
49
|
+
authorization_scopes: import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TLiteral<"docx:document:readonly">, import("@sinclair/typebox").TLiteral<"offline_access">]>;
|
|
47
50
|
expires_at: import("@sinclair/typebox").TString;
|
|
48
51
|
}>;
|
|
49
52
|
export declare const FeishuDocumentAuthorizationExchangeBodySchema: import("@sinclair/typebox").TObject<{
|
|
@@ -3,8 +3,13 @@ import { IsoDateTimeStringSchema, RelayAccountRefSchema, RelayPlatformSessionRef
|
|
|
3
3
|
export const FEISHU_H5_AUTHORIZATION_CODE_MAX_LENGTH = 2_048;
|
|
4
4
|
export const FEISHU_H5_REQUIRED_USER_SCOPE = "im:chat.members:read";
|
|
5
5
|
export const FEISHU_DOCX_REQUIRED_USER_SCOPE = "docx:document:readonly";
|
|
6
|
+
export const FEISHU_DOCX_READWRITE_USER_SCOPE = "docx:document";
|
|
7
|
+
export const FEISHU_OFFLINE_ACCESS_SCOPE = "offline_access";
|
|
6
8
|
export const FEISHU_PLATFORM_STATE_LENGTH = 43;
|
|
7
9
|
export const FEISHU_BROWSER_HANDOFF_TOKEN_LENGTH = 43;
|
|
10
|
+
export function hasFeishuDocxReadCapability(scopes) {
|
|
11
|
+
return scopes.some((scope) => scope === FEISHU_DOCX_REQUIRED_USER_SCOPE || scope === FEISHU_DOCX_READWRITE_USER_SCOPE);
|
|
12
|
+
}
|
|
8
13
|
export const FeishuPlatformStateSchema = Type.String({
|
|
9
14
|
minLength: FEISHU_PLATFORM_STATE_LENGTH,
|
|
10
15
|
maxLength: FEISHU_PLATFORM_STATE_LENGTH,
|
|
@@ -52,7 +57,10 @@ export const FeishuDocumentAuthorizationBootstrapResponseSchema = Type.Object({
|
|
|
52
57
|
platform: Type.Literal("feishu"),
|
|
53
58
|
app_id: Type.String({ minLength: 1, maxLength: 128, pattern: "^cli_[A-Za-z0-9]+$" }),
|
|
54
59
|
state: FeishuPlatformStateSchema,
|
|
55
|
-
authorization_scopes: Type.Tuple([
|
|
60
|
+
authorization_scopes: Type.Tuple([
|
|
61
|
+
Type.Literal(FEISHU_DOCX_REQUIRED_USER_SCOPE),
|
|
62
|
+
Type.Literal(FEISHU_OFFLINE_ACCESS_SCOPE),
|
|
63
|
+
]),
|
|
56
64
|
expires_at: IsoDateTimeStringSchema,
|
|
57
65
|
}, { additionalProperties: false });
|
|
58
66
|
export const FeishuDocumentAuthorizationExchangeBodySchema = Type.Object({
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
|
+
export declare const FEISHU_DOCUMENT_CONTROL_PATH = "/internal/v1/feishu-documents";
|
|
3
|
+
export declare const FeishuDocumentControlRequestSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
4
|
+
action: import("@sinclair/typebox").TLiteral<"list">;
|
|
5
|
+
authority: import("@sinclair/typebox").TObject<{
|
|
6
|
+
project_ref: import("@sinclair/typebox").TString;
|
|
7
|
+
installation_ref: import("@sinclair/typebox").TString;
|
|
8
|
+
binding_ref: import("@sinclair/typebox").TString;
|
|
9
|
+
external_subject_ref: import("@sinclair/typebox").TString;
|
|
10
|
+
role: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"owner">, import("@sinclair/typebox").TLiteral<"member">]>;
|
|
11
|
+
}>;
|
|
12
|
+
diagnostic_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
14
|
+
action: import("@sinclair/typebox").TLiteral<"connect">;
|
|
15
|
+
document_id: import("@sinclair/typebox").TString;
|
|
16
|
+
authority: import("@sinclair/typebox").TObject<{
|
|
17
|
+
project_ref: import("@sinclair/typebox").TString;
|
|
18
|
+
installation_ref: import("@sinclair/typebox").TString;
|
|
19
|
+
binding_ref: import("@sinclair/typebox").TString;
|
|
20
|
+
external_subject_ref: import("@sinclair/typebox").TString;
|
|
21
|
+
role: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"owner">, import("@sinclair/typebox").TLiteral<"member">]>;
|
|
22
|
+
}>;
|
|
23
|
+
diagnostic_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
25
|
+
expected_updated_at: import("@sinclair/typebox").TString;
|
|
26
|
+
action: import("@sinclair/typebox").TLiteral<"refresh">;
|
|
27
|
+
source_ref: import("@sinclair/typebox").TString;
|
|
28
|
+
authority: import("@sinclair/typebox").TObject<{
|
|
29
|
+
project_ref: import("@sinclair/typebox").TString;
|
|
30
|
+
installation_ref: import("@sinclair/typebox").TString;
|
|
31
|
+
binding_ref: import("@sinclair/typebox").TString;
|
|
32
|
+
external_subject_ref: import("@sinclair/typebox").TString;
|
|
33
|
+
role: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"owner">, import("@sinclair/typebox").TLiteral<"member">]>;
|
|
34
|
+
}>;
|
|
35
|
+
diagnostic_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
+
}>]>;
|
|
37
|
+
export type FeishuDocumentControlRequest = Static<typeof FeishuDocumentControlRequestSchema>;
|
|
38
|
+
//# sourceMappingURL=feishu-documents.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { FeishuDocumentSourceRefSchema, RefreshFeishuDocumentBodySchema, } from "../api/feishu-documents.js";
|
|
3
|
+
import { RelayProjectRefSchema } from "../domain/index.js";
|
|
4
|
+
export const FEISHU_DOCUMENT_CONTROL_PATH = "/internal/v1/feishu-documents";
|
|
5
|
+
const authority = Type.Object({
|
|
6
|
+
project_ref: RelayProjectRefSchema,
|
|
7
|
+
installation_ref: Type.String({ minLength: 1, maxLength: 512 }),
|
|
8
|
+
binding_ref: Type.String({ minLength: 1, maxLength: 512 }),
|
|
9
|
+
external_subject_ref: Type.String({ pattern: "^open_id:[A-Za-z0-9_-]{1,500}$" }),
|
|
10
|
+
role: Type.Union([Type.Literal("owner"), Type.Literal("member")]),
|
|
11
|
+
}, { additionalProperties: false });
|
|
12
|
+
const common = {
|
|
13
|
+
authority,
|
|
14
|
+
diagnostic_id: Type.Optional(Type.String({ pattern: "^fdiag_[a-f0-9]{32}$" })),
|
|
15
|
+
};
|
|
16
|
+
// The private document locator travels only in this authenticated Relay -> Integration body.
|
|
17
|
+
export const FeishuDocumentControlRequestSchema = Type.Union([
|
|
18
|
+
Type.Object({ ...common, action: Type.Literal("list") }, { additionalProperties: false }),
|
|
19
|
+
Type.Object({
|
|
20
|
+
...common,
|
|
21
|
+
action: Type.Literal("connect"),
|
|
22
|
+
document_id: Type.String({ pattern: "^[A-Za-z0-9]{27}$" }),
|
|
23
|
+
}, { additionalProperties: false }),
|
|
24
|
+
Type.Object({
|
|
25
|
+
...common,
|
|
26
|
+
action: Type.Literal("refresh"),
|
|
27
|
+
source_ref: FeishuDocumentSourceRefSchema,
|
|
28
|
+
...RefreshFeishuDocumentBodySchema.properties,
|
|
29
|
+
}, { additionalProperties: false }),
|
|
30
|
+
]);
|
|
31
|
+
//# sourceMappingURL=feishu-documents.js.map
|
|
@@ -73,4 +73,5 @@ export declare function isFeishuPlatformSessionContext(value: unknown): value is
|
|
|
73
73
|
export declare function parseFeishuPlatformSessionContext(value: unknown): FeishuPlatformSessionContext | null;
|
|
74
74
|
export * from "./platform-integration.js";
|
|
75
75
|
export * from "./feishu-user-credentials.js";
|
|
76
|
+
export * from "./feishu-documents.js";
|
|
76
77
|
//# sourceMappingURL=index.d.ts.map
|