@stigmer/react 0.0.91 → 0.0.93
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 +57 -12
- package/agent/AgentDetailView.js +7 -7
- package/agent/AgentDetailView.js.map +1 -1
- package/agent/AgentPicker.js +3 -3
- package/agent/AgentPicker.js.map +1 -1
- package/api-key/ApiKeyCreatedAlert.js +1 -1
- package/api-key/ApiKeyCreatedAlert.js.map +1 -1
- package/api-key/ApiKeyListPanel.js +4 -4
- package/api-key/ApiKeyListPanel.js.map +1 -1
- package/api-key/CreateApiKeyForm.js +1 -1
- package/api-key/CreateApiKeyForm.js.map +1 -1
- package/attachment/AttachmentChipList.js +2 -2
- package/attachment/AttachmentChipList.js.map +1 -1
- package/color-mode.d.ts +48 -0
- package/color-mode.d.ts.map +1 -0
- package/color-mode.js +53 -0
- package/color-mode.js.map +1 -0
- package/composer/ComposerToolbar.d.ts +6 -2
- package/composer/ComposerToolbar.d.ts.map +1 -1
- package/composer/ComposerToolbar.js +5 -3
- package/composer/ComposerToolbar.js.map +1 -1
- package/composer/ConfigureMenu.js +3 -3
- package/composer/ConfigureMenu.js.map +1 -1
- package/composer/ContextChip.js +1 -1
- package/composer/ContextChip.js.map +1 -1
- package/composer/ContextPopover.js +1 -1
- package/composer/ContextPopover.js.map +1 -1
- package/composer/SessionComposer.d.ts +24 -3
- package/composer/SessionComposer.d.ts.map +1 -1
- package/composer/SessionComposer.js +5 -4
- package/composer/SessionComposer.js.map +1 -1
- package/environment/CreateEnvironmentForm.js +1 -1
- package/environment/CreateEnvironmentForm.js.map +1 -1
- package/environment/EnvVarForm.js +2 -2
- package/environment/EnvVarForm.js.map +1 -1
- package/environment/EnvironmentListPanel.js +2 -2
- package/environment/EnvironmentListPanel.js.map +1 -1
- package/environment/EnvironmentVariableEditor.js +6 -6
- package/environment/EnvironmentVariableEditor.js.map +1 -1
- package/error/ErrorMessage.js +1 -1
- package/error/ErrorMessage.js.map +1 -1
- package/execution/ApprovalCard.js +4 -4
- package/execution/ApprovalCard.js.map +1 -1
- package/execution/ArtifactCard.js +1 -1
- package/execution/ArtifactCard.js.map +1 -1
- package/execution/ArtifactPreviewModal.js +4 -4
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/FollowUpInput.js +1 -1
- package/execution/FollowUpInput.js.map +1 -1
- package/execution/McpToolDetail.js +4 -4
- package/execution/McpToolDetail.js.map +1 -1
- package/execution/MessageEntry.js +1 -1
- package/execution/MessageEntry.js.map +1 -1
- package/execution/MessageThread.js +1 -1
- package/execution/MessageThread.js.map +1 -1
- package/execution/SessionVariablesInput.js +4 -4
- package/execution/SessionVariablesInput.js.map +1 -1
- package/execution/SubAgentSection.js +2 -2
- package/execution/SubAgentSection.js.map +1 -1
- package/execution/ToolCallDetail.js +2 -2
- package/execution/ToolCallDetail.js.map +1 -1
- package/execution/ToolCallGroup.js +1 -1
- package/execution/ToolCallGroup.js.map +1 -1
- package/execution/ToolCallItem.js +2 -2
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/WriteBackCard.js +3 -3
- package/execution/WriteBackCard.js.map +1 -1
- package/execution/tool-rendering-primitives.js +3 -3
- package/execution/tool-rendering-primitives.js.map +1 -1
- package/github/GitHubRepoPicker.js +5 -5
- package/github/GitHubRepoPicker.js.map +1 -1
- package/iam-policy/GrantAccessForm.js +1 -1
- package/iam-policy/GrantAccessForm.js.map +1 -1
- package/iam-policy/OrgMembersPanel.js +5 -5
- package/iam-policy/OrgMembersPanel.js.map +1 -1
- package/identity-provider/CreateIdentityProviderForm.js +3 -3
- package/identity-provider/CreateIdentityProviderForm.js.map +1 -1
- package/identity-provider/IdentityProviderDetailPanel.js +5 -5
- package/identity-provider/IdentityProviderDetailPanel.js.map +1 -1
- package/identity-provider/IdentityProviderListPanel.js +3 -3
- package/identity-provider/IdentityProviderListPanel.js.map +1 -1
- package/identity-provider/IdentityProviderWizard.js +7 -7
- package/identity-provider/IdentityProviderWizard.js.map +1 -1
- package/identity-provider/ProviderPicker.js +2 -2
- package/identity-provider/ProviderPicker.js.map +1 -1
- package/index.d.ts +8 -4
- package/index.d.ts.map +1 -1
- package/index.js +7 -3
- package/index.js.map +1 -1
- package/internal/CloudFeatureNotice.js +1 -1
- package/internal/CloudFeatureNotice.js.map +1 -1
- package/internal/Tabs.js +1 -1
- package/internal/Tabs.js.map +1 -1
- package/internal/markdown-components.js +2 -2
- package/internal/markdown-components.js.map +1 -1
- package/invitation/InvitationCreatedAlert.js +1 -1
- package/invitation/InvitationCreatedAlert.js.map +1 -1
- package/invitation/InvitationManager.js +5 -5
- package/invitation/InvitationManager.js.map +1 -1
- package/invitation/InvitationRedemption.js +4 -4
- package/invitation/InvitationRedemption.js.map +1 -1
- package/library/ResourceCountCard.js +1 -1
- package/library/ResourceCountCard.js.map +1 -1
- package/library/ResourceListView.js +5 -5
- package/library/ResourceListView.js.map +1 -1
- package/mcp-server/McpServerConfigPanel.js +5 -5
- package/mcp-server/McpServerConfigPanel.js.map +1 -1
- package/mcp-server/McpServerConnectDialog.js +4 -4
- package/mcp-server/McpServerConnectDialog.js.map +1 -1
- package/mcp-server/McpServerDetailView.js +14 -14
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/mcp-server/McpServerPicker.js +4 -4
- package/mcp-server/McpServerPicker.js.map +1 -1
- package/mcp-server/McpToolSelector.js +3 -3
- package/mcp-server/McpToolSelector.js.map +1 -1
- package/mcp-server/OAuthAppForm.js +1 -1
- package/mcp-server/OAuthAppForm.js.map +1 -1
- package/models/ModelSelector.js +1 -1
- package/models/ModelSelector.js.map +1 -1
- package/oauth-app/CreateOAuthAppForm.js +1 -1
- package/oauth-app/CreateOAuthAppForm.js.map +1 -1
- package/oauth-app/OAuthAppDetailPanel.js +3 -3
- package/oauth-app/OAuthAppDetailPanel.js.map +1 -1
- package/oauth-app/OAuthAppListPanel.js +2 -2
- package/oauth-app/OAuthAppListPanel.js.map +1 -1
- package/organization/CreateOrganizationForm.js +1 -1
- package/organization/CreateOrganizationForm.js.map +1 -1
- package/organization/OrgProfilePanel.js +3 -3
- package/organization/OrgProfilePanel.js.map +1 -1
- package/package.json +4 -4
- package/platform-client/CreatePlatformClientForm.js +2 -2
- package/platform-client/CreatePlatformClientForm.js.map +1 -1
- package/platform-client/PlatformClientDetailPanel.js +4 -4
- package/platform-client/PlatformClientDetailPanel.js.map +1 -1
- package/platform-client/PlatformClientListPanel.js +3 -3
- package/platform-client/PlatformClientListPanel.js.map +1 -1
- package/platform-client/PlatformClientSecretAlert.js +2 -2
- package/platform-client/PlatformClientSecretAlert.js.map +1 -1
- package/provider.d.ts +39 -2
- package/provider.d.ts.map +1 -1
- package/provider.js +11 -3
- package/provider.js.map +1 -1
- package/runner/RunnerListPanel.d.ts +65 -0
- package/runner/RunnerListPanel.d.ts.map +1 -0
- package/runner/RunnerListPanel.js +237 -0
- package/runner/RunnerListPanel.js.map +1 -0
- package/runner/RunnerPicker.d.ts +54 -0
- package/runner/RunnerPicker.d.ts.map +1 -0
- package/runner/RunnerPicker.js +133 -0
- package/runner/RunnerPicker.js.map +1 -0
- package/runner/__tests__/useDeleteRunner.test.d.ts +2 -0
- package/runner/__tests__/useDeleteRunner.test.d.ts.map +1 -0
- package/runner/__tests__/useDeleteRunner.test.js +108 -0
- package/runner/__tests__/useDeleteRunner.test.js.map +1 -0
- package/runner/__tests__/useLaunchLocalRunner.test.d.ts +2 -0
- package/runner/__tests__/useLaunchLocalRunner.test.d.ts.map +1 -0
- package/runner/__tests__/useLaunchLocalRunner.test.js +143 -0
- package/runner/__tests__/useLaunchLocalRunner.test.js.map +1 -0
- package/runner/__tests__/useStopRunner.test.d.ts +2 -0
- package/runner/__tests__/useStopRunner.test.d.ts.map +1 -0
- package/runner/__tests__/useStopRunner.test.js +114 -0
- package/runner/__tests__/useStopRunner.test.js.map +1 -0
- package/runner/index.d.ts +14 -0
- package/runner/index.d.ts.map +1 -0
- package/runner/index.js +8 -0
- package/runner/index.js.map +1 -0
- package/runner/phase.d.ts +30 -0
- package/runner/phase.d.ts.map +1 -0
- package/runner/phase.js +58 -0
- package/runner/phase.js.map +1 -0
- package/runner/useDeleteRunner.d.ts +36 -0
- package/runner/useDeleteRunner.d.ts.map +1 -0
- package/runner/useDeleteRunner.js +42 -0
- package/runner/useDeleteRunner.js.map +1 -0
- package/runner/useLaunchLocalRunner.d.ts +84 -0
- package/runner/useLaunchLocalRunner.d.ts.map +1 -0
- package/runner/useLaunchLocalRunner.js +75 -0
- package/runner/useLaunchLocalRunner.js.map +1 -0
- package/runner/useRunnerList.d.ts +49 -0
- package/runner/useRunnerList.d.ts.map +1 -0
- package/runner/useRunnerList.js +70 -0
- package/runner/useRunnerList.js.map +1 -0
- package/runner/useStopRunner.d.ts +53 -0
- package/runner/useStopRunner.d.ts.map +1 -0
- package/runner/useStopRunner.js +50 -0
- package/runner/useStopRunner.js.map +1 -0
- package/session/draft.d.ts +53 -0
- package/session/draft.d.ts.map +1 -0
- package/session/draft.js +45 -0
- package/session/draft.js.map +1 -0
- package/session/index.d.ts +10 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +5 -0
- package/session/index.js.map +1 -1
- package/session/useCreateSession.d.ts +8 -0
- package/session/useCreateSession.d.ts.map +1 -1
- package/session/useCreateSession.js +1 -0
- package/session/useCreateSession.js.map +1 -1
- package/session/useEditSessionPrep.d.ts +26 -0
- package/session/useEditSessionPrep.d.ts.map +1 -0
- package/session/useEditSessionPrep.js +83 -0
- package/session/useEditSessionPrep.js.map +1 -0
- package/session/useNewSessionFlow.d.ts +110 -0
- package/session/useNewSessionFlow.d.ts.map +1 -0
- package/session/useNewSessionFlow.js +184 -0
- package/session/useNewSessionFlow.js.map +1 -0
- package/session/usePersistedModel.d.ts +18 -0
- package/session/usePersistedModel.d.ts.map +1 -0
- package/session/usePersistedModel.js +31 -0
- package/session/usePersistedModel.js.map +1 -0
- package/session/useSessionPageFlow.d.ts +104 -0
- package/session/useSessionPageFlow.d.ts.map +1 -0
- package/session/useSessionPageFlow.js +172 -0
- package/session/useSessionPageFlow.js.map +1 -0
- package/skill/SkillDetailView.js +3 -3
- package/skill/SkillDetailView.js.map +1 -1
- package/skill/SkillPicker.js +3 -3
- package/skill/SkillPicker.js.map +1 -1
- package/src/agent/AgentDetailView.tsx +8 -8
- package/src/agent/AgentPicker.tsx +3 -3
- package/src/api-key/ApiKeyCreatedAlert.tsx +2 -2
- package/src/api-key/ApiKeyListPanel.tsx +6 -6
- package/src/api-key/CreateApiKeyForm.tsx +2 -2
- package/src/attachment/AttachmentChipList.tsx +3 -3
- package/src/color-mode.ts +75 -0
- package/src/composer/ComposerToolbar.tsx +29 -7
- package/src/composer/ConfigureMenu.tsx +6 -6
- package/src/composer/ContextChip.tsx +1 -1
- package/src/composer/ContextPopover.tsx +2 -2
- package/src/composer/SessionComposer.tsx +34 -5
- package/src/environment/CreateEnvironmentForm.tsx +3 -3
- package/src/environment/EnvVarForm.tsx +6 -6
- package/src/environment/EnvironmentListPanel.tsx +3 -3
- package/src/environment/EnvironmentVariableEditor.tsx +7 -7
- package/src/error/ErrorMessage.tsx +5 -5
- package/src/execution/ApprovalCard.tsx +5 -5
- package/src/execution/ArtifactCard.tsx +2 -2
- package/src/execution/ArtifactPreviewModal.tsx +4 -4
- package/src/execution/FollowUpInput.tsx +2 -2
- package/src/execution/McpToolDetail.tsx +4 -4
- package/src/execution/MessageEntry.tsx +1 -1
- package/src/execution/MessageThread.tsx +1 -1
- package/src/execution/SessionVariablesInput.tsx +7 -7
- package/src/execution/SubAgentSection.tsx +5 -5
- package/src/execution/ToolCallDetail.tsx +2 -2
- package/src/execution/ToolCallGroup.tsx +3 -3
- package/src/execution/ToolCallItem.tsx +4 -4
- package/src/execution/WriteBackCard.tsx +5 -5
- package/src/execution/tool-rendering-primitives.tsx +5 -5
- package/src/github/GitHubRepoPicker.tsx +5 -5
- package/src/iam-policy/GrantAccessForm.tsx +2 -2
- package/src/iam-policy/OrgMembersPanel.tsx +11 -11
- package/src/identity-provider/CreateIdentityProviderForm.tsx +4 -4
- package/src/identity-provider/IdentityProviderDetailPanel.tsx +7 -7
- package/src/identity-provider/IdentityProviderListPanel.tsx +7 -7
- package/src/identity-provider/IdentityProviderWizard.tsx +8 -8
- package/src/identity-provider/ProviderPicker.tsx +2 -2
- package/src/index.ts +46 -7
- package/src/internal/CloudFeatureNotice.tsx +1 -1
- package/src/internal/Tabs.tsx +1 -1
- package/src/internal/markdown-components.tsx +2 -2
- package/src/invitation/InvitationCreatedAlert.tsx +2 -2
- package/src/invitation/InvitationManager.tsx +9 -9
- package/src/invitation/InvitationRedemption.tsx +11 -11
- package/src/library/ResourceCountCard.tsx +1 -1
- package/src/library/ResourceListView.tsx +7 -7
- package/src/mcp-server/McpServerConfigPanel.tsx +7 -7
- package/src/mcp-server/McpServerConnectDialog.tsx +5 -5
- package/src/mcp-server/McpServerDetailView.tsx +19 -19
- package/src/mcp-server/McpServerPicker.tsx +6 -6
- package/src/mcp-server/McpToolSelector.tsx +4 -4
- package/src/mcp-server/OAuthAppForm.tsx +3 -3
- package/src/models/ModelSelector.tsx +1 -1
- package/src/oauth-app/CreateOAuthAppForm.tsx +3 -3
- package/src/oauth-app/OAuthAppDetailPanel.tsx +7 -7
- package/src/oauth-app/OAuthAppListPanel.tsx +3 -3
- package/src/organization/CreateOrganizationForm.tsx +3 -3
- package/src/organization/OrgProfilePanel.tsx +4 -5
- package/src/platform-client/CreatePlatformClientForm.tsx +6 -6
- package/src/platform-client/PlatformClientDetailPanel.tsx +19 -19
- package/src/platform-client/PlatformClientListPanel.tsx +7 -7
- package/src/platform-client/PlatformClientSecretAlert.tsx +2 -2
- package/src/provider.tsx +52 -2
- package/src/runner/RunnerListPanel.tsx +725 -0
- package/src/runner/RunnerPicker.tsx +319 -0
- package/src/runner/__tests__/useDeleteRunner.test.tsx +150 -0
- package/src/runner/__tests__/useLaunchLocalRunner.test.tsx +223 -0
- package/src/runner/__tests__/useStopRunner.test.tsx +154 -0
- package/src/runner/index.ts +34 -0
- package/src/runner/phase.ts +62 -0
- package/src/runner/useDeleteRunner.ts +67 -0
- package/src/runner/useLaunchLocalRunner.ts +139 -0
- package/src/runner/useRunnerList.ts +114 -0
- package/src/runner/useStopRunner.ts +92 -0
- package/src/session/draft.ts +82 -0
- package/src/session/index.ts +28 -0
- package/src/session/useCreateSession.ts +9 -0
- package/src/session/useEditSessionPrep.ts +111 -0
- package/src/session/useNewSessionFlow.ts +283 -0
- package/src/session/usePersistedModel.ts +41 -0
- package/src/session/useSessionPageFlow.ts +280 -0
- package/src/skill/SkillDetailView.tsx +5 -5
- package/src/skill/SkillPicker.tsx +3 -3
- package/src/styles.css +25 -1
- package/src/usage/OrgUsagePanel.tsx +4 -4
- package/src/workspace/WorkspaceEditor.tsx +78 -66
- package/src/workspace/index.ts +0 -8
- package/styles.css +1 -1
- package/usage/OrgUsagePanel.js +2 -2
- package/usage/OrgUsagePanel.js.map +1 -1
- package/workspace/WorkspaceEditor.d.ts +28 -3
- package/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/workspace/WorkspaceEditor.js +24 -25
- package/workspace/WorkspaceEditor.js.map +1 -1
- package/workspace/index.d.ts +0 -4
- package/workspace/index.d.ts.map +1 -1
- package/workspace/index.js +0 -2
- package/workspace/index.js.map +1 -1
- package/src/workspace/FolderBrowser.tsx +0 -579
- package/src/workspace/useFolderListing.ts +0 -164
- package/workspace/FolderBrowser.d.ts +0 -37
- package/workspace/FolderBrowser.d.ts.map +0 -1
- package/workspace/FolderBrowser.js +0 -188
- package/workspace/FolderBrowser.js.map +0 -1
- package/workspace/useFolderListing.d.ts +0 -73
- package/workspace/useFolderListing.d.ts.map +0 -1
- package/workspace/useFolderListing.js +0 -110
- package/workspace/useFolderListing.js.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
5
|
+
import { CreateLaunchTokenRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/io_pb";
|
|
6
|
+
import { useStigmer } from "../hooks";
|
|
7
|
+
import { toError } from "../internal/toError";
|
|
8
|
+
const LAUNCH_RUNNER_SCHEME = "stigmer://launch-runner";
|
|
9
|
+
function defaultOpenUrl(url) {
|
|
10
|
+
window.location.href = url;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Behavior hook that initiates a browser-to-desktop runner launch.
|
|
14
|
+
*
|
|
15
|
+
* Orchestrates two steps:
|
|
16
|
+
* 1. Calls `stigmer.runner.createLaunchToken({ org })` to mint a
|
|
17
|
+
* one-time, 60-second token backed by the caller's credentials.
|
|
18
|
+
* 2. Opens `stigmer://launch-runner?token={token}` so the OS dispatches
|
|
19
|
+
* to the Stigmer Desktop app (which exchanges the token for a JWT
|
|
20
|
+
* and starts a local runner via its CLI sidecar).
|
|
21
|
+
*
|
|
22
|
+
* The hook reports success when the URL is opened. It does **not**
|
|
23
|
+
* detect whether the desktop app is installed or whether the runner
|
|
24
|
+
* actually started — those are observable via `useRunnerList`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* function LaunchButton({ org }: { org: string }) {
|
|
29
|
+
* const { launch, isLaunching, error } = useLaunchLocalRunner();
|
|
30
|
+
*
|
|
31
|
+
* return (
|
|
32
|
+
* <button onClick={() => launch({ org })} disabled={isLaunching}>
|
|
33
|
+
* {isLaunching ? "Launching…" : "Launch Local Runner"}
|
|
34
|
+
* </button>
|
|
35
|
+
* );
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* // Custom URL handler for non-browser environments
|
|
42
|
+
* const { launch } = useLaunchLocalRunner({
|
|
43
|
+
* openUrl: (url) => nativeBridge.openExternal(url),
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function useLaunchLocalRunner(options) {
|
|
48
|
+
const stigmer = useStigmer();
|
|
49
|
+
const [isLaunching, setIsLaunching] = useState(false);
|
|
50
|
+
const [error, setError] = useState(null);
|
|
51
|
+
const openUrl = options?.openUrl ?? defaultOpenUrl;
|
|
52
|
+
const clearError = useCallback(() => setError(null), []);
|
|
53
|
+
const launch = useCallback(async (input) => {
|
|
54
|
+
setIsLaunching(true);
|
|
55
|
+
setError(null);
|
|
56
|
+
try {
|
|
57
|
+
const response = await stigmer.runner.createLaunchToken(create(CreateLaunchTokenRequestSchema, { org: input.org }));
|
|
58
|
+
const url = `${LAUNCH_RUNNER_SCHEME}?token=${encodeURIComponent(response.token)}`;
|
|
59
|
+
const expiresAt = response.expiresAt
|
|
60
|
+
? timestampDate(response.expiresAt)
|
|
61
|
+
: undefined;
|
|
62
|
+
openUrl(url);
|
|
63
|
+
return { url, expiresAt };
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
setError(toError(err));
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
setIsLaunching(false);
|
|
71
|
+
}
|
|
72
|
+
}, [stigmer, openUrl]);
|
|
73
|
+
return { launch, isLaunching, error, clearError };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=useLaunchLocalRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLaunchLocalRunner.js","sourceRoot":"","sources":["../../src/runner/useLaunchLocalRunner.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,C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C,CAAC;YAEb,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,CAAC,CACnB,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Runner } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/api_pb";
|
|
2
|
+
/** Options for {@link useRunnerList}. */
|
|
3
|
+
export interface UseRunnerListOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Include system-managed (ephemeral cloud) runners in the result.
|
|
6
|
+
*
|
|
7
|
+
* System-managed runners are labeled `stigmer.ai/system-managed: "true"`
|
|
8
|
+
* and are created by the platform for cloud executions. They are hidden
|
|
9
|
+
* from the session composer by default but useful in admin views.
|
|
10
|
+
*
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
readonly includeSystemManaged?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Return value of {@link useRunnerList}. */
|
|
16
|
+
export interface UseRunnerListReturn {
|
|
17
|
+
/** User-created runners for the organization, empty while loading or on error. */
|
|
18
|
+
readonly runners: readonly Runner[];
|
|
19
|
+
/** `true` while the fetch is in flight. */
|
|
20
|
+
readonly isLoading: boolean;
|
|
21
|
+
/** Error from the last failed fetch, or `null` when healthy. */
|
|
22
|
+
readonly error: Error | null;
|
|
23
|
+
/** Discard cached data and re-fetch the runner list from the server. */
|
|
24
|
+
readonly refetch: () => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Data hook that fetches runners for an organization.
|
|
28
|
+
*
|
|
29
|
+
* Calls `stigmer.runner.list({ org })` and returns the result with
|
|
30
|
+
* loading/error state. System-managed (ephemeral cloud) runners are
|
|
31
|
+
* filtered out by default — pass `includeSystemManaged: true` to
|
|
32
|
+
* include them (useful for admin panels like Settings > Runners).
|
|
33
|
+
*
|
|
34
|
+
* Returns an empty array when `org` is `null` (no organization selected).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Session composer — user-created runners only
|
|
39
|
+
* const { runners, isLoading } = useRunnerList("acme");
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Admin page — all runners including system-managed
|
|
45
|
+
* const { runners } = useRunnerList("acme", { includeSystemManaged: true });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function useRunnerList(org: string | null, options?: UseRunnerListOptions): UseRunnerListReturn;
|
|
49
|
+
//# sourceMappingURL=useRunnerList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunnerList.d.ts","sourceRoot":"","sources":["../../src/runner/useRunnerList.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAOlF,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,mBAAmB,CAmDrB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { ListRunnersRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/io_pb";
|
|
5
|
+
import { useStigmer } from "../hooks";
|
|
6
|
+
import { toError } from "../internal/toError";
|
|
7
|
+
const SYSTEM_MANAGED_LABEL = "stigmer.ai/system-managed";
|
|
8
|
+
/**
|
|
9
|
+
* Data hook that fetches runners for an organization.
|
|
10
|
+
*
|
|
11
|
+
* Calls `stigmer.runner.list({ org })` and returns the result with
|
|
12
|
+
* loading/error state. System-managed (ephemeral cloud) runners are
|
|
13
|
+
* filtered out by default — pass `includeSystemManaged: true` to
|
|
14
|
+
* include them (useful for admin panels like Settings > Runners).
|
|
15
|
+
*
|
|
16
|
+
* Returns an empty array when `org` is `null` (no organization selected).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Session composer — user-created runners only
|
|
21
|
+
* const { runners, isLoading } = useRunnerList("acme");
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Admin page — all runners including system-managed
|
|
27
|
+
* const { runners } = useRunnerList("acme", { includeSystemManaged: true });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function useRunnerList(org, options) {
|
|
31
|
+
const stigmer = useStigmer();
|
|
32
|
+
const [runners, setRunners] = useState([]);
|
|
33
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
34
|
+
const [error, setError] = useState(null);
|
|
35
|
+
const [fetchKey, setFetchKey] = useState(0);
|
|
36
|
+
const includeSystemManaged = options?.includeSystemManaged ?? false;
|
|
37
|
+
const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!org) {
|
|
40
|
+
setRunners([]);
|
|
41
|
+
setIsLoading(false);
|
|
42
|
+
setError(null);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const cancelled = { current: false };
|
|
46
|
+
setIsLoading(true);
|
|
47
|
+
setError(null);
|
|
48
|
+
stigmer.runner
|
|
49
|
+
.list(create(ListRunnersRequestSchema, { org }))
|
|
50
|
+
.then((result) => {
|
|
51
|
+
if (cancelled.current)
|
|
52
|
+
return;
|
|
53
|
+
const items = includeSystemManaged
|
|
54
|
+
? result.items
|
|
55
|
+
: result.items.filter((r) => r.metadata?.labels[SYSTEM_MANAGED_LABEL] !== "true");
|
|
56
|
+
setRunners(items);
|
|
57
|
+
setIsLoading(false);
|
|
58
|
+
}, (err) => {
|
|
59
|
+
if (cancelled.current)
|
|
60
|
+
return;
|
|
61
|
+
setError(toError(err));
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
cancelled.current = true;
|
|
66
|
+
};
|
|
67
|
+
}, [stigmer, org, includeSystemManaged, fetchKey]);
|
|
68
|
+
return { runners, isLoading, error, refetch };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=useRunnerList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunnerList.js","sourceRoot":"","sources":["../../src/runner/useRunnerList.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,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EAAE;YACT,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAE9B,MAAM,KAAK,GAAG,oBAAoB;gBAChC,CAAC,CAAC,MAAM,CAAC,KAAK;gBACd,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,oBAAoB,CAAC,KAAK,MAAM,CAC3D,CAAC;YAEN,UAAU,CAAC,KAAK,CAAC,CAAC;YAClB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACN,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;QAEJ,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEnD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Runner } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/api_pb";
|
|
2
|
+
/** Input for {@link UseStopRunnerReturn.stop}. */
|
|
3
|
+
export interface StopRunnerInput {
|
|
4
|
+
/** ID of the runner to stop. */
|
|
5
|
+
readonly runnerId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional reason for the stop, logged on the runner and in audit.
|
|
8
|
+
*
|
|
9
|
+
* @example "user requested via web console"
|
|
10
|
+
*/
|
|
11
|
+
readonly reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Return value of {@link useStopRunner}. */
|
|
14
|
+
export interface UseStopRunnerReturn {
|
|
15
|
+
/**
|
|
16
|
+
* Stop a runner gracefully.
|
|
17
|
+
*
|
|
18
|
+
* If the runner is connected, sends a stop command via the bidi stream
|
|
19
|
+
* and waits for acknowledgment. If offline, directly transitions to
|
|
20
|
+
* STOPPED. Idempotent — stopping an already-stopped or failed runner
|
|
21
|
+
* returns the resource as-is.
|
|
22
|
+
*
|
|
23
|
+
* Resolves with the updated {@link Runner} resource.
|
|
24
|
+
*/
|
|
25
|
+
readonly stop: (input: StopRunnerInput) => Promise<Runner>;
|
|
26
|
+
/** `true` while the stop RPC is in flight. */
|
|
27
|
+
readonly isStopping: boolean;
|
|
28
|
+
/** Error from the last failed stop attempt, or `null` when healthy. */
|
|
29
|
+
readonly error: Error | null;
|
|
30
|
+
/** Reset `error` to `null`. */
|
|
31
|
+
readonly clearError: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Mutation hook that wraps `runner.stop()` with loading and error state.
|
|
35
|
+
*
|
|
36
|
+
* Stops a runner gracefully. Connected runners receive a stop command
|
|
37
|
+
* via the bidi stream; offline runners transition directly to STOPPED.
|
|
38
|
+
* The operation is idempotent — stopping an already-stopped or failed
|
|
39
|
+
* runner succeeds without error.
|
|
40
|
+
*
|
|
41
|
+
* Returns the updated {@link Runner} resource on success so callers
|
|
42
|
+
* can reflect the new phase in the UI without a separate refetch.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* const { stop, isStopping, error } = useStopRunner();
|
|
47
|
+
*
|
|
48
|
+
* await stop({ runnerId: "rnr_abc123", reason: "user requested" });
|
|
49
|
+
* refetch(); // refresh the runner list
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function useStopRunner(): UseStopRunnerReturn;
|
|
53
|
+
//# sourceMappingURL=useStopRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStopRunner.d.ts","sourceRoot":"","sources":["../../src/runner/useStopRunner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAKlF,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CA8BnD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { RunnerStopInputSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/io_pb";
|
|
5
|
+
import { useStigmer } from "../hooks";
|
|
6
|
+
import { toError } from "../internal/toError";
|
|
7
|
+
/**
|
|
8
|
+
* Mutation hook that wraps `runner.stop()` with loading and error state.
|
|
9
|
+
*
|
|
10
|
+
* Stops a runner gracefully. Connected runners receive a stop command
|
|
11
|
+
* via the bidi stream; offline runners transition directly to STOPPED.
|
|
12
|
+
* The operation is idempotent — stopping an already-stopped or failed
|
|
13
|
+
* runner succeeds without error.
|
|
14
|
+
*
|
|
15
|
+
* Returns the updated {@link Runner} resource on success so callers
|
|
16
|
+
* can reflect the new phase in the UI without a separate refetch.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { stop, isStopping, error } = useStopRunner();
|
|
21
|
+
*
|
|
22
|
+
* await stop({ runnerId: "rnr_abc123", reason: "user requested" });
|
|
23
|
+
* refetch(); // refresh the runner list
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function useStopRunner() {
|
|
27
|
+
const stigmer = useStigmer();
|
|
28
|
+
const [isStopping, setIsStopping] = useState(false);
|
|
29
|
+
const [error, setError] = useState(null);
|
|
30
|
+
const clearError = useCallback(() => setError(null), []);
|
|
31
|
+
const stop = useCallback(async (input) => {
|
|
32
|
+
setIsStopping(true);
|
|
33
|
+
setError(null);
|
|
34
|
+
try {
|
|
35
|
+
return await stigmer.runner.stop(create(RunnerStopInputSchema, {
|
|
36
|
+
runnerId: input.runnerId,
|
|
37
|
+
reason: input.reason ?? "",
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
setError(toError(err));
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
setIsStopping(false);
|
|
46
|
+
}
|
|
47
|
+
}, [stigmer]);
|
|
48
|
+
return { stop, isStopping, error, clearError };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useStopRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStopRunner.js","sourceRoot":"","sources":["../../src/runner/useStopRunner.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAmC9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG,WAAW,CACtB,KAAK,EAAE,KAAsB,EAAmB,EAAE;QAChD,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAC9B,MAAM,CAAC,qBAAqB,EAAE;gBAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;aAC3B,CAAC,CACH,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ResourceRef } from "@stigmer/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Resource types that can be created or edited via a draft session.
|
|
4
|
+
*
|
|
5
|
+
* Each type maps to a Stigmer system agent that guides the user
|
|
6
|
+
* through the creation/editing flow in a conversational session.
|
|
7
|
+
*/
|
|
8
|
+
export type DraftResourceType = "agent" | "skill" | "mcp-server";
|
|
9
|
+
/**
|
|
10
|
+
* Parsed draft session parameters.
|
|
11
|
+
*
|
|
12
|
+
* When `editRef` is present, the session is an edit session (modify an
|
|
13
|
+
* existing resource). When absent, it's a create session (new resource).
|
|
14
|
+
*/
|
|
15
|
+
export interface DraftParams {
|
|
16
|
+
/** The kind of resource this draft session will create or edit. */
|
|
17
|
+
readonly draftType: DraftResourceType;
|
|
18
|
+
/**
|
|
19
|
+
* When present, identifies the existing resource to edit.
|
|
20
|
+
* Absent for create-mode sessions.
|
|
21
|
+
*/
|
|
22
|
+
readonly editRef?: {
|
|
23
|
+
/** Organization that owns the resource. */
|
|
24
|
+
readonly org: string;
|
|
25
|
+
/** URL-friendly identifier of the resource. */
|
|
26
|
+
readonly slug: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* System agents responsible for creating each resource type.
|
|
31
|
+
*
|
|
32
|
+
* Keys match {@link DraftResourceType}; values are {@link ResourceRef}
|
|
33
|
+
* objects pointing to Stigmer's built-in creator agents.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CREATOR_AGENTS: Record<DraftResourceType, ResourceRef>;
|
|
36
|
+
/**
|
|
37
|
+
* Validate a string as a recognized {@link DraftResourceType}.
|
|
38
|
+
*
|
|
39
|
+
* Returns the validated type or `null` if unrecognized.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseDraftType(value: string | null): DraftResourceType | null;
|
|
42
|
+
/**
|
|
43
|
+
* Parse draft session parameters from standard `URLSearchParams`.
|
|
44
|
+
*
|
|
45
|
+
* Returns `null` when no valid `draft` param is present. When `editOrg`
|
|
46
|
+
* and `editSlug` are both present, the returned object includes an
|
|
47
|
+
* `editRef` indicating this is an edit session rather than a create session.
|
|
48
|
+
*
|
|
49
|
+
* Works identically with Next.js `useSearchParams()` or react-router's
|
|
50
|
+
* `useSearchParams()` — both return standard `URLSearchParams`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseDraftParams(searchParams: URLSearchParams): DraftParams | null;
|
|
53
|
+
//# sourceMappingURL=draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/session/draft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,2CAA2C;QAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,+CAA+C;QAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,WAAW,CAIjE,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAK7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,eAAe,GAC5B,WAAW,GAAG,IAAI,CAYpB"}
|
package/session/draft.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System agents responsible for creating each resource type.
|
|
3
|
+
*
|
|
4
|
+
* Keys match {@link DraftResourceType}; values are {@link ResourceRef}
|
|
5
|
+
* objects pointing to Stigmer's built-in creator agents.
|
|
6
|
+
*/
|
|
7
|
+
export const CREATOR_AGENTS = {
|
|
8
|
+
agent: { org: "stigmer", slug: "agent-creator" },
|
|
9
|
+
skill: { org: "stigmer", slug: "skill-creator" },
|
|
10
|
+
"mcp-server": { org: "stigmer", slug: "mcp-server-creator" },
|
|
11
|
+
};
|
|
12
|
+
const VALID_TYPES = new Set(Object.keys(CREATOR_AGENTS));
|
|
13
|
+
/**
|
|
14
|
+
* Validate a string as a recognized {@link DraftResourceType}.
|
|
15
|
+
*
|
|
16
|
+
* Returns the validated type or `null` if unrecognized.
|
|
17
|
+
*/
|
|
18
|
+
export function parseDraftType(value) {
|
|
19
|
+
if (value !== null && VALID_TYPES.has(value)) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse draft session parameters from standard `URLSearchParams`.
|
|
26
|
+
*
|
|
27
|
+
* Returns `null` when no valid `draft` param is present. When `editOrg`
|
|
28
|
+
* and `editSlug` are both present, the returned object includes an
|
|
29
|
+
* `editRef` indicating this is an edit session rather than a create session.
|
|
30
|
+
*
|
|
31
|
+
* Works identically with Next.js `useSearchParams()` or react-router's
|
|
32
|
+
* `useSearchParams()` — both return standard `URLSearchParams`.
|
|
33
|
+
*/
|
|
34
|
+
export function parseDraftParams(searchParams) {
|
|
35
|
+
const draftType = parseDraftType(searchParams.get("draft"));
|
|
36
|
+
if (!draftType)
|
|
37
|
+
return null;
|
|
38
|
+
const editOrg = searchParams.get("editOrg");
|
|
39
|
+
const editSlug = searchParams.get("editSlug");
|
|
40
|
+
if (editOrg && editSlug) {
|
|
41
|
+
return { draftType, editRef: { org: editOrg, slug: editSlug } };
|
|
42
|
+
}
|
|
43
|
+
return { draftType };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../src/session/draft.ts"],"names":[],"mappings":"AA+BA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAA2C;IACpE,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE;IAChD,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE;IAChD,YAAY,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE;CAC7D,CAAC;AAEF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7C,OAAO,KAA0B,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,YAA6B;IAE7B,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE9C,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;QACxB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC;IAClE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC"}
|
package/session/index.d.ts
CHANGED
|
@@ -18,6 +18,16 @@ export { useSessionUsage } from "./useSessionUsage";
|
|
|
18
18
|
export type { ModelCostEntry, UseSessionUsageReturn, } from "./useSessionUsage";
|
|
19
19
|
export { useAgentRefFromSession } from "./useAgentRefFromSession";
|
|
20
20
|
export type { UseAgentRefFromSessionReturn } from "./useAgentRefFromSession";
|
|
21
|
+
export { useNewSessionFlow } from "./useNewSessionFlow";
|
|
22
|
+
export type { UseNewSessionFlowOptions, UseNewSessionFlowReturn, } from "./useNewSessionFlow";
|
|
23
|
+
export { useSessionPageFlow } from "./useSessionPageFlow";
|
|
24
|
+
export type { UseSessionPageFlowOptions, UseSessionPageFlowReturn, } from "./useSessionPageFlow";
|
|
25
|
+
export { usePersistedModel } from "./usePersistedModel";
|
|
26
|
+
export type { UsePersistedModelReturn } from "./usePersistedModel";
|
|
27
|
+
export { useEditSessionPrep } from "./useEditSessionPrep";
|
|
28
|
+
export type { UseEditSessionPrepReturn } from "./useEditSessionPrep";
|
|
29
|
+
export { CREATOR_AGENTS, parseDraftType, parseDraftParams, } from "./draft";
|
|
30
|
+
export type { DraftResourceType, DraftParams, } from "./draft";
|
|
21
31
|
export { groupSessionsByTime } from "./group-sessions";
|
|
22
32
|
export type { SessionGroup } from "./group-sessions";
|
|
23
33
|
export { PENDING_SUBJECT, resolvedSubject } from "@stigmer/sdk";
|
package/session/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,qBAAq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,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/session/index.js
CHANGED
|
@@ -8,6 +8,11 @@ export { useSessionArtifacts } from "./useSessionArtifacts";
|
|
|
8
8
|
export { useSessionWriteBacks } from "./useSessionWriteBacks";
|
|
9
9
|
export { useSessionUsage } from "./useSessionUsage";
|
|
10
10
|
export { useAgentRefFromSession } from "./useAgentRefFromSession";
|
|
11
|
+
export { useNewSessionFlow } from "./useNewSessionFlow";
|
|
12
|
+
export { useSessionPageFlow } from "./useSessionPageFlow";
|
|
13
|
+
export { usePersistedModel } from "./usePersistedModel";
|
|
14
|
+
export { useEditSessionPrep } from "./useEditSessionPrep";
|
|
15
|
+
export { CREATOR_AGENTS, parseDraftType, parseDraftParams, } from "./draft";
|
|
11
16
|
export { groupSessionsByTime } from "./group-sessions";
|
|
12
17
|
// Session utilities (re-exported from @stigmer/sdk)
|
|
13
18
|
export { PENDING_SUBJECT, resolvedSubject } from "@stigmer/sdk";
|
package/session/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGt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kB,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,oDAAoD;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -11,6 +11,14 @@ export interface SharedSessionFields {
|
|
|
11
11
|
readonly mcpServerUsages?: McpServerUsageInput[];
|
|
12
12
|
/** Skill references to enable for executions in this session. */
|
|
13
13
|
readonly skillRefs?: ResourceRef[];
|
|
14
|
+
/**
|
|
15
|
+
* Runner to bind this session to.
|
|
16
|
+
*
|
|
17
|
+
* When set, all executions in the session are routed to this runner's
|
|
18
|
+
* task queue. When omitted, the backend auto-selects a runner (session
|
|
19
|
+
* auto-bind in OSS, cloud auto-provisioning in Cloud).
|
|
20
|
+
*/
|
|
21
|
+
readonly runnerId?: string;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* Input for creating a session. Exactly one agent resolution strategy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateSession.d.ts","sourceRoot":"","sources":["../../src/session/useCreateSession.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAItB,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClD,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IA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C;CAC5B;AAED,gDAAgD;AAChD,MAAM,WAAW,sBAAsB;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7E,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA2DzD"}
|
|
@@ -70,6 +70,7 @@ export function useCreateSession() {
|
|
|
70
70
|
workspaceEntries: input.workspaceEntries,
|
|
71
71
|
mcpServerUsages: input.mcpServerUsages,
|
|
72
72
|
skillRefs: input.skillRefs,
|
|
73
|
+
runnerId: input.runnerId,
|
|
73
74
|
agentInstanceId: resolvedInstanceId,
|
|
74
75
|
});
|
|
75
76
|
return { sessionId: session.metadata.id };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateSession.js","sourceRoot":"","sources":["../../src/session/useCreateSession.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,eAAe,GAIhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCreateSession.js","sourceRoot":"","sources":["../../src/session/useCreateSession.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,eAAe,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C;YACjC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,gEAAgE;oBAC9D,6DAA6D,CAChE,CAAC;YACJ,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC3C,IAAI,EAAE,WAAW,IAAI,CAAC,GAAG,EAAE,EAAE;gBAC7B,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,eAAe;gBACzC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,eAAe,EAAE,kBAAkB;aACpC,CAAC,CAAC;YAEH,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,QAAS,CAAC,EAAE,EAAE,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DraftResourceType } from "./draft";
|
|
2
|
+
/** Return value of {@link useEditSessionPrep}. */
|
|
3
|
+
export interface UseEditSessionPrepReturn {
|
|
4
|
+
/** Files ready to be passed as `initialAttachments` to SessionComposer. */
|
|
5
|
+
readonly files: File[] | undefined;
|
|
6
|
+
/** Non-null when resource fetch or serialization failed. */
|
|
7
|
+
readonly error: string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Prepares initial attachment files for an edit-mode draft session.
|
|
11
|
+
*
|
|
12
|
+
* Given a resource type and an org/slug reference, this hook fetches the
|
|
13
|
+
* existing resource and serializes it into a `File` object suitable for
|
|
14
|
+
* the `initialAttachments` prop of `SessionComposer`:
|
|
15
|
+
*
|
|
16
|
+
* - **agent** / **mcp-server**: serialized to YAML
|
|
17
|
+
* - **skill**: downloaded as a ZIP package
|
|
18
|
+
*
|
|
19
|
+
* Pass `null` for `draftType` or `editRef` to skip preparation (used
|
|
20
|
+
* when the session is in create-mode rather than edit-mode).
|
|
21
|
+
*/
|
|
22
|
+
export declare function useEditSessionPrep(draftType: DraftResourceType | null, editRef: {
|
|
23
|
+
readonly org: string;
|
|
24
|
+
readonly slug: string;
|
|
25
|
+
} | null): UseEditSessionPrepReturn;
|
|
26
|
+
//# sourceMappingURL=useEditSessionPrep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditSessionPrep.d.ts","sourceRoot":"","sources":["../../src/session/useEditSessionPrep.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,OAAO,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAC9D,wBAAwB,CA0E1B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { GetArtifactRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/io_pb";
|
|
5
|
+
import { useStigmer } from "../hooks";
|
|
6
|
+
import { useAgent } from "../agent";
|
|
7
|
+
import { useMcpServer } from "../mcp-server";
|
|
8
|
+
import { useSkill } from "../skill";
|
|
9
|
+
import { serializeAgentYaml, serializeMcpServerYaml } from "../library";
|
|
10
|
+
/**
|
|
11
|
+
* Prepares initial attachment files for an edit-mode draft session.
|
|
12
|
+
*
|
|
13
|
+
* Given a resource type and an org/slug reference, this hook fetches the
|
|
14
|
+
* existing resource and serializes it into a `File` object suitable for
|
|
15
|
+
* the `initialAttachments` prop of `SessionComposer`:
|
|
16
|
+
*
|
|
17
|
+
* - **agent** / **mcp-server**: serialized to YAML
|
|
18
|
+
* - **skill**: downloaded as a ZIP package
|
|
19
|
+
*
|
|
20
|
+
* Pass `null` for `draftType` or `editRef` to skip preparation (used
|
|
21
|
+
* when the session is in create-mode rather than edit-mode).
|
|
22
|
+
*/
|
|
23
|
+
export function useEditSessionPrep(draftType, editRef) {
|
|
24
|
+
const stigmer = useStigmer();
|
|
25
|
+
const editOrg = editRef?.org ?? null;
|
|
26
|
+
const editSlug = editRef?.slug ?? null;
|
|
27
|
+
const { agent: editAgent } = useAgent(draftType === "agent" ? editOrg : null, draftType === "agent" ? editSlug : null);
|
|
28
|
+
const { mcpServer: editMcpServer } = useMcpServer(draftType === "mcp-server" ? editOrg : null, draftType === "mcp-server" ? editSlug : null);
|
|
29
|
+
const { skill: editSkill } = useSkill(draftType === "skill" ? editOrg : null, draftType === "skill" ? editSlug : null);
|
|
30
|
+
const [files, setFiles] = useState(undefined);
|
|
31
|
+
const [error, setError] = useState(null);
|
|
32
|
+
const built = useRef(false);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (built.current)
|
|
35
|
+
return;
|
|
36
|
+
if (draftType === "agent" && editAgent) {
|
|
37
|
+
built.current = true;
|
|
38
|
+
try {
|
|
39
|
+
const yaml = serializeAgentYaml(editAgent);
|
|
40
|
+
const slug = editAgent.metadata?.slug ?? "agent";
|
|
41
|
+
setFiles([new File([yaml], `${slug}.yaml`, { type: "text/yaml" })]);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
setError("Failed to serialize agent for editing");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (draftType === "mcp-server" && editMcpServer) {
|
|
48
|
+
built.current = true;
|
|
49
|
+
try {
|
|
50
|
+
const yaml = serializeMcpServerYaml(editMcpServer);
|
|
51
|
+
const slug = editMcpServer.metadata?.slug ?? "mcp-server";
|
|
52
|
+
setFiles([new File([yaml], `${slug}.yaml`, { type: "text/yaml" })]);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
setError("Failed to serialize MCP server for editing");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [draftType, editAgent, editMcpServer]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (built.current)
|
|
61
|
+
return;
|
|
62
|
+
if (draftType !== "skill" || !editSkill)
|
|
63
|
+
return;
|
|
64
|
+
const storageKey = editSkill.status?.artifactStorageKey;
|
|
65
|
+
if (!storageKey)
|
|
66
|
+
return;
|
|
67
|
+
built.current = true;
|
|
68
|
+
const slug = editSkill.metadata?.slug ?? "skill";
|
|
69
|
+
stigmer.skill
|
|
70
|
+
.getArtifact(create(GetArtifactRequestSchema, { artifactStorageKey: storageKey }))
|
|
71
|
+
.then((resp) => {
|
|
72
|
+
const buf = new ArrayBuffer(resp.artifact.byteLength);
|
|
73
|
+
new Uint8Array(buf).set(resp.artifact);
|
|
74
|
+
const blob = new Blob([buf], { type: "application/zip" });
|
|
75
|
+
setFiles([new File([blob], `${slug}.zip`, { type: "application/zip" })]);
|
|
76
|
+
})
|
|
77
|
+
.catch(() => {
|
|
78
|
+
setError("Failed to download skill package for editing");
|
|
79
|
+
});
|
|
80
|
+
}, [draftType, editSkill, stigmer]);
|
|
81
|
+
return { files, error };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=useEditSessionPrep.js.map
|