Skip to content

Commit 6d5187e

Browse files
committed
feat(hub): group Logs under Mods, demo mod self-repair, goto highlighting
- HubModsPages: register one 'Mods' top tab with [Mods, Logs] sub-tabs (HubSubTabPage) instead of two separate top tabs. - Full Access demo: wire CoreAiLuaModAutoRepair into the demo Hub with the repair threshold lowered to one consecutive error, so a broken mod self-heals on first failure. - LuaTokenizer: recognise the Lua 'goto' keyword so it highlights in the mod editor. CoreAI.Mods.Tests 584/584 EditMode green; compile clean.
1 parent d0d3d4e commit 6d5187e

5 files changed

Lines changed: 52 additions & 9 deletions

File tree

Assets/CoreAI.Demos/FullAccess/FullAccessDemo.unity

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ GameObject:
306306
- component: {fileID: 481775747}
307307
- component: {fileID: 481775746}
308308
- component: {fileID: 481775745}
309+
- component: {fileID: 481775751}
309310
m_Layer: 0
310311
m_Name: CoreAiHub
311312
m_TagString: Untagged
@@ -328,7 +329,6 @@ MonoBehaviour:
328329
targetCube: {fileID: 0}
329330
coreAiScope: {fileID: 0}
330331
luaPlatformDriver: {fileID: 0}
331-
fullModeModSourceOverride: {fileID: 0}
332332
chatConfig: {fileID: 11400000, guid: 35a273c9c56ed3d488f1445c0c8c3efb, type: 2}
333333
--- !u!114 &481775746
334334
MonoBehaviour:
@@ -411,6 +411,25 @@ Transform:
411411
m_Children: []
412412
m_Father: {fileID: 0}
413413
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
414+
--- !u!114 &481775751
415+
MonoBehaviour:
416+
m_ObjectHideFlags: 0
417+
m_CorrespondingSourceObject: {fileID: 0}
418+
m_PrefabInstance: {fileID: 0}
419+
m_PrefabAsset: {fileID: 0}
420+
m_GameObject: {fileID: 481775744}
421+
m_Enabled: 1
422+
m_EditorHideFlags: 0
423+
m_Script: {fileID: 11500000, guid: a7685b0dcbf88bd4aa64e17421b6c629, type: 3}
424+
m_Name:
425+
m_EditorClassIdentifier: CoreAI.Mods::CoreAI.Presentation.CoreAiLuaModAutoRepair
426+
lifetimeScope: {fileID: 0}
427+
autoRepairEnabled: 1
428+
minConsecutiveErrors: 1
429+
maxAttemptsPerMod: 2
430+
cooldownSeconds: 20
431+
modVersionKeyPrefix:
432+
sourceTag: lua_mod_auto_repair
414433
--- !u!1 &573228319
415434
GameObject:
416435
m_ObjectHideFlags: 0

Assets/CoreAI/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
**Settings / Token Budget / Statistics** are now sub-tabs of a single **AI Settings** tab, keeping the
1818
top tab bar short; new sub-tab groupings are one registration.
1919
- Hub **Lua mod editor** now renders **Lua syntax highlighting** in the inline editor (keywords,
20-
strings, numbers, comments) while keeping the field editable. (`LuaSyntaxHighlighter`)
20+
strings, numbers, comments) while keeping the field editable, including the `goto` keyword.
21+
(`LuaSyntaxHighlighter`, `LuaTokenizer`)
22+
- Full Access demo now **self-heals a failing mod on its first runtime error**: a `CoreAiLuaModAutoRepair`
23+
component is wired into the demo Hub with the repair threshold lowered to one consecutive error, so a
24+
broken mod is handed back to the Programmer to fix without waiting for a streak.
2125
- Programmer skill **`read_skill('Full Lua')`**: the full `unity_*` reflection surface moved behind an
2226
on-demand skill, so it stays available as a rarely-needed backup without bloating the base prompt.
2327

@@ -30,6 +34,8 @@
3034
`coreai_world_find` / `coreai_world_pos` / `coreai_world_exists` remain, and the `WorldEdit` capability
3135
still gates the Rbx surface. Prompts, tool descriptions, the Lua Modding skill and the gallery example
3236
Lua were updated to match. (`RegisterWorldEditBuildBindings`)
37+
- Hub **Mods** and **Mod Logs** are now grouped under one **Mods** top tab with `[Mods, Logs]` sub-tabs
38+
instead of two separate top tabs, keeping the tab bar compact. (`HubModsPages`)
3339

