@tangle-network/agent-app 0.45.49 → 0.45.50

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.
@@ -85,6 +85,11 @@ interface ToolResultEventData {
85
85
  * integrations page; "github_app" is the GitHub App installed on the repo (the
86
86
  * event source for a GitHub trigger), connected via the App install flow. */
87
87
  type ConnectionRequirementKind = "integration" | "github_app";
88
+ /** Names one requirement in the same list, by its (provider, kind) identity. */
89
+ interface ConnectionRequirementRef {
90
+ provider: string;
91
+ kind: ConnectionRequirementKind;
92
+ }
88
93
  /** A connection a proposed workflow references, and whether the user has it
89
94
  * connected right now. Surfaced on an authoring proposal so the card can show
90
95
  * what must be connected — and WHERE — before the workflow can be created. */
@@ -99,6 +104,17 @@ interface ConnectionRequirement {
99
104
  * there's no link to offer (e.g. a github_app requirement on a deploy with no
100
105
  * app slug); the card then shows the requirement without a connect link. */
101
106
  connectUrl?: string | null;
107
+ /**
108
+ * Another requirement in the SAME list that must be satisfied before this one
109
+ * can be, supplied by the server. A GitHub App installation is claimed
110
+ * through the user's own GitHub OAuth token, so the install is refused while
111
+ * that connection is missing — the card withholds a connect that could only
112
+ * end that way, and names the step that comes first instead.
113
+ *
114
+ * The server lists a prerequisite BEFORE the requirement naming it. Absent on
115
+ * proposals predating the field, and on a requirement nothing blocks.
116
+ */
117
+ prerequisite?: ConnectionRequirementRef | null;
102
118
  }
