anriltine commited on
Commit
01aca8a
Β·
verified Β·
1 Parent(s): 73ac7c0

Deploy TinyModel1Space from GitHub Actions

Browse files
scripts/nl_controls.py CHANGED
@@ -1497,6 +1497,67 @@ def _embedded_letter_format(m: str) -> tuple[str, str] | None:
1497
  return instr, "letter_format"
1498
 
1499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1500
  def _embedded_meeting_agenda(m: str) -> tuple[str, str] | None:
1501
  """``meeting_agenda`` β€” timeboxed meeting run-of-show (distinct from ``action_plan`` owner tables)."""
1502
  if len(m) < 48:
@@ -3811,7 +3872,7 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3811
  ``code_only``, ``code_explained``, ``len_cap=80w``, ``guided``, ``ephemeral``, ``a11y``,
3812
  ``cite_sources``, ``cite_minimal``, ``ranked_options``, ``checklist``, ``no_checklist``,
3813
  ``pseudocode``, ``runnable_code``, ``options_n=N``, ``diagram``, ``no_diagram``,
3814
- ``risks_first``, ``benefits_first``, ``revise_draft``, ``revise_diff``, ``email_format``, ``letter_format``, ``meeting_agenda``, ``topic_guard``,
3815
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3816
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3817
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
@@ -3947,6 +4008,11 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3947
  extras.append(ltf[0])
3948
  trace_tags.append(ltf[1])
3949
 
 
 
 
 
 
3950
  mag = _embedded_meeting_agenda(m)
3951
  if mag:
3952
  extras.append(mag[0])
 
1497
  return instr, "letter_format"
1498
 
1499
 
1500
+ def _embedded_runbook_format(m: str) -> tuple[str, str] | None:
1501
+ """``runbook_format`` β€” ops/on-call runbook scaffold (distinct from ``postmortem`` and ``checklist``)."""
1502
+ if len(m) < 48:
1503
+ return None
1504
+ no_rb = bool(
1505
+ re.search(
1506
+ r"\b(no runbook format|without (?:a\s+)?runbook format|not a runbook format|"
1507
+ r"skip (?:the\s+)?runbook format|don'?t use runbook format|"
1508
+ r"avoid runbook (?:format|template|sections)|"
1509
+ r"no operational runbook (?:format|template))\b",
1510
+ m,
1511
+ )
1512
+ )
1513
+ if no_rb:
1514
+ return None
1515
+ checklist_only = bool(
1516
+ re.search(
1517
+ r"\b((?:as a|use a|markdown) checklist|checklist (?:format|style)|"
1518
+ r"tick[- ]box(?:es)?|checkbox(?:es)? (?:list|format))\b",
1519
+ m,
1520
+ )
1521
+ )
1522
+ if checklist_only:
1523
+ return None
1524
+ postmortem_only = bool(
1525
+ re.search(
1526
+ r"\b(postmortem format|blameless postmortem|incident postmortem|"
1527
+ r"post[- ]mortem format)\b",
1528
+ m,
1529
+ )
1530
+ )
1531
+ if postmortem_only:
1532
+ return None
1533
+ want = bool(
1534
+ re.search(
1535
+ r"\b(runbook(?:\s+format)?|operational runbook|on[- ]call runbook|"
1536
+ r"incident runbook|ops runbook|"
1537
+ r"write (?:an?\s+)?runbook|draft (?:an?\s+)?runbook|"
1538
+ r"playbook format|operational playbook|"
1539
+ r"runbook (?:for|to) (?:the\s+)?(?:on[- ]call|failover|rollback|restore|deploy))\b",
1540
+ m,
1541
+ )
1542
+ )
1543
+ if not want:
1544
+ return None
1545
+ if not re.search(
1546
+ r"\b(on[- ]call|incident|outage|failover|rollback|restore|deploy|"
1547
+ r"sre|operations|ops|escalat|drill|procedure|write|draft|"
1548
+ r"describe|outline|publish|document)\b",
1549
+ m,
1550
+ ):
1551
+ return None
1552
+ instr = (
1553
+ "The user wants an **operational runbook**: use markdown headings **Purpose**, "
1554
+ "**Prerequisites**, **Procedure** (numbered steps), **Verification**, **Rollback**, "
1555
+ "**Escalation**, and optional **References**β€”concrete operator actions, not a "
1556
+ "postmortem narrative or `- [ ]` checkbox checklist."
1557
+ )
1558
+ return instr, "runbook_format"
1559
+
1560
+
1561
  def _embedded_meeting_agenda(m: str) -> tuple[str, str] | None:
