Skip to content

Commit 9af574d

Browse files
committed
Run AI spotlight through real agent runtime
1 parent ae1a905 commit 9af574d

31 files changed

Lines changed: 486 additions & 34 deletions

‎AGENTS.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Rule format:
103103
- TPS pronunciation and phonetic cue examples must use realistic pronunciation notation with IPA-style symbols and stress marks, not placeholder labels such as `GUIDE` or `IPA`.
104104
- TPS cue matrix focus words must name the cue being demonstrated when possible, for example `[sad]sad[/sad]` instead of styling a generic word such as `calibration`, so each screenshot is understandable on its own.
105105
- TPS articulation visuals must follow music-reading metaphors: `legato` should read like one curved slur/ligature mark spanning the entire cue word or grouped phrase, not a wavy spelling-style underline or separate per-word marks; `staccato` should read as dots.
106+
- TPS legato and other curved reader marks must render as smooth vector-quality strokes at README screenshot scale; do not use CSS gradients or raster tricks that create jagged, stair-stepped, or pixelated curves.
106107
- TPS crescendo, stress, legato, pronunciation, phonetic, emphasis, and other scope-based cue treatments must cover the full cue word or phrase scope when the tag applies to a whole word or phrase; partial-letter or single-glyph decoration is a regression unless the TPS semantics explicitly target only that glyph.
107108
- TPS editorial cues must remain visually distinct: `[emphasis]`, Markdown `**bold**`, Markdown `*italic*`, and `[highlight]` need separate reader treatments instead of collapsing into the same underline or generic emphasis style.
108109
- TPS cue matrix reviews must explicitly compare similar treatments side by side and reject identical-looking cue families; screenshots are not acceptable until a reader can tell the intended semantics apart at normal README scale.
@@ -174,9 +175,11 @@ Rule format:
174175
- Shared top-bar chrome must use one consistent navigation contract across routed screens: the app brand/icon acts as Home, the Back control uses real browser/in-app history when available, and responsive phone/tablet layouts must keep those actions reachable without overlapping or clipping.
175176
- The PrompterOne AI assistant belongs in global shell/header chrome, must be available on every routed screen through a spotlight-style surface and hotkey, and must not remain an editor-only action.
176177
- The AI spotlight is a command/search palette plus agent chat/execution surface, not a planning screen: it should suggest route-aware commands and navigation targets while typing, send the entered prompt to the agent on submit, show execution progress only as live process/status feedback, and use a macOS Spotlight-style overlay where the underlying route remains visible with only a very light dim and no dark blurred full-page backdrop.
178+
- AI spotlight must not fake agent execution: when a provider is configured, submitting a prompt must invoke a real Microsoft Agent Framework agent with the user prompt, route/editor context, and MCP-style tool catalog; when no provider is configured, the UI must clearly report that AI is unavailable instead of showing a pretend working state.
177179
- The AI spotlight prompt input must receive focus immediately when the spotlight opens so users can start typing without an extra click.
178180
- Script graph views must prioritize a readable writer knowledge map over decorative circular placement or raw TPS/source dumps: highlight the main/root document node, group meaningful document structure, ideas, people, themes, story references, and relationships by graph value/kind, expose node and edge hover tooltips with source detail, provide zoom/fit/layout controls, avoid noisy duplicated node-list strips under the graph, and never present source lines, WPM/pace, timing, cue, archetype, or raw TPS attribute values as primary graph nodes or primary edge labels. Graph viewing must support both a full graph-only mode and a split source/graph mode with a user-draggable divider that resizes the zones. Graph extraction must be useful to scriptwriters at a high-level glance: it should show what the text is about, how blocks and ideas connect, which references or entities recur, and where the user can jump back into the source; regex, stop-word, capitalization, keyword, and hardcoded-domain semantic heuristics are strictly forbidden. The only non-LLM fallback is an explicit user-requested tokenizer/vector similarity mode based on TikToken-style token vectors and distance calculations.
179181
- Script graph labels, details, semantic scopes, tokenizer chunks, and knowledge-graph markdown input must use compiled TPS display text from the TPS SDK, matching the clean text shown in the prompter; raw TPS source may be used for editor ranges and metadata only, not as a post-hoc string-cleaned source for visible graph prose.
182+
- Script graph build actions must use the configured LLM extractor when an AI provider is available; tokenizer/vector similarity is only an explicit lower-fidelity fallback button and must not silently replace LLM graph extraction.
180183
- The AI spotlight action inventory and agent tool inventory are related but separate surfaces: Spotlight suggestions are a macOS-style UI function search over routes and app actions, while agent MCP-style tools are the callable agent contract. Keep both fed from typed descriptors, and every supported agent tool must carry stable names, descriptions, scope, input parameters, MCP safety hints (`read-only`, `idempotent`, `destructive`, `open-world`), and an explicit approval requirement when a call can mutate app or document state.
181184
- Assistant context must be route-aware. On editor routes, the assistant context must include the current script content, cursor location, selected lines or ranges, and document metadata so rewrite actions can target the intended selection or paragraph instead of replacing the whole script.
182185
- AI document-editing tools must operate through explicit range-based contracts such as line or character insert, replace, and delete operations; whole-file regeneration is forbidden for partial rewrite requests.

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ No PrompterOne backend. No desktop install. No account wall. Open the app, start
5454
- **Teleprompter**: read with persisted font and width controls, focal-line positioning, horizontal and vertical mirror toggles, orientation switching, browser fullscreen, segmented progress, and optional camera background.
5555
- **Onboarding**: walk the first-run flow with a localized tour that explains TPS, RSVP, the editor, Learn, Teleprompter, and Go Live, then reopen that tour later from Settings.
5656
- **Settings**: manage appearance, browser language, media permissions, camera and microphone setup, sync offsets, recording defaults, AI provider preferences, cloud snapshot targets, transport credentials, and onboarding restart from one routed screen.
57+
- **AI Spotlight**: when an AI provider is configured, run the global assistant as a real Microsoft Agent Framework agent with route context, editor text, selected ranges, graph summary, and PrompterOne MCP-style tools.
5758
- **Go Live**: run the browser-owned studio shell and save the composed program feed locally with decodable video and audio while remote transport and destination routing continue to expand.
5859

