FABRIC-3.md §I.1: (user) console prompt segment, closing the 4.4s->4.3->1.11 chain
Extends the REPL prompt to "[VM name] (user) ok>" (e.g. "[Hera] (zuse) ok>") per the locked FABRIC.md §4.4s spec, unblocked by this session's own §I.3/§I.8 identity-tracking work. Adds capsule_wirebind_attached_username() alongside the existing tracked VMUuid, and a new sk_print_prompt() helper (repl.c) that all three prompt call sites now go through -- checks Zuse first, then a WIREBIND user, prints nothing when neither is attached. Closes 4.4s, 4.3 (console umbrella), and formally settles 1.11 (dirty-event granularity) as region-based per FABRIC-2.md's own "no independent path" ruling -- a decision closure only, not an implementation, so §17.4 (framebuffer heat/decay physics) stays open, re-scoped precisely: blocked on the dirty-region-tracking mechanism existing, not on 1.11's decision. Documents a reported-but-unreproduced terminal defect (§I.9) as a new punch-list item -- investigated the readline/keyboard-bridge code paths, found nothing conclusive, needs a live repro with a serial log before it's actionable. Verified 3-arch boot to ok> (amd64/aarch64/riscv64, each in the foreground); logs and DoE CSVs from this session's verification runs included per this repo's own audit-artifact convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YcT3H2PQeyujrzjqS3Var
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
60d9c2520e
commit
1d468a65b1
@@ -34,6 +34,11 @@
|
||||
* candidate, so one tracked id is enough -- no set/list. */
|
||||
static VMUuid g_wirebind_attached_vm_id;
|
||||
static int g_wirebind_attached_valid = 0;
|
||||
/* Plain username (no "~user" registry-name suffix), tracked separately
|
||||
* from g_wirebind_attached_vm_id -- the registry entry's own name is
|
||||
* user_vm_name ("<username>~user"), not the bare form the (user) prompt
|
||||
* segment wants (FABRIC-3.md §I.1/4.4s). */
|
||||
static char g_wirebind_attached_username[USER_IDENTITY_USERNAME_MAX] = {0};
|
||||
|
||||
/* WIREBIND_CERT_MAX_DEVBLOCKS: a sane upper bound on how much cert
|
||||
* content this reads, independent of whatever sig->cert_devblocks
|
||||
@@ -179,6 +184,7 @@ void capsule_wirebind_try_attach(struct blkio_dev *dev,
|
||||
* actually owns block-subsystem state). */
|
||||
g_wirebind_attached_vm_id = user_id;
|
||||
g_wirebind_attached_valid = 1;
|
||||
memcpy(g_wirebind_attached_username, username, sizeof(g_wirebind_attached_username));
|
||||
|
||||
/* Register the pairing in the console's own routing table, index 3
|
||||
* -- the fixed convention sk_repl_dispatch_line() (repl.c) uses. */
|
||||
@@ -203,7 +209,8 @@ static int wirebind_resolve_attached(VMRegistryEntry *out) {
|
||||
if (!g_wirebind_attached_valid) return -1;
|
||||
if (capsule_vm_registry_get(g_wirebind_attached_vm_id, out) != 0 ||
|
||||
out->state != VM_STATE_LIVE) {
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_username[0] = '\0';
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -225,7 +232,8 @@ int capsule_wirebind_eject(void) {
|
||||
}
|
||||
|
||||
capsule_vm_kill(entry.name);
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_username[0] = '\0';
|
||||
|
||||
console_puts("EJECT: ");
|
||||
console_puts(entry.name);
|
||||
@@ -245,9 +253,15 @@ void capsule_wirebind_unclean_detach(void) {
|
||||
}
|
||||
|
||||
capsule_vm_kill(entry.name);
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_valid = 0;
|
||||
g_wirebind_attached_username[0] = '\0';
|
||||
|
||||
console_puts("WIREBIND: ");
|
||||
console_puts(entry.name);
|
||||
console_println(" detached without flush (device already gone)");
|
||||
}
|
||||
|
||||
const char *capsule_wirebind_attached_username(void) {
|
||||
if (!g_wirebind_attached_valid) return (const char *)0;
|
||||
return g_wirebind_attached_username;
|
||||
}
|
||||
|
||||
+33
-5
@@ -57,6 +57,31 @@
|
||||
|
||||
const char lithos_version[64] = LITHOS_VERSION_STR;
|
||||
|
||||
/* FABRIC.md §27.8/4.4s, unblocked 2026-09-04: extends the prompt to
|
||||
* "[VM name] (user) ok>" (e.g. "[Hera] (zuse) ok>") whenever an
|
||||
* identity is currently attached -- Zuse (mama_vm->zuse_session; there
|
||||
* is only ever one, so no username lookup needed) or a regular WIREBIND
|
||||
* user (capsule_wirebind_attached_username()). Checked independently of
|
||||
* which VM's own bracket console.c is currently showing: both identities
|
||||
* are console-level attach state, not per-VM dictionary state, so the
|
||||
* segment reflects "who is at the console" the same way regardless of
|
||||
* which VM you've USE'd into. Prints nothing (bare "ok> ", today's
|
||||
* existing format, unchanged) when neither is attached -- Hera's own
|
||||
* documented normal steady state (FABRIC-3.md §D.2). */
|
||||
static void sk_print_prompt(void) {
|
||||
VM *mama_vm = (VM *)sk_get_mama_vm();
|
||||
const char *username;
|
||||
|
||||
if (mama_vm && mama_vm->zuse_session) {
|
||||
console_puts("(zuse) ");
|
||||
} else if ((username = capsule_wirebind_attached_username()) != (const char *)0) {
|
||||
console_puts("(");
|
||||
console_puts(username);
|
||||
console_puts(") ");
|
||||
}
|
||||
console_puts(SK_PROMPT_TEXT);
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
* USE-word dispatch: which VM receives REPL input.
|
||||
@@ -597,7 +622,7 @@ int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt)
|
||||
if (reanchor_prompt && n == 0 &&
|
||||
console_tx_count() != prompt_tx_mark)
|
||||
{
|
||||
console_puts(SK_PROMPT_TEXT);
|
||||
sk_print_prompt();
|
||||
console_fb_draw_cursor();
|
||||
prompt_tx_mark = console_tx_count();
|
||||
}
|
||||
@@ -787,8 +812,10 @@ int sk_repl_step(VM *vm)
|
||||
* only by the genuine C-level fault handler now (vm.c's own
|
||||
* emergency-fault-recovery use, EMERGENCY_CONSOLE_ENABLED). Every
|
||||
* word run from this REPL, Hera's bare prompt included, goes
|
||||
* through ordinary ACL enforcement. */
|
||||
console_puts(SK_PROMPT_TEXT);
|
||||
* through ordinary ACL enforcement. FABRIC.md 4.4s (2026-09-04):
|
||||
* sk_print_prompt() extends this with a "(user)" segment when an
|
||||
* identity is attached -- see its own doc comment. */
|
||||
sk_print_prompt();
|
||||
}
|
||||
|
||||
sk_console_readline(input, sizeof(input), vm, 1);
|
||||
@@ -831,8 +858,9 @@ void sk_repl_run(VM *vm)
|
||||
* bracket -- print only "ok> " here, don't build a second one.
|
||||
* emergency_console is no longer set from here (FABRIC-3.md §F.20/
|
||||
* §F.21: the emergency-CLI ACL bypass is retired) -- see sk_repl_
|
||||
* step()'s matching comment above. */
|
||||
console_puts(SK_PROMPT_TEXT);
|
||||
* step()'s matching comment above. FABRIC.md 4.4s (2026-09-04):
|
||||
* sk_print_prompt() extends this with a "(user)" segment. */
|
||||
sk_print_prompt();
|
||||
|
||||
sk_console_readline(input, sizeof(input), active, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user