1562
  """``meeting_agenda`` β€” timeboxed meeting run-of-show (distinct from ``action_plan`` owner tables)."""
1563
  if len(m) < 48:
 
3872
  ``code_only``, ``code_explained``, ``len_cap=80w``, ``guided``, ``ephemeral``, ``a11y``,
3873
  ``cite_sources``, ``cite_minimal``, ``ranked_options``, ``checklist``, ``no_checklist``,
3874
  ``pseudocode``, ``runnable_code``, ``options_n=N``, ``diagram``, ``no_diagram``,
3875
+ ``risks_first``, ``benefits_first``, ``revise_draft``, ``revise_diff``, ``email_format``, ``letter_format``, ``runbook_format``, ``meeting_agenda``, ``topic_guard``,
3876
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3877
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3878
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
 
4008
  extras.append(ltf[0])
4009
  trace_tags.append(ltf[1])
4010
 
4011
+ rbf = _embedded_runbook_format(m)
4012
+ if rbf:
4013
+ extras.append(rbf[0])
4014
+ trace_tags.append(rbf[1])
4015
+
4016
  mag = _embedded_meeting_agenda(m)
4017
  if mag:
4018
  extras.append(mag[0])
scripts/universal_brain_chat.py CHANGED
@@ -112,7 +112,7 @@ from rag_faq_smoke import _pick_model, hybrid_retrieve, load_chunks # noqa: E40
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
- - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **formal business letter in prose** β†’ letter_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **sprint retrospective / retro format in prose** β†’ sprint_retro, **user story / As a I want So that in prose** β†’ user_story, **definition of done / DoD criteria in prose** β†’ definition_of_done, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
@@ -227,6 +227,7 @@ These behaviors apply when your line is handled as **normal chat** (not a short
227
  | Revise / polish draft | In a **long** message that includes **your draft** (email, memo, Slack post, etc.), ask to **rewrite**, **polish**, **proofread**, or **make it more professional/concise**β€”paste the draft in the same line or label it **Draft:** / **here’s my draft** (avoid mixing with **don’t rewrite** / **keep my wording unchanged**). | **`revise_draft`** in **`prompt_signals:`**; reply should return an improved version of your text, not a generic essay |
228
  | Email format (compose) | In a **long** message, ask to **write an email**, **draft an email to** someone, **compose a follow-up email**, or use **email format** with **Subject** and **Greeting** (avoid mixing with **no email format** / **not as an email**; use **Revise / polish draft** if you are polishing pasted copy). | **`email_format`** in **`prompt_signals:`**; reply should use **Subject:**, **Greeting**, body paragraphs, and **Sign-off** |
229
  | Letter format (formal business) | In a **long** correspondence prompt, ask to **write a letter**, **draft a formal letter**, **business letter format**, or **letter to** an office/agency with **Date**, **To**, and **Salutation** (avoid mixing with **no letter format** / **not as a letter**; use **Email format** for Subject-line email layout). | **`letter_format`** in **`prompt_signals:`**; reply should use **Date:**, **To:**, **Salutation**, body, **Closing**, and **Signature** |
 
230
  | Meeting agenda (timeboxed) | In a **long** sync or workshop prompt, ask for a **meeting agenda**, **agenda format**, **timeboxed agenda**, or **run-of-show** for an upcoming session (avoid mixing with **no meeting agenda** / **skip agenda format**; use **Action plan** if you want owner/due-date tables). | **`meeting_agenda`** in **`prompt_signals:`**; reply should use **Meeting title**, **Objective**, **Agenda** (timeboxed items), **Pre-reads**, **Decisions needed** |
231
  | Revise with before/after diff | In a **long** revise message with your draft pasted, also ask for **before and after**, **show what changed**, **track changes**, **side by side**, or **diff format** (avoid mixing with **no diff** / **inline revision only**). | **`revise_diff`** in **`prompt_signals:`** (often with **`revise_draft`**); reply should label **Before** / **After** or mark edits clearly |
232
  | Topic guardrails (omit subjects) | In a **long** question, say **don’t mention**, **avoid discussing**, **steer clear of**, or **no discussion of** a topic (e.g. pricing, competitors). Avoid mixing with **make sure to mention** / **must cover** mandatory topics in the same line. | **`topic_guard`** in **`prompt_signals:`**; reply should respect the omitted subjects |
 
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
+ - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **formal business letter in prose** β†’ letter_format, **operational runbook / on-call playbook in prose** β†’ runbook_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **sprint retrospective / retro format in prose** β†’ sprint_retro, **user story / As a I want So that in prose** β†’ user_story, **definition of done / DoD criteria in prose** β†’ definition_of_done, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
 
227
  | Revise / polish draft | In a **long** message that includes **your draft** (email, memo, Slack post, etc.), ask to **rewrite**, **polish**, **proofread**, or **make it more professional/concise**β€”paste the draft in the same line or label it **Draft:** / **here’s my draft** (avoid mixing with **don’t rewrite** / **keep my wording unchanged**). | **`revise_draft`** in **`prompt_signals:`**; reply should return an improved version of your text, not a generic essay |
228
  | Email format (compose) | In a **long** message, ask to **write an email**, **draft an email to** someone, **compose a follow-up email**, or use **email format** with **Subject** and **Greeting** (avoid mixing with **no email format** / **not as an email**; use **Revise / polish draft** if you are polishing pasted copy). | **`email_format`** in **`prompt_signals:`**; reply should use **Subject:**, **Greeting**, body paragraphs, and **Sign-off** |
229
  | Letter format (formal business) | In a **long** correspondence prompt, ask to **write a letter**, **draft a formal letter**, **business letter format**, or **letter to** an office/agency with **Date**, **To**, and **Salutation** (avoid mixing with **no letter format** / **not as a letter**; use **Email format** for Subject-line email layout). | **`letter_format`** in **`prompt_signals:`**; reply should use **Date:**, **To:**, **Salutation**, body, **Closing**, and **Signature** |
230
+ | Runbook (ops / on-call) | In a **long** SRE or on-call prompt, ask for a **runbook**, **runbook format**, **operational runbook**, or **on-call playbook** with procedure and rollback steps (avoid mixing with **no runbook format** / **skip runbook format**; use **Postmortem** for after-action incident write-ups). | **`runbook_format`** in **`prompt_signals:`**; reply should use **Purpose**, **Prerequisites**, **Procedure**, **Verification**, **Rollback**, **Escalation** |
231
  | Meeting agenda (timeboxed) | In a **long** sync or workshop prompt, ask for a **meeting agenda**, **agenda format**, **timeboxed agenda**, or **run-of-show** for an upcoming session (avoid mixing with **no meeting agenda** / **skip agenda format**; use **Action plan** if you want owner/due-date tables). | **`meeting_agenda`** in **`prompt_signals:`**; reply should use **Meeting title**, **Objective**, **Agenda** (timeboxed items), **Pre-reads**, **Decisions needed** |
232
  | Revise with before/after diff | In a **long** revise message with your draft pasted, also ask for **before and after**, **show what changed**, **track changes**, **side by side**, or **diff format** (avoid mixing with **no diff** / **inline revision only**). | **`revise_diff`** in **`prompt_signals:`** (often with **`revise_draft`**); reply should label **Before** / **After** or mark edits clearly |
233
  | Topic guardrails (omit subjects) | In a **long** question, say **don’t mention**, **avoid discussing**, **steer clear of**, or **no discussion of** a topic (e.g. pricing, competitors). Avoid mixing with **make sure to mention** / **must cover** mandatory topics in the same line. | **`topic_guard`** in **`prompt_signals:`**; reply should respect the omitted subjects |