5960
## What You Get
@@ -70,7 +71,7 @@ The operating desk for the rest of the app. The library keeps starter scripts an
7071

7172
This is not a plain textarea. The editor understands **TPS** (Teleprompter Script), so you can write in segments, blocks, pacing markers, emphasis, emotion tags, pronunciation guides, pause cues, and speed modifiers directly in the source. Front matter is parsed into the metadata rail and kept out of the visible body instead of lingering inline.
7273

73-
The authoring surface includes structure navigation on the left, a full formatting and insert toolbar, floating selection controls, a metadata rail for front matter and speed offsets, in-document find, import and export actions, browser-local autosave with revision history, syntax-aware highlighting over the live source, and a first-class script graph tab. The graph view can run beside or over the source, lets writers inspect the script's high-level knowledge map, and keeps jump-back-to-source context attached to graph nodes. Recent UI work moved TPS authoring fully onto the Monaco editor surface, tightened dropdown and tooltip behavior, cleaned up gutter spacing, and kept large-draft responsiveness intact on both polished demo scripts and very large seeded drafts.
74+
The authoring surface includes structure navigation on the left, a full formatting and insert toolbar, floating selection controls, a metadata rail for front matter and speed offsets, in-document find, import and export actions, browser-local autosave with revision history, syntax-aware highlighting over the live source, and a first-class script graph tab. The graph view can run beside or over the source, lets writers inspect the script's high-level knowledge map, and keeps jump-back-to-source context attached to graph nodes. Its **Build AI graph** action uses the configured LLM extractor; tokenizer similarity stays an explicit lower-fidelity fallback instead of silently pretending to be semantic analysis. Recent UI work moved TPS authoring fully onto the Monaco editor surface, tightened dropdown and tooltip behavior, cleaned up gutter spacing, and kept large-draft responsiveness intact on both polished demo scripts and very large seeded drafts.
7475

7576
![Editor](docs/screenshots/readme/editor.png)
7677

@@ -234,7 +235,7 @@ PrompterOne is in **active alpha**: the core authoring, rehearsal, reader, and l
234235
| **LiveKit transport** | 🟡 | Real transport-aware browser integration and guest-path work, with operational polish still expanding |
235236
| **Distribution routing** | 🟡 | Targets are capability-gated and blocked when the selected transport cannot service them |
236237
| **Cloud storage snapshots** | 🟡 | Browser-local provider configuration ships now; broader import/export maturity is still expanding |
237-
| **AI provider execution** | 🟡 | Provider settings and UI hooks exist, but full runtime execution is still gated behind honest provider integrations |
238+
| **AI provider execution** | ✅ | AI Spotlight runs a configured Microsoft Agent Framework agent with route/editor context and MCP-style tools; script graph analysis uses the configured LLM extractor before any explicit tokenizer fallback |
238239
| **Generic RTMP fan-out** | ❌ | Intentionally unsupported without a real upstream transport path |
239240
| **PrompterOne backend** | ❌ | By design: the browser is the only app runtime |
240241

@@ -249,7 +250,7 @@ These are product directions, not release-date promises.
249250

250251
**After that:**
251252
- Stronger guest and destination-routing workflows on top of the browser studio
252-
- AI-assisted writing once provider integrations are real enough to document honestly
253+
- More agent-callable editor, media, and streaming operations on top of the existing AI runtime
253254
- Deeper operational telemetry and operator ergonomics in Go Live
254255

