@stigmer/react-core 0.0.0-stage → 0.1.1
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/LICENSE +194 -0
- package/README.md +59 -2
- package/agent/useAgentSearch.d.ts +27 -0
- package/agent/useAgentSearch.d.ts.map +1 -0
- package/agent/useAgentSearch.js +27 -0
- package/agent/useAgentSearch.js.map +1 -0
- package/composer/interaction-mode.d.ts +28 -0
- package/composer/interaction-mode.d.ts.map +1 -0
- package/composer/interaction-mode.js +37 -0
- package/composer/interaction-mode.js.map +1 -0
- package/context.d.ts +12 -0
- package/context.d.ts.map +1 -0
- package/context.js +13 -0
- package/context.js.map +1 -0
- package/deployment-mode.d.ts +46 -0
- package/deployment-mode.d.ts.map +1 -0
- package/deployment-mode.js +52 -0
- package/deployment-mode.js.map +1 -0
- package/execution-target-context.d.ts +24 -0
- package/execution-target-context.d.ts.map +1 -0
- package/execution-target-context.js +27 -0
- package/execution-target-context.js.map +1 -0
- package/grant/useWhoAmI.d.ts +41 -0
- package/grant/useWhoAmI.d.ts.map +1 -0
- package/grant/useWhoAmI.js +64 -0
- package/grant/useWhoAmI.js.map +1 -0
- package/hooks.d.ts +23 -0
- package/hooks.d.ts.map +1 -0
- package/hooks.js +32 -0
- package/hooks.js.map +1 -0
- package/index.d.ts +72 -0
- package/index.d.ts.map +1 -0
- package/index.js +50 -0
- package/index.js.map +1 -0
- package/internal/FetchCacheProvider.d.ts +52 -0
- package/internal/FetchCacheProvider.d.ts.map +1 -0
- package/internal/FetchCacheProvider.js +69 -0
- package/internal/FetchCacheProvider.js.map +1 -0
- package/internal/backoff.d.ts +72 -0
- package/internal/backoff.d.ts.map +1 -0
- package/internal/backoff.js +90 -0
- package/internal/backoff.js.map +1 -0
- package/internal/dev/enabled.d.ts +7 -0
- package/internal/dev/enabled.d.ts.map +1 -0
- package/internal/dev/enabled.js +38 -0
- package/internal/dev/enabled.js.map +1 -0
- package/internal/dev/use-stream-rate.d.ts +24 -0
- package/internal/dev/use-stream-rate.d.ts.map +1 -0
- package/internal/dev/use-stream-rate.js +95 -0
- package/internal/dev/use-stream-rate.js.map +1 -0
- package/internal/everyPage.d.ts +22 -0
- package/internal/everyPage.d.ts.map +1 -0
- package/internal/everyPage.js +28 -0
- package/internal/everyPage.js.map +1 -0
- package/internal/fetch-cache.d.ts +85 -0
- package/internal/fetch-cache.d.ts.map +1 -0
- package/internal/fetch-cache.js +143 -0
- package/internal/fetch-cache.js.map +1 -0
- package/internal/maskedEdit.d.ts +39 -0
- package/internal/maskedEdit.d.ts.map +1 -0
- package/internal/maskedEdit.js +65 -0
- package/internal/maskedEdit.js.map +1 -0
- package/internal/page-return.d.ts +13 -0
- package/internal/page-return.d.ts.map +1 -0
- package/internal/page-return.js +26 -0
- package/internal/page-return.js.map +1 -0
- package/internal/store/conversation-store.d.ts +91 -0
- package/internal/store/conversation-store.d.ts.map +1 -0
- package/internal/store/conversation-store.js +150 -0
- package/internal/store/conversation-store.js.map +1 -0
- package/internal/stream-controller.d.ts +108 -0
- package/internal/stream-controller.d.ts.map +1 -0
- package/internal/stream-controller.js +204 -0
- package/internal/stream-controller.js.map +1 -0
- package/internal/toError.d.ts +16 -0
- package/internal/toError.d.ts.map +1 -0
- package/internal/toError.js +22 -0
- package/internal/toError.js.map +1 -0
- package/internal/useCursorPages.d.ts +70 -0
- package/internal/useCursorPages.d.ts.map +1 -0
- package/internal/useCursorPages.js +173 -0
- package/internal/useCursorPages.js.map +1 -0
- package/internal/useFetch.d.ts +76 -0
- package/internal/useFetch.d.ts.map +1 -0
- package/internal/useFetch.js +171 -0
- package/internal/useFetch.js.map +1 -0
- package/internal/useKeyedSubmission.d.ts +49 -0
- package/internal/useKeyedSubmission.d.ts.map +1 -0
- package/internal/useKeyedSubmission.js +67 -0
- package/internal/useKeyedSubmission.js.map +1 -0
- package/internal.d.ts +31 -0
- package/internal.d.ts.map +1 -0
- package/internal.js +41 -0
- package/internal.js.map +1 -0
- package/models/harness.d.ts +54 -0
- package/models/harness.d.ts.map +1 -0
- package/models/harness.js +71 -0
- package/models/harness.js.map +1 -0
- package/models/registry.d.ts +276 -0
- package/models/registry.d.ts.map +1 -0
- package/models/registry.js +274 -0
- package/models/registry.js.map +1 -0
- package/models/service-tier.d.ts +27 -0
- package/models/service-tier.d.ts.map +1 -0
- package/models/service-tier.js +34 -0
- package/models/service-tier.js.map +1 -0
- package/models/thinking-mode.d.ts +44 -0
- package/models/thinking-mode.d.ts.map +1 -0
- package/models/thinking-mode.js +52 -0
- package/models/thinking-mode.js.map +1 -0
- package/package.json +45 -4
- package/resource-workbench/workbench-page.d.ts +24 -0
- package/resource-workbench/workbench-page.d.ts.map +1 -0
- package/resource-workbench/workbench-page.js +6 -0
- package/resource-workbench/workbench-page.js.map +1 -0
- package/run/FileReviewContext.d.ts +55 -0
- package/run/FileReviewContext.d.ts.map +1 -0
- package/run/FileReviewContext.js +49 -0
- package/run/FileReviewContext.js.map +1 -0
- package/run/file-review-status.d.ts +94 -0
- package/run/file-review-status.d.ts.map +1 -0
- package/run/file-review-status.js +106 -0
- package/run/file-review-status.js.map +1 -0
- package/run/message-file-view.d.ts +16 -0
- package/run/message-file-view.d.ts.map +1 -0
- package/run/message-file-view.js +5 -0
- package/run/message-file-view.js.map +1 -0
- package/run/run-phases.d.ts +10 -0
- package/run/run-phases.d.ts.map +1 -0
- package/run/run-phases.js +26 -0
- package/run/run-phases.js.map +1 -0
- package/run/thread-message.d.ts +19 -0
- package/run/thread-message.d.ts.map +1 -0
- package/run/thread-message.js +6 -0
- package/run/thread-message.js.map +1 -0
- package/run/tool-categories.d.ts +222 -0
- package/run/tool-categories.d.ts.map +1 -0
- package/run/tool-categories.js +436 -0
- package/run/tool-categories.js.map +1 -0
- package/run/useAnswerToolUse.d.ts +65 -0
- package/run/useAnswerToolUse.d.ts.map +1 -0
- package/run/useAnswerToolUse.js +69 -0
- package/run/useAnswerToolUse.js.map +1 -0
- package/run/useArtifactContent.d.ts +71 -0
- package/run/useArtifactContent.d.ts.map +1 -0
- package/run/useArtifactContent.js +73 -0
- package/run/useArtifactContent.js.map +1 -0
- package/run/useArtifactDownloadUrl.d.ts +69 -0
- package/run/useArtifactDownloadUrl.d.ts.map +1 -0
- package/run/useArtifactDownloadUrl.js +61 -0
- package/run/useArtifactDownloadUrl.js.map +1 -0
- package/run/useCreateRun.d.ts +338 -0
- package/run/useCreateRun.d.ts.map +1 -0
- package/run/useCreateRun.js +180 -0
- package/run/useCreateRun.js.map +1 -0
- package/run/useFileChangeContent.d.ts +56 -0
- package/run/useFileChangeContent.d.ts.map +1 -0
- package/run/useFileChangeContent.js +81 -0
- package/run/useFileChangeContent.js.map +1 -0
- package/run/useReviewFileChanges.d.ts +79 -0
- package/run/useReviewFileChanges.d.ts.map +1 -0
- package/run/useReviewFileChanges.js +103 -0
- package/run/useReviewFileChanges.js.map +1 -0
- package/run/useRunActions.d.ts +53 -0
- package/run/useRunActions.d.ts.map +1 -0
- package/run/useRunActions.js +82 -0
- package/run/useRunActions.js.map +1 -0
- package/run/useStopBackgroundCommand.d.ts +43 -0
- package/run/useStopBackgroundCommand.d.ts.map +1 -0
- package/run/useStopBackgroundCommand.js +58 -0
- package/run/useStopBackgroundCommand.js.map +1 -0
- package/runner-adapter.d.ts +49 -0
- package/runner-adapter.d.ts.map +1 -0
- package/runner-adapter.js +20 -0
- package/runner-adapter.js.map +1 -0
- package/search/index.d.ts +9 -0
- package/search/index.d.ts.map +1 -0
- package/search/index.js +5 -0
- package/search/index.js.map +1 -0
- package/search/librarySource.d.ts +21 -0
- package/search/librarySource.d.ts.map +1 -0
- package/search/librarySource.js +99 -0
- package/search/librarySource.js.map +1 -0
- package/search/useResourceCount.d.ts +38 -0
- package/search/useResourceCount.d.ts.map +1 -0
- package/search/useResourceCount.js +36 -0
- package/search/useResourceCount.js.map +1 -0
- package/search/useResourceList.d.ts +41 -0
- package/search/useResourceList.d.ts.map +1 -0
- package/search/useResourceList.js +42 -0
- package/search/useResourceList.js.map +1 -0
- package/search/useResourceSearch.d.ts +40 -0
- package/search/useResourceSearch.d.ts.map +1 -0
- package/search/useResourceSearch.js +42 -0
- package/search/useResourceSearch.js.map +1 -0
- package/session/execution-target.d.ts +20 -0
- package/session/execution-target.d.ts.map +1 -0
- package/session/execution-target.js +26 -0
- package/session/execution-target.js.map +1 -0
- package/session/useLocalSessionWorker.d.ts +49 -0
- package/session/useLocalSessionWorker.d.ts.map +1 -0
- package/session/useLocalSessionWorker.js +101 -0
- package/session/useLocalSessionWorker.js.map +1 -0
- package/session/useSession.d.ts +54 -0
- package/session/useSession.d.ts.map +1 -0
- package/session/useSession.js +47 -0
- package/session/useSession.js.map +1 -0
- package/session/useSessionConversation.d.ts +441 -0
- package/session/useSessionConversation.d.ts.map +1 -0
- package/session/useSessionConversation.js +583 -0
- package/session/useSessionConversation.js.map +1 -0
- package/session/useSessionEvents.d.ts +129 -0
- package/session/useSessionEvents.d.ts.map +1 -0
- package/session/useSessionEvents.js +236 -0
- package/session/useSessionEvents.js.map +1 -0
- package/session/useSessionList.d.ts +61 -0
- package/session/useSessionList.d.ts.map +1 -0
- package/session/useSessionList.js +64 -0
- package/session/useSessionList.js.map +1 -0
- package/session/useSessionRuns.d.ts +63 -0
- package/session/useSessionRuns.d.ts.map +1 -0
- package/session/useSessionRuns.js +55 -0
- package/session/useSessionRuns.js.map +1 -0
- package/session/useSessionUsage.d.ts +93 -0
- package/session/useSessionUsage.d.ts.map +1 -0
- package/session/useSessionUsage.js +128 -0
- package/session/useSessionUsage.js.map +1 -0
- package/session/useUpdateSession.d.ts +48 -0
- package/session/useUpdateSession.d.ts.map +1 -0
- package/session/useUpdateSession.js +55 -0
- package/session/useUpdateSession.js.map +1 -0
- package/src/agent/useAgentSearch.ts +40 -0
- package/src/composer/interaction-mode.ts +51 -0
- package/src/context.ts +15 -0
- package/src/deployment-mode.ts +57 -0
- package/src/execution-target-context.ts +32 -0
- package/src/grant/useWhoAmI.ts +94 -0
- package/src/hooks.ts +36 -0
- package/src/index.ts +143 -0
- package/src/internal/FetchCacheProvider.tsx +82 -0
- package/src/internal/backoff.ts +112 -0
- package/src/internal/dev/enabled.ts +39 -0
- package/src/internal/dev/use-stream-rate.ts +138 -0
- package/src/internal/everyPage.ts +32 -0
- package/src/internal/fetch-cache.ts +180 -0
- package/src/internal/maskedEdit.ts +88 -0
- package/src/internal/page-return.ts +24 -0
- package/src/internal/store/conversation-store.ts +200 -0
- package/src/internal/stream-controller.ts +263 -0
- package/src/internal/toError.ts +19 -0
- package/src/internal/useCursorPages.ts +228 -0
- package/src/internal/useFetch.ts +246 -0
- package/src/internal/useKeyedSubmission.ts +101 -0
- package/src/internal.ts +63 -0
- package/src/models/harness.ts +98 -0
- package/src/models/registry.ts +530 -0
- package/src/models/service-tier.ts +49 -0
- package/src/models/thinking-mode.ts +72 -0
- package/src/resource-workbench/workbench-page.ts +33 -0
- package/src/run/FileReviewContext.ts +95 -0
- package/src/run/file-review-status.ts +183 -0
- package/src/run/message-file-view.ts +19 -0
- package/src/run/run-phases.ts +29 -0
- package/src/run/thread-message.ts +25 -0
- package/src/run/tool-categories.ts +638 -0
- package/src/run/useAnswerToolUse.ts +136 -0
- package/src/run/useArtifactContent.ts +136 -0
- package/src/run/useArtifactDownloadUrl.ts +118 -0
- package/src/run/useCreateRun.ts +490 -0
- package/src/run/useFileChangeContent.ts +139 -0
- package/src/run/useReviewFileChanges.ts +184 -0
- package/src/run/useRunActions.ts +150 -0
- package/src/run/useStopBackgroundCommand.ts +89 -0
- package/src/runner-adapter.ts +56 -0
- package/src/search/index.ts +20 -0
- package/src/search/librarySource.ts +131 -0
- package/src/search/useResourceCount.ts +73 -0
- package/src/search/useResourceList.ts +79 -0
- package/src/search/useResourceSearch.ts +84 -0
- package/src/session/execution-target.ts +39 -0
- package/src/session/useLocalSessionWorker.ts +107 -0
- package/src/session/useSession.ts +70 -0
- package/src/session/useSessionConversation.ts +1178 -0
- package/src/session/useSessionEvents.ts +365 -0
- package/src/session/useSessionList.ts +122 -0
- package/src/session/useSessionRuns.ts +104 -0
- package/src/session/useSessionUsage.ts +257 -0
- package/src/session/useUpdateSession.ts +86 -0
- package/src/test/index.ts +7 -0
- package/src/test/samples.ts +859 -0
- package/src/version-history/computeDiff.ts +30 -0
- package/src/version-history/diff-hunks.ts +63 -0
- package/src/version-history/diff-types.ts +21 -0
- package/test/index.d.ts +2 -0
- package/test/index.d.ts.map +1 -0
- package/test/index.js +7 -0
- package/test/index.js.map +1 -0
- package/test/samples.d.ts +364 -0
- package/test/samples.d.ts.map +1 -0
- package/test/samples.js +589 -0
- package/test/samples.js.map +1 -0
- package/version-history/computeDiff.d.ts +18 -0
- package/version-history/computeDiff.d.ts.map +1 -0
- package/version-history/computeDiff.js +24 -0
- package/version-history/computeDiff.js.map +1 -0
- package/version-history/diff-hunks.d.ts +21 -0
- package/version-history/diff-hunks.d.ts.map +1 -0
- package/version-history/diff-hunks.js +58 -0
- package/version-history/diff-hunks.js.map +1 -0
- package/version-history/diff-types.d.ts +16 -0
- package/version-history/diff-types.d.ts.map +1 -0
- package/version-history/diff-types.js +5 -0
- package/version-history/diff-types.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Stigmer Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
191
|
+
|
|
192
|
+
Except for the contents of the ee/ directory, which are licensed under the
|
|
193
|
+
Stigmer Enterprise License (see ee/LICENSE), everything in this repository
|
|
194
|
+
is licensed under the Apache License, Version 2.0, above.
|
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @stigmer/react-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React hooks for [Stigmer](https://stigmer.ai), the open-source backend for the agents in your product. This is the conversation layer of Stigmer's React kits: the client context, the fetch cache, and the hooks that start a run, follow a session, answer an approval and review a file change, with nothing that draws. A chat that does not render HTML (a terminal, a native app) builds on this package alone; [`@stigmer/react-sdk`](../react/README.md) builds its components over it, and [`@stigmer/ink-ui`](../ink/) its terminal views.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @stigmer/react-core @stigmer/client @stigmer/apis @bufbuild/protobuf react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Its peers are `react` 19, `@stigmer/client`, `@stigmer/apis` and `@bufbuild/protobuf`. It installs no rendering package: no `react-dom`, no component library, no icons.
|
|
12
|
+
|
|
13
|
+
If you already use `@stigmer/react-sdk`, you have this package: the React kit re-exports every name here from its root and `./headless`, so import from whichever you install.
|
|
14
|
+
|
|
15
|
+
## Use
|
|
16
|
+
|
|
17
|
+
Give the hooks a client through `StigmerContext` (the React kit's `StigmerProvider` and the terminal kit's `InkStigmerProvider` do it for you), then call them:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Stigmer } from "@stigmer/client";
|
|
21
|
+
import { StigmerContext, useSessionConversation } from "@stigmer/react-core";
|
|
22
|
+
|
|
23
|
+
const client = new Stigmer({ baseUrl: "http://localhost:7234" });
|
|
24
|
+
|
|
25
|
+
function Conversation({ sessionId, org }: { sessionId: string; org: string }) {
|
|
26
|
+
const conversation = useSessionConversation(sessionId, org);
|
|
27
|
+
return <pre>{conversation.turns.at(-1)?.answer ?? "Waiting for the agent"}</pre>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function App() {
|
|
31
|
+
return (
|
|
32
|
+
<StigmerContext.Provider value={client}>
|
|
33
|
+
<Conversation sessionId="ses_01j..." org="acme" />
|
|
34
|
+
</StigmerContext.Provider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The hooks are documented in the [React SDK reference](https://stigmer.ai/docs/sdk/react), which lists them where the React kit re-exports them.
|
|
40
|
+
|
|
41
|
+
## Entries
|
|
42
|
+
|
|
43
|
+
| Entry | What it holds |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `@stigmer/react-core` | The public hooks, contexts and helpers. Every name here is a public API. |
|
|
46
|
+
| `@stigmer/react-core/test` | Sample data for tests, galleries and screenshots (`samples`, `sampleInstant`), built through the same schemas the server answers with, at a fixed instant. |
|
|
47
|
+
| `@stigmer/react-core/internal` | The React kit's own plumbing (the data-fetch hook and cache, the error mapper, the paging walks). For `@stigmer/react-sdk` only. |
|
|
48
|
+
|
|
49
|
+
`@stigmer/react-core/internal` carries no compatibility promise: a name may change or leave in any release. It exists so the React kit's hooks and components share one fetch cache and one error mapping with the conversation hooks. It is safe for the kit because every `@stigmer/*` package ships in lockstep and pins the others at the exact same version. Nothing else imports it, and a repository test (`scripts/react-core-internal.test.mjs`) fails if anything does. It stays one entry with one consumer: a second internal entry, or a second package reading this one, is a design change to make in the open, not a convenience.
|
|
50
|
+
|
|
51
|
+
## Develop
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm run typecheck -w @stigmer/react-core
|
|
55
|
+
npm run test -w @stigmer/react-core
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`src/__tests__/boundary.test.ts` holds the package's line: its sources import only their own files and the packages above.
|
|
59
|
+
|
|
60
|
+
The package's TypeDoc run (`npm run tsdoc:check`) checks what it exports but not where its comments link: they link to the React kit's components that use each hook, which only the React kit's run can resolve, and that run checks them, since it documents every name here.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type UseResourceSearchOptions, type UseResourceSearchReturn } from "../search/index.js";
|
|
2
|
+
/** Options for {@link useAgentSearch}. Delegates to the shared resource search options. */
|
|
3
|
+
export type UseAgentSearchOptions = UseResourceSearchOptions;
|
|
4
|
+
/** Return value of {@link useAgentSearch}. Delegates to the shared resource search return type. */
|
|
5
|
+
export type UseAgentSearchReturn = UseResourceSearchReturn;
|
|
6
|
+
/**
|
|
7
|
+
* Data hook that searches agents available to the user.
|
|
8
|
+
*
|
|
9
|
+
* Lists the organization's agents, newest first, while nothing is typed
|
|
10
|
+
* and searches them once something is, with a debounce, loading/error
|
|
11
|
+
* tracking, and cancellation-safe fetching. Platform builders use this
|
|
12
|
+
* when they want full control over rendering; the {@link AgentPicker}
|
|
13
|
+
* styled component uses it internally. Results are the given
|
|
14
|
+
* organization's agents the caller may read.
|
|
15
|
+
*
|
|
16
|
+
* This is a Layer 1 building-block hook used by both platform builders
|
|
17
|
+
* (Profile A) and direct Stigmer users (Profile B). Platform builders
|
|
18
|
+
* can use it standalone to build custom agent selection UIs. The
|
|
19
|
+
* Stigmer Console composes it via higher-level orchestration hooks.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { results, isLoading, query, setQuery } = useAgentSearch("acme");
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useAgentSearch(org: string, options?: UseAgentSearchOptions): UseAgentSearchReturn;
|
|
27
|
+
//# sourceMappingURL=useAgentSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentSearch.d.ts","sourceRoot":"","sources":["../src/agent/useAgentSearch.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAC7D,mGAAmG;AACnG,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAC9B,oBAAoB,CAEtB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ApiResourceKind } from "@stigmer/apis/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
3
|
+
import { useResourceSearch, } from "../search/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Data hook that searches agents available to the user.
|
|
6
|
+
*
|
|
7
|
+
* Lists the organization's agents, newest first, while nothing is typed
|
|
8
|
+
* and searches them once something is, with a debounce, loading/error
|
|
9
|
+
* tracking, and cancellation-safe fetching. Platform builders use this
|
|
10
|
+
* when they want full control over rendering; the {@link AgentPicker}
|
|
11
|
+
* styled component uses it internally. Results are the given
|
|
12
|
+
* organization's agents the caller may read.
|
|
13
|
+
*
|
|
14
|
+
* This is a Layer 1 building-block hook used by both platform builders
|
|
15
|
+
* (Profile A) and direct Stigmer users (Profile B). Platform builders
|
|
16
|
+
* can use it standalone to build custom agent selection UIs. The
|
|
17
|
+
* Stigmer Console composes it via higher-level orchestration hooks.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { results, isLoading, query, setQuery } = useAgentSearch("acme");
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function useAgentSearch(org, options) {
|
|
25
|
+
return useResourceSearch(ApiResourceKind.agent, org, options);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=useAgentSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentSearch.js","sourceRoot":"","sources":["../src/agent/useAgentSearch.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,mFAAmF,CAAC;AACpH,OAAO,EACL,iBAAiB,GAGlB,MAAM,oBAAoB,CAAC;AAO5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAW,EACX,OAA+B;IAE/B,OAAO,iBAAiB,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { InteractionMode } from "@stigmer/apis/ai/stigmer/agentic/run/v1/enum_pb";
|
|
2
|
+
/**
|
|
3
|
+
* Interaction mode options for runs.
|
|
4
|
+
*
|
|
5
|
+
* Maps to `InteractionMode` proto enum values (excluding UNSPECIFIED):
|
|
6
|
+
* - `"agent"` → `INTERACTION_MODE_AGENT` (full tool access)
|
|
7
|
+
* - `"plan"` → `INTERACTION_MODE_PLAN` (read-only analysis)
|
|
8
|
+
*/
|
|
9
|
+
export type InteractionModeOption = "agent" | "plan";
|
|
10
|
+
/**
|
|
11
|
+
* Convert an {@link InteractionModeOption} string to the proto
|
|
12
|
+
* {@link InteractionMode} enum.
|
|
13
|
+
*
|
|
14
|
+
* Mirrors {@link toProtoHarness} — keeps the option-string <-> proto mapping
|
|
15
|
+
* in one place so component props can stay framework-agnostic while run
|
|
16
|
+
* creation speaks proto.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toProtoInteractionMode(mode: InteractionModeOption): InteractionMode;
|
|
19
|
+
/**
|
|
20
|
+
* Convert a proto {@link InteractionMode} enum to an
|
|
21
|
+
* {@link InteractionModeOption} string.
|
|
22
|
+
*
|
|
23
|
+
* `UNSPECIFIED` (and any unknown value) maps to `undefined` so callers can
|
|
24
|
+
* decide their own default — the composer falls back to `"agent"`, matching
|
|
25
|
+
* the proto contract (`UNSPECIFIED` resolves to `INTERACTION_MODE_AGENT`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function fromProtoInteractionMode(mode: InteractionMode | undefined): InteractionModeOption | undefined;
|
|
28
|
+
//# sourceMappingURL=interaction-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-mode.d.ts","sourceRoot":"","sources":["../src/composer/interaction-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,qBAAqB,GAC1B,eAAe,CAQjB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,eAAe,GAAG,SAAS,GAChC,qBAAqB,GAAG,SAAS,CASnC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InteractionMode } from "@stigmer/apis/ai/stigmer/agentic/run/v1/enum_pb";
|
|
2
|
+
/**
|
|
3
|
+
* Convert an {@link InteractionModeOption} string to the proto
|
|
4
|
+
* {@link InteractionMode} enum.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors {@link toProtoHarness} — keeps the option-string <-> proto mapping
|
|
7
|
+
* in one place so component props can stay framework-agnostic while run
|
|
8
|
+
* creation speaks proto.
|
|
9
|
+
*/
|
|
10
|
+
export function toProtoInteractionMode(mode) {
|
|
11
|
+
switch (mode) {
|
|
12
|
+
case "plan":
|
|
13
|
+
return InteractionMode.PLAN;
|
|
14
|
+
case "agent":
|
|
15
|
+
default:
|
|
16
|
+
return InteractionMode.AGENT;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Convert a proto {@link InteractionMode} enum to an
|
|
21
|
+
* {@link InteractionModeOption} string.
|
|
22
|
+
*
|
|
23
|
+
* `UNSPECIFIED` (and any unknown value) maps to `undefined` so callers can
|
|
24
|
+
* decide their own default — the composer falls back to `"agent"`, matching
|
|
25
|
+
* the proto contract (`UNSPECIFIED` resolves to `INTERACTION_MODE_AGENT`).
|
|
26
|
+
*/
|
|
27
|
+
export function fromProtoInteractionMode(mode) {
|
|
28
|
+
switch (mode) {
|
|
29
|
+
case InteractionMode.AGENT:
|
|
30
|
+
return "agent";
|
|
31
|
+
case InteractionMode.PLAN:
|
|
32
|
+
return "plan";
|
|
33
|
+
default:
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=interaction-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-mode.js","sourceRoot":"","sources":["../src/composer/interaction-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAWlF;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAA2B;IAE3B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,eAAe,CAAC,IAAI,CAAC;QAC9B,KAAK,OAAO,CAAC;QACb;YACE,OAAO,eAAe,CAAC,KAAK,CAAC;IACjC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAiC;IAEjC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/context.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Stigmer } from "@stigmer/client";
|
|
2
|
+
/**
|
|
3
|
+
* React context for the Stigmer SDK client instance.
|
|
4
|
+
*
|
|
5
|
+
* Separated from the provider component to prevent circular imports:
|
|
6
|
+
* both the provider and consumer hooks import from this file.
|
|
7
|
+
*
|
|
8
|
+
* The context value is `null` when no provider is mounted. Consumer hooks
|
|
9
|
+
* throw in this case to surface wiring mistakes during development.
|
|
10
|
+
*/
|
|
11
|
+
export declare const StigmerContext: import("react").Context<Stigmer | null>;
|
|
12
|
+
//# sourceMappingURL=context.d.ts.map
|
package/context.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,yCAAsC,CAAC"}
|
package/context.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* React context for the Stigmer SDK client instance.
|
|
5
|
+
*
|
|
6
|
+
* Separated from the provider component to prevent circular imports:
|
|
7
|
+
* both the provider and consumer hooks import from this file.
|
|
8
|
+
*
|
|
9
|
+
* The context value is `null` when no provider is mounted. Consumer hooks
|
|
10
|
+
* throw in this case to surface wiring mistakes during development.
|
|
11
|
+
*/
|
|
12
|
+
export const StigmerContext = createContext(null);
|
|
13
|
+
//# sourceMappingURL=context.js.map
|
package/context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["src/context.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAiB,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DeploymentMode } from "@stigmer/client";
|
|
2
|
+
import { ApiResourceKind } from "@stigmer/client";
|
|
3
|
+
/**
|
|
4
|
+
* React context for the current deployment mode.
|
|
5
|
+
*
|
|
6
|
+
* Separated from the provider to mirror the `StigmerContext` / `context.ts`
|
|
7
|
+
* pattern and avoid circular imports.
|
|
8
|
+
*
|
|
9
|
+
* Defaults to `"cloud"` so existing consumers who don't pass
|
|
10
|
+
* `deploymentMode` to `StigmerProvider` see all features enabled.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DeploymentModeContext: import("react").Context<DeploymentMode>;
|
|
13
|
+
/**
|
|
14
|
+
* Read the deployment mode from the nearest `StigmerProvider`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `"local"` for Stigmer (the open-source edition), `"enterprise"`
|
|
17
|
+
* for Stigmer Enterprise and `"cloud"` for Stigmer Cloud. Ask it a TIER
|
|
18
|
+
* question through {@link useResourceAvailable}; a site that compares it to
|
|
19
|
+
* `"cloud"` directly is asking about a cloud-only facility (plans and
|
|
20
|
+
* invoices, Stigmer-managed compute, the shared platform messaging apps) and should
|
|
21
|
+
* say which one.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useDeploymentMode(): DeploymentMode;
|
|
24
|
+
/**
|
|
25
|
+
* Check whether a given {@link ApiResourceKind} is served by the connected
|
|
26
|
+
* edition.
|
|
27
|
+
*
|
|
28
|
+
* Combines the deployment mode from context with the proto-derived tier
|
|
29
|
+
* metadata via {@link isResourceAvailable}: a kind is served when the
|
|
30
|
+
* edition ranks at or above the kind's minimum edition (oss < enterprise <
|
|
31
|
+
* cloud).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { ApiResourceKind } from "@stigmer/client";
|
|
36
|
+
*
|
|
37
|
+
* function ApiKeysSection({ children }: { children: ReactNode }) {
|
|
38
|
+
* const available = useResourceAvailable(ApiResourceKind.api_key);
|
|
39
|
+
* if (!available) return <p>API keys are available on Stigmer Cloud.</p>;
|
|
40
|
+
* return <section>{children}</section>;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useResourceAvailable(kind: ApiResourceKind): boolean;
|
|
45
|
+
export { type DeploymentMode, ApiResourceKind };
|
|
46
|
+
//# sourceMappingURL=deployment-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-mode.d.ts","sourceRoot":"","sources":["src/deployment-mode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAuB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAGnE;AAED,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { isResourceAvailable, ApiResourceKind } from "@stigmer/client";
|
|
4
|
+
/**
|
|
5
|
+
* React context for the current deployment mode.
|
|
6
|
+
*
|
|
7
|
+
* Separated from the provider to mirror the `StigmerContext` / `context.ts`
|
|
8
|
+
* pattern and avoid circular imports.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to `"cloud"` so existing consumers who don't pass
|
|
11
|
+
* `deploymentMode` to `StigmerProvider` see all features enabled.
|
|
12
|
+
*/
|
|
13
|
+
export const DeploymentModeContext = createContext("cloud");
|
|
14
|
+
/**
|
|
15
|
+
* Read the deployment mode from the nearest `StigmerProvider`.
|
|
16
|
+
*
|
|
17
|
+
* Returns `"local"` for Stigmer (the open-source edition), `"enterprise"`
|
|
18
|
+
* for Stigmer Enterprise and `"cloud"` for Stigmer Cloud. Ask it a TIER
|
|
19
|
+
* question through {@link useResourceAvailable}; a site that compares it to
|
|
20
|
+
* `"cloud"` directly is asking about a cloud-only facility (plans and
|
|
21
|
+
* invoices, Stigmer-managed compute, the shared platform messaging apps) and should
|
|
22
|
+
* say which one.
|
|
23
|
+
*/
|
|
24
|
+
export function useDeploymentMode() {
|
|
25
|
+
return useContext(DeploymentModeContext);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check whether a given {@link ApiResourceKind} is served by the connected
|
|
29
|
+
* edition.
|
|
30
|
+
*
|
|
31
|
+
* Combines the deployment mode from context with the proto-derived tier
|
|
32
|
+
* metadata via {@link isResourceAvailable}: a kind is served when the
|
|
33
|
+
* edition ranks at or above the kind's minimum edition (oss < enterprise <
|
|
34
|
+
* cloud).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* import { ApiResourceKind } from "@stigmer/client";
|
|
39
|
+
*
|
|
40
|
+
* function ApiKeysSection({ children }: { children: ReactNode }) {
|
|
41
|
+
* const available = useResourceAvailable(ApiResourceKind.api_key);
|
|
42
|
+
* if (!available) return <p>API keys are available on Stigmer Cloud.</p>;
|
|
43
|
+
* return <section>{children}</section>;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function useResourceAvailable(kind) {
|
|
48
|
+
const mode = useDeploymentMode();
|
|
49
|
+
return isResourceAvailable(kind, mode);
|
|
50
|
+
}
|
|
51
|
+
export { ApiResourceKind };
|
|
52
|
+
//# sourceMappingURL=deployment-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-mode.js","sourceRoot":"","sources":["src/deployment-mode.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAiB,OAAO,CAAC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAqB;IACxD,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACjC,OAAO,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,OAAO,EAAuB,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExecutionTargetOption } from "./session/execution-target.js";
|
|
2
|
+
/**
|
|
3
|
+
* React context for the app-level execution target.
|
|
4
|
+
*
|
|
5
|
+
* Separated from the provider to mirror the `DeploymentModeContext`
|
|
6
|
+
* pattern and avoid circular imports.
|
|
7
|
+
*
|
|
8
|
+
* `undefined` means no explicit target was configured at the provider
|
|
9
|
+
* level -- the server decides based on deployment context.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ExecutionTargetContext: import("react").Context<ExecutionTargetOption | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Read the app-level execution target from the nearest
|
|
14
|
+
* `StigmerProvider`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `"local"`, `"cloud"`, or `undefined` when the provider
|
|
17
|
+
* does not specify one (server decides).
|
|
18
|
+
*
|
|
19
|
+
* Hooks like `useNewSessionFlow` and `useCreateSession` read this
|
|
20
|
+
* to apply a consistent execution target across all sessions without
|
|
21
|
+
* requiring per-call configuration.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useExecutionTarget(): ExecutionTargetOption | undefined;
|
|
24
|
+
//# sourceMappingURL=execution-target-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-target-context.d.ts","sourceRoot":"","sources":["src/execution-target-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,4DAEvB,CAAC;AAEb;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,qBAAqB,GAAG,SAAS,CAEtE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* React context for the app-level execution target.
|
|
5
|
+
*
|
|
6
|
+
* Separated from the provider to mirror the `DeploymentModeContext`
|
|
7
|
+
* pattern and avoid circular imports.
|
|
8
|
+
*
|
|
9
|
+
* `undefined` means no explicit target was configured at the provider
|
|
10
|
+
* level -- the server decides based on deployment context.
|
|
11
|
+
*/
|
|
12
|
+
export const ExecutionTargetContext = createContext(undefined);
|
|
13
|
+
/**
|
|
14
|
+
* Read the app-level execution target from the nearest
|
|
15
|
+
* `StigmerProvider`.
|
|
16
|
+
*
|
|
17
|
+
* Returns `"local"`, `"cloud"`, or `undefined` when the provider
|
|
18
|
+
* does not specify one (server decides).
|
|
19
|
+
*
|
|
20
|
+
* Hooks like `useNewSessionFlow` and `useCreateSession` read this
|
|
21
|
+
* to apply a consistent execution target across all sessions without
|
|
22
|
+
* requiring per-call configuration.
|
|
23
|
+
*/
|
|
24
|
+
export function useExecutionTarget() {
|
|
25
|
+
return useContext(ExecutionTargetContext);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=execution-target-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-target-context.js","sourceRoot":"","sources":["src/execution-target-context.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAEjD,SAAS,CAAC,CAAC;AAEb;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IdentityAccount } from "@stigmer/apis/ai/stigmer/iam/identityaccount/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useWhoAmI}. */
|
|
3
|
+
export interface UseWhoAmIReturn {
|
|
4
|
+
/** The authenticated user's identity account, or `null` while loading / on error. */
|
|
5
|
+
readonly account: IdentityAccount | null;
|
|
6
|
+
/** `true` while the initial fetch is in flight. */
|
|
7
|
+
readonly isLoading: boolean;
|
|
8
|
+
/** Error from the failed request, or `null` when healthy. */
|
|
9
|
+
readonly error: Error | null;
|
|
10
|
+
}
|
|
11
|
+
/** Options for {@link useWhoAmI}. */
|
|
12
|
+
export interface UseWhoAmIOptions {
|
|
13
|
+
/**
|
|
14
|
+
* `false` holds the hook idle: no request, `account` stays `null`. A
|
|
15
|
+
* surface that needs the caller only in some states (a guest token
|
|
16
|
+
* cannot make this read) keeps the hook mounted and switches it here.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
readonly enabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Data hook that fetches the current authenticated user's
|
|
24
|
+
* {@link IdentityAccount} via `identityAccount.whoAmI()`.
|
|
25
|
+
*
|
|
26
|
+
* The result is cached for the lifetime of the `Stigmer` client
|
|
27
|
+
* instance — subsequent mounts and re-renders reuse the cached
|
|
28
|
+
* value without additional network calls.
|
|
29
|
+
*
|
|
30
|
+
* Useful for self-protection in access management UIs (disabling
|
|
31
|
+
* "remove" or "change role" on the current user) and displaying
|
|
32
|
+
* a "You" indicator.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const { account } = useWhoAmI();
|
|
37
|
+
* const myId = account?.metadata?.id;
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useWhoAmI(options?: UseWhoAmIOptions): UseWhoAmIReturn;
|
|
41
|
+
//# sourceMappingURL=useWhoAmI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWhoAmI.d.ts","sourceRoot":"","sources":["../src/grant/useWhoAmI.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAI9F,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IACzC,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe,CA8CrE"}
|