103
119
  /**
104
120
  * Outcome of a host-driven, in-place connect for a single proposal requirement
@@ -830,4 +846,4 @@ declare function AssistantLauncherProvider({ children, }: {
830
846
  }): react.JSX.Element;
831
847
  declare function useAssistantLauncher(): AssistantLauncher;
832
848
 
833
- export { type AssistantChat, type AssistantClient, type AssistantClientConfig, AssistantClientInputError, AssistantClientProvider, type AssistantDeliveryMode, AssistantDock, type AssistantDockProps, type AssistantLauncher, AssistantLauncherProvider, type AssistantModelOption, type AssistantModels, type AssistantModelsResult, AssistantPanel, type AssistantPanelProps, type AssistantSendOptions, type AssistantStreamEvent, type AssistantThreadSummary, type AssistantThreads, AssistantTranscript, type AssistantTranscriptProps, type AssistantTranscriptView, type ChatMessage, type ChatRequest, type ChatRole, type ConfirmResult, type ConfirmedResult, type ConnectRequirementResult, type ConnectionRequirement, type ConnectionRequirementKind, type DeltaEventData, type DoneEventData, type ErrorEventData, type PendingProposal, ProposalCard, type ProposalCardProps, type ReasoningEventData, type ThreadEventData, type ThreadHistoryResult, type ToolActivityStatus, type ToolCallEventData, type ToolOutcome, type ToolProposalEventData, type ToolResultEventData, type UsageEventData, type UsageInfo, type UseAssistantChatOptions, adaptTranscript, assistantIsThinking, createAssistantClient, useAssistantChat, useAssistantClient, useAssistantLauncher, useAssistantModels, useAssistantThreads };
849
+ export { type AssistantChat, type AssistantClient, type AssistantClientConfig, AssistantClientInputError, AssistantClientProvider, type AssistantDeliveryMode, AssistantDock, type AssistantDockProps, type AssistantLauncher, AssistantLauncherProvider, type AssistantModelOption, type AssistantModels, type AssistantModelsResult, AssistantPanel, type AssistantPanelProps, type AssistantSendOptions, type AssistantStreamEvent, type AssistantThreadSummary, type AssistantThreads, AssistantTranscript, type AssistantTranscriptProps, type AssistantTranscriptView, type ChatMessage, type ChatRequest, type ChatRole, type ConfirmResult, type ConfirmedResult, type ConnectRequirementResult, type ConnectionRequirement, type ConnectionRequirementKind, type ConnectionRequirementRef, type DeltaEventData, type DoneEventData, type ErrorEventData, type PendingProposal, ProposalCard, type ProposalCardProps, type ReasoningEventData, type ThreadEventData, type ThreadHistoryResult, type ToolActivityStatus, type ToolCallEventData, type ToolOutcome, type ToolProposalEventData, type ToolResultEventData, type UsageEventData, type UsageInfo, type UseAssistantChatOptions, adaptTranscript, assistantIsThinking, createAssistantClient, useAssistantChat, useAssistantClient, useAssistantLauncher, useAssistantModels, useAssistantThreads };
@@ -2,7 +2,7 @@ import {
2
2
  ChatComposer,
3
3
  ChatEmptyState,
4
4
  ChatMessages
5
- } from "../chunk-ZAKKG6WI.js";
5
+ } from "../chunk-7HY4LX7O.js";
6
6
  import "../chunk-FBVLEGEG.js";
7
7
  import "../chunk-ENLRJYVW.js";
8
8
  import "../chunk-GEYACSFW.js";
@@ -148,13 +148,22 @@ function parseRequirement(raw) {
148
148
  if (typeof r.connected !== "boolean") return null;
149
149
  const kind = r.kind === "integration" || r.kind === "github_app" ? r.kind : void 0;
150
150
  const connectUrl = typeof r.connectUrl === "string" || r.connectUrl === null ? r.connectUrl : void 0;
151
+ const prerequisite = parsePrerequisite(r.prerequisite);
151
152
  return {
152
153
  provider: r.provider,
153
154
  connected: r.connected,
154
155
  ...kind ? { kind } : {},
155
- ...connectUrl !== void 0 ? { connectUrl } : {}
156
+ ...connectUrl !== void 0 ? { connectUrl } : {},
157
+ ...prerequisite ? { prerequisite } : {}
156
158
  };
157
159
  }
160
+ function parsePrerequisite(v) {
161
+ if (!v || typeof v !== "object") return void 0;
162
+ const ref = v;
163
+ if (typeof ref.provider !== "string" || ref.provider === "") return void 0;
164
+ if (ref.kind !== "integration" && ref.kind !== "github_app") return void 0;
165
+ return { provider: ref.provider, kind: ref.kind };
166
+ }
158
167
  function parseRequirements(v) {
159
168
  if (!Array.isArray(v)) return void 0;
160
169
  const out = [];
@@ -1907,6 +1916,7 @@ function ProposalCard({
1907
1916
  const [tab, setTab] = useState4("graph");
1908
1917
  const isWorkflow = view.preview?.kind === "workflow";
1909
1918
  const showGraph = isWorkflow && !!renderGraph;
1919
+ const requirements = proposal.requirements ?? [];
1910
1920
  return /* @__PURE__ */ jsxs2("div", { className: "rounded-lg border border-primary/40 bg-card p-3 text-sm", children: [
1911
1921
  /* @__PURE__ */ jsx3("p", { className: "font-semibold text-[15px] text-foreground", children: view.title }),
1912
1922
  view.fields.length > 0 && /* @__PURE__ */ jsx3("dl", { className: "mt-2 space-y-1", children: view.fields.map((f) => /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[auto_1fr] gap-x-3 text-xs", children: [
@@ -1956,17 +1966,18 @@ function ProposalCard({
1956
1966
  /* @__PURE__ */ jsx3("pre", { className: "mt-1 max-h-[202px] overflow-auto rounded border border-border bg-secondary p-2 font-mono text-xs tabular-nums", children: /* @__PURE__ */ jsx3("code", { children: view.preview.content }) })
1957
1967
  )
1958
1968
  ] }),
1959
- proposal.requirements && proposal.requirements.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "mt-3 rounded border border-border p-2", children: [
1969
+ requirements.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "mt-3 rounded border border-border p-2", children: [
1960
1970
  /* @__PURE__ */ jsx3("p", { className: EYEBROW_CLASS, children: "Integrations" }),
1961
- /* @__PURE__ */ jsx3("ul", { className: "mt-1 space-y-1", children: proposal.requirements.map((r) => /* @__PURE__ */ jsx3(
1971
+ /* @__PURE__ */ jsx3("ul", { className: "mt-1 space-y-1", children: requirements.map((r) => /* @__PURE__ */ jsx3(
1962
1972
  RequirementRow,
1963
1973
  {
1964
1974
  req: r,
1975
+ blockedBy: blockingPrerequisite(r, requirements),
1965
1976
  navigate,
1966
1977
  onConnect,
1967
1978
  renderProviderIcon
1968
1979
  },
1969
- `${r.provider}-${r.kind ?? "integration"}`
1980
+ `${r.provider}-${requirementKind(r)}`
1970
1981
  )) }),
1971
1982
  /* @__PURE__ */ jsx3("p", { className: "mt-1 text-muted-foreground text-xs", children: "Connect the items above, then confirm." })
1972
1983
  ] }),
@@ -2012,8 +2023,24 @@ function openConnect(target, navigate) {
2012
2023
  window.location.assign(url.href);
2013
2024
  }
2014
2025
  }
2026
+ function requirementKind(req) {
2027
+ return req.kind ?? "integration";
2028
+ }
2029
+ function blockingPrerequisite(req, all) {
2030
+ const ref = req.prerequisite;
2031
+ if (!ref) return void 0;
2032
+ const match = all.find(
2033
+ (r) => r.provider === ref.provider && requirementKind(r) === ref.kind
2034
+ );
2035
+ return match && !match.connected ? match : void 0;
2036
+ }
2037
+ function blockedNote(prerequisite) {
2038
+ const label = providerLabel(prerequisite.provider);
2039
+ return requirementKind(prerequisite) === "github_app" ? `Install ${label} App first` : `Connect ${label} first`;
2040
+ }
2015
2041
  function RequirementRow({
2016
2042
  req,
2043
+ blockedBy,
2017
2044
  navigate,
2018
2045
  onConnect,
2019
2046
  renderProviderIcon
@@ -2027,10 +2054,10 @@ function RequirementRow({
2027
2054
  };
2028
2055
  }, []);
2029
2056
  const label = providerLabel(req.provider);
2030
- const isApp = req.kind === "github_app";
2057
+ const isApp = requirementKind(req) === "github_app";
2031
2058
  const kindLabel = isApp ? `${label} App` : label;
2032
2059
  const statusText = req.connected ? isApp ? "installed" : "connected" : isApp ? "not installed" : "not connected";
2033
- const canConnect = !req.connected && (Boolean(onConnect) || req.connectUrl !== null);
2060
+ const canConnect = !req.connected && !blockedBy && (Boolean(onConnect) || req.connectUrl !== null);
2034
2061
  const target = req.connectUrl ?? "/app/integrations";
2035
2062
  const handleConnect = () => {
2036
2063
  if (!onConnect) {
@@ -2084,6 +2111,10 @@ function RequirementRow({
2084
2111
  )
2085
2112
  ] })
2086
2113
  ] }),
2114
+ blockedBy && !req.connected && // Named rather than silent: a row with no affordance and no reason reads
2115
+ // as broken. The step it waits on is the row above (the server lists a
2116
+ // prerequisite first), so this points at something already on screen.
2117
+ /* @__PURE__ */ jsx3("span", { className: "shrink-0 text-muted-foreground text-xs", children: blockedNote(blockedBy) }),
2087
2118
  canConnect && /* @__PURE__ */ jsx3(
2088
2119
  "button",
2089
2120
  {