255256
## Quick Start
644 Bytes
Loading
1.07 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using PrompterOne.Core.AI.Models;
2+
3+
namespace PrompterOne.Core.AI.Abstractions;
4+
5+
public interface IScriptAgentRuntime
6+
{
7+
Task<ScriptAgentRunResult> RunAsync(
8+
ScriptAgentRunRequest request,
9+
CancellationToken cancellationToken = default);
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace PrompterOne.Core.AI.Agents;
2+
3+
public sealed class AssistantScriptAgent : ScriptAgent
4+
{
5+
public const string AgentId = "assistant";
6+
7+
private static readonly IReadOnlyList<string> AgentSkillIds = [WriterScriptAgent.AgentId, ReviewerScriptAgent.AgentId];
8+
9+
public override string Id => AgentId;
10+
11+
public override string Name => "Script Assistant";
12+
13+
public override string Description => "Answers route-aware questions and uses PrompterOne tools for script work.";
14+
15+
public override IReadOnlyList<string> SkillIds => AgentSkillIds;
16+
17+
protected override string SystemPrompt =>
18+
"""
19+
You are the PrompterOne AI assistant.
20+
Answer the user's request using the active route, editor context, selected range, graph summary, and available tools.
21+
Use MCP-style tools when you need current document text, selected text, graph details, or app action metadata.
22+
For partial document edits, work through explicit range-based tool contracts. Do not regenerate a whole script unless the user clearly asks for a full rewrite.
23+
If a change would mutate user text, propose a scoped edit and explain the reason clearly.
24+
Keep responses concise and directly useful inside the app.
25+
""";
26+
}

‎src/PrompterOne.Core/AI/Models/ScriptKnowledgeGraphModels.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public sealed record ScriptKnowledgeGraphArtifact(
2424

2525
public enum ScriptKnowledgeGraphSemanticMode
2626
{
27+
StructuralOnly,
2728
ModelOnly,
2829
TokenizerSimilarity
2930
}

‎src/PrompterOne.Core/AI/Services/ScriptAgentRuntime.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PrompterOne.Core.AI.Services;
99
public sealed class ScriptAgentRuntime(
1010
IEnumerable<ScriptAgent> agents,
1111
IEnumerable<ScriptWorkflow> workflows,
12-
IScriptAgentFactory agentFactory)
12+
IScriptAgentFactory agentFactory) : IScriptAgentRuntime
1313
{
1414
private readonly IReadOnlyDictionary<string, ScriptAgent> _agentsById = agents.ToDictionary(
1515
static agent => agent.Id,

‎src/PrompterOne.Core/AI/Services/ScriptKnowledgeGraphService.cs‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ public async Task<ScriptKnowledgeGraphArtifact> BuildAsync(
5858
edges,
5959
ranges);
6060
AddKnowledgeBankGraph(kbResult.Graph.ToSnapshot(), content, nodes, edges, ranges);
61-
var semanticStatus = await TryAddModelSemanticGraphAsync(
62-
request,
63-
compiledDocument.DisplayMarkdown,
64-
semanticScopes,
65-
nodes,
66-
edges,
67-
ranges,
68-
cancellationToken)
69-
.ConfigureAwait(false);
61+
var semanticStatus = request.SemanticMode == ScriptKnowledgeGraphSemanticMode.StructuralOnly
62+
? ScriptKnowledgeGraphSemanticStatus.StructuralOnly
63+
: await TryAddModelSemanticGraphAsync(
64+
request,
65+
compiledDocument.DisplayMarkdown,
66+
semanticScopes,
67+
nodes,
68+
edges,
69+
ranges,
70+
cancellationToken)
71+
.ConfigureAwait(false);
7072
if (semanticStatus != ScriptKnowledgeGraphSemanticStatus.Model &&
7173
request.SemanticMode == ScriptKnowledgeGraphSemanticMode.TokenizerSimilarity &&
7274
await _tokenizerSimilarityExtractor
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Agents.AI;
2+
using PrompterOne.Core.AI.Agents;
3+
using PrompterOne.Core.AI.Models;
4+
5+
namespace PrompterOne.Core.AI.Workflows;
6+
7+
public sealed class AssistantScriptWorkflow : ScriptWorkflow
8+
{
9+
public const string WorkflowId = "assistant";
10+
11+
private static readonly IReadOnlyList<string> WorkflowAgentIds = [AssistantScriptAgent.AgentId];
12+
13+
public override string Id => WorkflowId;
14+
15+
public override string Name => "Script Assistant";
16+
17+
public override string Description => "Runs one route-aware assistant agent with PrompterOne context and tools.";
18+
19+
public override ScriptWorkflowKind Kind => ScriptWorkflowKind.Sequential;
20+
21+
public override IReadOnlyList<string> AgentIds => WorkflowAgentIds;
22+
23+
protected override AIAgent BuildWorkflowAgent(IReadOnlyList<AIAgent> agents) =>
24+
agents.Count == 1
25+
? agents[0]
26+
: throw new InvalidOperationException("The assistant workflow requires exactly one agent.");
27+
}

0 commit comments

Comments
 (0)