@stigmer/react 3.12.5 → 3.12.7
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/agent/AgentDetailView.js +2 -2
- package/agent/AgentDetailView.js.map +1 -1
- package/agent/index.d.ts +0 -1
- package/agent/index.d.ts.map +1 -1
- package/agent/index.js +0 -1
- package/agent/index.js.map +1 -1
- package/agent/useUpdateAgent.d.ts +3 -3
- package/agent/useUpdateAgent.js +3 -3
- package/agent-instance/AgentInstanceDetailPanel.d.ts.map +1 -1
- package/agent-instance/AgentInstanceDetailPanel.js +5 -7
- package/agent-instance/AgentInstanceDetailPanel.js.map +1 -1
- package/agent-instance/useUpdateAgentInstance.d.ts +1 -1
- package/agent-instance/useUpdateAgentInstance.js +1 -1
- package/channel/AgentChannelsPanel.d.ts.map +1 -1
- package/channel/AgentChannelsPanel.js +10 -5
- package/channel/AgentChannelsPanel.js.map +1 -1
- package/channel/ChannelRunConfigDialog.d.ts +51 -0
- package/channel/ChannelRunConfigDialog.d.ts.map +1 -0
- package/channel/ChannelRunConfigDialog.js +121 -0
- package/channel/ChannelRunConfigDialog.js.map +1 -0
- package/channel/index.d.ts +2 -0
- package/channel/index.d.ts.map +1 -1
- package/channel/index.js +1 -0
- package/channel/index.js.map +1 -1
- package/channel/useSaveAgentChannel.d.ts.map +1 -1
- package/channel/useSaveAgentChannel.js +6 -3
- package/channel/useSaveAgentChannel.js.map +1 -1
- package/channel-app/ChannelAppDetailPanel.js +9 -9
- package/channel-app/ChannelAppDetailPanel.js.map +1 -1
- package/composer/ComposerToolbar.d.ts +24 -1
- package/composer/ComposerToolbar.d.ts.map +1 -1
- package/composer/ComposerToolbar.js +7 -2
- package/composer/ComposerToolbar.js.map +1 -1
- package/composer/SessionComposer.d.ts +19 -0
- package/composer/SessionComposer.d.ts.map +1 -1
- package/composer/SessionComposer.js +24 -5
- package/composer/SessionComposer.js.map +1 -1
- package/composer/index.d.ts +1 -0
- package/composer/index.d.ts.map +1 -1
- package/composer/index.js.map +1 -1
- package/cursor-accounts/CursorAccountsConsole.d.ts.map +1 -1
- package/cursor-accounts/CursorAccountsConsole.js +12 -3
- package/cursor-accounts/CursorAccountsConsole.js.map +1 -1
- package/cursor-accounts/cursor-account-coverage.d.ts +30 -1
- package/cursor-accounts/cursor-account-coverage.d.ts.map +1 -1
- package/cursor-accounts/cursor-account-coverage.js +21 -0
- package/cursor-accounts/cursor-account-coverage.js.map +1 -1
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +8 -11
- package/execution/MessageThread.js.map +1 -1
- package/execution/useCreateAgentExecution.d.ts +15 -0
- package/execution/useCreateAgentExecution.d.ts.map +1 -1
- package/execution/useCreateAgentExecution.js +5 -0
- package/execution/useCreateAgentExecution.js.map +1 -1
- package/execution/useFileChangeContent.d.ts +2 -6
- package/execution/useFileChangeContent.d.ts.map +1 -1
- package/execution/useFileChangeContent.js +4 -12
- package/execution/useFileChangeContent.js.map +1 -1
- package/identity-account/AccountPreferencesPanel.d.ts +2 -1
- package/identity-account/AccountPreferencesPanel.d.ts.map +1 -1
- package/identity-account/AccountPreferencesPanel.js +33 -18
- package/identity-account/AccountPreferencesPanel.js.map +1 -1
- package/identity-provider/IdentityProviderDetailPanel.d.ts.map +1 -1
- package/identity-provider/IdentityProviderDetailPanel.js +16 -15
- package/identity-provider/IdentityProviderDetailPanel.js.map +1 -1
- package/index.d.ts +10 -7
- package/index.d.ts.map +1 -1
- package/index.js +8 -4
- package/index.js.map +1 -1
- package/internal/download.d.ts +8 -0
- package/internal/download.d.ts.map +1 -0
- package/internal/download.js +25 -0
- package/internal/download.js.map +1 -0
- package/library/useExportResource.d.ts.map +1 -1
- package/library/useExportResource.js +3 -17
- package/library/useExportResource.js.map +1 -1
- package/mcp-server/McpServerDetailView.js +2 -2
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/mcp-server/index.d.ts +0 -1
- package/mcp-server/index.d.ts.map +1 -1
- package/mcp-server/index.js +0 -1
- package/mcp-server/index.js.map +1 -1
- package/mcp-server/internal/definitionDrift.d.ts +14 -12
- package/mcp-server/internal/definitionDrift.d.ts.map +1 -1
- package/mcp-server/internal/definitionDrift.js +22 -19
- package/mcp-server/internal/definitionDrift.js.map +1 -1
- package/mcp-server/useUpdateMcpServer.d.ts +3 -3
- package/mcp-server/useUpdateMcpServer.js +3 -3
- package/memory/MemoryListPanel.d.ts +35 -0
- package/memory/MemoryListPanel.d.ts.map +1 -0
- package/memory/MemoryListPanel.js +141 -0
- package/memory/MemoryListPanel.js.map +1 -0
- package/memory/index.d.ts +8 -0
- package/memory/index.d.ts.map +1 -0
- package/memory/index.js +12 -0
- package/memory/index.js.map +1 -0
- package/memory/memoryGroups.d.ts +31 -0
- package/memory/memoryGroups.d.ts.map +1 -0
- package/memory/memoryGroups.js +52 -0
- package/memory/memoryGroups.js.map +1 -0
- package/memory/useConfirmMemory.d.ts +31 -0
- package/memory/useConfirmMemory.d.ts.map +1 -0
- package/memory/useConfirmMemory.js +43 -0
- package/memory/useConfirmMemory.js.map +1 -0
- package/memory/useDeleteMemory.d.ts +30 -0
- package/memory/useDeleteMemory.d.ts.map +1 -0
- package/memory/useDeleteMemory.js +42 -0
- package/memory/useDeleteMemory.js.map +1 -0
- package/memory/useMemories.d.ts +33 -0
- package/memory/useMemories.d.ts.map +1 -0
- package/memory/useMemories.js +42 -0
- package/memory/useMemories.js.map +1 -0
- package/memory/useRejectMemory.d.ts +34 -0
- package/memory/useRejectMemory.d.ts.map +1 -0
- package/memory/useRejectMemory.js +46 -0
- package/memory/useRejectMemory.js.map +1 -0
- package/memory/useUpdateMemoryContent.d.ts +32 -0
- package/memory/useUpdateMemoryContent.d.ts.map +1 -0
- package/memory/useUpdateMemoryContent.js +48 -0
- package/memory/useUpdateMemoryContent.js.map +1 -0
- package/models/ModelSelector.d.ts +33 -1
- package/models/ModelSelector.d.ts.map +1 -1
- package/models/ModelSelector.js +37 -4
- package/models/ModelSelector.js.map +1 -1
- package/models/index.d.ts +2 -0
- package/models/index.d.ts.map +1 -1
- package/models/index.js +1 -0
- package/models/index.js.map +1 -1
- package/models/registry.d.ts +16 -0
- package/models/registry.d.ts.map +1 -1
- package/models/registry.js +13 -0
- package/models/registry.js.map +1 -1
- package/models/thinking-mode.d.ts +27 -0
- package/models/thinking-mode.d.ts.map +1 -0
- package/models/thinking-mode.js +32 -0
- package/models/thinking-mode.js.map +1 -0
- package/oauth-app/OAuthAppDetailPanel.d.ts.map +1 -1
- package/oauth-app/OAuthAppDetailPanel.js +21 -20
- package/oauth-app/OAuthAppDetailPanel.js.map +1 -1
- package/package.json +4 -4
- package/platform-client/PlatformClientDetailPanel.d.ts.map +1 -1
- package/platform-client/PlatformClientDetailPanel.js +12 -13
- package/platform-client/PlatformClientDetailPanel.js.map +1 -1
- package/schedule/ScheduleDetailView.d.ts.map +1 -1
- package/schedule/ScheduleDetailView.js +21 -10
- package/schedule/ScheduleDetailView.js.map +1 -1
- package/schedule/ScheduleForm.d.ts.map +1 -1
- package/schedule/ScheduleForm.js +13 -3
- package/schedule/ScheduleForm.js.map +1 -1
- package/session/NewSessionViewer.d.ts.map +1 -1
- package/session/NewSessionViewer.js +9 -1
- package/session/NewSessionViewer.js.map +1 -1
- package/session/SessionViewer.d.ts +14 -1
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +21 -25
- package/session/SessionViewer.js.map +1 -1
- package/session/TranscriptExportMenu.d.ts +24 -0
- package/session/TranscriptExportMenu.d.ts.map +1 -0
- package/session/TranscriptExportMenu.js +26 -0
- package/session/TranscriptExportMenu.js.map +1 -0
- package/session/index.d.ts +4 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +2 -0
- package/session/index.js.map +1 -1
- package/session/run-config.d.ts +9 -0
- package/session/run-config.d.ts.map +1 -1
- package/session/run-config.js +5 -0
- package/session/run-config.js.map +1 -1
- package/session/useExportTranscript.d.ts +44 -0
- package/session/useExportTranscript.d.ts.map +1 -0
- package/session/useExportTranscript.js +109 -0
- package/session/useExportTranscript.js.map +1 -0
- package/session/useNewSessionFlow.d.ts +11 -0
- package/session/useNewSessionFlow.d.ts.map +1 -1
- package/session/useNewSessionFlow.js +20 -6
- package/session/useNewSessionFlow.js.map +1 -1
- package/session/useSessionConversation.d.ts +12 -1
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +21 -42
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionExecutions.d.ts +2 -14
- package/session/useSessionExecutions.d.ts.map +1 -1
- package/session/useSessionExecutions.js +4 -26
- package/session/useSessionExecutions.js.map +1 -1
- package/session/useSessionPageFlow.d.ts +23 -10
- package/session/useSessionPageFlow.d.ts.map +1 -1
- package/session/useSessionPageFlow.js +75 -19
- package/session/useSessionPageFlow.js.map +1 -1
- package/session/useUpdateSession.d.ts +18 -24
- package/session/useUpdateSession.d.ts.map +1 -1
- package/session/useUpdateSession.js +18 -24
- package/session/useUpdateSession.js.map +1 -1
- package/settings/MemorySection.d.ts +12 -0
- package/settings/MemorySection.d.ts.map +1 -0
- package/settings/MemorySection.js +21 -0
- package/settings/MemorySection.js.map +1 -0
- package/settings/index.d.ts +1 -0
- package/settings/index.d.ts.map +1 -1
- package/settings/index.js +1 -0
- package/settings/index.js.map +1 -1
- package/settings/settings-nav.d.ts.map +1 -1
- package/settings/settings-nav.js +2 -1
- package/settings/settings-nav.js.map +1 -1
- package/src/__tests__/public-api.test.ts +21 -0
- package/src/agent/AgentDetailView.tsx +2 -2
- package/src/agent/index.ts +0 -2
- package/src/agent/useUpdateAgent.ts +3 -3
- package/src/agent-instance/AgentInstanceDetailPanel.tsx +5 -7
- package/src/agent-instance/__tests__/AgentInstanceDetailPanel.test.tsx +75 -0
- package/src/agent-instance/useUpdateAgentInstance.ts +1 -1
- package/src/channel/AgentChannelsPanel.tsx +26 -1
- package/src/channel/ChannelRunConfigDialog.tsx +351 -0
- package/src/channel/__tests__/ChannelRunConfigDialog.test.tsx +210 -0
- package/src/channel/index.ts +2 -0
- package/src/channel/useSaveAgentChannel.ts +6 -3
- package/src/channel-app/ChannelAppDetailPanel.tsx +9 -9
- package/src/channel-app/__tests__/channelAppWhatsApp.test.tsx +2 -0
- package/src/channel-app/__tests__/channelAppWipeSafety.test.tsx +87 -0
- package/src/composer/ComposerToolbar.tsx +67 -0
- package/src/composer/SessionComposer.tsx +49 -3
- package/src/composer/__tests__/ComposerToolbar-autoApprove.test.tsx +80 -0
- package/src/composer/__tests__/SessionComposer-thinkingMode.test.tsx +176 -0
- package/src/composer/index.ts +1 -0
- package/src/cursor-accounts/CursorAccountsConsole.tsx +40 -5
- package/src/cursor-accounts/__tests__/CursorAccountsConsole.test.tsx +32 -0
- package/src/cursor-accounts/__tests__/cursor-account-coverage.test.ts +58 -1
- package/src/cursor-accounts/cursor-account-coverage.ts +55 -0
- package/src/execution/MessageThread.tsx +8 -11
- package/src/execution/useCreateAgentExecution.ts +19 -0
- package/src/execution/useFileChangeContent.ts +5 -12
- package/src/identity-account/AccountPreferencesPanel.tsx +154 -68
- package/src/identity-account/__tests__/AccountPreferencesPanel.test.tsx +36 -2
- package/src/identity-provider/IdentityProviderDetailPanel.tsx +18 -15
- package/src/identity-provider/__tests__/IdentityProviderDetailPanel.test.tsx +80 -0
- package/src/index.ts +36 -2
- package/src/internal/download.ts +29 -0
- package/src/library/useExportResource.ts +3 -19
- package/src/mcp-server/McpServerDetailView.tsx +2 -2
- package/src/mcp-server/index.ts +0 -2
- package/src/mcp-server/internal/definitionDrift.ts +22 -20
- package/src/mcp-server/useUpdateMcpServer.ts +3 -3
- package/src/memory/MemoryListPanel.tsx +532 -0
- package/src/memory/__tests__/MemoryListPanel.test.tsx +259 -0
- package/src/memory/__tests__/memoryHooks.test.tsx +220 -0
- package/src/memory/index.ts +19 -0
- package/src/memory/memoryGroups.ts +64 -0
- package/src/memory/useConfirmMemory.ts +62 -0
- package/src/memory/useDeleteMemory.ts +61 -0
- package/src/memory/useMemories.ts +66 -0
- package/src/memory/useRejectMemory.ts +65 -0
- package/src/memory/useUpdateMemoryContent.ts +67 -0
- package/src/models/ModelSelector.tsx +94 -1
- package/src/models/index.ts +2 -0
- package/src/models/registry.ts +29 -0
- package/src/models/thinking-mode.ts +48 -0
- package/src/oauth-app/OAuthAppDetailPanel.tsx +23 -21
- package/src/oauth-app/__tests__/OAuthAppDetailPanel.test.tsx +94 -0
- package/src/platform-client/PlatformClientDetailPanel.tsx +14 -13
- package/src/platform-client/__tests__/PlatformClientDetailPanel.test.tsx +82 -0
- package/src/schedule/ScheduleDetailView.tsx +29 -4
- package/src/schedule/ScheduleForm.tsx +14 -1
- package/src/session/NewSessionViewer.tsx +15 -1
- package/src/session/SessionViewer.tsx +48 -49
- package/src/session/TranscriptExportMenu.tsx +78 -0
- package/src/session/__tests__/SessionViewer-autoApproveToggle.test.tsx +178 -0
- package/src/session/__tests__/SessionViewer-transcriptExport.test.tsx +151 -0
- package/src/session/__tests__/TranscriptExportMenu.test.tsx +97 -0
- package/src/session/__tests__/useExportTranscript.test.tsx +187 -0
- package/src/session/__tests__/useNewSessionFlow.test.tsx +33 -0
- package/src/session/__tests__/useSessionPageFlow.autoApprove.test.tsx +176 -2
- package/src/session/index.ts +9 -0
- package/src/session/run-config.ts +16 -0
- package/src/session/useExportTranscript.ts +171 -0
- package/src/session/useNewSessionFlow.ts +34 -7
- package/src/session/useSessionConversation.ts +42 -56
- package/src/session/useSessionExecutions.ts +5 -26
- package/src/session/useSessionPageFlow.ts +98 -32
- package/src/session/useUpdateSession.ts +18 -24
- package/src/settings/MemorySection.tsx +45 -0
- package/src/settings/index.ts +1 -0
- package/src/settings/settings-nav.ts +2 -0
- package/src/usage/useExportCSV.ts +2 -14
- package/src/workflow/ApprovalFormBuilder.tsx +20 -5
- package/src/workflow/WorkflowDetailView.tsx +2 -2
- package/src/workflow/__tests__/WorkflowInstanceDetailPanel.test.tsx +83 -0
- package/src/workflow/index.ts +0 -2
- package/src/workflow/instance/WorkflowInstanceDetailPanel.tsx +6 -7
- package/src/workflow/useUpdateWorkflow.ts +3 -3
- package/styles.css +1 -1
- package/usage/useExportCSV.d.ts.map +1 -1
- package/usage/useExportCSV.js +2 -13
- package/usage/useExportCSV.js.map +1 -1
- package/workflow/ApprovalFormBuilder.d.ts.map +1 -1
- package/workflow/ApprovalFormBuilder.js +10 -8
- package/workflow/ApprovalFormBuilder.js.map +1 -1
- package/workflow/WorkflowDetailView.js +2 -2
- package/workflow/WorkflowDetailView.js.map +1 -1
- package/workflow/index.d.ts +0 -1
- package/workflow/index.d.ts.map +1 -1
- package/workflow/index.js +0 -1
- package/workflow/index.js.map +1 -1
- package/workflow/instance/WorkflowInstanceDetailPanel.d.ts.map +1 -1
- package/workflow/instance/WorkflowInstanceDetailPanel.js +6 -7
- package/workflow/instance/WorkflowInstanceDetailPanel.js.map +1 -1
- package/workflow/useUpdateWorkflow.d.ts +3 -3
- package/workflow/useUpdateWorkflow.js +3 -3
- package/agent/internal/agentToInput.d.ts +0 -15
- package/agent/internal/agentToInput.d.ts.map +0 -1
- package/agent/internal/agentToInput.js +0 -84
- package/agent/internal/agentToInput.js.map +0 -1
- package/mcp-server/internal/mcpServerToInput.d.ts +0 -12
- package/mcp-server/internal/mcpServerToInput.d.ts.map +0 -1
- package/mcp-server/internal/mcpServerToInput.js +0 -84
- package/mcp-server/internal/mcpServerToInput.js.map +0 -1
- package/session/session-spec-converters.d.ts +0 -24
- package/session/session-spec-converters.d.ts.map +0 -1
- package/session/session-spec-converters.js +0 -72
- package/session/session-spec-converters.js.map +0 -1
- package/src/agent/internal/__tests__/agentToInput.test.ts +0 -145
- package/src/agent/internal/agentToInput.ts +0 -102
- package/src/mcp-server/__tests__/mcpServerToInput.test.ts +0 -201
- package/src/mcp-server/internal/mcpServerToInput.ts +0 -98
- package/src/session/__tests__/session-spec-converters.test.ts +0 -183
- package/src/session/session-spec-converters.ts +0 -86
- package/src/workflow/internal/workflowToInput.ts +0 -96
- package/workflow/internal/workflowToInput.d.ts +0 -12
- package/workflow/internal/workflowToInput.d.ts.map +0 -1
- package/workflow/internal/workflowToInput.js +0 -73
- package/workflow/internal/workflowToInput.js.map +0 -1
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { create, toJson } from "@bufbuild/protobuf";
|
|
3
|
-
import type { DescMessage } from "@bufbuild/protobuf";
|
|
4
|
-
import { McpServerSchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
5
|
-
import {
|
|
6
|
-
HttpServerConfigSchema,
|
|
7
|
-
McpServerAuthSchema,
|
|
8
|
-
McpServerSpecSchema,
|
|
9
|
-
StdioServerConfigSchema,
|
|
10
|
-
ToolApprovalPolicySchema,
|
|
11
|
-
} from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
12
|
-
import { EnvVarDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
13
|
-
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
14
|
-
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
15
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
16
|
-
import { buildMcpServerProto } from "@stigmer/sdk";
|
|
17
|
-
import { mcpServerToInput } from "../internal/mcpServerToInput.js";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* `mcpServerToInput` powers every read-modify-write update in the SDK: the
|
|
21
|
-
* backend does FULL spec replacement, so any spec field the conversion
|
|
22
|
-
* fails to carry is silently ERASED by the very next inline edit. That is
|
|
23
|
-
* not hypothetical — `spec.tags` and `auth.oauth_only` were lost this way
|
|
24
|
-
* until the conversion (and the SDK input type) learned them.
|
|
25
|
-
*
|
|
26
|
-
* Two layers of protection:
|
|
27
|
-
*
|
|
28
|
-
* 1. A field-inventory fence: pins the exact field set of every proto
|
|
29
|
-
* message the conversion traverses. Adding a field to the proto makes
|
|
30
|
-
* this test fail with instructions, instead of shipping a new
|
|
31
|
-
* silent-data-loss bug.
|
|
32
|
-
* 2. A round-trip proof: a fully-populated server survives
|
|
33
|
-
* `mcpServerToInput` -> `buildMcpServerProto` with its spec intact.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
// ---------------------------------------------------------------------------
|
|
37
|
-
// Layer 1 — field-inventory fence
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Every message the conversion walks, with its complete expected field set
|
|
42
|
-
* (proto `localName`s; oneof members appear as individual fields).
|
|
43
|
-
*
|
|
44
|
-
* If this fails because a field was ADDED: map the new field in
|
|
45
|
-
* `mcpServerToInput`, populate it in `fullyPopulatedServer` below, and only
|
|
46
|
-
* then extend the expected list here.
|
|
47
|
-
*/
|
|
48
|
-
const EXPECTED_FIELD_INVENTORY: ReadonlyArray<
|
|
49
|
-
readonly [DescMessage, readonly string[]]
|
|
50
|
-
> = [
|
|
51
|
-
[
|
|
52
|
-
McpServerSpecSchema,
|
|
53
|
-
[
|
|
54
|
-
"auth",
|
|
55
|
-
"defaultEnabledTools",
|
|
56
|
-
"description",
|
|
57
|
-
"env",
|
|
58
|
-
"githubStars",
|
|
59
|
-
"http",
|
|
60
|
-
"iconUrl",
|
|
61
|
-
"pinnedToolApprovals",
|
|
62
|
-
"repositoryUrl",
|
|
63
|
-
"stdio",
|
|
64
|
-
"tags",
|
|
65
|
-
],
|
|
66
|
-
],
|
|
67
|
-
[StdioServerConfigSchema, ["args", "command", "workingDir"]],
|
|
68
|
-
[HttpServerConfigSchema, ["headers", "queryParams", "timeoutSeconds", "url"]],
|
|
69
|
-
[EnvVarDeclarationSchema, ["description", "isSecret", "optional"]],
|
|
70
|
-
[ToolApprovalPolicySchema, ["fromDestructiveHint", "message", "toolName"]],
|
|
71
|
-
[
|
|
72
|
-
McpServerAuthSchema,
|
|
73
|
-
[
|
|
74
|
-
"discoveryUrl",
|
|
75
|
-
"oauthAppRef",
|
|
76
|
-
"oauthOnly",
|
|
77
|
-
"scopeHints",
|
|
78
|
-
"targetEnvVar",
|
|
79
|
-
"tokenLifetimeHint",
|
|
80
|
-
],
|
|
81
|
-
],
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
describe("mcpServerToInput field-inventory fence", () => {
|
|
85
|
-
it.each(
|
|
86
|
-
EXPECTED_FIELD_INVENTORY.map(
|
|
87
|
-
([schema, fields]) => [schema.typeName, schema, fields] as const,
|
|
88
|
-
),
|
|
89
|
-
)("%s has exactly the fields the conversion maps", (_name, schema, fields) => {
|
|
90
|
-
const actual = schema.fields.map((f) => f.localName).sort();
|
|
91
|
-
expect(
|
|
92
|
-
actual,
|
|
93
|
-
`${schema.typeName} changed shape. Map any new field in ` +
|
|
94
|
-
"mcpServerToInput (unmapped spec fields are ERASED on the next " +
|
|
95
|
-
"update), populate it in this file's fullyPopulatedServer fixture, " +
|
|
96
|
-
"then update EXPECTED_FIELD_INVENTORY.",
|
|
97
|
-
).toEqual([...fields].sort());
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// ---------------------------------------------------------------------------
|
|
102
|
-
// Layer 2 — round-trip proof
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* A server with EVERY spec field set to a non-default value, so any field
|
|
107
|
-
* the conversion drops shows up as a round-trip diff.
|
|
108
|
-
*/
|
|
109
|
-
function fullyPopulatedServer(transport: "stdio" | "http") {
|
|
110
|
-
const server = create(McpServerSchema, {
|
|
111
|
-
apiVersion: "agentic.stigmer.ai/v1",
|
|
112
|
-
kind: "McpServer",
|
|
113
|
-
metadata: create(ApiResourceMetadataSchema, {
|
|
114
|
-
name: "Monday",
|
|
115
|
-
org: "acme",
|
|
116
|
-
slug: "monday",
|
|
117
|
-
labels: { "stigmer.ai/category": "productivity" },
|
|
118
|
-
}),
|
|
119
|
-
spec: create(McpServerSpecSchema, {
|
|
120
|
-
description: "monday.com MCP server",
|
|
121
|
-
iconUrl: "https://example.com/monday.svg",
|
|
122
|
-
tags: ["monday", "project-management"],
|
|
123
|
-
defaultEnabledTools: ["boards_list", "items_create"],
|
|
124
|
-
env: {
|
|
125
|
-
MONDAY_ACCESS_TOKEN: create(EnvVarDeclarationSchema, {
|
|
126
|
-
isSecret: true,
|
|
127
|
-
description: "OAuth access token",
|
|
128
|
-
optional: true,
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
|
-
pinnedToolApprovals: [
|
|
132
|
-
create(ToolApprovalPolicySchema, {
|
|
133
|
-
toolName: "items_delete",
|
|
134
|
-
message: "Deletes board items",
|
|
135
|
-
fromDestructiveHint: true,
|
|
136
|
-
}),
|
|
137
|
-
],
|
|
138
|
-
repositoryUrl: "https://github.com/mondaycom/mcp",
|
|
139
|
-
githubStars: 387,
|
|
140
|
-
auth: create(McpServerAuthSchema, {
|
|
141
|
-
oauthAppRef: create(ApiResourceReferenceSchema, {
|
|
142
|
-
org: "stigmer",
|
|
143
|
-
slug: "monday-oauth",
|
|
144
|
-
kind: ApiResourceKind.oauth_app,
|
|
145
|
-
}),
|
|
146
|
-
targetEnvVar: "MONDAY_ACCESS_TOKEN",
|
|
147
|
-
tokenLifetimeHint: "1h",
|
|
148
|
-
scopeHints: ["boards:read", "boards:write"],
|
|
149
|
-
discoveryUrl: "https://auth.monday.com/.well-known/oauth",
|
|
150
|
-
oauthOnly: true,
|
|
151
|
-
}),
|
|
152
|
-
}),
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (transport === "stdio") {
|
|
156
|
-
server.spec!.serverType = {
|
|
157
|
-
case: "stdio",
|
|
158
|
-
value: create(StdioServerConfigSchema, {
|
|
159
|
-
command: "npx",
|
|
160
|
-
args: ["-y", "@mondaycom/mcp"],
|
|
161
|
-
workingDir: "/workspace",
|
|
162
|
-
}),
|
|
163
|
-
};
|
|
164
|
-
} else {
|
|
165
|
-
server.spec!.serverType = {
|
|
166
|
-
case: "http",
|
|
167
|
-
value: create(HttpServerConfigSchema, {
|
|
168
|
-
url: "https://mcp.monday.com/mcp",
|
|
169
|
-
headers: { Authorization: "Bearer ${MONDAY_ACCESS_TOKEN}" },
|
|
170
|
-
queryParams: { version: "2" },
|
|
171
|
-
timeoutSeconds: 45,
|
|
172
|
-
}),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return server;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
describe("mcpServerToInput round-trip", () => {
|
|
180
|
-
it.each(["stdio", "http"] as const)(
|
|
181
|
-
"a fully-populated %s server survives toInput -> buildProto with spec intact",
|
|
182
|
-
(transport) => {
|
|
183
|
-
const original = fullyPopulatedServer(transport);
|
|
184
|
-
const rebuilt = buildMcpServerProto(mcpServerToInput(original));
|
|
185
|
-
|
|
186
|
-
expect(toJson(McpServerSpecSchema, rebuilt.spec!)).toEqual(
|
|
187
|
-
toJson(McpServerSpecSchema, original.spec!),
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
// Metadata identity fields the conversion is responsible for.
|
|
191
|
-
// (visibility is intentionally absent: the backend preserves it on
|
|
192
|
-
// update, and updateVisibility is its dedicated write path.)
|
|
193
|
-
expect(rebuilt.metadata?.name).toBe("Monday");
|
|
194
|
-
expect(rebuilt.metadata?.org).toBe("acme");
|
|
195
|
-
expect(rebuilt.metadata?.slug).toBe("monday");
|
|
196
|
-
expect(rebuilt.metadata?.labels).toEqual({
|
|
197
|
-
"stigmer.ai/category": "productivity",
|
|
198
|
-
});
|
|
199
|
-
},
|
|
200
|
-
);
|
|
201
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
2
|
-
import type { McpServerInput } from "@stigmer/sdk";
|
|
3
|
-
|
|
4
|
-
interface EnvVarDeclarationInput {
|
|
5
|
-
isSecret?: boolean;
|
|
6
|
-
description?: string;
|
|
7
|
-
optional?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Converts a fetched McpServer proto to the McpServerInput shape expected
|
|
12
|
-
* by `stigmer.mcpServer.update()`. Enables inline field editing: read
|
|
13
|
-
* the current resource, modify one field, and re-submit the full input.
|
|
14
|
-
*
|
|
15
|
-
* Must be kept exhaustive — any spec field not mapped here will be
|
|
16
|
-
* cleared on the next update (the backend does full spec replacement).
|
|
17
|
-
*/
|
|
18
|
-
export function mcpServerToInput(server: McpServer): McpServerInput {
|
|
19
|
-
const meta = server.metadata;
|
|
20
|
-
const spec = server.spec;
|
|
21
|
-
|
|
22
|
-
let env: Record<string, EnvVarDeclarationInput> | undefined;
|
|
23
|
-
if (spec?.env && Object.keys(spec.env).length > 0) {
|
|
24
|
-
env = {};
|
|
25
|
-
for (const [key, decl] of Object.entries(spec.env)) {
|
|
26
|
-
env[key] = {
|
|
27
|
-
isSecret: decl.isSecret || undefined,
|
|
28
|
-
description: decl.description || undefined,
|
|
29
|
-
optional: decl.optional || undefined,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const pinnedToolApprovals =
|
|
35
|
-
spec?.pinnedToolApprovals?.length
|
|
36
|
-
? spec.pinnedToolApprovals.map((p) => ({
|
|
37
|
-
toolName: p.toolName || undefined,
|
|
38
|
-
message: p.message || undefined,
|
|
39
|
-
fromDestructiveHint: p.fromDestructiveHint || undefined,
|
|
40
|
-
}))
|
|
41
|
-
: undefined;
|
|
42
|
-
|
|
43
|
-
const auth = spec?.auth
|
|
44
|
-
? {
|
|
45
|
-
oauthAppRef: spec.auth.oauthAppRef
|
|
46
|
-
? { org: spec.auth.oauthAppRef.org || "", slug: spec.auth.oauthAppRef.slug }
|
|
47
|
-
: undefined,
|
|
48
|
-
targetEnvVar: spec.auth.targetEnvVar || undefined,
|
|
49
|
-
tokenLifetimeHint: spec.auth.tokenLifetimeHint || undefined,
|
|
50
|
-
scopeHints: spec.auth.scopeHints.length > 0 ? [...spec.auth.scopeHints] : undefined,
|
|
51
|
-
discoveryUrl: spec.auth.discoveryUrl || undefined,
|
|
52
|
-
oauthOnly: spec.auth.oauthOnly || undefined,
|
|
53
|
-
}
|
|
54
|
-
: undefined;
|
|
55
|
-
|
|
56
|
-
const input: McpServerInput = {
|
|
57
|
-
name: meta?.name ?? "",
|
|
58
|
-
org: meta?.org ?? "",
|
|
59
|
-
slug: meta?.slug,
|
|
60
|
-
labels: meta?.labels && Object.keys(meta.labels).length > 0
|
|
61
|
-
? { ...meta.labels }
|
|
62
|
-
: undefined,
|
|
63
|
-
description: spec?.description || undefined,
|
|
64
|
-
iconUrl: spec?.iconUrl || undefined,
|
|
65
|
-
tags: spec?.tags?.length ? [...spec.tags] : undefined,
|
|
66
|
-
defaultEnabledTools: spec?.defaultEnabledTools?.length
|
|
67
|
-
? [...spec.defaultEnabledTools]
|
|
68
|
-
: undefined,
|
|
69
|
-
env,
|
|
70
|
-
pinnedToolApprovals,
|
|
71
|
-
repositoryUrl: spec?.repositoryUrl || undefined,
|
|
72
|
-
githubStars: spec?.githubStars || undefined,
|
|
73
|
-
auth,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
if (spec?.serverType?.case === "stdio") {
|
|
77
|
-
input.stdio = {
|
|
78
|
-
command: spec.serverType.value.command,
|
|
79
|
-
args: spec.serverType.value.args.length > 0
|
|
80
|
-
? [...spec.serverType.value.args]
|
|
81
|
-
: undefined,
|
|
82
|
-
workingDir: spec.serverType.value.workingDir || undefined,
|
|
83
|
-
};
|
|
84
|
-
} else if (spec?.serverType?.case === "http") {
|
|
85
|
-
input.http = {
|
|
86
|
-
url: spec.serverType.value.url,
|
|
87
|
-
headers: spec.serverType.value.headers && Object.keys(spec.serverType.value.headers).length > 0
|
|
88
|
-
? { ...spec.serverType.value.headers }
|
|
89
|
-
: undefined,
|
|
90
|
-
queryParams: spec.serverType.value.queryParams && Object.keys(spec.serverType.value.queryParams).length > 0
|
|
91
|
-
? { ...spec.serverType.value.queryParams }
|
|
92
|
-
: undefined,
|
|
93
|
-
timeoutSeconds: spec.serverType.value.timeoutSeconds || undefined,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return input;
|
|
98
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
specWorkspaceToInput,
|
|
4
|
-
specMcpUsagesToInput,
|
|
5
|
-
specSkillRefsToInput,
|
|
6
|
-
} from "../session-spec-converters";
|
|
7
|
-
import type { Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
8
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
9
|
-
|
|
10
|
-
type SessionSpec = Session["spec"];
|
|
11
|
-
|
|
12
|
-
function makeSpec(overrides: Partial<NonNullable<SessionSpec>> = {}): SessionSpec {
|
|
13
|
-
return {
|
|
14
|
-
agentInstanceId: "",
|
|
15
|
-
subject: "",
|
|
16
|
-
harnessStateId: "",
|
|
17
|
-
metadata: {},
|
|
18
|
-
workspaceEntries: [],
|
|
19
|
-
mcpServerUsages: [],
|
|
20
|
-
skillRefs: [],
|
|
21
|
-
harness: 0,
|
|
22
|
-
cursorMode: 0,
|
|
23
|
-
...overrides,
|
|
24
|
-
} as unknown as SessionSpec;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
describe("specWorkspaceToInput", () => {
|
|
28
|
-
it("returns undefined for undefined spec", () => {
|
|
29
|
-
expect(specWorkspaceToInput(undefined)).toBeUndefined();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("returns empty array for spec with no workspace entries", () => {
|
|
33
|
-
expect(specWorkspaceToInput(makeSpec())).toEqual([]);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("converts git repo entries", () => {
|
|
37
|
-
const spec = makeSpec({
|
|
38
|
-
workspaceEntries: [
|
|
39
|
-
{
|
|
40
|
-
name: "my-repo",
|
|
41
|
-
source: {
|
|
42
|
-
source: {
|
|
43
|
-
case: "gitRepo" as const,
|
|
44
|
-
value: { url: "https://github.com/org/repo", branch: "main", commit: "", depth: 0 },
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
] as unknown as SessionSpec extends undefined ? never : NonNullable<SessionSpec>["workspaceEntries"],
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const result = specWorkspaceToInput(spec);
|
|
52
|
-
expect(result).toEqual([
|
|
53
|
-
{
|
|
54
|
-
name: "my-repo",
|
|
55
|
-
source: {
|
|
56
|
-
gitRepo: {
|
|
57
|
-
url: "https://github.com/org/repo",
|
|
58
|
-
branch: "main",
|
|
59
|
-
commit: undefined,
|
|
60
|
-
depth: undefined,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
]);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("converts local path entries", () => {
|
|
68
|
-
const spec = makeSpec({
|
|
69
|
-
workspaceEntries: [
|
|
70
|
-
{
|
|
71
|
-
name: "local",
|
|
72
|
-
source: {
|
|
73
|
-
source: {
|
|
74
|
-
case: "localPath" as const,
|
|
75
|
-
value: { path: "/home/user/project" },
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
] as unknown as SessionSpec extends undefined ? never : NonNullable<SessionSpec>["workspaceEntries"],
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const result = specWorkspaceToInput(spec);
|
|
83
|
-
expect(result).toEqual([
|
|
84
|
-
{
|
|
85
|
-
name: "local",
|
|
86
|
-
source: {
|
|
87
|
-
localPath: { path: "/home/user/project" },
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("specMcpUsagesToInput", () => {
|
|
95
|
-
it("returns undefined for undefined spec", () => {
|
|
96
|
-
expect(specMcpUsagesToInput(undefined)).toBeUndefined();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("returns empty array for spec with no MCP server usages", () => {
|
|
100
|
-
expect(specMcpUsagesToInput(makeSpec())).toEqual([]);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("converts MCP server usages with ref and enabled tools", () => {
|
|
104
|
-
const spec = makeSpec({
|
|
105
|
-
mcpServerUsages: [
|
|
106
|
-
{
|
|
107
|
-
mcpServerRef: {
|
|
108
|
-
org: "acme",
|
|
109
|
-
slug: "github-tools",
|
|
110
|
-
version: "v1",
|
|
111
|
-
kind: ApiResourceKind.mcp_server,
|
|
112
|
-
},
|
|
113
|
-
enabledTools: ["create_issue", "list_prs"],
|
|
114
|
-
toolApprovalOverrides: [],
|
|
115
|
-
},
|
|
116
|
-
] as unknown as NonNullable<SessionSpec>["mcpServerUsages"],
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
const result = specMcpUsagesToInput(spec);
|
|
120
|
-
expect(result).toEqual([
|
|
121
|
-
{
|
|
122
|
-
mcpServerRef: {
|
|
123
|
-
org: "acme",
|
|
124
|
-
slug: "github-tools",
|
|
125
|
-
version: "v1",
|
|
126
|
-
kind: ApiResourceKind.mcp_server,
|
|
127
|
-
},
|
|
128
|
-
enabledTools: ["create_issue", "list_prs"],
|
|
129
|
-
toolApprovalOverrides: undefined,
|
|
130
|
-
},
|
|
131
|
-
]);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("converts MCP server usages with tool approval overrides", () => {
|
|
135
|
-
const spec = makeSpec({
|
|
136
|
-
mcpServerUsages: [
|
|
137
|
-
{
|
|
138
|
-
mcpServerRef: {
|
|
139
|
-
org: "acme",
|
|
140
|
-
slug: "shell",
|
|
141
|
-
version: "",
|
|
142
|
-
kind: ApiResourceKind.mcp_server,
|
|
143
|
-
},
|
|
144
|
-
enabledTools: [],
|
|
145
|
-
toolApprovalOverrides: [
|
|
146
|
-
{ toolName: "exec", requiresApproval: true, message: "Dangerous" },
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
] as unknown as NonNullable<SessionSpec>["mcpServerUsages"],
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const result = specMcpUsagesToInput(spec);
|
|
153
|
-
expect(result).toHaveLength(1);
|
|
154
|
-
expect(result![0].toolApprovalOverrides).toEqual([
|
|
155
|
-
{ toolName: "exec", requiresApproval: true, message: "Dangerous" },
|
|
156
|
-
]);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
describe("specSkillRefsToInput", () => {
|
|
161
|
-
it("returns undefined for undefined spec", () => {
|
|
162
|
-
expect(specSkillRefsToInput(undefined)).toBeUndefined();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it("returns empty array for spec with no skill refs", () => {
|
|
166
|
-
expect(specSkillRefsToInput(makeSpec())).toEqual([]);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("converts skill references", () => {
|
|
170
|
-
const spec = makeSpec({
|
|
171
|
-
skillRefs: [
|
|
172
|
-
{ org: "acme", slug: "code-review", version: "v2", kind: ApiResourceKind.skill },
|
|
173
|
-
{ org: "acme", slug: "testing", version: "", kind: ApiResourceKind.skill },
|
|
174
|
-
] as unknown as NonNullable<SessionSpec>["skillRefs"],
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const result = specSkillRefsToInput(spec);
|
|
178
|
-
expect(result).toEqual([
|
|
179
|
-
{ org: "acme", slug: "code-review", version: "v2", kind: ApiResourceKind.skill },
|
|
180
|
-
{ org: "acme", slug: "testing", version: undefined, kind: ApiResourceKind.skill },
|
|
181
|
-
]);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
2
|
-
import type {
|
|
3
|
-
McpServerUsageInput,
|
|
4
|
-
ResourceRef,
|
|
5
|
-
WorkspaceEntryInput,
|
|
6
|
-
} from "@stigmer/sdk";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Convert proto workspace entries back to SDK input format.
|
|
10
|
-
*
|
|
11
|
-
* Used by `useSessionConversation` (session update with replace semantics)
|
|
12
|
-
* and `useSessionPageFlow` (hydrating composer state from a loaded session).
|
|
13
|
-
*/
|
|
14
|
-
export function specWorkspaceToInput(
|
|
15
|
-
spec: Session["spec"],
|
|
16
|
-
): WorkspaceEntryInput[] | undefined {
|
|
17
|
-
return spec?.workspaceEntries?.map((e): WorkspaceEntryInput => {
|
|
18
|
-
if (e.source?.source.case === "gitRepo") {
|
|
19
|
-
const v = e.source.source.value;
|
|
20
|
-
return {
|
|
21
|
-
name: e.name || undefined,
|
|
22
|
-
source: {
|
|
23
|
-
gitRepo: {
|
|
24
|
-
url: v.url,
|
|
25
|
-
branch: v.branch || undefined,
|
|
26
|
-
commit: v.commit || undefined,
|
|
27
|
-
depth: v.depth || undefined,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
if (e.source?.source.case === "localPath") {
|
|
33
|
-
return {
|
|
34
|
-
name: e.name || undefined,
|
|
35
|
-
source: {
|
|
36
|
-
localPath: { path: e.source.source.value.path || undefined },
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return { name: e.name || undefined, source: {} };
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Convert proto MCP server usages back to SDK input format.
|
|
46
|
-
*
|
|
47
|
-
* Used by `useSessionConversation` (session update with replace semantics)
|
|
48
|
-
* and `useSessionPageFlow` (hydrating composer state from a loaded session).
|
|
49
|
-
*/
|
|
50
|
-
export function specMcpUsagesToInput(
|
|
51
|
-
spec: Session["spec"],
|
|
52
|
-
): McpServerUsageInput[] | undefined {
|
|
53
|
-
return spec?.mcpServerUsages?.map((u) => ({
|
|
54
|
-
mcpServerRef: {
|
|
55
|
-
org: u.mcpServerRef?.org ?? "",
|
|
56
|
-
slug: u.mcpServerRef?.slug ?? "",
|
|
57
|
-
version: u.mcpServerRef?.version || undefined,
|
|
58
|
-
kind: u.mcpServerRef?.kind,
|
|
59
|
-
},
|
|
60
|
-
enabledTools: u.enabledTools?.length ? [...u.enabledTools] : undefined,
|
|
61
|
-
toolApprovalOverrides: u.toolApprovalOverrides?.length
|
|
62
|
-
? u.toolApprovalOverrides.map((o) => ({
|
|
63
|
-
toolName: o.toolName || undefined,
|
|
64
|
-
requiresApproval: o.requiresApproval || undefined,
|
|
65
|
-
message: o.message || undefined,
|
|
66
|
-
}))
|
|
67
|
-
: undefined,
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Convert proto skill references back to SDK input format.
|
|
73
|
-
*
|
|
74
|
-
* Used by `useSessionConversation` (session update with replace semantics)
|
|
75
|
-
* and `useSessionPageFlow` (hydrating composer state from a loaded session).
|
|
76
|
-
*/
|
|
77
|
-
export function specSkillRefsToInput(
|
|
78
|
-
spec: Session["spec"],
|
|
79
|
-
): ResourceRef[] | undefined {
|
|
80
|
-
return spec?.skillRefs?.map((r) => ({
|
|
81
|
-
org: r.org ?? "",
|
|
82
|
-
slug: r.slug ?? "",
|
|
83
|
-
version: r.version || undefined,
|
|
84
|
-
kind: r.kind,
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { Workflow } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
|
|
2
|
-
import type {
|
|
3
|
-
WorkflowInput,
|
|
4
|
-
WorkflowDocumentInput,
|
|
5
|
-
WorkflowTaskInput,
|
|
6
|
-
} from "@stigmer/sdk";
|
|
7
|
-
import type { WorkflowTask } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/spec_pb";
|
|
8
|
-
|
|
9
|
-
interface EnvVarDeclarationInput {
|
|
10
|
-
isSecret?: boolean;
|
|
11
|
-
description?: string;
|
|
12
|
-
optional?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Converts a fetched Workflow proto to the WorkflowInput shape expected
|
|
17
|
-
* by `stigmer.workflow.update()`. Enables inline field editing: read the
|
|
18
|
-
* current resource, modify one field, and re-submit the full input.
|
|
19
|
-
*
|
|
20
|
-
* Must be kept exhaustive -- any spec field not mapped here will be
|
|
21
|
-
* cleared on the next update (the backend does full spec replacement).
|
|
22
|
-
*/
|
|
23
|
-
export function workflowToInput(workflow: Workflow): WorkflowInput {
|
|
24
|
-
const meta = workflow.metadata;
|
|
25
|
-
const spec = workflow.spec;
|
|
26
|
-
const doc = spec?.document;
|
|
27
|
-
|
|
28
|
-
const document: WorkflowDocumentInput = {
|
|
29
|
-
dsl: doc?.dsl || "1.0.0",
|
|
30
|
-
namespace: doc?.namespace ?? "",
|
|
31
|
-
name: doc?.name ?? "",
|
|
32
|
-
version: doc?.version ?? "",
|
|
33
|
-
description: doc?.description || undefined,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const tasks: WorkflowTaskInput[] | undefined =
|
|
37
|
-
spec?.tasks?.map(convertTask);
|
|
38
|
-
|
|
39
|
-
let env: Record<string, EnvVarDeclarationInput> | undefined;
|
|
40
|
-
if (spec?.env && Object.keys(spec.env).length > 0) {
|
|
41
|
-
env = {};
|
|
42
|
-
for (const [key, decl] of Object.entries(spec.env)) {
|
|
43
|
-
env[key] = {
|
|
44
|
-
isSecret: decl.isSecret || undefined,
|
|
45
|
-
description: decl.description || undefined,
|
|
46
|
-
optional: decl.optional || undefined,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let budget: WorkflowInput["budget"];
|
|
52
|
-
if (spec?.budget) {
|
|
53
|
-
const b = spec.budget;
|
|
54
|
-
if (
|
|
55
|
-
Number(b.maxCostMicros ?? 0) > 0 ||
|
|
56
|
-
Number(b.maxTotalTokens ?? 0) > 0 ||
|
|
57
|
-
(b.maxDurationSeconds ?? 0) > 0
|
|
58
|
-
) {
|
|
59
|
-
budget = {
|
|
60
|
-
maxCostMicros: b.maxCostMicros || undefined,
|
|
61
|
-
maxTotalTokens: b.maxTotalTokens || undefined,
|
|
62
|
-
maxDurationSeconds: b.maxDurationSeconds || undefined,
|
|
63
|
-
onExceeded: b.onExceeded || undefined,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
name: meta?.name ?? "",
|
|
70
|
-
org: meta?.org ?? "",
|
|
71
|
-
slug: meta?.slug,
|
|
72
|
-
labels:
|
|
73
|
-
meta?.labels && Object.keys(meta.labels).length > 0
|
|
74
|
-
? { ...meta.labels }
|
|
75
|
-
: undefined,
|
|
76
|
-
visibility: meta?.visibility || undefined,
|
|
77
|
-
description: spec?.description || undefined,
|
|
78
|
-
document,
|
|
79
|
-
tasks: tasks?.length ? tasks : undefined,
|
|
80
|
-
env,
|
|
81
|
-
budget,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function convertTask(task: WorkflowTask): WorkflowTaskInput {
|
|
86
|
-
return {
|
|
87
|
-
name: task.name || undefined,
|
|
88
|
-
kind: task.kind,
|
|
89
|
-
taskConfig: task.taskConfig ?? {},
|
|
90
|
-
export: task.export?.as ? { as: task.export.as } : undefined,
|
|
91
|
-
flow: task.flow?.then ? { then: task.flow.then } : undefined,
|
|
92
|
-
compensate: task.compensate?.length
|
|
93
|
-
? task.compensate.map(convertTask)
|
|
94
|
-
: undefined,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Workflow } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
|
|
2
|
-
import type { WorkflowInput } from "@stigmer/sdk";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a fetched Workflow proto to the WorkflowInput shape expected
|
|
5
|
-
* by `stigmer.workflow.update()`. Enables inline field editing: read the
|
|
6
|
-
* current resource, modify one field, and re-submit the full input.
|
|
7
|
-
*
|
|
8
|
-
* Must be kept exhaustive -- any spec field not mapped here will be
|
|
9
|
-
* cleared on the next update (the backend does full spec replacement).
|
|
10
|
-
*/
|
|
11
|
-
export declare function workflowToInput(workflow: Workflow): WorkflowInput;
|
|
12
|
-
//# sourceMappingURL=workflowToInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflowToInput.d.ts","sourceRoot":"","sources":["../../../src/workflow/internal/workflowToInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uDAAuD,CAAC;AACtF,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,cAAc,CAAC;AAStB;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CA4DjE"}
|