create-feltkit 0.3.37 → 0.5.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.
- package/bin/create.js +3 -3
- package/package.json +4 -4
- package/scaffold.d.ts +1 -1
- package/scaffold.js +8 -5
- package/template/README.md +72 -177
- package/template/_gitignore +4 -0
- package/template/agent/agent.ts +28 -0
- package/template/agent/channels/eve.ts +6 -0
- package/template/agent/instructions.md +24 -0
- package/template/agent/lib/deterministic.ts +46 -0
- package/template/agent/lib/feltkit-capabilities.json +294 -0
- package/template/agent/tools/crew_artifacts_create.ts +4 -0
- package/template/agent/tools/crew_context_read.ts +4 -0
- package/template/agent/tools/crew_context_record.ts +4 -0
- package/template/agent/tools/crew_context_search.ts +4 -0
- package/template/agent/tools/crew_decisions_propose.ts +4 -0
- package/template/agent/tools/crew_tasks_add.ts +6 -0
- package/template/agent/tools/crew_tasks_list.ts +4 -0
- package/template/agent/tools/crew_tasks_note.ts +4 -0
- package/template/agent/tools/crew_workspace_overview.ts +4 -0
- package/template/agent/tools/crew_workstreams_update.ts +6 -0
- package/template/agent/tools/web_fetch.ts +1 -0
- package/template/agent/tools/web_search.ts +3 -0
- package/template/feltkit/_generated/api.ts +8 -4
- package/template/feltkit/activity.ts +26 -0
- package/template/feltkit/app.ts +147 -54
- package/template/feltkit/boards.ts +10 -0
- package/template/feltkit/decisions.ts +99 -0
- package/template/feltkit/knowledge.ts +119 -0
- package/template/feltkit/model.ts +96 -0
- package/template/feltkit/work.ts +45 -0
- package/template/feltkit/workspace.ts +171 -0
- package/template/index.html +1 -1
- package/template/native/App.tsx +249 -0
- package/template/package.json +11 -5
- package/template/shared/rules.ts +23 -0
- package/template/src/App.tsx +177 -528
- package/template/src/screens/activity.tsx +66 -0
- package/template/src/screens/agent.tsx +188 -0
- package/template/src/screens/context.tsx +71 -0
- package/template/src/screens/decisions.tsx +89 -0
- package/template/src/screens/home.tsx +140 -0
- package/template/src/screens/team.tsx +13 -0
- package/template/src/screens/work.tsx +149 -0
- package/template/src/styles.css +201 -118
- package/template/src/ui.tsx +179 -0
- package/template/tests/crew.test.ts +111 -0
- package/template/tsconfig.json +18 -3
- package/template-managed/Dockerfile +2 -2
- package/template-managed/README.md +1 -1
- package/template-managed/package.json +3 -3
- package/template-tasks/README.md +383 -0
- package/template-tasks/_gitignore +12 -0
- package/template-tasks/feltkit/_generated/api.ts +10 -0
- package/template-tasks/feltkit/app.ts +73 -0
- package/template-tasks/index.html +17 -0
- package/template-tasks/native/App.tsx +220 -0
- package/template-tasks/native/native.json +5 -0
- package/template-tasks/package.json +30 -0
- package/template-tasks/public/apple-touch-icon.png +0 -0
- package/template-tasks/public/favicon.png +0 -0
- package/template-tasks/public/theme.js +7 -0
- package/template-tasks/shared/rules.ts +18 -0
- package/template-tasks/src/App.tsx +557 -0
- package/template-tasks/src/main.tsx +17 -0
- package/template-tasks/src/styles.css +134 -0
- package/template-tasks/src/theme.tsx +58 -0
- package/template-tasks/tsconfig.json +16 -0
- package/template-tasks/vite.config.ts +6 -0
- /package/{template → template-tasks}/feltkit/inbox.ts +0 -0
- /package/{template → template-tasks}/feltkit/projects.ts +0 -0
- /package/{template → template-tasks}/feltkit/tasks.ts +0 -0
- /package/{template → template-tasks}/public/feltkit-mark.png +0 -0
- /package/{template → template-tasks}/tests/tasks.test.ts +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crew on iOS and Android: React Native screens over the same functions, the same generated api, the same
|
|
3
|
+
* permissions and the same rules (shared/rules.ts) as the web app in src/. The agent's approvals are answered
|
|
4
|
+
* through the same FeltKit call (`client.eve("crew").answer`), so an approval from a phone is the same AppPort
|
|
5
|
+
* approval as one from the web.
|
|
6
|
+
*
|
|
7
|
+
* The host (generated by `feltkit build ios|android`) connects to the instance, holds the session in secure storage
|
|
8
|
+
* and renders this inside <FeltKitProvider>.
|
|
9
|
+
*/
|
|
10
|
+
import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
|
11
|
+
import { ActivityIndicator, Button, FlatList, Pressable, RefreshControl, SafeAreaView, ScrollView, StyleSheet, Text, TextInput, View } from "react-native";
|
|
12
|
+
import { useConnectionState, useFeltKit, useMutation, useQueryState, useSession, type EveFact, type NativeAppProps } from "@feltdb/feltkit/native";
|
|
13
|
+
import { api } from "../feltkit/_generated/api";
|
|
14
|
+
import { can, describe, STAGE_LABEL } from "../shared/rules";
|
|
15
|
+
|
|
16
|
+
type Tab = "home" | "work" | "agent";
|
|
17
|
+
|
|
18
|
+
export default function App({ link, onLinkHandled }: NativeAppProps) {
|
|
19
|
+
const { session, signInAsDevUser, signIn, signOut } = useSession();
|
|
20
|
+
const live = useConnectionState();
|
|
21
|
+
const [notice, setNotice] = useState<string | null>(null);
|
|
22
|
+
const principal = session?.principal ?? null;
|
|
23
|
+
|
|
24
|
+
const tried = useRef(false);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (session && !principal && session.devUsers.length && !tried.current) {
|
|
27
|
+
tried.current = true;
|
|
28
|
+
void signInAsDevUser(session.devUsers[0]!.id).catch((e) => setNotice(describe(e)));
|
|
29
|
+
}
|
|
30
|
+
}, [session, principal, signInAsDevUser]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!link) return;
|
|
34
|
+
if (link.kind === "verified") setNotice(`${link.email} is verified.`);
|
|
35
|
+
else if (link.kind === "signed-in") setNotice(null);
|
|
36
|
+
else if ("message" in link) setNotice(link.message);
|
|
37
|
+
onLinkHandled();
|
|
38
|
+
}, [link, onLinkHandled]);
|
|
39
|
+
|
|
40
|
+
if (!session) return <Centered><ActivityIndicator accessibilityLabel="Loading" /></Centered>;
|
|
41
|
+
return (
|
|
42
|
+
<SafeAreaView style={styles.screen}>
|
|
43
|
+
<View style={styles.bar}>
|
|
44
|
+
<Text style={styles.brand} accessibilityRole="header">Crew</Text>
|
|
45
|
+
<Text style={styles.muted}>{live ? "live" : "offline"}</Text>
|
|
46
|
+
{principal ? <Button title="Sign out" onPress={() => void signOut()} /> : null}
|
|
47
|
+
</View>
|
|
48
|
+
{notice ? <Text style={styles.notice} accessibilityRole="alert" onPress={() => setNotice(null)}>{notice}</Text> : null}
|
|
49
|
+
{principal ? <Signedin permissions={session.permissions ?? []} onError={(e) => setNotice(describe(e))} /> : <SignIn devUsers={session.devUsers} onDev={signInAsDevUser} onSignIn={signIn} onError={(e) => setNotice(describe(e))} />}
|
|
50
|
+
</SafeAreaView>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function SignIn(props: { devUsers: Array<{ id: string; name: string }>; onDev(id: string): Promise<void>; onSignIn(i: { email: string; password: string }): Promise<void>; onError(e: unknown): void }) {
|
|
55
|
+
const [email, setEmail] = useState("");
|
|
56
|
+
const [password, setPassword] = useState("");
|
|
57
|
+
const [busy, setBusy] = useState(false);
|
|
58
|
+
const attempt = (work: () => Promise<void>) => async () => {
|
|
59
|
+
setBusy(true);
|
|
60
|
+
try { await work(); } catch (error) { props.onError(error); } finally { setBusy(false); }
|
|
61
|
+
};
|
|
62
|
+
return (
|
|
63
|
+
<View style={styles.pad}>
|
|
64
|
+
<Text style={styles.heading}>Sign in to Crew</Text>
|
|
65
|
+
{props.devUsers.map((u) => <Button key={u.id} title={`Continue as ${u.name}`} disabled={busy} onPress={attempt(() => props.onDev(u.id))} />)}
|
|
66
|
+
<TextInput style={styles.input} value={email} onChangeText={setEmail} placeholder="E-mail" autoCapitalize="none" autoComplete="email" keyboardType="email-address" accessibilityLabel="E-mail" />
|
|
67
|
+
<TextInput style={styles.input} value={password} onChangeText={setPassword} placeholder="Password" secureTextEntry autoComplete="password" accessibilityLabel="Password" />
|
|
68
|
+
<Button title="Sign in" disabled={busy || !email || !password} onPress={attempt(() => props.onSignIn({ email, password }))} />
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Signed in: a workspace to work in, then its screens. */
|
|
74
|
+
function Signedin({ permissions, onError }: { permissions: string[]; onError(e: unknown): void }) {
|
|
75
|
+
const client = useFeltKit();
|
|
76
|
+
const [tenants, setTenants] = useState<Awaited<ReturnType<typeof client.tenants>> | null>(null);
|
|
77
|
+
const [tab, setTab] = useState<Tab>("home");
|
|
78
|
+
const load = useCallback(() => client.tenants().then(setTenants, onError), [client]);
|
|
79
|
+
useEffect(() => { void load(); }, [load]);
|
|
80
|
+
if (!tenants) return <Centered><ActivityIndicator /></Centered>;
|
|
81
|
+
if (!tenants.current) {
|
|
82
|
+
return (
|
|
83
|
+
<ScrollView contentContainerStyle={styles.pad}>
|
|
84
|
+
<Text style={styles.heading}>Your workspaces</Text>
|
|
85
|
+
{tenants.tenants.map((t) => <Button key={t.id} title={t.name} onPress={() => client.switchTenant(t.id).then(load, onError)} />)}
|
|
86
|
+
{!tenants.tenants.length ? <Text style={styles.muted}>Create a workspace or accept an invitation on the web, then open it here.</Text> : null}
|
|
87
|
+
</ScrollView>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return (
|
|
91
|
+
<View style={{ flex: 1 }}>
|
|
92
|
+
<View style={{ flex: 1 }}>
|
|
93
|
+
{tab === "home" && <Home />}
|
|
94
|
+
{tab === "work" && <Work canWork={can(permissions, "boards.work")} onError={onError} />}
|
|
95
|
+
{tab === "agent" && <Agent onError={onError} />}
|
|
96
|
+
</View>
|
|
97
|
+
<View style={styles.tabs} accessibilityRole="tablist">
|
|
98
|
+
{(["home", "work", "agent"] as const).map((t) => (
|
|
99
|
+
<Pressable key={t} accessibilityRole="tab" accessibilityState={{ selected: tab === t }} onPress={() => setTab(t)} style={styles.tab}>
|
|
100
|
+
<Text style={[styles.tabText, tab === t && styles.tabOn]}>{t === "home" ? "Home" : t === "work" ? "Work" : "Agent"}</Text>
|
|
101
|
+
</Pressable>
|
|
102
|
+
))}
|
|
103
|
+
</View>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function Home() {
|
|
109
|
+
const o = useQueryState(api.workspace.overview).data as any;
|
|
110
|
+
if (!o) return <Centered><ActivityIndicator /></Centered>;
|
|
111
|
+
if (!o.setup) return <Centered><Text style={styles.muted}>Set up this workspace on the web first.</Text></Centered>;
|
|
112
|
+
const e = o.evidence;
|
|
113
|
+
return (
|
|
114
|
+
<ScrollView contentContainerStyle={styles.pad}>
|
|
115
|
+
<Text style={styles.eyebrow}>{STAGE_LABEL[o.mission.stage as keyof typeof STAGE_LABEL]}</Text>
|
|
116
|
+
<Text style={styles.heading}>{o.mission.title}</Text>
|
|
117
|
+
<Text style={styles.body}>{o.mission.outcome}</Text>
|
|
118
|
+
<View style={styles.measures}>
|
|
119
|
+
<Measure value={e.verified} label="verified" />
|
|
120
|
+
<Measure value={e.decisions} label="decisions" />
|
|
121
|
+
<Measure value={`${e.tasksDone}/${e.tasks}`} label="tasks done" />
|
|
122
|
+
</View>
|
|
123
|
+
<View style={styles.next}><Text style={styles.eyebrow}>Next</Text><Text style={styles.strong}>{o.next.title}</Text><Text style={styles.muted}>{o.next.detail}</Text></View>
|
|
124
|
+
<Text style={styles.section}>Workstreams</Text>
|
|
125
|
+
{o.workstreams.map((w: any) => (
|
|
126
|
+
<View key={w.id} style={styles.row}><Text style={styles.strong}>{w.name}</Text><Text style={styles.muted}>{w.done}/{w.tasks} done · {w.status.replace("-", " ")}</Text></View>
|
|
127
|
+
))}
|
|
128
|
+
</ScrollView>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function Measure({ value, label }: { value: ReactNode; label: string }) {
|
|
133
|
+
return <View style={styles.measure}><Text style={styles.measureValue}>{value}</Text><Text style={styles.muted}>{label}</Text></View>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function Work({ canWork, onError }: { canWork: boolean; onError(e: unknown): void }) {
|
|
137
|
+
const o = useQueryState(api.workspace.overview).data as any;
|
|
138
|
+
const [stream, setStream] = useState<string | null>(null);
|
|
139
|
+
const w = o?.workstreams?.find((x: any) => x.id === stream) ?? o?.workstreams?.[0];
|
|
140
|
+
const threads = useQueryState(api.boards.listThreads, w ? { channelId: w.channelId, kind: "task", limit: 200 } : "skip");
|
|
141
|
+
const claim = useMutation(api.boards.claimTask);
|
|
142
|
+
const complete = useMutation(api.boards.completeTask);
|
|
143
|
+
if (!w) return <Centered><ActivityIndicator /></Centered>;
|
|
144
|
+
return (
|
|
145
|
+
<View style={{ flex: 1 }}>
|
|
146
|
+
<ScrollView horizontal style={styles.chips} contentContainerStyle={{ gap: 6, paddingHorizontal: 16 }} showsHorizontalScrollIndicator={false}>
|
|
147
|
+
{o.workstreams.map((x: any) => <Pressable key={x.id} onPress={() => setStream(x.id)} style={[styles.chip, x.id === w.id && styles.chipOn]}><Text style={x.id === w.id ? styles.chipOnText : undefined}>{x.name}</Text></Pressable>)}
|
|
148
|
+
</ScrollView>
|
|
149
|
+
<FlatList
|
|
150
|
+
data={(threads.data ?? []) as any[]}
|
|
151
|
+
keyExtractor={(t) => t.id}
|
|
152
|
+
renderItem={({ item: t }) => (
|
|
153
|
+
<View style={styles.row}>
|
|
154
|
+
<Text style={[styles.strong, t.status === "completed" && styles.done]}>{t.title}</Text>
|
|
155
|
+
<View style={styles.rowActions}>
|
|
156
|
+
<Text style={styles.muted}>{t.status.replace("_", " ")}</Text>
|
|
157
|
+
{canWork && (t.status === "ready" || t.status === "open") ? <Button title="Claim" onPress={() => claim({ threadId: t.id }).catch(onError)} /> : null}
|
|
158
|
+
{canWork && (t.status === "claimed" || t.status === "in_progress") ? <Button title="Done" onPress={() => complete({ threadId: t.id, summary: "Completed from the Crew app." }).catch(onError)} /> : null}
|
|
159
|
+
</View>
|
|
160
|
+
</View>
|
|
161
|
+
)}
|
|
162
|
+
/>
|
|
163
|
+
</View>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** What the agent waits on in this workspace: approve or deny, as on the web. */
|
|
168
|
+
function Agent({ onError }: { onError(e: unknown): void }) {
|
|
169
|
+
const client = useFeltKit();
|
|
170
|
+
const [waiting, setWaiting] = useState<Array<{ sessionId: string; title: string; interactionId: string; prompt: string }> | null>(null);
|
|
171
|
+
const [busy, setBusy] = useState(false);
|
|
172
|
+
const load = useCallback(async () => {
|
|
173
|
+
try {
|
|
174
|
+
const agent = client.eve("crew");
|
|
175
|
+
const open: NonNullable<typeof waiting> = [];
|
|
176
|
+
for (const s of (await agent.sessions()).slice(0, 10)) {
|
|
177
|
+
const facts: EveFact[] = await agent.history(s.id);
|
|
178
|
+
const settled = new Set(facts.filter((f) => f.type === "interaction.settled").map((f) => String(f.data?.interactionId)));
|
|
179
|
+
for (const f of facts) {
|
|
180
|
+
if (f.type !== "interaction.opened" || settled.has(String(f.data?.interactionId))) continue;
|
|
181
|
+
open.push({ sessionId: s.id, title: s.title, interactionId: String(f.data?.interactionId), prompt: String((f.data?.request as { prompt?: string } | undefined)?.prompt ?? "Approve?") });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
setWaiting(open);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
onError(error);
|
|
187
|
+
setWaiting([]);
|
|
188
|
+
}
|
|
189
|
+
}, [client]);
|
|
190
|
+
useEffect(() => { void load(); const t = setInterval(load, 5000); return () => clearInterval(t); }, [load]);
|
|
191
|
+
const answer = (w: { sessionId: string; interactionId: string }, decision: "approve" | "deny") => async () => {
|
|
192
|
+
setBusy(true);
|
|
193
|
+
try { await client.eve("crew").answer(w.sessionId, w.interactionId, decision); await load(); } catch (e) { onError(e); } finally { setBusy(false); }
|
|
194
|
+
};
|
|
195
|
+
if (!waiting) return <Centered><ActivityIndicator /></Centered>;
|
|
196
|
+
return (
|
|
197
|
+
<FlatList
|
|
198
|
+
contentContainerStyle={styles.pad}
|
|
199
|
+
data={waiting}
|
|
200
|
+
keyExtractor={(w) => w.interactionId}
|
|
201
|
+
refreshControl={<RefreshControl refreshing={false} onRefresh={load} />}
|
|
202
|
+
ListHeaderComponent={<Text style={styles.heading}>Waiting for you</Text>}
|
|
203
|
+
ListEmptyComponent={<Text style={styles.muted}>The agent is not waiting on anyone. Ask it for something on the web.</Text>}
|
|
204
|
+
renderItem={({ item: w }) => (
|
|
205
|
+
<View style={styles.approval}>
|
|
206
|
+
<Text style={styles.strong}>{w.prompt}</Text>
|
|
207
|
+
<Text style={styles.muted}>{w.title}</Text>
|
|
208
|
+
<View style={styles.rowActions}><Button title="Approve" disabled={busy} onPress={answer(w, "approve")} /><Button title="Deny" disabled={busy} onPress={answer(w, "deny")} /></View>
|
|
209
|
+
</View>
|
|
210
|
+
)}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function Centered({ children }: { children: ReactNode }) {
|
|
216
|
+
return <View style={styles.centered}>{children}</View>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const styles = StyleSheet.create({
|
|
220
|
+
screen: { flex: 1, backgroundColor: "#f6f5f1" },
|
|
221
|
+
bar: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingHorizontal: 16, paddingVertical: 10, gap: 12 },
|
|
222
|
+
brand: { fontSize: 18, fontWeight: "700", color: "#1d1c19" },
|
|
223
|
+
pad: { padding: 16, gap: 12 },
|
|
224
|
+
centered: { flex: 1, alignItems: "center", justifyContent: "center", padding: 24 },
|
|
225
|
+
heading: { fontSize: 24, fontWeight: "600", color: "#1d1c19" },
|
|
226
|
+
eyebrow: { fontSize: 12, fontWeight: "600", color: "#7a776e", textTransform: "uppercase", letterSpacing: 1 },
|
|
227
|
+
body: { fontSize: 16, lineHeight: 23, color: "#4a4842" },
|
|
228
|
+
strong: { fontSize: 15, fontWeight: "600", color: "#1d1c19" },
|
|
229
|
+
muted: { fontSize: 13, color: "#7a776e" },
|
|
230
|
+
section: { fontSize: 17, fontWeight: "650" as never, marginTop: 8, color: "#1d1c19" },
|
|
231
|
+
notice: { marginHorizontal: 16, padding: 10, borderRadius: 8, backgroundColor: "#fbe7e5", color: "#a4302a" },
|
|
232
|
+
input: { borderWidth: 1, borderColor: "#d6d2c7", borderRadius: 8, padding: 10, backgroundColor: "#fff" },
|
|
233
|
+
measures: { flexDirection: "row", gap: 8 },
|
|
234
|
+
measure: { flex: 1, backgroundColor: "#fff", borderRadius: 10, padding: 10, borderWidth: 1, borderColor: "#e7e4dc" },
|
|
235
|
+
measureValue: { fontSize: 20, fontWeight: "700", color: "#1d1c19" },
|
|
236
|
+
next: { backgroundColor: "#e6efe9", borderRadius: 12, padding: 14, gap: 4 },
|
|
237
|
+
row: { backgroundColor: "#fff", borderBottomWidth: 1, borderColor: "#e7e4dc", paddingHorizontal: 16, paddingVertical: 12, gap: 4 },
|
|
238
|
+
rowActions: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
239
|
+
done: { textDecorationLine: "line-through", color: "#7a776e" },
|
|
240
|
+
chips: { flexGrow: 0, paddingVertical: 10 },
|
|
241
|
+
chip: { borderWidth: 1, borderColor: "#d6d2c7", borderRadius: 999, paddingHorizontal: 12, paddingVertical: 6, backgroundColor: "#fff" },
|
|
242
|
+
chipOn: { backgroundColor: "#1d1c19", borderColor: "#1d1c19" },
|
|
243
|
+
chipOnText: { color: "#fff" },
|
|
244
|
+
approval: { backgroundColor: "#fbf0dc", borderRadius: 12, padding: 14, gap: 8 },
|
|
245
|
+
tabs: { flexDirection: "row", borderTopWidth: 1, borderColor: "#e7e4dc", backgroundColor: "#fff" },
|
|
246
|
+
tab: { flex: 1, alignItems: "center", paddingVertical: 12 },
|
|
247
|
+
tabText: { color: "#7a776e", fontSize: 14 },
|
|
248
|
+
tabOn: { color: "#2f5d50", fontWeight: "700" },
|
|
249
|
+
});
|
package/template/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "feltkit-example-
|
|
2
|
+
"name": "feltkit-example-crew",
|
|
3
3
|
"private": true,
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
@@ -13,18 +13,24 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@feltdb
|
|
17
|
-
"@feltdb/
|
|
18
|
-
"@
|
|
16
|
+
"@appport/eve-world-feltdb": "0.1.1",
|
|
17
|
+
"@feltdb/core": ">=0.25.0 <0.26.0",
|
|
18
|
+
"@feltdb/feltkit": "0.5.0",
|
|
19
|
+
"eve": "npm:@appport/eve@1.1.2",
|
|
19
20
|
"react": "19.3.1",
|
|
20
21
|
"react-dom": "19.3.1"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@types/node": "
|
|
24
|
+
"@types/node": "26.6.6",
|
|
24
25
|
"@types/react": "19.3.0",
|
|
25
26
|
"@types/react-dom": "19.3.0",
|
|
26
27
|
"@vitejs/plugin-react": "5.1.0",
|
|
27
28
|
"typescript": "7.0.2",
|
|
28
29
|
"vite": "7.3.7"
|
|
30
|
+
},
|
|
31
|
+
"overrides": {
|
|
32
|
+
"eve": {
|
|
33
|
+
"vite": "$vite"
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the screens decide, shared by the web app (src/) and the native app (native/): no UI, no platform. The server
|
|
3
|
+
* enforces all of it on every call; this is only what a screen shows and how it words a refusal.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Same matching rule as AppPort: exact, "ns.*", or "*". */
|
|
7
|
+
export function can(granted: readonly string[], permission: string): boolean {
|
|
8
|
+
return granted.some((g) => g === "*" || g === permission || (g.endsWith(".*") && permission.startsWith(g.slice(0, -1))));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** A failed call, as a sentence for the person. */
|
|
12
|
+
export function describe(error: unknown): string {
|
|
13
|
+
const e = error as { code?: string; message?: string; hint?: string } | null;
|
|
14
|
+
if (e?.code === "FORBIDDEN") return `Not allowed: ${e.message}`;
|
|
15
|
+
if (e?.code === "UNAUTHORIZED") return "Sign in to continue.";
|
|
16
|
+
if (e?.code === "CONFLICT") return e.message ?? "That changed elsewhere. Look again, then try once more.";
|
|
17
|
+
if (e?.code === "UNAVAILABLE") return e.message ?? "The service is not answering right now. Try again in a moment.";
|
|
18
|
+
if (e?.hint === "EVE_NOT_ACTIVATED") return "The workspace agent is not active here yet.";
|
|
19
|
+
return e?.message ?? String(error);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const STAGES = ["defining", "validating", "building", "launching", "operating"] as const;
|
|
23
|
+
export const STAGE_LABEL: Record<(typeof STAGES)[number], string> = { defining: "Defining", validating: "Validating", building: "Building", launching: "Launching", operating: "Operating" };
|