@xpufx/paseo-forges 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/client/active-forge.ts +47 -0
  4. package/client/board-alert.tsx +236 -0
  5. package/client/foreign-link.tsx +33 -0
  6. package/client/hook-queue-panel.tsx +412 -0
  7. package/client/issues-pill.tsx +1976 -0
  8. package/client/label-chip.tsx +116 -0
  9. package/client/linkifier.tsx +280 -0
  10. package/client/pill-label.ts +183 -0
  11. package/client/vendor/paseo-plugin-helper/command-center.ts +43 -0
  12. package/client/vendor/paseo-plugin-helper/components/AboutSection.tsx +493 -0
  13. package/client/vendor/paseo-plugin-helper/components/AttentionBeacon.tsx +250 -0
  14. package/client/vendor/paseo-plugin-helper/components/Badge.tsx +156 -0
  15. package/client/vendor/paseo-plugin-helper/components/Button.tsx +178 -0
  16. package/client/vendor/paseo-plugin-helper/components/Card.tsx +225 -0
  17. package/client/vendor/paseo-plugin-helper/components/CodeBlock.tsx +196 -0
  18. package/client/vendor/paseo-plugin-helper/components/Collapsible.tsx +277 -0
  19. package/client/vendor/paseo-plugin-helper/components/CommandBox.tsx +172 -0
  20. package/client/vendor/paseo-plugin-helper/components/CopyButton.tsx +180 -0
  21. package/client/vendor/paseo-plugin-helper/components/DataTable.tsx +200 -0
  22. package/client/vendor/paseo-plugin-helper/components/EmptyState.tsx +97 -0
  23. package/client/vendor/paseo-plugin-helper/components/HighlightedText.tsx +70 -0
  24. package/client/vendor/paseo-plugin-helper/components/InlineButton.tsx +73 -0
  25. package/client/vendor/paseo-plugin-helper/components/KeyValue.tsx +446 -0
  26. package/client/vendor/paseo-plugin-helper/components/MetricGauge.tsx +247 -0
  27. package/client/vendor/paseo-plugin-helper/components/ProgressBar.tsx +117 -0
  28. package/client/vendor/paseo-plugin-helper/components/Responsive.tsx +53 -0
  29. package/client/vendor/paseo-plugin-helper/components/SearchInput.tsx +118 -0
  30. package/client/vendor/paseo-plugin-helper/components/SectionHeader.tsx +80 -0
  31. package/client/vendor/paseo-plugin-helper/components/Select.tsx +215 -0
  32. package/client/vendor/paseo-plugin-helper/components/StatusDot.tsx +80 -0
  33. package/client/vendor/paseo-plugin-helper/components/Tabs.tsx +319 -0
  34. package/client/vendor/paseo-plugin-helper/components/TextInput.tsx +150 -0
  35. package/client/vendor/paseo-plugin-helper/components/Toggle.tsx +163 -0
  36. package/client/vendor/paseo-plugin-helper/components/TruncatedText.tsx +157 -0
  37. package/client/vendor/paseo-plugin-helper/components/index.ts +25 -0
  38. package/client/vendor/paseo-plugin-helper/custom-pills.tsx +224 -0
  39. package/client/vendor/paseo-plugin-helper/forge-icon.tsx +79 -0
  40. package/client/vendor/paseo-plugin-helper/host.ts +277 -0
  41. package/client/vendor/paseo-plugin-helper/icon.tsx +39 -0
  42. package/client/vendor/paseo-plugin-helper/index.ts +28 -0
  43. package/client/vendor/paseo-plugin-helper/layout/ActionBar.tsx +49 -0
  44. package/client/vendor/paseo-plugin-helper/layout/FormRow.tsx +103 -0
  45. package/client/vendor/paseo-plugin-helper/layout/Grid.tsx +65 -0
  46. package/client/vendor/paseo-plugin-helper/layout/ModalBody.tsx +378 -0
  47. package/client/vendor/paseo-plugin-helper/layout/ModalContent.tsx +49 -0
  48. package/client/vendor/paseo-plugin-helper/layout/Row.tsx +39 -0
  49. package/client/vendor/paseo-plugin-helper/layout/Stack.tsx +39 -0
  50. package/client/vendor/paseo-plugin-helper/layout/index.ts +7 -0
  51. package/client/vendor/paseo-plugin-helper/panel.tsx +81 -0
  52. package/client/vendor/paseo-plugin-helper/pill.tsx +884 -0
  53. package/client/vendor/paseo-plugin-helper/query-refresh.ts +79 -0
  54. package/client/vendor/paseo-plugin-helper/query.ts +66 -0
  55. package/client/vendor/paseo-plugin-helper/settings-screen.tsx +372 -0
  56. package/client/vendor/paseo-plugin-helper/settings.ts +181 -0
  57. package/client/vendor/paseo-plugin-helper/shared-settings.ts +46 -0
  58. package/client/vendor/paseo-plugin-helper/snapshot.ts +68 -0
  59. package/client/vendor/paseo-plugin-helper/surface.tsx +80 -0
  60. package/client/vendor/paseo-plugin-helper/theme/color-utils.ts +118 -0
  61. package/client/vendor/paseo-plugin-helper/theme/flair.ts +76 -0
  62. package/client/vendor/paseo-plugin-helper/theme/host-variables.ts +121 -0
  63. package/client/vendor/paseo-plugin-helper/theme/index.ts +7 -0
  64. package/client/vendor/paseo-plugin-helper/theme/provider.tsx +214 -0
  65. package/client/vendor/paseo-plugin-helper/theme/responsive.ts +213 -0
  66. package/client/vendor/paseo-plugin-helper/theme/tokens.ts +161 -0
  67. package/client/vendor/paseo-plugin-helper/theme/useResponsive.ts +57 -0
  68. package/client/vendor/paseo-plugin-helper/utils/clipboard.ts +149 -0
  69. package/client/vendor/paseo-plugin-helper/utils/haptics.ts +34 -0
  70. package/client/webhook-card.tsx +198 -0
  71. package/docs/specs/forge-workflow-gui.md +820 -0
  72. package/docs/workflow.md +339 -0
  73. package/examples/README.md +108 -0
  74. package/examples/hook-service/README.md +66 -0
  75. package/examples/hook-service/forge-hook.service +28 -0
  76. package/examples/hook-service/hook-server.mjs +265 -0
  77. package/examples/hook-service/hook.env.example +21 -0
  78. package/examples/labels/README.md +64 -0
  79. package/examples/labels/label-base.yaml +117 -0
  80. package/examples/skills/coding-agent/SKILL.md +262 -0
  81. package/examples/skills/coding-agent-fgjx/SKILL.md +271 -0
  82. package/examples/skills/orchestrator/SKILL.md +133 -0
  83. package/examples/skills/orchestrator-fgjx/SKILL.md +139 -0
  84. package/examples/tools/README.md +68 -0
  85. package/examples/tools/fgjx +464 -0
  86. package/package.json +38 -0
  87. package/paseo-plugin.json +4 -0
  88. package/server/forge-client.ts +484 -0
  89. package/server/forge-guard.ts +70 -0
  90. package/server/git-origin.ts +70 -0
  91. package/server/hook-queue.ts +127 -0
  92. package/server/issues.ts +542 -0
  93. package/server/settings.ts +52 -0
  94. package/server/vendor/paseo-plugin-helper/agent.ts +85 -0
  95. package/server/vendor/paseo-plugin-helper/custom-pills.ts +344 -0
  96. package/server/vendor/paseo-plugin-helper/index.ts +18 -0
  97. package/server/vendor/paseo-plugin-helper/jsonc.ts +78 -0
  98. package/server/vendor/paseo-plugin-helper/logger.ts +210 -0
  99. package/server/vendor/paseo-plugin-helper/mcp-config.ts +367 -0
  100. package/server/vendor/paseo-plugin-helper/mcp-injection.ts +85 -0
  101. package/server/vendor/paseo-plugin-helper/network.ts +91 -0
  102. package/server/vendor/paseo-plugin-helper/plugins.ts +160 -0
  103. package/server/vendor/paseo-plugin-helper/process.ts +186 -0
  104. package/server/vendor/paseo-plugin-helper/redact.ts +86 -0
  105. package/server/vendor/paseo-plugin-helper/rpc-guard.ts +77 -0
  106. package/server/vendor/paseo-plugin-helper/settings.ts +97 -0
  107. package/server/vendor/paseo-plugin-helper/shared-settings.ts +243 -0
  108. package/server/vendor/paseo-plugin-helper/storage.ts +244 -0
  109. package/server/vendor/paseo-plugin-helper/system.ts +128 -0
  110. package/server/vendor/paseo-plugin-helper/task.ts +116 -0
  111. package/server/vendor/paseo-plugin-helper/version.ts +153 -0
  112. package/server/vendor/paseo-plugin-helper/workspace-beacon.ts +418 -0
  113. package/shared/hook-queue.ts +140 -0
  114. package/shared/issues.ts +1750 -0
  115. package/shared/vendor/paseo-plugin-helper/README.md +11 -0
  116. package/shared/vendor/paseo-plugin-helper/async.ts +35 -0
  117. package/shared/vendor/paseo-plugin-helper/custom-pills.ts +169 -0
  118. package/shared/vendor/paseo-plugin-helper/forge.ts +110 -0
  119. package/shared/vendor/paseo-plugin-helper/formatters.ts +271 -0
  120. package/shared/vendor/paseo-plugin-helper/highlight.ts +184 -0
  121. package/shared/vendor/paseo-plugin-helper/index.ts +10 -0
  122. package/shared/vendor/paseo-plugin-helper/rpc.ts +72 -0
  123. package/shared/vendor/paseo-plugin-helper/settings.ts +138 -0
  124. package/shared/vendor/paseo-plugin-helper/suite-settings.ts +17 -0
  125. package/shared/vendor/paseo-plugin-helper/suppressed.ts +31 -0
  126. package/shared/vendor/paseo-plugin-helper/types.ts +36 -0
  127. package/shared/version.ts +2 -0
  128. package/shared/webhook.ts +223 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xpufx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # forges