3440
- Hub **API-profiles endpoint editor** redesigned: field visibility is applied on first render (HTTP
3541
endpoints no longer show LLMUnity-only fields), an **Advanced** foldout hides secondary fields

Assets/CoreAIMods/Runtime/HubIntegration/HubModsPages.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using System;
22
using CoreAI.Ai.LuaCs;
33
using CoreAI.Hub;
4+
using CoreAI.Hub.UI;
45

56
namespace CoreAI.Ai.Hub
67
{
78
/// <summary>
8-
/// One-call registration of the CoreAI Mods page into a <see cref="HubPageRegistry"/>. The page is
9+
/// One-call registration of the CoreAI Mods tab into a <see cref="HubPageRegistry"/>: a single
10+
/// grouped page with [Mods, Logs] sub-tabs (via <see cref="HubSubTabPage"/>). The page is
911
/// registered as a lazy factory (its content is built only when the tab is first activated) at
1012
/// order 300 by default, so it slots after the built-in Chat (0) / Settings (100) / Statistics
1113
/// (200) tabs. Overloads accept the Lua-CSharp <see cref="LuaCsModRuntime"/> plus the shared
@@ -16,13 +18,13 @@ public static class HubModsPages
1618
/// <summary>Registry id of the Mods page.</summary>
1719
public const string ModsPageId = HubModsPage.DefaultPageId;
1820

19-
/// <summary>Registry id of the Mod Logs page.</summary>
21+
/// <summary>Page id of the Mod Logs page, shown as the Logs sub-tab under the Mods tab.</summary>
2022
public const string LogsPageId = HubModLogsPage.DefaultPageId;
2123

2224
/// <summary>Default Hub tab order for the Mods page (after Chat/Settings/Statistics).</summary>
2325
public const int DefaultOrder = 300;
2426

25-
/// <summary>Default Hub tab order for the Mod Logs page (after Mods).</summary>
27+
/// <summary>Default order of the Mod Logs child page inside the Mods tab.</summary>
2628
public const int DefaultLogsOrder = 350;
2729

2830
/// <summary>Registers the Mods page backed by the Lua-CSharp <see cref="LuaCsModRuntime"/>.</summary>
@@ -61,8 +63,17 @@ public static void Register(HubPageRegistry registry, IHubModService service, in
6163
throw new ArgumentNullException(nameof(service));
6264
}
6365

64-
registry.Register(ModsPageId, () => new HubModsPage(service, order), order);
65-
registry.Register(LogsPageId, () => new HubModLogsPage(service, DefaultLogsOrder), DefaultLogsOrder);
66+
// WHY: one top-level Mods tab with [Mods, Logs] sub-tabs instead of two top tabs, keeping the
67+
// tab bar compact; HubSubTabPage proxies activation lifecycle to whichever sub-tab is visible.
68+
registry.Register(
69+
ModsPageId,
70+
() => new HubSubTabPage(
71+
ModsPageId,
72+
"Mods",
73+
order,
74+
new HubModsPage(service, order),
75+
new HubModLogsPage(service, DefaultLogsOrder)),
76+
order);
6677
}
6778
}
6879
}

Assets/CoreAIMods/Runtime/LuaAssets/LuaTokenizer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public static class LuaTokenizer
1313
{
1414
private static readonly HashSet<string> Keywords = new(StringComparer.Ordinal)
1515
{
16-
"and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in",
17-
"local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while",
16+
"and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if",
17+
"in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while",
1818
// WHY: "type"/"export" are Luau soft keywords (only reserved at statement start); this
1919
// best-effort lexer highlights them unconditionally, matching how most Luau editors do it.
2020
"continue", "type", "export"

Assets/CoreAIMods/Tests/EditMode/LuaTokenizerEditModeTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ public void Tokenize_ContinueKeyword_IsKeyword()
223223
Assert.AreEqual(LuaTokenKind.Keyword, tokens[0].Kind);
224224
}
225225

226+
[Test]
227+
public void Tokenize_GotoKeyword_IsKeyword()
228+
{
229+
List<LuaToken> tokens = Significant("goto");
230+
Assert.AreEqual(LuaTokenKind.Keyword, tokens[0].Kind);
231+
}
232+
226233
[Test]
227234
public void Tokenize_CompoundAssignPlusEquals_IsSingleOperatorToken()
228235
{

0 commit comments

Comments
 (0)