@wingman-ai/gateway 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.wingman/agents/coding/agent.md +5 -0
- package/.wingman/agents/coding-v2/agent.md +58 -0
- package/.wingman/agents/game-dev/agent.md +94 -0
- package/.wingman/agents/game-dev/art-generation.md +37 -0
- package/.wingman/agents/game-dev/asset-refinement.md +17 -0
- package/.wingman/agents/game-dev/planning-idea.md +17 -0
- package/.wingman/agents/game-dev/ui-specialist.md +17 -0
- package/.wingman/agents/main/agent.md +2 -0
- package/README.md +1 -0
- package/dist/agent/config/agentConfig.d.ts +4 -0
- package/dist/agent/config/mcpClientManager.cjs +44 -10
- package/dist/agent/config/mcpClientManager.d.ts +6 -2
- package/dist/agent/config/mcpClientManager.js +44 -10
- package/dist/agent/config/toolRegistry.cjs +3 -1
- package/dist/agent/config/toolRegistry.js +3 -1
- package/dist/agent/tests/mcpClientManager.test.cjs +124 -0
- package/dist/agent/tests/mcpClientManager.test.d.ts +1 -0
- package/dist/agent/tests/mcpClientManager.test.js +118 -0
- package/dist/agent/tools/command_execute.cjs +1 -1
- package/dist/agent/tools/command_execute.js +1 -1
- package/dist/cli/config/schema.d.ts +2 -0
- package/dist/cli/core/agentInvoker.cjs +55 -66
- package/dist/cli/core/agentInvoker.d.ts +10 -13
- package/dist/cli/core/agentInvoker.js +42 -62
- package/dist/cli/core/imagePersistence.cjs +125 -0
- package/dist/cli/core/imagePersistence.d.ts +24 -0
- package/dist/cli/core/imagePersistence.js +85 -0
- package/dist/cli/core/sessionManager.cjs +297 -40
- package/dist/cli/core/sessionManager.d.ts +9 -0
- package/dist/cli/core/sessionManager.js +297 -40
- package/dist/debug/terminalProbe.cjs +57 -0
- package/dist/debug/terminalProbe.d.ts +10 -0
- package/dist/debug/terminalProbe.js +20 -0
- package/dist/debug/terminalProbeAuth.cjs +140 -0
- package/dist/debug/terminalProbeAuth.d.ts +20 -0
- package/dist/debug/terminalProbeAuth.js +97 -0
- package/dist/gateway/http/fs.cjs +19 -0
- package/dist/gateway/http/fs.js +19 -0
- package/dist/gateway/http/sessions.cjs +25 -5
- package/dist/gateway/http/sessions.js +25 -5
- package/dist/gateway/server.cjs +112 -11
- package/dist/gateway/server.d.ts +2 -0
- package/dist/gateway/server.js +112 -11
- package/dist/providers/codex.cjs +230 -37
- package/dist/providers/codex.d.ts +2 -0
- package/dist/providers/codex.js +231 -38
- package/dist/tests/agentInvokerSummarization.test.cjs +56 -37
- package/dist/tests/agentInvokerSummarization.test.js +58 -39
- package/dist/tests/agentInvokerWorkdir.test.cjs +50 -0
- package/dist/tests/agentInvokerWorkdir.test.js +52 -2
- package/dist/tests/cli-init.test.cjs +36 -0
- package/dist/tests/cli-init.test.js +36 -0
- package/dist/tests/codex-provider.test.cjs +173 -0
- package/dist/tests/codex-provider.test.js +174 -1
- package/dist/tests/falRuntime.test.cjs +78 -0
- package/dist/tests/falRuntime.test.d.ts +1 -0
- package/dist/tests/falRuntime.test.js +72 -0
- package/dist/tests/falSummary.test.cjs +51 -0
- package/dist/tests/falSummary.test.d.ts +1 -0
- package/dist/tests/falSummary.test.js +45 -0
- package/dist/tests/gateway.test.cjs +109 -1
- package/dist/tests/gateway.test.js +109 -1
- package/dist/tests/imagePersistence.test.cjs +143 -0
- package/dist/tests/imagePersistence.test.d.ts +1 -0
- package/dist/tests/imagePersistence.test.js +137 -0
- package/dist/tests/sessionMessageAttachments.test.cjs +30 -0
- package/dist/tests/sessionMessageAttachments.test.js +30 -0
- package/dist/tests/sessionStateMessages.test.cjs +126 -0
- package/dist/tests/sessionStateMessages.test.js +126 -0
- package/dist/tests/sessions-api.test.cjs +117 -3
- package/dist/tests/sessions-api.test.js +118 -4
- package/dist/tests/terminalProbe.test.cjs +45 -0
- package/dist/tests/terminalProbe.test.d.ts +1 -0
- package/dist/tests/terminalProbe.test.js +39 -0
- package/dist/tests/terminalProbeAuth.test.cjs +85 -0
- package/dist/tests/terminalProbeAuth.test.d.ts +1 -0
- package/dist/tests/terminalProbeAuth.test.js +79 -0
- package/dist/tools/fal/runtime.cjs +103 -0
- package/dist/tools/fal/runtime.d.ts +10 -0
- package/dist/tools/fal/runtime.js +60 -0
- package/dist/tools/fal/summary.cjs +78 -0
- package/dist/tools/fal/summary.d.ts +22 -0
- package/dist/tools/fal/summary.js +41 -0
- package/dist/tools/mcp-fal-ai.cjs +1041 -0
- package/dist/tools/mcp-fal-ai.d.ts +1 -0
- package/dist/tools/mcp-fal-ai.js +1025 -0
- package/dist/types/mcp.cjs +2 -0
- package/dist/types/mcp.d.ts +8 -0
- package/dist/types/mcp.js +3 -1
- package/dist/webui/assets/index-0nUBsUUq.js +278 -0
- package/dist/webui/assets/index-kk7OrD-G.css +11 -0
- package/dist/webui/index.html +2 -2
- package/package.json +16 -13
- package/dist/webui/assets/index-DVWQluit.css +0 -11
- package/dist/webui/assets/index-Dlyzwalc.js +0 -270
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { handleSessionsApi } from "../gateway/http/sessions.js";
|
|
3
|
-
import { SessionManager } from "../cli/core/sessionManager.js";
|
|
4
|
-
import { mkdtempSync, rmSync } from "node:fs";
|
|
1
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
2
|
import { tmpdir } from "node:os";
|
|
6
3
|
import { join } from "node:path";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
5
|
+
import { SessionManager } from "../cli/core/sessionManager.js";
|
|
6
|
+
import { handleSessionsApi } from "../gateway/http/sessions.js";
|
|
7
7
|
const isBunRuntime = void 0 !== globalThis.Bun;
|
|
8
8
|
const describeIfBun = isBunRuntime ? describe : describe.skip;
|
|
9
9
|
describeIfBun("sessions API", ()=>{
|
|
@@ -59,4 +59,118 @@ describeIfBun("sessions API", ()=>{
|
|
|
59
59
|
expect(updated?.messageCount).toBe(0);
|
|
60
60
|
expect(updated?.lastMessagePreview).toBeNull();
|
|
61
61
|
});
|
|
62
|
+
it("returns pending messages and clears them via DELETE", async ()=>{
|
|
63
|
+
const ctx = {
|
|
64
|
+
getSessionManager: async ()=>manager,
|
|
65
|
+
router: {
|
|
66
|
+
selectAgent: (agentId)=>agentId || "main"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const createReq = new Request("http://localhost/api/sessions", {
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "application/json"
|
|
73
|
+
},
|
|
74
|
+
body: JSON.stringify({
|
|
75
|
+
agentId: "main",
|
|
76
|
+
name: "Pending Test"
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
const createRes = await handleSessionsApi(ctx, createReq, new URL(createReq.url));
|
|
80
|
+
expect(createRes).not.toBeNull();
|
|
81
|
+
expect(createRes?.ok).toBe(true);
|
|
82
|
+
const created = await createRes.json();
|
|
83
|
+
manager.persistPendingMessage({
|
|
84
|
+
sessionId: created.id,
|
|
85
|
+
requestId: "req-pending-test",
|
|
86
|
+
message: {
|
|
87
|
+
id: "user-req-pending-test",
|
|
88
|
+
role: "user",
|
|
89
|
+
content: "Persist me",
|
|
90
|
+
createdAt: Date.now()
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const getReq = new Request(`http://localhost/api/sessions/${encodeURIComponent(created.id)}/messages?agentId=main`, {
|
|
94
|
+
method: "GET"
|
|
95
|
+
});
|
|
96
|
+
const getRes = await handleSessionsApi(ctx, getReq, new URL(getReq.url));
|
|
97
|
+
expect(getRes).not.toBeNull();
|
|
98
|
+
expect(getRes?.ok).toBe(true);
|
|
99
|
+
const pendingMessages = await getRes.json();
|
|
100
|
+
expect(pendingMessages.some((message)=>"user" === message.role && message.content.includes("Persist me"))).toBe(true);
|
|
101
|
+
const deleteReq = new Request(`http://localhost/api/sessions/${encodeURIComponent(created.id)}/messages?agentId=main`, {
|
|
102
|
+
method: "DELETE"
|
|
103
|
+
});
|
|
104
|
+
const deleteRes = await handleSessionsApi(ctx, deleteReq, new URL(deleteReq.url));
|
|
105
|
+
expect(deleteRes).not.toBeNull();
|
|
106
|
+
expect(deleteRes?.ok).toBe(true);
|
|
107
|
+
const afterClearGetReq = new Request(`http://localhost/api/sessions/${encodeURIComponent(created.id)}/messages?agentId=main`, {
|
|
108
|
+
method: "GET"
|
|
109
|
+
});
|
|
110
|
+
const afterClearGetRes = await handleSessionsApi(ctx, afterClearGetReq, new URL(afterClearGetReq.url));
|
|
111
|
+
expect(afterClearGetRes).not.toBeNull();
|
|
112
|
+
expect(afterClearGetRes?.ok).toBe(true);
|
|
113
|
+
const afterClearMessages = await afterClearGetRes.json();
|
|
114
|
+
expect(afterClearMessages).toHaveLength(0);
|
|
115
|
+
});
|
|
116
|
+
it("lists sessions for discovered agents not present in config", async ()=>{
|
|
117
|
+
const configDir = join(tempDir, ".wingman");
|
|
118
|
+
const discoveredAgentId = "local-helper";
|
|
119
|
+
const discoveredAgentDir = join(configDir, "agents", discoveredAgentId);
|
|
120
|
+
mkdirSync(discoveredAgentDir, {
|
|
121
|
+
recursive: true
|
|
122
|
+
});
|
|
123
|
+
writeFileSync(join(discoveredAgentDir, "agent.json"), JSON.stringify({
|
|
124
|
+
name: discoveredAgentId,
|
|
125
|
+
description: "Local helper agent",
|
|
126
|
+
systemPrompt: "You are a local helper."
|
|
127
|
+
}, null, 2));
|
|
128
|
+
const ctx = {
|
|
129
|
+
workspace: tempDir,
|
|
130
|
+
configDir,
|
|
131
|
+
getWingmanConfig: ()=>({
|
|
132
|
+
agents: {
|
|
133
|
+
list: [
|
|
134
|
+
{
|
|
135
|
+
id: "main",
|
|
136
|
+
model: "openai:gpt-4.1-mini"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
getSessionManager: async ()=>manager,
|
|
142
|
+
router: {
|
|
143
|
+
selectAgent: (agentId)=>agentId || "main"
|
|
144
|
+
},
|
|
145
|
+
logger: {
|
|
146
|
+
debug: ()=>{},
|
|
147
|
+
info: ()=>{},
|
|
148
|
+
warn: ()=>{},
|
|
149
|
+
error: ()=>{}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const createReq = new Request("http://localhost/api/sessions", {
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: {
|
|
155
|
+
"Content-Type": "application/json"
|
|
156
|
+
},
|
|
157
|
+
body: JSON.stringify({
|
|
158
|
+
agentId: discoveredAgentId,
|
|
159
|
+
name: "Discovered Agent Thread"
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
const createRes = await handleSessionsApi(ctx, createReq, new URL(createReq.url));
|
|
163
|
+
expect(createRes).not.toBeNull();
|
|
164
|
+
expect(createRes?.ok).toBe(true);
|
|
165
|
+
const created = await createRes.json();
|
|
166
|
+
expect(created.agentId).toBe(discoveredAgentId);
|
|
167
|
+
const listReq = new Request("http://localhost/api/sessions?limit=100", {
|
|
168
|
+
method: "GET"
|
|
169
|
+
});
|
|
170
|
+
const listRes = await handleSessionsApi(ctx, listReq, new URL(listReq.url));
|
|
171
|
+
expect(listRes).not.toBeNull();
|
|
172
|
+
expect(listRes?.ok).toBe(true);
|
|
173
|
+
const sessions = await listRes.json();
|
|
174
|
+
expect(sessions.some((session)=>session.id === created.id && session.agentId === discoveredAgentId)).toBe(true);
|
|
175
|
+
});
|
|
62
176
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_exports__ = {};
|
|
3
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
+
const terminalProbe_cjs_namespaceObject = require("../debug/terminalProbe.cjs");
|
|
5
|
+
(0, external_vitest_namespaceObject.describe)("shouldReportTerminalProbeEvent", ()=>{
|
|
6
|
+
(0, external_vitest_namespaceObject.it)("reports terminal events by default", ()=>{
|
|
7
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("agent-complete")).toBe(true);
|
|
8
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("agent-error")).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
(0, external_vitest_namespaceObject.it)("hides non-terminal events by default", ()=>{
|
|
11
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("agent-start")).toBe(false);
|
|
12
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("request-queued")).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
(0, external_vitest_namespaceObject.it)("includes lifecycle events in verbose mode", ()=>{
|
|
15
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("agent-start", true)).toBe(true);
|
|
16
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbe_cjs_namespaceObject.shouldReportTerminalProbeEvent)("request-queued", true)).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
(0, external_vitest_namespaceObject.describe)("formatTerminalProbeEvent", ()=>{
|
|
20
|
+
(0, external_vitest_namespaceObject.it)("formats terminal events in a compact single line", ()=>{
|
|
21
|
+
const line = (0, terminalProbe_cjs_namespaceObject.formatTerminalProbeEvent)({
|
|
22
|
+
type: "agent-complete",
|
|
23
|
+
requestId: "req-1",
|
|
24
|
+
sessionId: "session-1",
|
|
25
|
+
timestampIso: "2026-02-12T18:12:00.000Z"
|
|
26
|
+
});
|
|
27
|
+
(0, external_vitest_namespaceObject.expect)(line).toContain("type=agent-complete");
|
|
28
|
+
(0, external_vitest_namespaceObject.expect)(line).toContain("req=req-1");
|
|
29
|
+
(0, external_vitest_namespaceObject.expect)(line).toContain("session=session-1");
|
|
30
|
+
});
|
|
31
|
+
(0, external_vitest_namespaceObject.it)("includes error text for error events", ()=>{
|
|
32
|
+
const line = (0, terminalProbe_cjs_namespaceObject.formatTerminalProbeEvent)({
|
|
33
|
+
type: "agent-error",
|
|
34
|
+
requestId: "req-2",
|
|
35
|
+
error: "Provider timeout",
|
|
36
|
+
timestampIso: "2026-02-12T18:12:01.000Z"
|
|
37
|
+
});
|
|
38
|
+
(0, external_vitest_namespaceObject.expect)(line).toContain("type=agent-error");
|
|
39
|
+
(0, external_vitest_namespaceObject.expect)(line).toContain('error="Provider timeout"');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
43
|
+
Object.defineProperty(exports, '__esModule', {
|
|
44
|
+
value: true
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { formatTerminalProbeEvent, shouldReportTerminalProbeEvent } from "../debug/terminalProbe.js";
|
|
3
|
+
describe("shouldReportTerminalProbeEvent", ()=>{
|
|
4
|
+
it("reports terminal events by default", ()=>{
|
|
5
|
+
expect(shouldReportTerminalProbeEvent("agent-complete")).toBe(true);
|
|
6
|
+
expect(shouldReportTerminalProbeEvent("agent-error")).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
it("hides non-terminal events by default", ()=>{
|
|
9
|
+
expect(shouldReportTerminalProbeEvent("agent-start")).toBe(false);
|
|
10
|
+
expect(shouldReportTerminalProbeEvent("request-queued")).toBe(false);
|
|
11
|
+
});
|
|
12
|
+
it("includes lifecycle events in verbose mode", ()=>{
|
|
13
|
+
expect(shouldReportTerminalProbeEvent("agent-start", true)).toBe(true);
|
|
14
|
+
expect(shouldReportTerminalProbeEvent("request-queued", true)).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe("formatTerminalProbeEvent", ()=>{
|
|
18
|
+
it("formats terminal events in a compact single line", ()=>{
|
|
19
|
+
const line = formatTerminalProbeEvent({
|
|
20
|
+
type: "agent-complete",
|
|
21
|
+
requestId: "req-1",
|
|
22
|
+
sessionId: "session-1",
|
|
23
|
+
timestampIso: "2026-02-12T18:12:00.000Z"
|
|
24
|
+
});
|
|
25
|
+
expect(line).toContain("type=agent-complete");
|
|
26
|
+
expect(line).toContain("req=req-1");
|
|
27
|
+
expect(line).toContain("session=session-1");
|
|
28
|
+
});
|
|
29
|
+
it("includes error text for error events", ()=>{
|
|
30
|
+
const line = formatTerminalProbeEvent({
|
|
31
|
+
type: "agent-error",
|
|
32
|
+
requestId: "req-2",
|
|
33
|
+
error: "Provider timeout",
|
|
34
|
+
timestampIso: "2026-02-12T18:12:01.000Z"
|
|
35
|
+
});
|
|
36
|
+
expect(line).toContain("type=agent-error");
|
|
37
|
+
expect(line).toContain('error="Provider timeout"');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_exports__ = {};
|
|
3
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
4
|
+
const external_node_os_namespaceObject = require("node:os");
|
|
5
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
6
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
7
|
+
const terminalProbeAuth_cjs_namespaceObject = require("../debug/terminalProbeAuth.cjs");
|
|
8
|
+
function writeConfig(configDir, config) {
|
|
9
|
+
const wingmanDir = (0, external_node_path_namespaceObject.join)(configDir, ".wingman");
|
|
10
|
+
(0, external_node_fs_namespaceObject.mkdirSync)(wingmanDir, {
|
|
11
|
+
recursive: true
|
|
12
|
+
});
|
|
13
|
+
const configPath = (0, external_node_path_namespaceObject.join)(wingmanDir, "wingman.config.json");
|
|
14
|
+
(0, external_node_fs_namespaceObject.writeFileSync)(configPath, JSON.stringify(config), "utf-8");
|
|
15
|
+
return configPath;
|
|
16
|
+
}
|
|
17
|
+
(0, external_vitest_namespaceObject.describe)("resolveTerminalProbeAuth", ()=>{
|
|
18
|
+
(0, external_vitest_namespaceObject.it)("prefers CLI auth when provided", ()=>{
|
|
19
|
+
const auth = (0, terminalProbeAuth_cjs_namespaceObject.resolveTerminalProbeAuth)({
|
|
20
|
+
cliToken: "cli-token",
|
|
21
|
+
cliPassword: "cli-pass",
|
|
22
|
+
env: {
|
|
23
|
+
[terminalProbeAuth_cjs_namespaceObject.TERMINAL_PROBE_GATEWAY_TOKEN_ENV]: "env-token"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
(0, external_vitest_namespaceObject.expect)(auth.source).toBe("cli");
|
|
27
|
+
(0, external_vitest_namespaceObject.expect)(auth.token).toBe("cli-token");
|
|
28
|
+
(0, external_vitest_namespaceObject.expect)(auth.password).toBe("cli-pass");
|
|
29
|
+
});
|
|
30
|
+
(0, external_vitest_namespaceObject.it)("falls back to env auth when CLI auth is missing", ()=>{
|
|
31
|
+
const auth = (0, terminalProbeAuth_cjs_namespaceObject.resolveTerminalProbeAuth)({
|
|
32
|
+
env: {
|
|
33
|
+
[terminalProbeAuth_cjs_namespaceObject.TERMINAL_PROBE_GATEWAY_TOKEN_ENV]: "env-token",
|
|
34
|
+
[terminalProbeAuth_cjs_namespaceObject.TERMINAL_PROBE_GATEWAY_PASSWORD_ENV]: "env-pass"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
(0, external_vitest_namespaceObject.expect)(auth.source).toBe("env");
|
|
38
|
+
(0, external_vitest_namespaceObject.expect)(auth.token).toBe("env-token");
|
|
39
|
+
(0, external_vitest_namespaceObject.expect)(auth.password).toBe("env-pass");
|
|
40
|
+
});
|
|
41
|
+
(0, external_vitest_namespaceObject.it)("loads token auth from config when env and CLI are missing", ()=>{
|
|
42
|
+
const dir = (0, external_node_fs_namespaceObject.mkdtempSync)((0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "terminal-probe-auth-"));
|
|
43
|
+
const configPath = writeConfig(dir, {
|
|
44
|
+
gateway: {
|
|
45
|
+
auth: {
|
|
46
|
+
mode: "token",
|
|
47
|
+
token: "config-token"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const auth = (0, terminalProbeAuth_cjs_namespaceObject.resolveTerminalProbeAuth)({
|
|
52
|
+
env: {},
|
|
53
|
+
cwd: dir,
|
|
54
|
+
homeDir: (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "non-existent-home")
|
|
55
|
+
});
|
|
56
|
+
(0, external_vitest_namespaceObject.expect)(auth.source).toBe("config");
|
|
57
|
+
(0, external_vitest_namespaceObject.expect)(auth.token).toBe("config-token");
|
|
58
|
+
(0, external_vitest_namespaceObject.expect)(auth.configPath).toBe(configPath);
|
|
59
|
+
});
|
|
60
|
+
(0, external_vitest_namespaceObject.it)("returns none when no auth material is available", ()=>{
|
|
61
|
+
const auth = (0, terminalProbeAuth_cjs_namespaceObject.resolveTerminalProbeAuth)({
|
|
62
|
+
env: {},
|
|
63
|
+
cwd: (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "terminal-probe-auth-empty"),
|
|
64
|
+
homeDir: (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "terminal-probe-auth-empty-home")
|
|
65
|
+
});
|
|
66
|
+
(0, external_vitest_namespaceObject.expect)(auth.source).toBe("none");
|
|
67
|
+
(0, external_vitest_namespaceObject.expect)(auth.token).toBeUndefined();
|
|
68
|
+
(0, external_vitest_namespaceObject.expect)(auth.password).toBeUndefined();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
(0, external_vitest_namespaceObject.describe)("formatTerminalProbeHandshakeFailure", ()=>{
|
|
72
|
+
(0, external_vitest_namespaceObject.it)("formats string payloads directly", ()=>{
|
|
73
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbeAuth_cjs_namespaceObject.formatTerminalProbeHandshakeFailure)("authentication failed")).toBe("authentication failed");
|
|
74
|
+
});
|
|
75
|
+
(0, external_vitest_namespaceObject.it)("formats structured payloads as JSON", ()=>{
|
|
76
|
+
(0, external_vitest_namespaceObject.expect)((0, terminalProbeAuth_cjs_namespaceObject.formatTerminalProbeHandshakeFailure)({
|
|
77
|
+
code: "AUTH_FAILED",
|
|
78
|
+
message: "bad token"
|
|
79
|
+
})).toContain('"code":"AUTH_FAILED"');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
83
|
+
Object.defineProperty(exports, '__esModule', {
|
|
84
|
+
value: true
|
|
85
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { TERMINAL_PROBE_GATEWAY_PASSWORD_ENV, TERMINAL_PROBE_GATEWAY_TOKEN_ENV, formatTerminalProbeHandshakeFailure, resolveTerminalProbeAuth } from "../debug/terminalProbeAuth.js";
|
|
6
|
+
function writeConfig(configDir, config) {
|
|
7
|
+
const wingmanDir = join(configDir, ".wingman");
|
|
8
|
+
mkdirSync(wingmanDir, {
|
|
9
|
+
recursive: true
|
|
10
|
+
});
|
|
11
|
+
const configPath = join(wingmanDir, "wingman.config.json");
|
|
12
|
+
writeFileSync(configPath, JSON.stringify(config), "utf-8");
|
|
13
|
+
return configPath;
|
|
14
|
+
}
|
|
15
|
+
describe("resolveTerminalProbeAuth", ()=>{
|
|
16
|
+
it("prefers CLI auth when provided", ()=>{
|
|
17
|
+
const auth = resolveTerminalProbeAuth({
|
|
18
|
+
cliToken: "cli-token",
|
|
19
|
+
cliPassword: "cli-pass",
|
|
20
|
+
env: {
|
|
21
|
+
[TERMINAL_PROBE_GATEWAY_TOKEN_ENV]: "env-token"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(auth.source).toBe("cli");
|
|
25
|
+
expect(auth.token).toBe("cli-token");
|
|
26
|
+
expect(auth.password).toBe("cli-pass");
|
|
27
|
+
});
|
|
28
|
+
it("falls back to env auth when CLI auth is missing", ()=>{
|
|
29
|
+
const auth = resolveTerminalProbeAuth({
|
|
30
|
+
env: {
|
|
31
|
+
[TERMINAL_PROBE_GATEWAY_TOKEN_ENV]: "env-token",
|
|
32
|
+
[TERMINAL_PROBE_GATEWAY_PASSWORD_ENV]: "env-pass"
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
expect(auth.source).toBe("env");
|
|
36
|
+
expect(auth.token).toBe("env-token");
|
|
37
|
+
expect(auth.password).toBe("env-pass");
|
|
38
|
+
});
|
|
39
|
+
it("loads token auth from config when env and CLI are missing", ()=>{
|
|
40
|
+
const dir = mkdtempSync(join(tmpdir(), "terminal-probe-auth-"));
|
|
41
|
+
const configPath = writeConfig(dir, {
|
|
42
|
+
gateway: {
|
|
43
|
+
auth: {
|
|
44
|
+
mode: "token",
|
|
45
|
+
token: "config-token"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const auth = resolveTerminalProbeAuth({
|
|
50
|
+
env: {},
|
|
51
|
+
cwd: dir,
|
|
52
|
+
homeDir: join(tmpdir(), "non-existent-home")
|
|
53
|
+
});
|
|
54
|
+
expect(auth.source).toBe("config");
|
|
55
|
+
expect(auth.token).toBe("config-token");
|
|
56
|
+
expect(auth.configPath).toBe(configPath);
|
|
57
|
+
});
|
|
58
|
+
it("returns none when no auth material is available", ()=>{
|
|
59
|
+
const auth = resolveTerminalProbeAuth({
|
|
60
|
+
env: {},
|
|
61
|
+
cwd: join(tmpdir(), "terminal-probe-auth-empty"),
|
|
62
|
+
homeDir: join(tmpdir(), "terminal-probe-auth-empty-home")
|
|
63
|
+
});
|
|
64
|
+
expect(auth.source).toBe("none");
|
|
65
|
+
expect(auth.token).toBeUndefined();
|
|
66
|
+
expect(auth.password).toBeUndefined();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe("formatTerminalProbeHandshakeFailure", ()=>{
|
|
70
|
+
it("formats string payloads directly", ()=>{
|
|
71
|
+
expect(formatTerminalProbeHandshakeFailure("authentication failed")).toBe("authentication failed");
|
|
72
|
+
});
|
|
73
|
+
it("formats structured payloads as JSON", ()=>{
|
|
74
|
+
expect(formatTerminalProbeHandshakeFailure({
|
|
75
|
+
code: "AUTH_FAILED",
|
|
76
|
+
message: "bad token"
|
|
77
|
+
})).toContain('"code":"AUTH_FAILED"');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
resolveFalWorkdir: ()=>resolveFalWorkdir,
|
|
28
|
+
resolveFalStateDir: ()=>resolveFalStateDir,
|
|
29
|
+
resolveFalOutputDir: ()=>resolveFalOutputDir,
|
|
30
|
+
resolveFalLocalMediaPath: ()=>resolveFalLocalMediaPath
|
|
31
|
+
});
|
|
32
|
+
const external_node_os_namespaceObject = require("node:os");
|
|
33
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
34
|
+
const DEFAULT_STATE_SUBPATH = [
|
|
35
|
+
".wingman",
|
|
36
|
+
"fal-ai"
|
|
37
|
+
];
|
|
38
|
+
const DEFAULT_OUTPUT_SUBPATH = [
|
|
39
|
+
"generated"
|
|
40
|
+
];
|
|
41
|
+
function normalizeHomePath(pathname, homeDir) {
|
|
42
|
+
if ("~" === pathname) return homeDir;
|
|
43
|
+
if (pathname.startsWith("~/")) return (0, external_node_path_namespaceObject.join)(homeDir, pathname.slice(2));
|
|
44
|
+
return pathname;
|
|
45
|
+
}
|
|
46
|
+
function normalizeFromBase(pathname, baseDir) {
|
|
47
|
+
return (0, external_node_path_namespaceObject.isAbsolute)(pathname) ? (0, external_node_path_namespaceObject.normalize)(pathname) : (0, external_node_path_namespaceObject.normalize)((0, external_node_path_namespaceObject.resolve)(baseDir, pathname));
|
|
48
|
+
}
|
|
49
|
+
function resolveFalWorkdir(options) {
|
|
50
|
+
const env = options?.env || process.env;
|
|
51
|
+
const cwd = options?.cwd || process.cwd();
|
|
52
|
+
const homeDir = options?.homeDir || (0, external_node_os_namespaceObject.homedir)();
|
|
53
|
+
const raw = env.WINGMAN_WORKDIR?.trim();
|
|
54
|
+
if (!raw) return (0, external_node_path_namespaceObject.normalize)(cwd);
|
|
55
|
+
const withHome = normalizeHomePath(raw, homeDir);
|
|
56
|
+
return normalizeFromBase(withHome, cwd);
|
|
57
|
+
}
|
|
58
|
+
function resolveFalStateDir(options) {
|
|
59
|
+
const env = options?.env || process.env;
|
|
60
|
+
const explicit = env.FAL_MCP_STATE_DIR?.trim();
|
|
61
|
+
if (explicit) {
|
|
62
|
+
const cwd = options?.cwd || process.cwd();
|
|
63
|
+
const homeDir = options?.homeDir || (0, external_node_os_namespaceObject.homedir)();
|
|
64
|
+
const withHome = normalizeHomePath(explicit, homeDir);
|
|
65
|
+
return normalizeFromBase(withHome, cwd);
|
|
66
|
+
}
|
|
67
|
+
const workdir = resolveFalWorkdir(options);
|
|
68
|
+
return (0, external_node_path_namespaceObject.join)(workdir, ...DEFAULT_STATE_SUBPATH);
|
|
69
|
+
}
|
|
70
|
+
function resolveFalOutputDir(options) {
|
|
71
|
+
const env = options?.env || process.env;
|
|
72
|
+
const explicit = env.FAL_MCP_OUTPUT_DIR?.trim();
|
|
73
|
+
if (explicit) {
|
|
74
|
+
const cwd = options?.cwd || process.cwd();
|
|
75
|
+
const homeDir = options?.homeDir || (0, external_node_os_namespaceObject.homedir)();
|
|
76
|
+
const withHome = normalizeHomePath(explicit, homeDir);
|
|
77
|
+
const workdir = resolveFalWorkdir(options);
|
|
78
|
+
return normalizeFromBase(withHome, workdir || cwd);
|
|
79
|
+
}
|
|
80
|
+
const workdir = resolveFalWorkdir(options);
|
|
81
|
+
return (0, external_node_path_namespaceObject.join)(workdir, ...DEFAULT_OUTPUT_SUBPATH);
|
|
82
|
+
}
|
|
83
|
+
function resolveFalLocalMediaPath(pathname, workdir, options) {
|
|
84
|
+
const cwd = options?.cwd || process.cwd();
|
|
85
|
+
const homeDir = options?.homeDir || (0, external_node_os_namespaceObject.homedir)();
|
|
86
|
+
const trimmed = pathname.trim();
|
|
87
|
+
const withHome = normalizeHomePath(trimmed, homeDir);
|
|
88
|
+
if ((0, external_node_path_namespaceObject.isAbsolute)(withHome)) return (0, external_node_path_namespaceObject.normalize)(withHome);
|
|
89
|
+
return (0, external_node_path_namespaceObject.normalize)((0, external_node_path_namespaceObject.resolve)(workdir || cwd, withHome));
|
|
90
|
+
}
|
|
91
|
+
exports.resolveFalLocalMediaPath = __webpack_exports__.resolveFalLocalMediaPath;
|
|
92
|
+
exports.resolveFalOutputDir = __webpack_exports__.resolveFalOutputDir;
|
|
93
|
+
exports.resolveFalStateDir = __webpack_exports__.resolveFalStateDir;
|
|
94
|
+
exports.resolveFalWorkdir = __webpack_exports__.resolveFalWorkdir;
|
|
95
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
96
|
+
"resolveFalLocalMediaPath",
|
|
97
|
+
"resolveFalOutputDir",
|
|
98
|
+
"resolveFalStateDir",
|
|
99
|
+
"resolveFalWorkdir"
|
|
100
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
101
|
+
Object.defineProperty(exports, '__esModule', {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type RuntimePathOptions = {
|
|
2
|
+
env?: NodeJS.ProcessEnv;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
homeDir?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function resolveFalWorkdir(options?: RuntimePathOptions): string;
|
|
7
|
+
export declare function resolveFalStateDir(options?: RuntimePathOptions): string;
|
|
8
|
+
export declare function resolveFalOutputDir(options?: RuntimePathOptions): string;
|
|
9
|
+
export declare function resolveFalLocalMediaPath(pathname: string, workdir: string, options?: Pick<RuntimePathOptions, "cwd" | "homeDir">): string;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { isAbsolute, join, normalize, resolve } from "node:path";
|
|
3
|
+
const DEFAULT_STATE_SUBPATH = [
|
|
4
|
+
".wingman",
|
|
5
|
+
"fal-ai"
|
|
6
|
+
];
|
|
7
|
+
const DEFAULT_OUTPUT_SUBPATH = [
|
|
8
|
+
"generated"
|
|
9
|
+
];
|
|
10
|
+
function normalizeHomePath(pathname, homeDir) {
|
|
11
|
+
if ("~" === pathname) return homeDir;
|
|
12
|
+
if (pathname.startsWith("~/")) return join(homeDir, pathname.slice(2));
|
|
13
|
+
return pathname;
|
|
14
|
+
}
|
|
15
|
+
function normalizeFromBase(pathname, baseDir) {
|
|
16
|
+
return isAbsolute(pathname) ? normalize(pathname) : normalize(resolve(baseDir, pathname));
|
|
17
|
+
}
|
|
18
|
+
function resolveFalWorkdir(options) {
|
|
19
|
+
const env = options?.env || process.env;
|
|
20
|
+
const cwd = options?.cwd || process.cwd();
|
|
21
|
+
const homeDir = options?.homeDir || homedir();
|
|
22
|
+
const raw = env.WINGMAN_WORKDIR?.trim();
|
|
23
|
+
if (!raw) return normalize(cwd);
|
|
24
|
+
const withHome = normalizeHomePath(raw, homeDir);
|
|
25
|
+
return normalizeFromBase(withHome, cwd);
|
|
26
|
+
}
|
|
27
|
+
function resolveFalStateDir(options) {
|
|
28
|
+
const env = options?.env || process.env;
|
|
29
|
+
const explicit = env.FAL_MCP_STATE_DIR?.trim();
|
|
30
|
+
if (explicit) {
|
|
31
|
+
const cwd = options?.cwd || process.cwd();
|
|
32
|
+
const homeDir = options?.homeDir || homedir();
|
|
33
|
+
const withHome = normalizeHomePath(explicit, homeDir);
|
|
34
|
+
return normalizeFromBase(withHome, cwd);
|
|
35
|
+
}
|
|
36
|
+
const workdir = resolveFalWorkdir(options);
|
|
37
|
+
return join(workdir, ...DEFAULT_STATE_SUBPATH);
|
|
38
|
+
}
|
|
39
|
+
function resolveFalOutputDir(options) {
|
|
40
|
+
const env = options?.env || process.env;
|
|
41
|
+
const explicit = env.FAL_MCP_OUTPUT_DIR?.trim();
|
|
42
|
+
if (explicit) {
|
|
43
|
+
const cwd = options?.cwd || process.cwd();
|
|
44
|
+
const homeDir = options?.homeDir || homedir();
|
|
45
|
+
const withHome = normalizeHomePath(explicit, homeDir);
|
|
46
|
+
const workdir = resolveFalWorkdir(options);
|
|
47
|
+
return normalizeFromBase(withHome, workdir || cwd);
|
|
48
|
+
}
|
|
49
|
+
const workdir = resolveFalWorkdir(options);
|
|
50
|
+
return join(workdir, ...DEFAULT_OUTPUT_SUBPATH);
|
|
51
|
+
}
|
|
52
|
+
function resolveFalLocalMediaPath(pathname, workdir, options) {
|
|
53
|
+
const cwd = options?.cwd || process.cwd();
|
|
54
|
+
const homeDir = options?.homeDir || homedir();
|
|
55
|
+
const trimmed = pathname.trim();
|
|
56
|
+
const withHome = normalizeHomePath(trimmed, homeDir);
|
|
57
|
+
if (isAbsolute(withHome)) return normalize(withHome);
|
|
58
|
+
return normalize(resolve(workdir || cwd, withHome));
|
|
59
|
+
}
|
|
60
|
+
export { resolveFalLocalMediaPath, resolveFalOutputDir, resolveFalStateDir, resolveFalWorkdir };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
buildFalGenerationSummary: ()=>buildFalGenerationSummary,
|
|
28
|
+
formatFalPath: ()=>formatFalPath
|
|
29
|
+
});
|
|
30
|
+
const external_node_os_namespaceObject = require("node:os");
|
|
31
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
32
|
+
function buildFalGenerationSummary(input) {
|
|
33
|
+
const media = input.media || [];
|
|
34
|
+
const lines = [
|
|
35
|
+
`FAL job \`${input.jobId}\` for \`${input.toolName}\` is **${input.status.toLowerCase()}**.`,
|
|
36
|
+
`- Model: \`${input.modelId}\``,
|
|
37
|
+
`- Assets: ${media.length}`
|
|
38
|
+
];
|
|
39
|
+
if ("pending" === input.reviewState) lines.push("- Review required: call `fal_generation_status` with `action` set to `accept` or `deny`.");
|
|
40
|
+
if (media.length > 0) {
|
|
41
|
+
lines.push("- Files:");
|
|
42
|
+
for (const item of media){
|
|
43
|
+
const localPath = "string" == typeof item.path && item.path.trim() ? formatFalPath(item.path, {
|
|
44
|
+
cwd: input.cwd,
|
|
45
|
+
homeDir: input.homeDir
|
|
46
|
+
}) : null;
|
|
47
|
+
const target = localPath || item.remoteUrl || "(unavailable)";
|
|
48
|
+
const mime = item.mimeType ? ` ${item.mimeType}` : "";
|
|
49
|
+
lines.push(` - [${item.modality}] ${target}${mime}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (input.error?.trim()) lines.push("", `Error: ${input.error.trim()}`);
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
55
|
+
function formatFalPath(pathname, options) {
|
|
56
|
+
const trimmed = pathname.trim();
|
|
57
|
+
if (!trimmed) return pathname;
|
|
58
|
+
const cwd = options?.cwd || process.cwd();
|
|
59
|
+
const homeDir = options?.homeDir || process.env.HOME || (0, external_node_os_namespaceObject.homedir)();
|
|
60
|
+
if (cwd) {
|
|
61
|
+
const rel = (0, external_node_path_namespaceObject.relative)(cwd, trimmed);
|
|
62
|
+
if (rel && "." !== rel && !rel.startsWith("..") && !(0, external_node_path_namespaceObject.isAbsolute)(rel)) return `./${rel}`;
|
|
63
|
+
}
|
|
64
|
+
if (homeDir && trimmed.startsWith(homeDir)) {
|
|
65
|
+
const suffix = trimmed.slice(homeDir.length).replace(/^[/\\]+/, "");
|
|
66
|
+
return suffix ? `~/${suffix}` : "~";
|
|
67
|
+
}
|
|
68
|
+
return (0, external_node_path_namespaceObject.basename)(trimmed) === trimmed ? `./${trimmed}` : trimmed;
|
|
69
|
+
}
|
|
70
|
+
exports.buildFalGenerationSummary = __webpack_exports__.buildFalGenerationSummary;
|
|
71
|
+
exports.formatFalPath = __webpack_exports__.formatFalPath;
|
|
72
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
73
|
+
"buildFalGenerationSummary",
|
|
74
|
+
"formatFalPath"
|
|
75
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
76
|
+
Object.defineProperty(exports, '__esModule', {
|
|
77
|
+
value: true
|
|
78
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type FalSummaryMedia = {
|
|
2
|
+
modality: "image" | "audio" | "video" | "file";
|
|
3
|
+
path?: string | null;
|
|
4
|
+
remoteUrl?: string | null;
|
|
5
|
+
mimeType?: string | null;
|
|
6
|
+
};
|
|
7
|
+
export interface FalSummaryInput {
|
|
8
|
+
toolName: string;
|
|
9
|
+
jobId: string;
|
|
10
|
+
status: string;
|
|
11
|
+
modelId: string;
|
|
12
|
+
reviewState?: "pending" | "accepted" | "denied" | null;
|
|
13
|
+
media?: FalSummaryMedia[];
|
|
14
|
+
error?: string | null;
|
|
15
|
+
cwd?: string;
|
|
16
|
+
homeDir?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildFalGenerationSummary(input: FalSummaryInput): string;
|
|
19
|
+
export declare function formatFalPath(pathname: string, options?: {
|
|
20
|
+
cwd?: string;
|
|
21
|
+
homeDir?: string;
|
|
22
|
+
}): string;
|