2
+
3
+ Work with Forge/Gitea-family issues from inside Paseo: list open issues for the
4
+ repo backing a workspace, read an issue's body and comments (with parsed agent
5
+ envelopes), change scoped labels, and post comments, all in plugin surfaces
6
+ with no browser. Augment with the provided webhook bridge and scoped labels
7
+ to unlock autonomous agent orchestration.
8
+
9
+ Pull requests, releases, actions, and everything else are out of scope for now.
10
+
11
+ Built on [paseo-plugin-helper](https://github.com/xpufx/paseo/tree/main/packages/paseo-plugin-helper), the shared Paseo plugin runtime.
12
+
13
+ ## Screenshots
14
+
15
+ | Main | Issue List | Issue Detail |
16
+ | :---: | :---: | :---: |
17
+ | <img src="screenshots/forge-main.png" width="100%" alt="Forges Main" /> | <img src="screenshots/forge-list.png" width="100%" alt="Forge Issue List" /> | <img src="screenshots/forge-issue-detail.png" width="100%" alt="Forge Issue Detail" /> |
18
+
19
+ ## Highlights
20
+
21
+ - **No CLI dependency.** All forge access goes through an embedded TypeScript
22
+ `fetch` client (`server/forge-client.ts`) against the Gitea-family
23
+ `/api/v1`. There is no `git`/`fgj`/`fgjx` subprocess and no dependency on any
24
+ host dotfile.
25
+ - **Daemon-side tokens.** The API token is stored per host in plugin settings
26
+ and only ever attached to `fetch` calls in the daemon. It never reaches the
27
+ client.
28
+ - **Live label vocabulary.** Scopes are derived from the labels actually on the
29
+ board, so a foreign board degrades gracefully instead of failing on an
30
+ unknown scope.
31
+ - **Paged reads.** Issue list, keyword search, label list, and comment list are
32
+ all collections: each call returns **one page**, and the default page size is
33
+ **server-defined and can change**. Treat every list as paged
34
+ (`limit`/`page`, or follow `Link`/`X-Total-Count`) instead of assuming a
35
+ single call is complete; one unpaged call is never evidence of "no results".
36
+ A surface that lists results should page internally rather than render a
37
+ truncated set (#189).
38
+ - **Example skills.** Our agent workflow ships under `examples/` as a starting
39
+ point to adapt (see [`examples/README.md`](./examples/README.md)).
40
+
41
+ Supported forges (verified live, anonymous reads): any Forgejo/Gitea-family
42
+ host, including Forgejo, Gitea, and Codeberg.
43
+
44
+ ## Workflow Augmentation: Turn Issues into Agent Fleet Automation
45
+
46
+ Out of the box, `forges` gives you in-app issue management, scoped label chips, and steering comments directly inside Paseo.
47
+
48
+ When augmented with our scoped label taxonomy and lightweight webhook bridge ([`examples/hook-service/`](./examples/hook-service/)), `forges` becomes an autonomous agent coordination layer:
49
+
50
+ - **Automated Webhook Ingestion:** New issues, label edits, or comments on your forge immediately dispatch events to your orchestrator agent via Paseo's agent transport.
51
+ - **Autonomous Agent Handoffs:** Coding agents pick up assigned tickets, transition `state/` chips (`0-triage` → `1-wip` → `2-review` → `3-verify` → `4-done`), publish structured status envelopes, and pass attention back to the operator when human signoff is required.
52
+ - **Drop-In Scoped Label Taxonomy:** Seed our four core scopes (`state/`, `priority/`, `attention/`, `spec/`) using the generic template in [`examples/labels/label-base.yaml`](./examples/labels/label-base.yaml).
53
+ - **Adaptable Agent Skills:** Ships with zero-CLI skills (using plugin `/api/v1` RPCs directly) as well as CLI-assisted workflows ([`examples/skills/`](./examples/skills/)).
54
+
55
+ See [`docs/workflow.md`](./docs/workflow.md) for the end-to-end architecture and [`examples/README.md`](./examples/README.md) for starter templates.
56
+
57
+ ## Install
58
+
59
+ The plugin uses the Paseo 0.8 layout (`index.client.tsx` / `index.server.ts`
60
+ entries, `client/` / `server/` / `shared/` split, manifest
61
+ `requirements.paseo >= 0.8.0`).
62
+
63
+ ```sh
64
+ paseo plugin add xpufx/paseo --path plugins/forges
65
+ ```
66
+
67
+ Or from a local monorepo checkout:
68
+
69
+ ```sh
70
+ paseo plugin add ./plugins/forges
71
+ ```
72
+
73
+ ## Configuration
74
+
75
+ Open the plugin's **Settings** tab inside a workspace.
76
+
77
+ - **Active forge.** Each workspace watches one active forge at a time. The
78
+ list holds the workspace's forge remotes (any `parseForgeRemote` form plus
79
+ a bare `owner/repo`); **Auto** derives the remote from the workspace's git
80
+ `origin`. An explicit selection wins absolutely: an invalid or unreachable
81
+ selection fails loudly instead of silently deriving.
82
+ - **API token.** Saved per host in daemon-side plugin settings. Reads work
83
+ anonymously on public repos; labels and comments need an accepted token with
84
+ write scope on both public and private repos. For Forgejo/Gitea create the
85
+ PAT with `read:user`, `read:repository`, and `write:issue` (add
86
+ `write:repository` if label management still 403s). Edit capability is read
87
+ from the repo's permission object (`permissions.push`/`admin`, or GitLab
88
+ `access_level >= 30`), so a token that is accepted but under-scoped shows
89
+ "token lacks write scope" instead of enabling edits.
90
+
91
+ ## Development
92
+
93
+ ```sh
94
+ npm install --workspace=plugins/forges
95
+ npm run typecheck --workspace=plugins/forges
96
+ npm test --workspace=plugins/forges
97
+ ```
98
+
99
+ The helper audit also applies:
100
+
101
+ ```sh
102
+ node packages/paseo-plugin-helper/bin/paseo-plugin-helper.js audit plugins/forges
103
+ ```
104
+
105
+ See [`docs/specs/forge-workflow-gui.md`](./docs/specs/forge-workflow-gui.md)
106
+ for the data model, RPC contracts, and UI surfaces, and
107
+ [`docs/workflow.md`](./docs/workflow.md) for the end-to-end agent workflow
108
+ (hook service, label usage, agent responsibilities, and what the plugin ships
109
+ versus what an adopter supplies).
@@ -0,0 +1,47 @@
1
+ import { useMemo } from "react";
2
+ import { useAgent, useWorkspace } from "@getpaseo/plugin/client";
3
+ import type { PluginWorkspaceSnapshot } from "@getpaseo/plugin";
4
+ import {
5
+ activeForgeForDirectory,
6
+ forgeContextContract,
7
+ forgeSettingsContract,
8
+ resolveForgeTarget,
9
+ type ForgeRepoIdentity,
10
+ } from "../shared/issues.js";
11
+ import { usePluginSettings, useRpcQuery } from "paseo-plugin-helper/client";
12
+
13
+ /** Workspace directory backing an agent, or undefined while it cannot resolve. */
14
+ export function useAgentDirectory(agentId: string): string | undefined {
15
+ const workspaceId = useAgent(agentId, (agent: { workspaceId: string }) => agent?.workspaceId) as
16
+ | string
17
+ | null;
18
+ return (
19
+ useWorkspace(workspaceId ?? "", (workspace: PluginWorkspaceSnapshot) => workspace?.directory) ??
20
+ undefined
21
+ );
22
+ }
23
+
24
+ /**
25
+ * Active forge identity for a workspace directory, mirroring the server's
26
+ * resolution: an explicit selection wins absolutely, otherwise the git origin
27
+ * remote is derived via `forgeContextContract`. The git-context query is
28
+ * cache-keyed, so per-item callers share one request. Null when nothing
29
+ * resolves, which callers treat as "every link is foreign".
30
+ */
31
+ export function useActiveForgeIdentity(
32
+ directory: string | undefined | null,
33
+ ): ForgeRepoIdentity | null {
34
+ const { settings } = usePluginSettings(forgeSettingsContract);
35
+ const context = useRpcQuery(forgeContextContract, { directory: directory ?? undefined });
36
+ const target = activeForgeForDirectory(settings, directory) ?? "";
37
+ const derivedRemote = context.data?.derivedRemote ?? null;
38
+ return useMemo(() => {
39
+ const resolved = resolveForgeTarget(target, derivedRemote);
40
+ return resolved.ok ? { host: resolved.host, repo: resolved.repo } : null;
41
+ }, [target, derivedRemote]);
42
+ }
43
+
44
+ /** Active forge identity for the workspace backing a timeline agent. */
45
+ export function useActiveForgeIdentityForAgent(agentId: string): ForgeRepoIdentity | null {
46
+ return useActiveForgeIdentity(useAgentDirectory(agentId));
47
+ }
@@ -0,0 +1,236 @@
1
+ import React from "react";
2
+ import { Linking, Pressable, StyleSheet, Text, View } from "react-native";
3
+ import { z } from "zod";
4
+ import type {
5
+ PluginTimelineItemProps,
6
+ PluginTimelineTransformerContribution,
7
+ } from "@getpaseo/plugin/client";
8
+ import {
9
+ Badge,
10
+ ForgeIcon,
11
+ } from "paseo-plugin-helper/client";
12
+ import {
13
+ boardAlertTimelineSchema,
14
+ classifyForgeUrl,
15
+ parseBoardAlert,
16
+ } from "../shared/issues.js";
17
+ import { useActiveForgeIdentityForAgent } from "./active-forge.js";
18
+ import { ForeignLinkBadge } from "./foreign-link.js";
19
+ import { LabelChipList } from "./label-chip.js";
20
+
21
+ const boardAlertCardSchema = boardAlertTimelineSchema.extend({
22
+ text: z.string(),
23
+ });
24
+ type BoardAlertCardData = z.infer<typeof boardAlertCardSchema>;
25
+ type BoardAlertIssueRowData = z.infer<typeof boardAlertTimelineSchema>;
26
+
27
+ function transformTextItem<T extends { text: string }>(item: T) {
28
+ const parsed = parseBoardAlert(item.text);
29
+ if (!parsed) return undefined;
30
+ return {
31
+ items: [
32
+ {
33
+ type: "plugin" as const,
34
+ kind: "forge-board-alert",
35
+ version: 1,
36
+ data: { ...parsed, text: item.text },
37
+ },
38
+ ],
39
+ } as any;
40
+ }
41
+
42
+ /**
43
+ * Board-alert timeline transformer: raw autonomous-check dumps become
44
+ * typed `forge-board-alert` items so the composer renders the
45
+ * structured timeline card below instead of a text wall.
46
+ */
47
+ export const forgeBoardAlertUserTransformer: PluginTimelineTransformerContribution<"user_message"> = {
48
+ id: "forge-board-alert-user",
49
+ query: { itemType: "user_message" },
50
+ transform({ item }) {
51
+ return transformTextItem(item);
52
+ },
53
+ };
54
+
55
+ export const forgeBoardAlertAssistantTransformer: PluginTimelineTransformerContribution<"assistant_message"> = {
56
+ id: "forge-board-alert-assistant",
57
+ query: { itemType: "assistant_message" },
58
+ transform({ item }) {
59
+ return transformTextItem(item);
60
+ },
61
+ };
62
+
63
+ function BoardAlertIssueRow({
64
+ theme,
65
+ issue,
66
+ foreign,
67
+ }: {
68
+ theme: PluginTimelineItemProps<BoardAlertIssueRowData>["theme"];
69
+ issue: BoardAlertIssueRowData["issues"][number];
70
+ foreign: boolean;
71
+ }) {
72
+ const open = issue.url
73
+ ? () => {
74
+ Linking.openURL(issue.url as string).catch(() => {});
75
+ }
76
+ : undefined;
77
+ return (
78
+ <View style={styles.issueRow}>
79
+ <ForgeIcon host={issue.url} size={13} color={theme.colors.foregroundMuted} />
80
+ <Badge variant="info" label={`#${issue.number}`} />
81
+ <View style={styles.issueBody}>
82
+ {open ? (
83
+ <Pressable onPress={open} hitSlop={8}>
84
+ <Text style={[styles.issueTitle, styles.issueTitleLink, { color: theme.colors.accent }]}>
85
+ {issue.title}
86
+ </Text>
87
+ </Pressable>
88
+ ) : (
89
+ <Text style={[styles.issueTitle, { color: theme.colors.foreground }]}>
90
+ {issue.title}
91
+ </Text>
92
+ )}
93
+ {issue.url ? (
94
+ <Pressable onPress={open} hitSlop={8}>
95
+ <Text style={[styles.issueUrl, { color: theme.colors.accent }]}>
96
+ {issue.url}
97
+ </Text>
98
+ </Pressable>
99
+ ) : null}
100
+ <LabelChipList
101
+ labels={issue.labels.map((name) => ({ name }))}
102
+ style={styles.issueLabels}
103
+ />
104
+ {issue.action ? (
105
+ <Text style={[styles.issueAction, { color: theme.colors.foregroundMuted }]}>
106
+ {issue.action}
107
+ </Text>
108
+ ) : null}
109
+ </View>
110
+ {foreign ? <ForeignLinkBadge /> : null}
111
+ </View>
112
+ );
113
+ }
114
+
115
+ export function ForgeBoardAlertCard({
116
+ item,
117
+ theme,
118
+ agentId,
119
+ }: PluginTimelineItemProps<BoardAlertCardData>) {
120
+ const activeForge = useActiveForgeIdentityForAgent(agentId);
121
+ const count = item.data.issues.length;
122
+ return (
123
+ <View
124
+ style={[
125
+ styles.card,
126
+ {
127
+ backgroundColor: theme.colors.surface1,
128
+ borderColor: theme.colors.border,
129
+ },
130
+ ]}
131
+ >
132
+ <Text style={[styles.bodyText, { color: theme.colors.foreground }]}>
133
+ {item.data.text}
134
+ </Text>
135
+ <View style={styles.header}>
136
+ <ForgeIcon
137
+ host={activeForge?.host ?? item.data.issues[0]?.url}
138
+ size={14}
139
+ color={theme.colors.accent}
140
+ />
141
+ <Text style={[styles.title, { color: theme.colors.foreground }]}>
142
+ Forge Board Alert
143
+ </Text>
144
+ <Badge
145
+ variant="warning"
146
+ label={count === 1 ? "1 actionable" : `${count} actionable`}
147
+ />
148
+ </View>
149
+ <Text style={[styles.headline, { color: theme.colors.foregroundMuted }]}>
150
+ {item.data.headline}
151
+ </Text>
152
+ <View style={styles.issues}>
153
+ {item.data.issues.map((issue) => (
154
+ <BoardAlertIssueRow
155
+ key={issue.number}
156
+ theme={theme}
157
+ issue={issue}
158
+ foreign={classifyForgeUrl(issue.url, activeForge) === "foreign"}
159
+ />
160
+ ))}
161
+ </View>
162
+ <Text style={[styles.footer, { color: theme.colors.foregroundMuted }]}>
163
+ via forge
164
+ </Text>
165
+ </View>
166
+ );
167
+ }
168
+
169
+ export const forgeBoardAlertRenderer = {
170
+ kind: "forge-board-alert",
171
+ version: 1,
172
+ schema: boardAlertCardSchema,
173
+ Component: ForgeBoardAlertCard,
174
+ };
175
+
176
+ const styles = StyleSheet.create({
177
+ card: {
178
+ borderRadius: 8,
179
+ borderWidth: 1,
180
+ padding: 8,
181
+ marginVertical: 2,
182
+ gap: 6,
183
+ },
184
+ header: {
185
+ flexDirection: "row",
186
+ alignItems: "center",
187
+ gap: 6,
188
+ },
189
+ title: {
190
+ fontSize: 12,
191
+ fontWeight: "600",
192
+ flex: 1,
193
+ },
194
+ bodyText: {
195
+ fontSize: 13,
196
+ },
197
+ headline: {
198
+ fontSize: 11,
199
+ },
200
+ issues: {
201
+ gap: 8,
202
+ },
203
+ issueRow: {
204
+ flexDirection: "row",
205
+ alignItems: "flex-start",
206
+ gap: 8,
207
+ },
208
+ issueBody: {
209
+ flex: 1,
210
+ gap: 2,
211
+ },
212
+ issueTitle: {
213
+ fontSize: 13,
214
+ fontWeight: "600",
215
+ },
216
+ issueTitleLink: {
217
+ textDecorationLine: "underline",
218
+ },
219
+ issueUrl: {
220
+ fontSize: 11,
221
+ textDecorationLine: "underline",
222
+ },
223
+ issueLabels: {
224
+ flexDirection: "row",
225
+ flexWrap: "wrap",
226
+ gap: 4,
227
+ },
228
+ issueAction: {
229
+ fontSize: 11,
230
+ fontStyle: "italic",
231
+ },
232
+ footer: {
233
+ fontSize: 10,
234
+ fontStyle: "italic",
235
+ },
236
+ });
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { Text } from "react-native";
3
+ import { Badge } from "paseo-plugin-helper/client";
4
+
5
+ /** Shared label for the cross-repo marker, so every surface reads the same. */
6
+ export const FOREIGN_LINK_LABEL = "foreign";
7
+
8
+ /** Accessible description of the marker for pressable link rows. */
9
+ export const FOREIGN_LINK_HINT = "Points at a different forge repo";
10
+
11
+ /** Compact `foreign` badge for a link row laid out with flexbox. */
12
+ export function ForeignLinkBadge() {
13
+ return (
14
+ <Badge
15
+ variant="warning"
16
+ styleVariant="outline"
17
+ icon="Globe"
18
+ label={FOREIGN_LINK_LABEL}
19
+ />
20
+ );
21
+ }
22
+
23
+ /**
24
+ * Inline `foreign` marker for a link rendered inside a <Text> (markdown
25
+ * spans). Purely additive: the link keeps its own navigation handler.
26
+ */
27
+ export function ForeignInlineMark({ color }: { color: string }) {
28
+ return (
29
+ <Text style={{ fontSize: 10, fontWeight: "700", color }}>
30
+ {` ${FOREIGN_LINK_LABEL}`}
31
+ </Text>
32
+ );
33
+ }