From 3599d2cabdc0cd2b5102ec0a2286b1a6fb5fdf6f Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:34:36 +0000 Subject: [PATCH 1/5] Private workspace in the kernel (FA-91); sidebar gains Search, More and Prism ID The kernel answers whether a workspace opens, and whether a record may be read, stored, moved in from before a Prism ID, or its plain copy removed (app/src/Workspace.lex.tex, FA-91). ForgeKernel::dispatch sends "workspace " requests to it ahead of the protocols. Eight breaks theorems say a workspace opens only for its owner, with the current boundary key and a live session, never on a removed device; a record is read only when authentic and in place and stored only sealed. Nineteen workspaceWords_ theorems are proved by evaluation and replayed by the guest as acceptance vectors. Both gates were shown to fail on a planted defect (verification/private-workspace.md). No Studio code asks the kernel yet: sealing records is the next change. The sidebar (hologram.screens/AppSidebar.tsx): - Search under Home, and Ctrl or Cmd K: one centred palette over the apps and chats already in memory, with no debounce or round trip. It replaces upstream's AppSearchDialog at build, so the home input's app picker uses it too. - More: the items the visitor tucks away, and Edit sidebar to choose them (Templates and Plugins by default; kept in localStorage holo.sidebar.v1). - Prism ID at the foot: the Prism frame's own panel, loaded on first use and run only if its bytes match its pointer's SHA-256, as an app page runs it. This makes true what the Studio shell surface already claimed. The product is renamed Prism Foundry everywhere it is named, and the facets are projected again from app/product.json. Non-Prism lines shrink by 342. Upstream's app-sidebar.tsx and AppSearchDialog.tsx, which ours replace whole at build, are reduced to typed pointers (VENDORED.md), and dead code goes from host.js, prism.js, lexlean.mjs, obligations.mjs and build.mjs. Two tests move with it: the kernel's vector count is 355, and the patchSpec slice ends at stepSpec. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- CONFORMANCE.md | 6 + README.md | 22 +- app/product.json | 22 +- app/src/Compliance.lex.tex | 3 +- app/src/Design.lex.tex | 130 ++++-- app/src/Features.lex.tex | 33 +- app/src/ForgeKernel.lex.tex | 20 +- app/src/Quality.lex.tex | 2 +- app/src/Security.lex.tex | 2 +- app/src/Workspace.lex.tex | 344 +++++++++++++++ .../tests/in_tab_kernel_verdict.rs | 13 + features/suites/private-workspace.feature | 9 + model/ids.toml | 6 + site/app.json | 4 +- studio/scripts/stamp_shell.py | 2 +- studio/shell/host.js | 20 - studio/shell/live/lexlean.mjs | 1 - studio/shell/live/obligations.mjs | 1 - studio/shell/prism.js | 19 +- studio/shell/prism/builder/build.mjs | 2 - .../application_main_integration.test.mjs | 2 +- .../tools/current_main_integration.test.mjs | 4 +- studio/tools/foundry_model.mjs | 2 +- studio/vendor/dyad/VENDORED.md | 4 +- studio/vendor/dyad/hologram.screens.mjs | 2 + .../dyad/hologram.screens/AppSidebar.tsx | 134 +++++- .../dyad/hologram.screens/SearchDialog.tsx | 90 ++++ .../dyad/src/components/AppSearchDialog.tsx | 160 +------ .../dyad/src/components/app-sidebar.tsx | 390 +----------------- studio/vendor/dyad/vite.shell.config.mts | 2 +- verification/private-workspace.md | 54 +++ 32 files changed, 835 insertions(+), 672 deletions(-) create mode 100644 app/src/Workspace.lex.tex create mode 100644 features/suites/private-workspace.feature create mode 100644 studio/vendor/dyad/hologram.screens/SearchDialog.tsx create mode 100644 verification/private-workspace.md diff --git a/CLAUDE.md b/CLAUDE.md index 8100f356..c4fbabc5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,4 +1,4 @@ -# Working in Prism AI Foundry +# Working in Prism Foundry Read `AGENTS.md` first; its rules R1 to R6 bind every change. diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 307ac008..c35e602f 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -411,6 +411,12 @@ model does not sanction. | --- | --- | --- | | `FA-87` | `build` | A chat turn is answered only by Foundry's own model in Prism, and Prism R4 refuses every route to another model before the request leaves the tab | +## private-workspace + +| ID | Level | Statement | +| --- | --- | --- | +| `FA-91` | `build` | A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal | + ## product-model | ID | Level | Statement | diff --git a/README.md b/README.md index 34717fe3..0c5ec9b3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@

- Prism AI Foundry + Prism Foundry

-# Prism AI Foundry +# Prism Foundry

Start building  |  Spec  |  Conformance  |  For AI agents  |  Community @@ -20,11 +20,11 @@ > **Turn your ideas into apps you can prove.** > -> Describe what you want to build. Prism AI Foundry builds it, proves it, and publishes it to a live URL. +> Describe what you want to build. Prism Foundry builds it, proves it, and publishes it to a live URL. AI can take you from prompt to production in minutes. What it can't tell you is whether the app does what you asked. A preview shows that it worked once. Tests show that it worked for the cases someone thought of. -Prism AI Foundry adds the step that settles it: **formal verification**. Every rule your app promises is proved mathematically, for every possible input, before it can go live. Not tested. Proved. +Prism Foundry adds the step that settles it: **formal verification**. Every rule your app promises is proved mathematically, for every possible input, before it can go live. Not tested. Proved. Building and previewing run in your browser, with no install and no sign-in. Publishing happens on your device too: the app becomes a holo, named by its contents, that you share as a file or a link. Proving does too: Lean's kernel, compiled to WebAssembly, proves an app's rules in your tab, and no server takes part. An app that keeps state between requests is still proved on a hosted verifier. @@ -34,20 +34,20 @@ Building and previewing run in your browser, with no install and no sign-in. Pub The same flow you already know, with one more step. -| Step | You | Prism AI Foundry | +| Step | You | Prism Foundry | |---|---|---| | **1. Describe** | Say what you want, in plain words | Writes the app and the rules it must follow | | **2. Iterate** | Chat, tweak, preview | Checks the rules are complete and consistent | | **3. Prove** | Approve the rules | Proves every rule in Lean, for every input | | **4. Publish** | Share one link | Ships the app with its proof inside, as one file named by its contents | -Edit anything after it is proved and Prism AI Foundry returns to step 2. The proof badge always describes the app you have, never an older version. +Edit anything after it is proved and Prism Foundry returns to step 2. The proof badge always describes the app you have, never an older version.

(back to top)

## Why proof matters -| | Typical AI app builder | Prism AI Foundry | +| | Typical AI app builder | Prism Foundry | |---|---|---| | You describe | An app | An app | | You get | Code that seems to work | Rules proved for every input | @@ -80,9 +80,9 @@ Want to see the proof engine on its own? The [kernel page](https://uor-foundatio

(back to top)

-## What Prism AI Foundry proves about itself +## What Prism Foundry proves about itself -Prism AI Foundry holds itself to the same standard. Lean proves each of these for every request: +Prism Foundry holds itself to the same standard. Lean proves each of these for every request: | Promise | ID | |---|---| @@ -90,7 +90,7 @@ Prism AI Foundry holds itself to the same standard. Lean proves each of these fo | Never publishes an unproved app | FK-02 | | Every edit sends the app back to drafting | FK-03 | | Never proves rules that skipped the check | FK-04 | -| With no grant, only Prism AI Foundry itself may act | FK-05 | +| With no grant, only Prism Foundry itself may act | FK-05 | | With no grant, nothing reaches the network | FK-06 | | A denial always wins | FK-07 | | A preview or published app needs an explicit grant | FK-08 | @@ -174,7 +174,7 @@ Only Prism is implemented. Behavior is written in the Prism model (`*.lex.tex`); ## Community and acknowledgments -Join the [Discord](https://discord.gg/ZwuZaNyuve), or open an issue on GitHub. Prism AI Foundry is built with [PrismPM](https://github.com/UOR-Foundation/PrismPM), [LexLean](https://github.com/UOR-Foundation/LexLean) and [prism-code](https://www.npmjs.com/package/prism-code), on the work of the [UOR Foundation](https://uor.foundation/), and opens in the same frame as [Hologram OS](https://github.com/Hologram-Technologies/hologram-os). +Join the [Discord](https://discord.gg/ZwuZaNyuve), or open an issue on GitHub. Prism Foundry is built with [PrismPM](https://github.com/UOR-Foundation/PrismPM), [LexLean](https://github.com/UOR-Foundation/LexLean) and [prism-code](https://www.npmjs.com/package/prism-code), on the work of the [UOR Foundation](https://uor.foundation/), and opens in the same frame as [Hologram OS](https://github.com/Hologram-Technologies/hologram-os). ## License diff --git a/app/product.json b/app/product.json index ce5b8a0c..567b11cc 100644 --- a/app/product.json +++ b/app/product.json @@ -2,7 +2,7 @@ "schema": "prism/product/1", "lastModified": "2026-11-14T00:00:00Z", "goal": "Turn an idea typed in a browser tab into a full Prism model, proved by Lean and shared as one self-verifying holo, with no sign-in and no model outside Foundry.", - "title": "Prism AI Foundry", + "title": "Prism Foundry", "repository": "UOR-Foundation/foundry", "license": "MIT OR Apache-2.0", "stakeholders": [ @@ -900,19 +900,27 @@ }, { "name": "Prism id", - "text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay.", + "text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", "ids": [ - "FA-88" + "FA-88", + "FA-91" ], "calls": [ - "FoundrySpecification::prismIdBoundary" + "FoundrySpecification::prismIdBoundary", + "Workspace::dispatchWorkspace" ], "registry": [], "components": [ "frame", - "relay" + "relay", + "kernel", + "store" ], - "acceptance": [] + "acceptance": [ + "Workspace::workspaceWords_ownerOpens", + "Workspace::workspaceWords_anotherIdRefused", + "Workspace::workspaceWords_tamperedRecordRefused" + ] }, { "name": "Libraries and settings", @@ -1488,7 +1496,7 @@ { "name": "Studio shell", "stakeholder": "App builder", - "text": "Foundry opens at once in the tab: the sidebar, the title bar and the Prism frame, with no sign-in and the shell served from its verified closure.", + "text": "Foundry opens at once in the tab: the sidebar, with Search (a centred palette over the apps and chats in memory, Ctrl or Cmd K) under Home, More for the items the visitor tucks away (Edit sidebar) and the Prism frame's Prism ID panel at its foot, and the title bar, with no sign-in and the shell served from its verified closure.", "requires": [ "Shell integrity", "Windows and tools", diff --git a/app/src/Compliance.lex.tex b/app/src/Compliance.lex.tex index d27cd868..b5e08ae1 100644 --- a/app/src/Compliance.lex.tex +++ b/app/src/Compliance.lex.tex @@ -29,6 +29,7 @@ \importmodule{VersionPreviewProtocol} \importmodule{WorkOwnership} \importmodule{WorkProtocol} +\importmodule{Workspace} \title{standards reference} \begin{semanticmodule} structure{ @@ -48,7 +49,7 @@ name: obligations, parameters: [], result: (List Obligation), - body: (cons (record Obligation {index := 0, standard := "ISO/IEC/IEEE 42010:2022", subject := "Architecture description", text := "Stakeholders, concerns, viewpoints and views are declared and their references resolve.", evidence := (cons "Architecture::architectureDescriptionHolds" (nil String))}) (cons (record Obligation {index := 1, standard := "ISO/PAS 19450:2015 and OMG UML 2.5.1", subject := "Design views", text := "Building an app from an idea is an OPM view; every journey is a UML sequence along the data flows, and the build-phase machine is the kernel's own rules (10 views).", evidence := (cons "Design::viewOpmBuild" (cons "Design::viewUmlComponents" (cons "Design::viewUmlIdeaToAProvedApp" (cons "Design::viewUmlPublishAnApp" (cons "Design::viewUmlReturnToAnApp" (cons "Design::viewUmlShapeTheStudio" (cons "Design::viewUmlUseAPublishedApp" (cons "Design::viewUmlReplayAHolo" (cons "Design::viewUmlChangeFoundry" (cons "Design::viewUmlPhases" (nil String)))))))))))}) (cons (record Obligation {index := 2, standard := "ISO 9241-11:2018", subject := "Context of use", text := "Every stakeholder is a user group with a goal; every goal is a journey whose tasks are screens, each accepted (7 goals, 18 tasks).", evidence := (cons "Users::everyGoalHasItsUser" (cons "Users::everyTaskServesAGoal" (cons "Users::everyTaskIsAccepted" (cons "Users::everyMeasureNamesAGoal" (nil String)))))}) (cons (record Obligation {index := 3, standard := "ISO/IEC 25010:2023", subject := "Product quality", text := "All 9 characteristics and 40 subcharacteristics are declared; each is stated by a requirement with a measure or listed open (30 open); every budget and experience rule of the kernel is a measure whose threshold is the kernel's term.", evidence := (cons "Quality::qualityModelHolds" (cons "Quality::openSubcharacteristicCount" (nil String)))}) (cons (record Obligation {index := 4, standard := "ISO/IEC 27034-1:2011, ISO/IEC 27005:2022 and STRIDE per element", subject := "Application security and risk", text := "Every threat has a STRIDE category and a mapped control with evidence, or an accepted risk with its rationale; every category STRIDE per element opens on the 42 components and data flows is answered by a threat or stated open (132 open).", evidence := (cons "Security::strideEnumerated" (cons "Security::strideOpenCount" (cons "Security::controlSet" (nil String))))}) (cons (record Obligation {index := 5, standard := "Prism R4 (afflom/me app/specs/r4)", subject := "Own language and reasoning", text := "Every chat turn is decided by R4 before its request is made and before its answer is shown; Foundry grants no route, so only its own model answers.", evidence := (cons "PrismR4Proofs::r4Inv001Holds" (cons "PrismR4Proofs::r4Inv002Holds" (cons "PrismR4Proofs::r4Inv003Holds" (cons "PrismR4Proofs::r4Inv004Holds" (cons "PrismR4Proofs::r4Inv005Holds" (cons "PrismR4Proofs::r4Inv006Holds" (cons "PrismR4Proofs::r4Inv007Holds" (nil String))))))))}) (cons (record Obligation {index := 6, standard := "Prism AI Foundry specification", subject := "authority", text := "Every product-owned behavior has exactly one canonical semantic owner. An imported behavior names its external authority and an independently checked typed boundary. Authoring front ends and generated projections cannot independently redefine behavior.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 7, standard := "Prism AI Foundry specification", subject := "features", text := "Features declare versioned identity, vocabulary, inputs, outputs, state, events, errors, effects, dependencies, conflicts, projection targets, resource budgets, accessibility and applicable quality obligations.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 8, standard := "Prism AI Foundry specification", subject := "routing", text := "A replaceable semantic router proposes ranked features, dependencies, ambiguities and unresolved constraints from typed intent. Held-out relevance, dependency completeness, abstention and latency measurements qualify routing; proposal confidence grants no acceptance authority.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 9, standard := "Prism AI Foundry specification", subject := "composition", text := "Prism independently admits interfaces, dependency closure, conflicts, permissions, budgets and evidence obligations. Both the Foundry application and each generated application have separate finite declared release scopes.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 10, standard := "Prism AI Foundry specification", subject := "projection", text := "Product behavior is generated from the accepted model or crosses a declared typed adapter. Independent runtime comparison and qualified compiler evidence bind execution to the exact accepted semantics. An unsupported channel cannot report empty success as capability fulfillment.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 11, standard := "Prism AI Foundry specification", subject := "proofScope", text := "Every assurance claim binds its property, model, source, executable, toolchain, oracle and dependency identities. Specification proofs, projection preservation, runtime acceptance, measurements and live release acceptance remain separate claims.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 12, standard := "Prism AI Foundry specification", subject := "effects", text := "Network, inference, storage, preview, build and publication effects require explicit permission, transmitted-data disclosure, provider and credential ownership, timeout, malformed-response, revocation and offline behavior.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 13, standard := "Prism AI Foundry specification", subject := "identity", text := "An identity includes object kind, canonicalization profile, algorithm, digest and version. Recompute identities independently and retain transformation relationships among model, source, executable, assets, evidence, archive and deployment.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 14, standard := "Prism AI Foundry specification", subject := "packaging", text := "A complete locked production dependency closure reproduces the accepted artifacts. Independently validate the archive and reconstruction. Dependency or manifest mutation prevents promotion.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 15, standard := "Prism AI Foundry specification", subject := "journeys", text := "Declared creation, editing, preview, verification, restore, cancellation, recovery and publication journeys have positive and negative runtime acceptance. State, view, effects, diagnostics, focus and publication decisions share an authoritative command boundary.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 16, standard := "Prism AI Foundry specification", subject := "quality", text := "Functional correctness does not imply accessibility, audiovisual fidelity, usability or performance. Each declared quality requirement has an appropriate independent oracle, measurement or human assessment and a threshold fixed before acceptance.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 17, standard := "Prism AI Foundry specification", subject := "release", text := "The release receipt binds the declared scope to exact models, source, toolchain, dependencies, artifacts, evidence and destination. Independent retrieval and live replay establish deployment acceptance; a successful process exit alone does not.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 18, standard := "Prism AI Foundry specification", subject := "representation", text := "Exact byte compression retains original-object identity separately from representation, decoder and basis identities. Self-contained and conditional-basis accounting are distinct. Missing bases fail explicitly. Application optimization requires its own behavioral-preservation contract.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 19, standard := "Prism AI Foundry specification", subject := "ownership", text := "Admit and reserve work before executing effects. Retain achieved state, outstanding owners, spent work, unused reservations and resumable obligations after failure or cancellation. Semantic work, scheduling reservations and physical resource measurements remain distinct.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 20, standard := "Prism AI Foundry specification", subject := "factory", text := "Use the qualified PrismPM factory for dependency-scoped obligations. Bind declared input closures, prerequisite identities, commands, environments, policy and oracles. Materialized closures reject undeclared inputs. Scheduling weights affect order only; receipt reuse never weakens the complete acceptance boundary.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 21, standard := "SPDX MIT OR Apache-2.0", subject := "Licensing", text := "Foundry and its model are offered under MIT OR Apache-2.0.", evidence := (cons "ForgeKernel::application" (nil String))}) (nil Obligation))))))))))))))))))))))) + body: (cons (record Obligation {index := 0, standard := "ISO/IEC/IEEE 42010:2022", subject := "Architecture description", text := "Stakeholders, concerns, viewpoints and views are declared and their references resolve.", evidence := (cons "Architecture::architectureDescriptionHolds" (nil String))}) (cons (record Obligation {index := 1, standard := "ISO/PAS 19450:2015 and OMG UML 2.5.1", subject := "Design views", text := "Building an app from an idea is an OPM view; every journey is a UML sequence along the data flows, and the build-phase machine is the kernel's own rules (10 views).", evidence := (cons "Design::viewOpmBuild" (cons "Design::viewUmlComponents" (cons "Design::viewUmlIdeaToAProvedApp" (cons "Design::viewUmlPublishAnApp" (cons "Design::viewUmlReturnToAnApp" (cons "Design::viewUmlShapeTheStudio" (cons "Design::viewUmlUseAPublishedApp" (cons "Design::viewUmlReplayAHolo" (cons "Design::viewUmlChangeFoundry" (cons "Design::viewUmlPhases" (nil String)))))))))))}) (cons (record Obligation {index := 2, standard := "ISO 9241-11:2018", subject := "Context of use", text := "Every stakeholder is a user group with a goal; every goal is a journey whose tasks are screens, each accepted (7 goals, 18 tasks).", evidence := (cons "Users::everyGoalHasItsUser" (cons "Users::everyTaskServesAGoal" (cons "Users::everyTaskIsAccepted" (cons "Users::everyMeasureNamesAGoal" (nil String)))))}) (cons (record Obligation {index := 3, standard := "ISO/IEC 25010:2023", subject := "Product quality", text := "All 9 characteristics and 40 subcharacteristics are declared; each is stated by a requirement with a measure or listed open (30 open); every budget and experience rule of the kernel is a measure whose threshold is the kernel's term.", evidence := (cons "Quality::qualityModelHolds" (cons "Quality::openSubcharacteristicCount" (nil String)))}) (cons (record Obligation {index := 4, standard := "ISO/IEC 27034-1:2011, ISO/IEC 27005:2022 and STRIDE per element", subject := "Application security and risk", text := "Every threat has a STRIDE category and a mapped control with evidence, or an accepted risk with its rationale; every category STRIDE per element opens on the 42 components and data flows is answered by a threat or stated open (132 open).", evidence := (cons "Security::strideEnumerated" (cons "Security::strideOpenCount" (cons "Security::controlSet" (nil String))))}) (cons (record Obligation {index := 5, standard := "Prism R4 (afflom/me app/specs/r4)", subject := "Own language and reasoning", text := "Every chat turn is decided by R4 before its request is made and before its answer is shown; Foundry grants no route, so only its own model answers.", evidence := (cons "PrismR4Proofs::r4Inv001Holds" (cons "PrismR4Proofs::r4Inv002Holds" (cons "PrismR4Proofs::r4Inv003Holds" (cons "PrismR4Proofs::r4Inv004Holds" (cons "PrismR4Proofs::r4Inv005Holds" (cons "PrismR4Proofs::r4Inv006Holds" (cons "PrismR4Proofs::r4Inv007Holds" (nil String))))))))}) (cons (record Obligation {index := 6, standard := "Prism Foundry specification", subject := "authority", text := "Every product-owned behavior has exactly one canonical semantic owner. An imported behavior names its external authority and an independently checked typed boundary. Authoring front ends and generated projections cannot independently redefine behavior.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 7, standard := "Prism Foundry specification", subject := "features", text := "Features declare versioned identity, vocabulary, inputs, outputs, state, events, errors, effects, dependencies, conflicts, projection targets, resource budgets, accessibility and applicable quality obligations.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 8, standard := "Prism Foundry specification", subject := "routing", text := "A replaceable semantic router proposes ranked features, dependencies, ambiguities and unresolved constraints from typed intent. Held-out relevance, dependency completeness, abstention and latency measurements qualify routing; proposal confidence grants no acceptance authority.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 9, standard := "Prism Foundry specification", subject := "composition", text := "Prism independently admits interfaces, dependency closure, conflicts, permissions, budgets and evidence obligations. Both the Foundry application and each generated application have separate finite declared release scopes.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 10, standard := "Prism Foundry specification", subject := "projection", text := "Product behavior is generated from the accepted model or crosses a declared typed adapter. Independent runtime comparison and qualified compiler evidence bind execution to the exact accepted semantics. An unsupported channel cannot report empty success as capability fulfillment.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 11, standard := "Prism Foundry specification", subject := "proofScope", text := "Every assurance claim binds its property, model, source, executable, toolchain, oracle and dependency identities. Specification proofs, projection preservation, runtime acceptance, measurements and live release acceptance remain separate claims.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 12, standard := "Prism Foundry specification", subject := "effects", text := "Network, inference, storage, preview, build and publication effects require explicit permission, transmitted-data disclosure, provider and credential ownership, timeout, malformed-response, revocation and offline behavior.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 13, standard := "Prism Foundry specification", subject := "identity", text := "An identity includes object kind, canonicalization profile, algorithm, digest and version. Recompute identities independently and retain transformation relationships among model, source, executable, assets, evidence, archive and deployment.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 14, standard := "Prism Foundry specification", subject := "packaging", text := "A complete locked production dependency closure reproduces the accepted artifacts. Independently validate the archive and reconstruction. Dependency or manifest mutation prevents promotion.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 15, standard := "Prism Foundry specification", subject := "journeys", text := "Declared creation, editing, preview, verification, restore, cancellation, recovery and publication journeys have positive and negative runtime acceptance. State, view, effects, diagnostics, focus and publication decisions share an authoritative command boundary.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 16, standard := "Prism Foundry specification", subject := "quality", text := "Functional correctness does not imply accessibility, audiovisual fidelity, usability or performance. Each declared quality requirement has an appropriate independent oracle, measurement or human assessment and a threshold fixed before acceptance.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 17, standard := "Prism Foundry specification", subject := "release", text := "The release receipt binds the declared scope to exact models, source, toolchain, dependencies, artifacts, evidence and destination. Independent retrieval and live replay establish deployment acceptance; a successful process exit alone does not.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 18, standard := "Prism Foundry specification", subject := "representation", text := "Exact byte compression retains original-object identity separately from representation, decoder and basis identities. Self-contained and conditional-basis accounting are distinct. Missing bases fail explicitly. Application optimization requires its own behavioral-preservation contract.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 19, standard := "Prism Foundry specification", subject := "ownership", text := "Admit and reserve work before executing effects. Retain achieved state, outstanding owners, spent work, unused reservations and resumable obligations after failure or cancellation. Semantic work, scheduling reservations and physical resource measurements remain distinct.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 20, standard := "Prism Foundry specification", subject := "factory", text := "Use the qualified PrismPM factory for dependency-scoped obligations. Bind declared input closures, prerequisite identities, commands, environments, policy and oracles. Materialized closures reject undeclared inputs. Scheduling weights affect order only; receipt reuse never weakens the complete acceptance boundary.", evidence := (cons "FoundrySpecification::requirement" (nil String))}) (cons (record Obligation {index := 21, standard := "SPDX MIT OR Apache-2.0", subject := "Licensing", text := "Foundry and its model are offered under MIT OR Apache-2.0.", evidence := (cons "ForgeKernel::application" (nil String))}) (nil Obligation))))))))))))))))))))))) } definition{ diff --git a/app/src/Design.lex.tex b/app/src/Design.lex.tex index 3190d78f..89ab1546 100644 --- a/app/src/Design.lex.tex +++ b/app/src/Design.lex.tex @@ -202,6 +202,20 @@ body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentStitchRelay"}) } +definition{ + name: processPrismIdInFoundryKernelGuest, + parameters: [], + result: Foundation.Arch::SystemProcess, + body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentFoundryKernelGuest"}) +} + +definition{ + name: processPrismIdInDeviceStore, + parameters: [], + result: Foundation.Arch::SystemProcess, + body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentDeviceStore"}) +} + definition{ name: processShowHome, parameters: [], @@ -521,7 +535,7 @@ name: viewUmlComponents, parameters: [], result: Foundation.Arch::DesignView, - body: (record Foundation.Arch::DesignView {title := "Components of Prism AI Foundry", viewpoint := "Architecture::viewpointAppVisitorIntegrityOfPublishedApps", diagram := (ctor Foundation.Arch::DesignDiagram.umlComponent)}) + body: (record Foundation.Arch::DesignView {title := "Components of Prism Foundry", viewpoint := "Architecture::viewpointAppVisitorIntegrityOfPublishedApps", diagram := (ctor Foundation.Arch::DesignDiagram.umlComponent)}) } definition{ @@ -1620,301 +1634,329 @@ name: msgIdeaToAProvedApp28, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 28, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowHome"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 28, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processPrismIdInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp29, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 29, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowHome"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 29, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processPrismIdInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp30, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 30, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processIdeaRoutingInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 30, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processPrismIdInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp31, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 31, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processIdeaRoutingInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 31, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processPrismIdInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp32, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 32, source := "Architecture::componentStudio", target := "Architecture::componentModelInPrism", process := "Design::processIdeaRoutingInModelInPrism"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 32, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowHome"}) } definition{ name: msgIdeaToAProvedApp33, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 33, source := "Architecture::componentModelInPrism", target := "Architecture::componentStudio", process := "Design::processIdeaRoutingInModelInPrism"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 33, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowHome"}) } definition{ name: msgIdeaToAProvedApp34, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 34, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowChat"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 34, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processIdeaRoutingInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp35, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 35, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowChat"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 35, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processIdeaRoutingInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp36, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 36, source := "Architecture::componentStudio", target := "Architecture::componentPrismBuilder", process := "Design::processFullModelExtrapolationInPrismBuilder"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 36, source := "Architecture::componentStudio", target := "Architecture::componentModelInPrism", process := "Design::processIdeaRoutingInModelInPrism"}) } definition{ name: msgIdeaToAProvedApp37, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 37, source := "Architecture::componentPrismBuilder", target := "Architecture::componentStudio", process := "Design::processFullModelExtrapolationInPrismBuilder"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 37, source := "Architecture::componentModelInPrism", target := "Architecture::componentStudio", process := "Design::processIdeaRoutingInModelInPrism"}) } definition{ name: msgIdeaToAProvedApp38, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 38, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processCanonicalModelInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 38, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowChat"}) } definition{ name: msgIdeaToAProvedApp39, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 39, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processCanonicalModelInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 39, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowChat"}) } definition{ name: msgIdeaToAProvedApp40, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 40, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processFeatureCompositionInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 40, source := "Architecture::componentStudio", target := "Architecture::componentPrismBuilder", process := "Design::processFullModelExtrapolationInPrismBuilder"}) } definition{ name: msgIdeaToAProvedApp41, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 41, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processFeatureCompositionInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 41, source := "Architecture::componentPrismBuilder", target := "Architecture::componentStudio", process := "Design::processFullModelExtrapolationInPrismBuilder"}) } definition{ name: msgIdeaToAProvedApp42, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 42, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processBuildPhaseInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 42, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processCanonicalModelInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp43, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 43, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processBuildPhaseInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 43, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processCanonicalModelInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp44, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 44, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processExperienceRulesInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 44, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processFeatureCompositionInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp45, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 45, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processExperienceRulesInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 45, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processFeatureCompositionInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp46, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 46, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processVersionsAndPreviewInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 46, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processBuildPhaseInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp47, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 47, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processVersionsAndPreviewInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 47, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processBuildPhaseInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp48, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 48, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processVersionsAndPreviewInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 48, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processExperienceRulesInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp49, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 49, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processVersionsAndPreviewInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 49, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processExperienceRulesInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp50, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 50, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowPreview"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 50, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processVersionsAndPreviewInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp51, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 51, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowPreview"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 51, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processVersionsAndPreviewInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp52, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 52, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processStatefulAppsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 52, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processVersionsAndPreviewInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp53, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 53, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processStatefulAppsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 53, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processVersionsAndPreviewInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp54, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 54, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processStatefulAppsInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 54, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowPreview"}) } definition{ name: msgIdeaToAProvedApp55, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 55, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processStatefulAppsInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 55, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowPreview"}) } definition{ name: msgIdeaToAProvedApp56, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 56, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processEventAdmissionInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 56, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processStatefulAppsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp57, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 57, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processEventAdmissionInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 57, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processStatefulAppsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp58, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 58, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processEventAdmissionInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 58, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processStatefulAppsInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp59, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 59, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processEventAdmissionInDeviceStore"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 59, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processStatefulAppsInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp60, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 60, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processBuildsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 60, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processEventAdmissionInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp61, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 61, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processBuildsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 61, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processEventAdmissionInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp62, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 62, source := "Architecture::componentStudio", target := "Architecture::componentOriginKernelWorker", process := "Design::processBuildsInOriginKernelWorker"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 62, source := "Architecture::componentStudio", target := "Architecture::componentDeviceStore", process := "Design::processEventAdmissionInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp63, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 63, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processExperienceBudgetsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 63, source := "Architecture::componentDeviceStore", target := "Architecture::componentStudio", process := "Design::processEventAdmissionInDeviceStore"}) } definition{ name: msgIdeaToAProvedApp64, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 64, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processExperienceBudgetsInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 64, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processBuildsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp65, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 65, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowProofStatus"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 65, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processBuildsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp66, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 66, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowProofStatus"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 66, source := "Architecture::componentStudio", target := "Architecture::componentOriginKernelWorker", process := "Design::processBuildsInOriginKernelWorker"}) } definition{ name: msgIdeaToAProvedApp67, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 67, source := "Architecture::componentStudio", target := "Architecture::componentLeanChecker", process := "Design::processProofInLeanChecker"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 67, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processExperienceBudgetsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp68, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 68, source := "Architecture::componentLeanChecker", target := "Architecture::componentStudio", process := "Design::processProofInLeanChecker"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 68, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processExperienceBudgetsInFoundryKernelGuest"}) } definition{ name: msgIdeaToAProvedApp69, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 69, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processProofInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 69, source := "Architecture::componentBrowser", target := "Architecture::componentStudio", process := "Design::processShowProofStatus"}) } definition{ name: msgIdeaToAProvedApp70, parameters: [], result: Foundation.Arch::UmlMessage, - body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 70, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processProofInFoundryKernelGuest"}) + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 70, source := "Architecture::componentStudio", target := "Architecture::componentBrowser", process := "Design::processShowProofStatus"}) +} + +definition{ + name: msgIdeaToAProvedApp71, + parameters: [], + result: Foundation.Arch::UmlMessage, + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 71, source := "Architecture::componentStudio", target := "Architecture::componentLeanChecker", process := "Design::processProofInLeanChecker"}) +} + +definition{ + name: msgIdeaToAProvedApp72, + parameters: [], + result: Foundation.Arch::UmlMessage, + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 72, source := "Architecture::componentLeanChecker", target := "Architecture::componentStudio", process := "Design::processProofInLeanChecker"}) +} + +definition{ + name: msgIdeaToAProvedApp73, + parameters: [], + result: Foundation.Arch::UmlMessage, + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 73, source := "Architecture::componentStudio", target := "Architecture::componentFoundryKernelGuest", process := "Design::processProofInFoundryKernelGuest"}) +} + +definition{ + name: msgIdeaToAProvedApp74, + parameters: [], + result: Foundation.Arch::UmlMessage, + body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlIdeaToAProvedApp", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 74, source := "Architecture::componentFoundryKernelGuest", target := "Architecture::componentStudio", process := "Design::processProofInFoundryKernelGuest"}) } definition{ diff --git a/app/src/Features.lex.tex b/app/src/Features.lex.tex index da38cec4..e775b924 100644 --- a/app/src/Features.lex.tex +++ b/app/src/Features.lex.tex @@ -25,6 +25,7 @@ \importmodule{VersionPreviewProtocol} \importmodule{WorkOwnership} \importmodule{WorkProtocol} +\importmodule{Workspace} \importmodule{Architecture} \importmodule{Foundation.Arch} \title{feature} @@ -1338,6 +1339,27 @@ body: "crates/conformance/tests/kernel_owner_handoff.rs::kernel_owner_handoff_fa_75" } +definition{ + name: acceptWorkspaceWorkspaceWordsOwnerOpens, + parameters: [], + result: String, + body: "Workspace::workspaceWords_ownerOpens" +} + +definition{ + name: acceptWorkspaceWorkspaceWordsAnotherIdRefused, + parameters: [], + result: String, + body: "Workspace::workspaceWords_anotherIdRefused" +} + +definition{ + name: acceptWorkspaceWorkspaceWordsTamperedRecordRefused, + parameters: [], + result: String, + body: "Workspace::workspaceWords_tamperedRecordRefused" +} + definition{ name: testFA88, parameters: [], @@ -1345,6 +1367,13 @@ body: "crates/conformance/tests/prism_id.rs::prism_id_fa_88" } +definition{ + name: testFA91, + parameters: [], + result: String, + body: "crates/conformance/tests/in_tab_kernel_verdict.rs::private_workspace_fa_91" +} + definition{ name: testFA61, parameters: [], @@ -1643,7 +1672,7 @@ name: featurePrismId, parameters: [], result: Foundation.Arch::Feature, - body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay.", calls := (cons "FoundrySpecification::prismIdBoundary" (nil String)), acceptance := (cons "Features::testFA88" (nil String))}) + body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (nil String))))))}) } definition{ @@ -1671,7 +1700,7 @@ name: screenStudioShell, parameters: [], result: Foundation.Arch::Feature, - body: (record Foundation.Arch::Feature {statement := "Studio shell screen, for the app builder: Foundry opens at once in the tab: the sidebar, the title bar and the Prism frame, with no sign-in and the shell served from its verified closure.", calls := (cons "Features::featureShellIntegrity" (cons "Features::featureWindowsAndTools" (cons "Features::featureHostBoundary" (cons "Features::featurePrivateTelemetry" (cons "Features::featureProjectStore" (cons "Features::featureChat" (cons "Features::featureLibrariesAndSettings" (cons "Features::featureOwnLanguageAndReasoning" (cons "Features::featureReleaseIntegration" (cons "Features::featureEffectGate" (cons "Features::featurePrismId" (nil String)))))))))))), acceptance := (cons "Features::acceptStudioShellBudget" (cons "Features::featureShellIntegrity" (cons "Features::featureWindowsAndTools" (cons "Features::featureHostBoundary" (cons "Features::featurePrivateTelemetry" (cons "Features::featureProjectStore" (cons "Features::featureChat" (cons "Features::featureLibrariesAndSettings" (cons "Features::featureOwnLanguageAndReasoning" (cons "Features::featureReleaseIntegration" (cons "Features::featureEffectGate" (cons "Features::featurePrismId" (nil String)))))))))))))}) + body: (record Foundation.Arch::Feature {statement := "Studio shell screen, for the app builder: Foundry opens at once in the tab: the sidebar, with Search (a centred palette over the apps and chats in memory, Ctrl or Cmd K) under Home, More for the items the visitor tucks away (Edit sidebar) and the Prism frame's Prism ID panel at its foot, and the title bar, with no sign-in and the shell served from its verified closure.", calls := (cons "Features::featureShellIntegrity" (cons "Features::featureWindowsAndTools" (cons "Features::featureHostBoundary" (cons "Features::featurePrivateTelemetry" (cons "Features::featureProjectStore" (cons "Features::featureChat" (cons "Features::featureLibrariesAndSettings" (cons "Features::featureOwnLanguageAndReasoning" (cons "Features::featureReleaseIntegration" (cons "Features::featureEffectGate" (cons "Features::featurePrismId" (nil String)))))))))))), acceptance := (cons "Features::acceptStudioShellBudget" (cons "Features::featureShellIntegrity" (cons "Features::featureWindowsAndTools" (cons "Features::featureHostBoundary" (cons "Features::featurePrivateTelemetry" (cons "Features::featureProjectStore" (cons "Features::featureChat" (cons "Features::featureLibrariesAndSettings" (cons "Features::featureOwnLanguageAndReasoning" (cons "Features::featureReleaseIntegration" (cons "Features::featureEffectGate" (cons "Features::featurePrismId" (nil String)))))))))))))}) } definition{ diff --git a/app/src/ForgeKernel.lex.tex b/app/src/ForgeKernel.lex.tex index 8fb84805..06733398 100644 --- a/app/src/ForgeKernel.lex.tex +++ b/app/src/ForgeKernel.lex.tex @@ -15,6 +15,7 @@ \importmodule{VersionPreviewProtocol} \importmodule{InTabKernelProtocol} \importmodule{RuleJudge} +\importmodule{Workspace} \importmodule{FeatureComposition} \importmodule{CompositionProtocol} \importmodule{CompositionFixtures} @@ -637,7 +638,7 @@ } definition{ - name: dispatchApplication, + name: dispatchProtocols, parameters: [value : Bytes], result: Bytes, body: (if (prim equal (sliceOf value 0 5) 0x7265616420 : Bool) then (IdeaReader::readIdea (sliceOf value 5 (prim subtract (Foundation.Bytes::byteLength value) 5 : Nat))) else (if (prim equal (sliceOf value 0 8) 0x7072657669657720 : Bool) then (VersionPreviewProtocol::dispatchPreview (sliceOf value 8 (prim subtract (Foundation.Bytes::byteLength value) 8 : Nat))) else (if (prim equal (sliceOf value 0 6) 0x717565756520 : Bool) then (ChatQueueProtocol::dispatchQueue (sliceOf value 6 (prim subtract (Foundation.Bytes::byteLength value) 6 : Nat))) else (if (prim equal (sliceOf value 0 8) 0x70726f706f736520 : Bool) then (RoutingProtocol::dispatchRouting (sliceOf value 8 (prim subtract (Foundation.Bytes::byteLength value) 8 : Nat))) else (if (prim equal (sliceOf value 0 9) 0x696e74657261637420 : Bool) then (InteractionProtocol::dispatchInteraction (sliceOf value 9 (prim subtract (Foundation.Bytes::byteLength value) 9 : Nat))) else (if (prim equal (sliceOf value 0 6) 0x6576656e7420 : Bool) then (EventProtocol::dispatchEvent (sliceOf value 6 (prim subtract (Foundation.Bytes::byteLength value) 6 : Nat))) else (if (prim equal (sliceOf value 0 5) 0x776f726b20 : Bool) then (WorkProtocol::dispatchWork (sliceOf value 5 (prim subtract (Foundation.Bytes::byteLength value) 5 : Nat))) else (if (prim equal (sliceOf value 0 8) 0x636f6d706f736520 : Bool) then (CompositionProtocol::dispatchComposition (sliceOf value 8 (prim subtract (Foundation.Bytes::byteLength value) 8 : Nat))) else (if (64 = 9); } + +/// `FA-91`: A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal +#[test] +fn private_workspace_fa_91() { + // Lean proves every workspaceWords theorem by evaluation (`just app`) and the kernel gate replays + // each as an acceptance vector in the compiled guest; this holds the two to each other and to dispatch. + let workspace = include_str!("../../../app/src/Workspace.lex.tex"); + let kernel = include_str!("../../../app/src/ForgeKernel.lex.tex"); + assert!(kernel.contains("(Workspace::dispatchWorkspace (sliceOf value 10")); + let theorems = workspace.matches("name: workspaceWords_").count(); + assert_eq!(theorems, kernel.matches("request := 0x776f726b737061636520").count()); + assert!(theorems >= 19 && kernel.contains("(workspaceAcceptance))))")); +} diff --git a/features/suites/private-workspace.feature b/features/suites/private-workspace.feature new file mode 100644 index 00000000..06b97ff4 --- /dev/null +++ b/features/suites/private-workspace.feature @@ -0,0 +1,9 @@ +Feature: private-workspace + + @FA-91 @build + Scenario: A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal + Given the Workspace module in Foundry's Prism kernel, reached by the workspace request prefix + When the kernel is asked to open a workspace, read or store a record, move the workspace kept before an id, or remove its plain copy + Then it answers ok only for the owning id on a device with a live session and the current boundary key, for an authentic record in its place, for a sealed record within quota, for a first move, and for a removal after the sealed copy is committed + And every other request is refused by name, a removed device first, and a wrong version, a trailing word or an unknown kind is malformedWorkspaceRequest + And each answer is a theorem Lean proves by evaluation and an acceptance vector the compiled guest replays diff --git a/model/ids.toml b/model/ids.toml index b6939872..0c14870f 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -861,3 +861,9 @@ id = "FA-90" level = "build" suite = "rule-judge" statement = "A published app's answer is decided by the rule judge in Foundry's Prism kernel: the first rule whose conditions all hold decides, otherwise decides when none does, and a request outside the fields' bounds is refused" + +[[id]] +id = "FA-91" +level = "build" +suite = "private-workspace" +statement = "A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal" diff --git a/site/app.json b/site/app.json index f2441967..b0c6dcd3 100644 --- a/site/app.json +++ b/site/app.json @@ -2,7 +2,7 @@ "name": "Foundry kernel", "shortName": "Foundry", "live": "https://uor-foundation.github.io/foundry/app/", - "purpose": "Decide the next build phase of a Prism AI Foundry app, and whether an origin may use an effect. Send phase and event separated by a space, and it answers drafting, checked, proving, proved or published. Send gate, then origin, effect, whether a grant record exists, whether it grants and whether it denies, and it answers allow or deny. Anything else gets invalid request.", + "purpose": "Decide the next build phase of a Prism Foundry app, and whether an origin may use an effect. Send phase and event separated by a space, and it answers drafting, checked, proving, proved or published. Send gate, then origin, effect, whether a grant record exists, whether it grants and whether it denies, and it answers allow or deny. Anything else gets invalid request.", "inputLabel": "Request: phase event, or gate origin effect record granted denied", "placeholder": "drafting check", "submitLabel": "Decide", @@ -29,7 +29,7 @@ "proposition": { "name": "judge", "text": "judge request :=\n event is edit → drafting\n event is check and phase is drafting → checked\n event is approve and phase is checked → proving\n event is attest and phase is proving → proved\n event is fail and phase is proving → checked\n event is publish and phase is proved → published\n phase is drafting → drafting\n phase is checked → checked\n phase is proving → proving\n phase is proved → proved\n otherwise → published", - "plain": "Decide the next build phase of a Prism AI Foundry app from its current phase and the event that just happened." + "plain": "Decide the next build phase of a Prism Foundry app from its current phase and the event that just happened." }, "theorems": [ { diff --git a/studio/scripts/stamp_shell.py b/studio/scripts/stamp_shell.py index 72340a42..17430a9f 100644 --- a/studio/scripts/stamp_shell.py +++ b/studio/scripts/stamp_shell.py @@ -37,7 +37,7 @@ for name in ("package.json", "tailwind.config.ts", "index.html", "AI_RULES.md"): if (src / name).exists(): shutil.copy(src / name, dst / name) -# The product is Prism AI Foundry: the staged scaffold's words say so (the badge, the link); the vendored tree is untouched. +# The product is Prism Foundry: the staged scaffold's words say so (the badge, the link); the vendored tree is untouched. WORD = re.compile(r"\bDyad\b") for p in dst.rglob("*"): if p.is_file() and p.suffix in (".tsx", ".ts", ".md", ".html", ".json"): diff --git a/studio/shell/host.js b/studio/shell/host.js index 084f0e09..b6b1ca11 100644 --- a/studio/shell/host.js +++ b/studio/shell/host.js @@ -890,13 +890,6 @@ async function stepSpec(appId, way) { catch (e) { liveEditors.delete(appId); await refreshLive(appId); refuse(appId, null, e.message); throw e; } }); } -// What the user points at, said to the agent with the request, so "make this cheaper" has a "this". -function pointedNote(appId) { - const p = livePointed.get(appId); - if (!p) return ""; - const paths = Object.entries(p.edit).filter(([, v]) => Array.isArray(v)).map(([slot, v]) => `${slot} at ${JSON.stringify(v)}`).join("; "); - return `\n\n(The user is pointing at the ${p.kind} "${p.text}" on the screen${paths ? ": " + paths : ""}. To change it, write a .)`; -} // The built page takes the preview back from the live frame (an app's first turn opened the frame, then // wrote code, not rules): announced as a restart, so the renderer forgets the live frame's route. async function showBuilt(appId) { @@ -1149,19 +1142,6 @@ const djb2 = (str) => { let h = 5381; for (let i = 0; i < str.length; i++) h = ( const now = () => new Date().toISOString(); async function messagesOf(chatId) { const c = await get("chats", chatId); return c ? c.messages : []; } async function saveMessages(chatId, messages) { return updateStoredChat(await dbReady, chatId, { messages }); } -// What the model is shown of the project: every path, and the source of the files a visitor's app -// is made of; the shadcn ui library files are named, not pasted, since the model knows them. -async function codebaseOf(appId, source) { - const captured = source ? new Map(source.files) : null; - const paths = captured ? [...captured.keys()] : await filesOf(appId); - const parts = []; - for (const p of paths) { - if (p.startsWith("src/components/ui/")) continue; - const c = captured ? captured.get(p) : await get("files", appId + ":" + p); - parts.push(`\n${c}\n`); - } - return "Files in the project:\n" + paths.join("\n") + "\n\n" + parts.join("\n\n"); -} // ---- proved rules. An app that decides something carries prism/spec.json, a Prism spec. Its build // phase (drafting, checked, proving, proved, published) is the Forge kernel's answer, never this // file's: the kernel is the Prism app whose state machine Lean proves (FK-01 to FK-04), so the chat diff --git a/studio/shell/live/lexlean.mjs b/studio/shell/live/lexlean.mjs index e016112b..bcb863d0 100644 --- a/studio/shell/live/lexlean.mjs +++ b/studio/shell/live/lexlean.mjs @@ -18,7 +18,6 @@ import { names, declarations, proofDeclarations, declarationText } from "../pris if (!globalThis.Buffer) globalThis.Buffer = { from: (bytes) => ({ toString: () => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("") }) }; const kebab = (pascal) => pascal.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase(); -const pascalOf = (word) => word.split(/[^a-z0-9]+/i).filter(Boolean).map((w) => w[0].toUpperCase() + w.slice(1)).join(""); // ---- writing diff --git a/studio/shell/live/obligations.mjs b/studio/shell/live/obligations.mjs index 3586745a..650c72f4 100644 --- a/studio/shell/live/obligations.mjs +++ b/studio/shell/live/obligations.mjs @@ -9,7 +9,6 @@ // the obligations whose key is new; every other one is a hit. That cache is the delta. const cache = new Map(); // key -> null (holds) | witness point -export const cacheStats = () => ({ size: cache.size }); // Keys are UOR content addresses: BLAKE3 of the obligation's canonical bytes, as everywhere in Foundry. import { kappa } from "../prism-code/src/blake3.mjs"; diff --git a/studio/shell/prism.js b/studio/shell/prism.js index 436f2302..b25196f0 100644 --- a/studio/shell/prism.js +++ b/studio/shell/prism.js @@ -71,7 +71,6 @@ Example: ${SPEC_EXAMPLE}` + PROMPT_RULES; export const wroteLexLean = (text) => String(text || "").includes(""); /** A model's turn without the LexLean it wrote. */ export const withoutLexLean = (text) => String(text || "").replace(/[\s\S]*?(<\/prism-lexlean>|$)/g, ""); -export const LEXLEAN_REFUSED = "**LexLean not applied.** An app is written as its JSON spec, and Forge writes the LexLean module from it; a module a model writes is not used."; /** * What a model is shown of a decision app: its current spec, as the JSON it writes, or that there is @@ -91,25 +90,13 @@ export function moduleContext(source) { } export const CODE_REFUSED = "**Code not applied.** The app's code and screen are drawn from its LexLean module; files a model writes are not used."; -// ---- the device. The on-device model holds about 3,000 tokens and writes at most 900, so it is asked -// for the one thing it can write well, the rules, and Forge draws the screen from them (screenSource). -const DEVICE_RULES = `You write the rules of a small decision app as JSON. Reply with one block and nothing else. -Keys: "title"; "purpose" (one sentence); "fields" (1 to 8; each {"name": a lower-case word, "kind": "number" with "min" and "max", or "choice" with "values"}); "outcomes" (the answer words); "rules" (in order, the first that matches decides; each {"when": [{"field", "op", "value"}], "then"}); "otherwise"; "properties" (what must never or always happen; each {"kind": "never" or "always", "when": [...], "then"}); "examples" (each {"request": "the field values separated by spaces", "response"}). -"op" is "is" or "is not" for a choice field, and "<", "<=", ">", ">=" or "=" for a number field. Numbers are whole. -Example: -{"title":"Parking fee tier","purpose":"Decide the fee tier from hours parked and vehicle.","fields":[{"name":"hours","kind":"number","min":0,"max":24},{"name":"vehicle","kind":"choice","values":["car","motorcycle","truck"]}],"outcomes":["free","standard","premium"],"rules":[{"when":[{"field":"hours","op":"=","value":0}],"then":"free"},{"when":[{"field":"vehicle","op":"is","value":"truck"}],"then":"premium"}],"otherwise":"standard","properties":[{"kind":"never","when":[{"field":"hours","op":"=","value":0}],"then":"premium"}],"examples":[{"request":"0 truck","response":"free"},{"request":"3 car","response":"standard"}]}`; -export function deviceRequest(prompt, currentSpec) { - const ask = currentSpec ? `The app's rules now:\n${JSON.stringify(JSON.parse(currentSpec))}\n\nWrite the whole new rules for this change: ${prompt}` : prompt; - // /no_think: the rules model is a Qwen3, which otherwise reasons aloud until its 900 tokens are gone. - return [{ role: "system", content: DEVICE_RULES + "\nWrite each rule once. Write at most 4 examples. /no_think" }, { role: "user", content: ask + " /no_think" }]; -} // What the device wrote, without a reasoning block the model may still open. export const withoutThinking = (text) => (text || "").replace(/[\s\S]*?(<\/think>|$)/g, "").trim(); // The screen Forge writes when the rules check and no page uses them yet: a form with one input per // field, answered by decide(). It reads everything from the rules module, so it never goes stale. export function screenSource() { - return `// Written by Prism AI Foundry: a form for the app's rules. The answer comes from decide(), the rules Lean proves. + return `// Written by Prism Foundry: a form for the app's rules. The answer comes from decide(), the rules Lean proves. import { useState } from "react"; import { decide, FIELDS, SPEC } from "@/lib/prism"; @@ -295,14 +282,13 @@ export const INTERPRETER_PARTS = Object.freeze([prismAnswer.toString(), prismDec export const INTERPRETER = INTERPRETER_PARTS.join("\n") + "\n"; function moduleSource(spec, vectors) { - return `// Generated by Prism AI Foundry from prism/spec.json. Do not edit: change the rules in the chat. + return `// Generated by Prism Foundry from prism/spec.json. Do not edit: change the rules in the chat. // Lean proves the guarantees about these rules. This module answers with the same rules; Forge // replayed all ${vectors} acceptance vectors through it before writing it. export const SPEC = ${JSON.stringify(spec, null, 2)}; ${INTERPRETER_PARTS[0]} ${INTERPRETER_PARTS[1]} export const FIELDS = SPEC.fields; -export const OUTCOMES = SPEC.outcomes; /** The answer for one set of field values: an outcome word, or "invalid". */ export function decide(values) { return prismDecide(SPEC, values); } /** The answer for one request line, the field values separated by spaces. */ @@ -869,7 +855,6 @@ export { requestLimits }; // order. The grammar fixes form, never meaning: which fields, rules and answers the request needs is the // model's, and the checker and the approval card still judge them. // specGrammarCheck(text) -> "fail" (no spec starts with text), "partial" (some does), "done" (text is a whole spec) -export const SPEC_GRAMMAR_ID = "prism-spec-1/device-1"; const END = { end: true }, FAIL = { fail: true }; const NUM_OPS = ["<", "<=", ">", ">=", "=", "!="], CHOICE_OPS = ["is", "is not"]; const RESERVED = new Set(["invalid", "never", "always"]); diff --git a/studio/shell/prism/builder/build.mjs b/studio/shell/prism/builder/build.mjs index ec97b7f4..379a83f9 100644 --- a/studio/shell/prism/builder/build.mjs +++ b/studio/shell/prism/builder/build.mjs @@ -226,6 +226,4 @@ export async function buildApp(input, { lastModified, specAddress } = {}) { return { files, remove: [...TEMPLATE_EXAMPLE], model: m, claims }; } -/** One line per claim, for a summary: what Lean proves about the app. */ -export const claimLines = (claims) => claims.map((c) => `${c.id}: ${c.statement}`); export { describeConditions }; diff --git a/studio/tools/application_main_integration.test.mjs b/studio/tools/application_main_integration.test.mjs index 5bb529cb..e1ebb005 100644 --- a/studio/tools/application_main_integration.test.mjs +++ b/studio/tools/application_main_integration.test.mjs @@ -5,7 +5,7 @@ import {test} from 'node:test'; const read=p=>fs.readFileSync(new URL('../../'+p,import.meta.url),'utf8'); test('combined canonical dispatcher retains every application protocol and experience family',()=>{ const model=read('app/src/ForgeKernel.lex.tex');for(const name of ['dispatchPreview','dispatchQueue','dispatchRouting','dispatchInteraction','dispatchEvent','dispatchWork','dispatchComposition','budgetWithin','layoutTabs','motionAllows','targetOk','recentYes','thinkAllows','IdeaReader::readIdea'])assert.ok(model.includes(name)); - assert.ok(model.includes('acceptanceVectors := (verdictAcceptance)'));assert.ok(model.includes('responseMaximum := (4096 : UInt32)'));assert.equal((model.match(/request :=/g)||[]).length,336);assert.ok(model.includes('(acceptanceExperience)')); + assert.ok(model.includes('acceptanceVectors := (verdictAcceptance)'));assert.ok(model.includes('responseMaximum := (4096 : UInt32)'));assert.equal((model.match(/request :=/g)||[]).length,355);assert.ok(model.includes('(acceptanceExperience)')); }); test('integration retains every feature registration and the main experience proof obligations',()=>{ const ids=read('model/ids.toml');const retired=new Set([4,11,16,34,45,47]);for(let n=1;n<=59;n++)assert.equal(ids.includes('id = "FA-'+String(n).padStart(2,'0')+'"'),!retired.has(n)); diff --git a/studio/tools/current_main_integration.test.mjs b/studio/tools/current_main_integration.test.mjs index 90f71d7f..0371ee97 100644 --- a/studio/tools/current_main_integration.test.mjs +++ b/studio/tools/current_main_integration.test.mjs @@ -82,7 +82,7 @@ test("proof completion follows matching logic and refuses a competing commit", a test("live persistence failure discards optimistic history and reloads committed state", async () => { const source = { files: [["prism/spec.json", JSON.stringify(initial)]] }, editors = new Map([[1, createEditor(initial, () => ({ ok: true }))]]); let refreshed = 0, refused = 0; - const patch = fn("patchSpec", "// What the user points", { + const patch = fn("patchSpec", "async function stepSpec(", { structuredClone, requestAnimationFrame: (f) => setTimeout(f, 0), setTimeout, liveEditors: editors, liveBusy: new Map(), pushLive() {}, applyOps, inOrder: (_, job) => job(), assertGenerationActive, captureProjectSource: async () => source, dbReady: Promise.resolve(), editorOf: async (_, captured) => { assert.equal(captured, source); return editors.get(1); }, rulesOf: async () => proved(), @@ -112,7 +112,7 @@ test("invalid live edits redraw with source-bound publication trust", async () = kappa: async () => "current", pushLive: (_, __, value) => { trust = value; }, }); const editor = createEditor(initial, () => ({ ok: false, issues: ["invalid"] })); - const patch = fn("patchSpec", "// What the user points", { + const patch = fn("patchSpec", "async function stepSpec(", { structuredClone, requestAnimationFrame: (f) => setTimeout(f, 0), setTimeout, liveEditors: new Map([[1, editor]]), liveBusy: new Map(), applyOps, pushLive: (_, __, value) => { trust = value; }, inOrder: (_, job) => job(), assertGenerationActive, dbReady: Promise.resolve(), captureProjectSource: async () => ({}), diff --git a/studio/tools/foundry_model.mjs b/studio/tools/foundry_model.mjs index 4d1d86c1..2d1237ae 100644 --- a/studio/tools/foundry_model.mjs +++ b/studio/tools/foundry_model.mjs @@ -504,7 +504,7 @@ export function deriveFoundry({ product = JSON.parse(read("app/product.json")) } { standard: "ISO/IEC 25010:2023", subject: "Product quality", text: `All ${characteristics.length} characteristics and ${subcharacteristics.length} subcharacteristics are declared; each is stated by a requirement with a measure or listed open (${openSubcharacteristics.length} open); every budget and experience rule of the kernel is a measure whose threshold is the kernel's term.`, evidence: ["Quality::qualityModelHolds", "Quality::openSubcharacteristicCount"] }, { standard: "ISO/IEC 27034-1:2011, ISO/IEC 27005:2022 and STRIDE per element", subject: "Application security and risk", text: `Every threat has a STRIDE category and a mapped control with evidence, or an accepted risk with its rationale; every category STRIDE per element opens on the ${elements.length} components and data flows is answered by a threat or stated open (${strideOpen.length} open).`, evidence: ["Security::strideEnumerated", "Security::strideOpenCount", "Security::controlSet"] }, { standard: "Prism R4 (afflom/me app/specs/r4)", subject: "Own language and reasoning", text: "Every chat turn is decided by R4 before its request is made and before its answer is shown; Foundry grants no route, so only its own model answers.", evidence: r4Proofs }, - ...obligations.map((o) => ({ standard: "Prism AI Foundry specification", subject: o.name, text: o.text, evidence: ["FoundrySpecification::requirement"] })), + ...obligations.map((o) => ({ standard: "Prism Foundry specification", subject: o.name, text: o.text, evidence: ["FoundrySpecification::requirement"] })), { standard: `SPDX ${product.license}`, subject: "Licensing", text: `Foundry and its model are offered under ${product.license}.`, evidence: ["ForgeKernel::application"] }, ]; for (const ref of r4Proofs) modules.add(ref.split("::")[0]); diff --git a/studio/vendor/dyad/VENDORED.md b/studio/vendor/dyad/VENDORED.md index 19b9481d..84085187 100644 --- a/studio/vendor/dyad/VENDORED.md +++ b/studio/vendor/dyad/VENDORED.md @@ -31,7 +31,9 @@ Changes to reused files are listed here, one line each, so upstream can be track - The ui components are shadcn/ui new-york-v4 as the Hologram brand kit vendors it, not upstream's (`hologram.ui.mjs`, ours, used by `vite.shell.config.mts`): every import of a name the kit has (`@/components/ui/button`, or a relative `./ui/button`) resolves to the kit's file under `vendor/shadcn-ui/registry/new-york-v4/` (written by `tools/live_components.mjs --vendor`, digests in `vendor/shadcn-ui/VENDORED.sha256`), and the build refuses a bundle that holds Base UI or upstream's copy of a kit component. Upstream's own `src/components/ui/*` are untouched and never shipped; its five components the kit does not have (`ColorPicker`, `LoadingBar`, `NumberInput`, `SimpleAvatar`, `back-button`) are kept and are built from the kit's. Tailwind scans the kit's directory (`@source`, added to `globals.css` at build). - Every screen's calls to those components are rewritten at build from Base UI's props to Radix's (`hologram.radix.mjs`, ours): `render={}` and `as` become `asChild`, Accordion and ToggleGroup take `type`, `TooltipProvider delay` is `delayDuration`, `closeOnClick={false}` is `onSelect` preventing default, `keepMounted` is `forceMount`, a `SelectValue` render function is called with its Select's value, `MiniSelectTrigger` is the kit's `SelectTrigger` at `size="sm"`, a `CommandDialog` filter goes on a cmdk `Command` inside it, a relative ui import names `@/components/ui/`. The vendored files are untouched. `hologram.typecheck.mjs` (ours, with `tsconfig.hologram.json` and `tsconfig.hologram.dyad.json`) typechecks the rewritten screens against the kit's components and refuses an error upstream's own sources do not have, or a call the rewrite could not convert. - Featured app types are emitted from `shell/featured-apps.mjs` and its `hologram.featured-apps.mjs` re-export by the lockfile's TypeScript compiler, through `hologram.featured-apps.types.mjs --write`. The resulting `.d.mts` pair is checked without writes before the projected typecheck. `hologram.featured-apps.types.test.mjs` covers missing/stale declarations, export drift, broken re-exports and mandatory CI wiring; Studio runs it and the complete projected typecheck after verified shell closure and corpus. See `verification/featured-app-types.md` at the repository root. -- The shell's own screens, after shadcn's dashboard-01 block and built only from the kit's components, through `hologram.screens.mjs` (ours, applied by `vite.shell.config.mts` and by the typecheck): `src/components/app-sidebar.tsx` is replaced whole by `hologram.screens/AppSidebar.tsx` (an inset sidebar that collapses to icons: Prism's mark, a triangle of three faces drawn in the text colour, and the name "Prism AI Foundry" (collapsed to icons, the mark alone, centred over the icons), New app, Home, Apps, Templates, Library, Plugins, the user's apps with the open app's chats, Settings and Help, plus the site header), and `src/pages/apps.tsx` by `hologram.screens/AppsPage.tsx` (section cards with trend badges from the apps' and chats' own dates, tabs with counts, a data table with row selection, a row menu and upstream's bulk delete, and upstream's collection views and dialogs). `src/components/ui/back-button.tsx` is replaced by `hologram.screens/BackButton.tsx`, which draws nothing: the site header carries a breadcrumb (the kit's Breadcrumb) to the page above. Each is compiled at the path of the file it replaces. Patches, each refusing the build if its passage is gone (a retag patch renames one element and its closing tag, found by the TypeScript parser): `src/pages/settings.tsx` draws each settings section as the kit's Card and drops its own title (the header names the page); `src/pages/plugins.tsx`, `src/pages/templates.tsx` and `src/pages/library-home.tsx` take the inset's page spacing and keep their description and actions without a second title; `src/pages/app-details.tsx` sits on the kit's Card instead of a box styled as one, and shows its dates as dates; `src/app/layout.tsx` puts the page in the sidebar's `SidebarInset` under the site header and opens the sidebar by default; `src/components/ZoomSelector.tsx` names the chosen level's label alone in the trigger (Radix shows the chosen item whole, description included). `hologram.env.d.ts` (ours) types an imported `.svg` for the typecheck. +- One search (Ctrl or Cmd K, and Search under Home in the sidebar): `src/components/AppSearchDialog.tsx` is replaced at build by ours (`hologram.screens/SearchDialog.tsx`), a centred command palette over the apps and chats already in memory, which the home input's app picker also opens. Upstream's file is reduced to a pointer, since the build never compiles it. +- `src/components/app-sidebar.tsx`, which `hologram.screens/AppSidebar.tsx` replaces whole at build, is likewise reduced to a pointer with its typed export. Ours adds Search under Home, More (the items the visitor tucks away, and Edit sidebar, kept in localStorage `holo.sidebar.v1`) and Prism ID at the foot. +- The shell's own screens, after shadcn's dashboard-01 block and built only from the kit's components, through `hologram.screens.mjs` (ours, applied by `vite.shell.config.mts` and by the typecheck): `src/components/app-sidebar.tsx` is replaced whole by `hologram.screens/AppSidebar.tsx` (an inset sidebar that collapses to icons: Prism's mark, a triangle of three faces drawn in the text colour, and the name "Prism Foundry" (collapsed to icons, the mark alone, centred over the icons), New app, Home, Apps, Templates, Library, Plugins, the user's apps with the open app's chats, Settings and Help, plus the site header), and `src/pages/apps.tsx` by `hologram.screens/AppsPage.tsx` (section cards with trend badges from the apps' and chats' own dates, tabs with counts, a data table with row selection, a row menu and upstream's bulk delete, and upstream's collection views and dialogs). `src/components/ui/back-button.tsx` is replaced by `hologram.screens/BackButton.tsx`, which draws nothing: the site header carries a breadcrumb (the kit's Breadcrumb) to the page above. Each is compiled at the path of the file it replaces. Patches, each refusing the build if its passage is gone (a retag patch renames one element and its closing tag, found by the TypeScript parser): `src/pages/settings.tsx` draws each settings section as the kit's Card and drops its own title (the header names the page); `src/pages/plugins.tsx`, `src/pages/templates.tsx` and `src/pages/library-home.tsx` take the inset's page spacing and keep their description and actions without a second title; `src/pages/app-details.tsx` sits on the kit's Card instead of a box styled as one, and shows its dates as dates; `src/app/layout.tsx` puts the page in the sidebar's `SidebarInset` under the site header and opens the sidebar by default; `src/components/ZoomSelector.tsx` names the chosen level's label alone in the trigger (Radix shows the chosen item whole, description included). `hologram.env.d.ts` (ours) types an imported `.svg` for the typecheck. - `src/pages/chat.tsx`, through `hologram.screens.mjs`: on a phone (the kit's `useIsMobile`, the sidebar's own 768 px breakpoint) the build screen returns `hologram.screens/MobileBuild.tsx` (ours, kit components only) instead of the two resizable panels: one pane at a time (chat, or the preview panel in its preview or publish mode, both kept mounted) and a bottom bar with back to the apps and Chat / Preview / Publish as the kit's `Tabs`. Two patches: one import line, and `const isMobile = useIsMobile(); if (isMobile) return ;` before the `PanelGroup`. Wider screens are unchanged. - The composer's + menu (`src/components/chat/AuxiliaryActionsMenu.tsx`), through `hologram.screens.mjs`: its Attach files and Themes submenus open in the kit's `DropdownMenuPortal`, and scroll within the screen when long. Inside the menu, which scrolls and is transformed while it animates in, they were clipped to its box, so their items could not be seen. The menu opens from the + at the composer's left (`align="start"`, 8 px from the screen's edge). A `showImport` prop adds "Import app" to the menu, opening the shell's `ImportAppDialog`. `src/components/chat/HomeChatInput.tsx` passes it, and `src/pages/home.tsx` drops its Import App button and that button's import, so Home's one entry point is the composer. The build screen's composer has no Import app item. - `package.json`, `package-lock.json`: `radix-ui` 1.6.7 added, exactly as the brand kit's showcase pins it (the kit's components import it); npm moved the `@radix-ui/*` packages upstream already had through `cmdk` and `vaul` to the versions it requires, and `react-remove-scroll` from 2.7.1 to 2.7.2. diff --git a/studio/vendor/dyad/hologram.screens.mjs b/studio/vendor/dyad/hologram.screens.mjs index 8b90b6d0..914e7fd6 100644 --- a/studio/vendor/dyad/hologram.screens.mjs +++ b/studio/vendor/dyad/hologram.screens.mjs @@ -29,6 +29,8 @@ export const SCREENS = { "src/hooks/useAppThumbnails.ts": "hologram.screens/useAppThumbnails.ts", // The home's floor: the apps already made, or, before the first one, the gallery's templates. "src/components/FeaturedAppShowcase.tsx": "hologram.screens/FeaturedAppShowcase.tsx", + // One search: the sidebar's palette, which the home input's app picker also opens. + "src/components/AppSearchDialog.tsx": "hologram.screens/SearchDialog.tsx", }; // A page's body in the inset, as dashboard-01 spaces it: the site header names the page, so the page keeps diff --git a/studio/vendor/dyad/hologram.screens/AppSidebar.tsx b/studio/vendor/dyad/hologram.screens/AppSidebar.tsx index e262aea3..439be25c 100644 --- a/studio/vendor/dyad/hologram.screens/AppSidebar.tsx +++ b/studio/vendor/dyad/hologram.screens/AppSidebar.tsx @@ -2,16 +2,20 @@ // src/components/app-sidebar.tsx (hologram.screens.mjs; it is compiled at that path, so its imports // resolve as upstream's did). The structure is shadcn's dashboard-01 block: an // inset sidebar that collapses to icons, a primary action, the main navigation, the user's apps, and -// Settings and Help at the foot. Every part is the kit's shadcn/ui component; upstream's hooks and atoms +// Settings, Help and Prism ID at the foot, Search (Ctrl or Cmd K) under +// Home, and More, which holds the items the visitor tucks away (Edit sidebar). Every part is the kit's shadcn/ui component; upstream's hooks and atoms // supply the data and the navigation, so the screens behind it are unchanged. import { BookOpen, Blocks, CirclePlus, + CircleUserRound, + Ellipsis, HelpCircle, House, LayoutGrid, Menu, + Search, Settings, Star, Store, @@ -19,10 +23,11 @@ import { } from "lucide-react"; import { Link, useLocation, useNavigate, useRouter } from "@tanstack/react-router"; import { useAtomValue, useSetAtom } from "jotai"; -import { Fragment, useEffect, useMemo } from "react"; +import { Fragment, useEffect, useMemo, useState } from "react"; import { selectedAppIdAtom } from "@/atoms/appAtoms"; import { selectedChatIdAtom } from "@/atoms/chatAtoms"; +import { AppSearchDialog } from "@/components/AppSearchDialog"; import { helpDialogAtom } from "@/atoms/helpDialogAtom"; import { HelpDialog } from "@/components/HelpDialog"; import { useChats } from "@/hooks/useChats"; @@ -37,6 +42,10 @@ import { BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; +import { Button } from "@/components/ui/button"; +import { Checkbox } from "@/components/ui/checkbox"; +import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { Separator } from "@/components/ui/separator"; import { Sidebar, @@ -61,7 +70,7 @@ import { // The product's name, the same word the build's word transform (vite.shell.config.mts) writes on every // upstream screen. const PRODUCT = "Prism"; -const TITLE = `${PRODUCT} AI Foundry`; +const TITLE = `${PRODUCT} Foundry`; // Prism's mark: a triangle split into three lit faces. It is drawn in the text colour at three // strengths, so it follows every appearance without a colour of its own. @@ -75,6 +84,26 @@ function PrismMark({ className }: { className?: string }) { ); } +// Prism ID is the Prism frame's own panel, so Foundry keeps the one id every Prism app keeps. The frame is +// fetched on the first reach for it and run only if its bytes match its pointer's SHA-256, as an app page +// runs it (site/app.mjs). It stays off screen: its panel is a centred popover in the top layer. +const FRAME_HOST = "https://uor-foundation.github.io/template/frame/"; +let prismFrame: Promise | null = null; +async function loadPrismFrame() { + const pointer = await (await fetch(new URL("current.json", FRAME_HOST), { cache: "no-cache" })).json(); + const bytes = await (await fetch(new URL(pointer.module, FRAME_HOST))).arrayBuffer(); + const digest = Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes)), (b) => b.toString(16).padStart(2, "0")).join(""); + if (!/^[0-9a-f]{64}$/.test(pointer.sha256 ?? "") || digest !== pointer.sha256) throw Object.assign(new Error("prismFrameUnverified"), { code: "prismFrameUnverified" }); + await import(/* @vite-ignore */ URL.createObjectURL(new Blob([bytes], { type: "text/javascript" }))); + const frame = document.createElement("prism-frame"); + frame.style.cssText = "position:fixed;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)"; + return document.body.appendChild(frame); +} +function openPrismId() { + prismFrame ??= loadPrismFrame().catch((error) => { prismFrame = null; throw error; }); + prismFrame.then((frame) => frame.shadowRoot?.getElementById("account-panel")?.showPopover(), (error) => console.warn(`Prism id: ${error.code ?? error}`)); +} + type Nav = { title: string; to: string; icon: LucideIcon; exact?: boolean }; const NAV: Nav[] = [ { title: "Home", to: "/", icon: House, exact: true }, @@ -83,6 +112,16 @@ const NAV: Nav[] = [ { title: "Library", to: "/library", icon: BookOpen }, { title: "Plugins", to: "/plugins", icon: Blocks }, ]; +// What the visitor keeps in the sidebar; the rest waits under More. Home, Search and Apps always stay. The choice is a +// convenience of this browser, so it lives in localStorage and a page without it shows the defaults. +const SIDEBAR_KEY = "holo.sidebar.v1"; +const OPTIONAL = ["/templates", "/library", "/plugins"]; +function readShown(): string[] { + try { + const saved = JSON.parse(localStorage.getItem(SIDEBAR_KEY) ?? "null"); + return Array.isArray(saved) ? saved.filter((to) => OPTIONAL.includes(to)) : ["/library"]; + } catch { return ["/library"]; } +} const RECENT_APPS = 8; const RECENT_CHATS = 6; @@ -124,6 +163,20 @@ export function AppSidebar() { const setHelpDialog = useSetAtom(helpDialogAtom); const setSelectedAppId = useSetAtom(selectedAppIdAtom); const setSelectedChatId = useSetAtom(selectedChatIdAtom); + const [searching, setSearching] = useState(false); + const [shown, setShown] = useState(readShown); + const [editing, setEditing] = useState(false); + const toggle = (to: string) => setShown((was) => { + const next = was.includes(to) ? was.filter((t) => t !== to) : [...was, to]; + try { localStorage.setItem(SIDEBAR_KEY, JSON.stringify(next)); } catch {} + return next; + }); + const tucked = NAV.filter((n) => OPTIONAL.includes(n.to) && !shown.includes(n.to)); + const { apps } = useLoadApps(); + const openApp = useOpenApp(); + const { selectChat } = useSelectChat(); + const byRecency = useMemo(() => [...apps].sort((a, b) => +new Date(b.updatedAt) - +new Date(a.updatedAt)) + .map((a) => ({ id: a.id, name: a.name, createdAt: a.createdAt, matchedChatTitle: null, matchedChatMessage: null })), [apps]); const newApp = () => { setSelectedAppId(null); @@ -162,16 +215,45 @@ export function AppSidebar() { - {NAV.map((item) => ( - - - - - {item.title} - - - + {NAV.filter((n) => !tucked.includes(n)).map((item) => ( + + + + + + {item.title} + + + + {item.to === "/" && ( + + setSearching(true)}> + + Search + + + )} + ))} + + + + + + More + + + + {tucked.map((item) => ( + + {item.title} + + ))} + {tucked.length > 0 && } + setEditing(true)}>Edit sidebar… + + + @@ -194,9 +276,37 @@ export function AppSidebar() { + + + + Prism ID + + + selectChat({ chatId, appId })} onNewApp={newApp} /> + + + + Edit sidebar + Choose which items appear in your sidebar. The rest stay under More. + +
+ {NAV.filter((n) => OPTIONAL.includes(n.to)).map((item) => ( + + ))} +
+ + + +
+
); } diff --git a/studio/vendor/dyad/hologram.screens/SearchDialog.tsx b/studio/vendor/dyad/hologram.screens/SearchDialog.tsx new file mode 100644 index 00000000..ea1008a7 --- /dev/null +++ b/studio/vendor/dyad/hologram.screens/SearchDialog.tsx @@ -0,0 +1,90 @@ +// hologram-forge (ours, not upstream's; see VENDORED.md): the shell's one search, in place of +// src/components/AppSearchDialog.tsx (hologram.screens.mjs). A centred palette, as the kit's command dialog +// draws it. The apps and chats are already in memory, so it filters as you type, with no debounce and no +// round trip. From the home input it picks an app; from the sidebar it also finds chats and starts an app. +import { useEffect, useState } from "react"; +import { CirclePlus, LayoutGrid, MessageSquare } from "lucide-react"; +import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command"; +import { useChats } from "@/hooks/useChats"; +import type { AppSearchResult } from "@/lib/schemas"; + +const TABS = ["All", "Apps", "Chats"] as const; +const RECENT = 6; + +export function AppSearchDialog({ open, onOpenChange, onSelectApp, allApps, disableShortcut, onSelectChat, onNewApp }: { + open: boolean; + onOpenChange: (open: boolean) => void; + onSelectApp: (appId: number) => void; + allApps: AppSearchResult[]; + disableShortcut?: boolean; + onSelectChat?: (chatId: number, appId: number) => void; + onNewApp?: () => void; +}) { + const [tab, setTab] = useState<(typeof TABS)[number]>("All"); + const [query, setQuery] = useState(""); + const { chats } = useChats(null); + useEffect(() => { + if (disableShortcut) return; + const down = (e: KeyboardEvent) => { + if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); onOpenChange(!open); } + }; + document.addEventListener("keydown", down); + return () => document.removeEventListener("keydown", down); + }, [open, onOpenChange, disableShortcut]); + // Opening starts clean: an empty query shows the recent ones. + useEffect(() => { if (open) { setQuery(""); setTab("All"); } }, [open]); + const searching = query.trim() !== ""; + const names = new Map(allApps.map((a) => [a.id, a.name])); + const apps = tab === "Chats" ? [] : searching ? allApps : allApps.slice(0, RECENT); + const recent = [...chats].sort((a, b) => +new Date(b.createdAt) - +new Date(a.createdAt)); + const found = !onSelectChat || tab === "Apps" ? [] : searching ? recent : recent.slice(0, RECENT); + const then = (act: () => void) => () => { onOpenChange(false); act(); }; + return ( + + + {onSelectChat && ( +
+ {TABS.map((t) => ( + + ))} +
+ )} + {/* A fixed height, so the box never jumps while the results change under the cursor. */} + + No results + {apps.length > 0 && ( + + {apps.map((app) => ( + onSelectApp(app.id))} data-testid={`app-search-item-${app.id}`}> + + {app.name} + + ))} + + )} + {found.length > 0 && ( + + {found.map((chat) => ( + onSelectChat?.(chat.id, chat.appId))}> + + {chat.title || "New chat"} + {names.get(chat.appId) !== chat.title && {names.get(chat.appId)}} + + ))} + + )} + {onNewApp && tab === "All" && ( + + + + New app + + + )} + +
+ ); +} diff --git a/studio/vendor/dyad/src/components/AppSearchDialog.tsx b/studio/vendor/dyad/src/components/AppSearchDialog.tsx index 69ced8ed..e68c648f 100644 --- a/studio/vendor/dyad/src/components/AppSearchDialog.tsx +++ b/studio/vendor/dyad/src/components/AppSearchDialog.tsx @@ -1,156 +1,6 @@ -import { - CommandDialog, - CommandInput, - CommandList, - CommandEmpty, - CommandGroup, - CommandItem, -} from "./ui/command"; -import { useState, useEffect } from "react"; -import { useSearchApps } from "@/hooks/useSearchApps"; +// Upstream's app search dialog is replaced whole at build by the shell's one search, +// hologram.screens/SearchDialog.tsx (hologram.screens.mjs SCREENS), so its body is not kept here; it is +// upstream's src/components/AppSearchDialog.tsx at the commit VENDORED.md names. The path and its typed export +// stay, so imports resolve and the typecheck's upstream baseline is upstream's own. import type { AppSearchResult } from "@/lib/schemas"; - -type AppSearchDialogProps = { - open: boolean; - onOpenChange: (open: boolean) => void; - onSelectApp: (appId: number) => void; - allApps: AppSearchResult[]; - disableShortcut?: boolean; -}; - -export function AppSearchDialog({ - open, - onOpenChange, - onSelectApp, - allApps, - disableShortcut, -}: AppSearchDialogProps) { - const [searchQuery, setSearchQuery] = useState(""); - function useDebouncedValue(value: T, delay: number): T { - const [debounced, setDebounced] = useState(value); - useEffect(() => { - const handle = setTimeout(() => setDebounced(value), delay); - return () => clearTimeout(handle); - }, [value, delay]); - return debounced; - } - - const debouncedQuery = useDebouncedValue(searchQuery, 150); - const { apps: searchResults } = useSearchApps(debouncedQuery); - - // Show all apps if search is empty, otherwise show search results - const appsToShow: AppSearchResult[] = - debouncedQuery.trim() === "" ? allApps : searchResults; - - const commandFilter = ( - value: string, - search: string, - keywords?: string[], - ): number => { - const q = search.trim().toLowerCase(); - if (!q) return 1; - const v = (value || "").toLowerCase(); - if (v.includes(q)) { - // Higher score for earlier match in title/value - return 100 - Math.max(0, v.indexOf(q)); - } - const foundInKeywords = (keywords || []).some((k) => - (k || "").toLowerCase().includes(q), - ); - return foundInKeywords ? 50 : 0; - }; - - function getSnippet( - text: string, - query: string, - radius = 50, - ): { - before: string; - match: string; - after: string; - raw: string; - } { - const q = query.trim(); - const lowerText = text.toLowerCase(); - const lowerQuery = q.toLowerCase(); - const idx = lowerText.indexOf(lowerQuery); - if (idx === -1) { - const raw = - text.length > radius * 2 ? text.slice(0, radius * 2) + "…" : text; - return { before: "", match: "", after: "", raw }; - } - const start = Math.max(0, idx - radius); - const end = Math.min(text.length, idx + q.length + radius); - const before = (start > 0 ? "…" : "") + text.slice(start, idx); - const match = text.slice(idx, idx + q.length); - const after = - text.slice(idx + q.length, end) + (end < text.length ? "…" : ""); - return { before, match, after, raw: before + match + after }; - } - - useEffect(() => { - if (disableShortcut) return; - const down = (e: KeyboardEvent) => { - if (e.key === "k" && (e.metaKey || e.ctrlKey)) { - e.preventDefault(); - onOpenChange(!open); - } - }; - document.addEventListener("keydown", down); - return () => document.removeEventListener("keydown", down); - }, [open, onOpenChange, disableShortcut]); - - return ( - - - - - No results found. - - - {appsToShow.map((app) => { - const isSearch = searchQuery.trim() !== ""; - let snippet = null; - if (isSearch && app.matchedChatMessage) { - snippet = getSnippet(app.matchedChatMessage, searchQuery); - } else if (isSearch && app.matchedChatTitle) { - snippet = getSnippet(app.matchedChatTitle, searchQuery); - } - return ( - onSelectApp(app.id)} - value={app.name + (snippet ? ` ${snippet.raw}` : "")} - keywords={snippet ? [snippet.raw] : []} - data-testid={`app-search-item-${app.id}`} - > -
- {app.name} - {snippet && ( - - {snippet.before} - - {snippet.match} - - {snippet.after} - - )} -
-
- ); - })} -
-
-
- ); -} +export function AppSearchDialog(_: { open: boolean; onOpenChange: (open: boolean) => void; onSelectApp: (appId: number) => void; allApps: AppSearchResult[]; disableShortcut?: boolean }) { return null; } diff --git a/studio/vendor/dyad/src/components/app-sidebar.tsx b/studio/vendor/dyad/src/components/app-sidebar.tsx index d79abb14..6275f755 100644 --- a/studio/vendor/dyad/src/components/app-sidebar.tsx +++ b/studio/vendor/dyad/src/components/app-sidebar.tsx @@ -1,385 +1,5 @@ -import { - type LucideIcon, - Home, - Settings, - HelpCircle, - Store, - BookOpen, - Blocks, -} from "lucide-react"; -import { Link, useNavigate, useRouterState } from "@tanstack/react-router"; -import { useSidebar } from "@/components/ui/sidebar"; // import useSidebar hook -import { useCallback, useEffect, useRef, useState } from "react"; -import type { ComponentType } from "react"; -import { AnimatePresence, motion } from "framer-motion"; -import { useAtom, useAtomValue, useSetAtom } from "jotai"; -import { dropdownOpenAtom } from "@/atoms/uiAtoms"; -import { selectedAppIdAtom } from "@/atoms/appAtoms"; -import { selectedChatIdAtom } from "@/atoms/chatAtoms"; - -import { - Sidebar, - SidebarContent, - SidebarFooter, - SidebarGroup, - SidebarGroupContent, - SidebarMenu, - SidebarMenuItem, - SidebarTrigger, -} from "@/components/ui/sidebar"; -import { cn } from "@/lib/utils"; -import { ChatList } from "./ChatList"; -import { AppList } from "./AppList"; -import { HelpDialog } from "./HelpDialog"; -import { helpDialogAtom } from "@/atoms/helpDialogAtom"; -import { SettingsList } from "./SettingsList"; -import { LibraryList } from "./LibraryList"; -import { - type AppSidebarHoverState, - type AppSidebarItemTitle, - getSelectedSidebarPanel, - isSidebarItemActive, - shouldExpandSidebarForHover, - shouldShowSelectedAppChatList, -} from "./app-sidebar-state"; - -const SIDEBAR_COLLAPSE_DELAY_MS = 300; - -// Menu items. -const items = [ - { - title: "Apps", - to: "/", - icon: Home, - }, - { - title: "Settings", - to: "/settings", - icon: Settings, - }, - { - title: "Library", - to: "/library", - icon: BookOpen, - }, - { - title: "Templates", - to: "/templates", - icon: Store, - }, - { - title: "Plugins", - to: "/plugins", - icon: Blocks, - }, -] satisfies Array<{ - title: AppSidebarItemTitle; - to: string; - icon: ComponentType<{ className?: string }>; -}>; - -type AppSidebarItemTo = (typeof items)[number]["to"]; - -function AppSidebarRailButton({ - icon: Icon, - label, - isExpanded, - isActive = false, - to, - onClick, - onMouseEnter, -}: { - icon: LucideIcon; - label: string; - isExpanded: boolean; - isActive?: boolean; - to?: AppSidebarItemTo; - onClick?: () => void; - onMouseEnter?: () => void; -}) { - const className = cn( - "group/rail-button relative mb-1 flex h-10 items-center justify-center rounded-xl outline-none transition-[width,background-color] duration-200 ease-linear focus-visible:ring-2 focus-visible:ring-sidebar-ring", - isExpanded ? "w-14" : "w-10", - isActive - ? "bg-primary/15" - : "hover:bg-sidebar-accent active:bg-sidebar-accent", - ); - const content = ( - <> - - - - - {label} - - - ); - - if (to) { - return ( - - {content} - - ); - } - - return ( - - ); -} - -export function AppSidebar() { - const { state, toggleSidebar } = useSidebar(); // retrieve current sidebar state - const [hoverState, setHoverState] = - useState("no-hover"); - const expandedByHover = useRef(false); - const isPointerOverSidebar = useRef(false); - const collapseTimer = useRef | null>(null); - const setHelpDialog = useSetAtom(helpDialogAtom); - const [isDropdownOpen] = useAtom(dropdownOpenAtom); - const selectedAppId = useAtomValue(selectedAppIdAtom); - const setSelectedAppId = useSetAtom(selectedAppIdAtom); - const setSelectedChatId = useSetAtom(selectedChatIdAtom); - const navigate = useNavigate(); - - const cancelPendingCollapse = useCallback(() => { - if (collapseTimer.current !== null) { - clearTimeout(collapseTimer.current); - collapseTimer.current = null; - } - }, []); - - useEffect(() => cancelPendingCollapse, [cancelPendingCollapse]); - - useEffect(() => { - if ( - shouldExpandSidebarForHover({ - hoverState, - sidebarState: state, - isPointerOverSidebar: isPointerOverSidebar.current, - }) - ) { - expandedByHover.current = true; - toggleSidebar(); - } else if ( - hoverState.startsWith("start-hover") && - state === "collapsed" && - !isPointerOverSidebar.current - ) { - cancelPendingCollapse(); - expandedByHover.current = false; - setHoverState("no-hover"); - } - if ( - hoverState === "clear-hover" && - state === "expanded" && - expandedByHover.current && - !isDropdownOpen - ) { - toggleSidebar(); - expandedByHover.current = false; - setHoverState("no-hover"); - } - }, [ - hoverState, - toggleSidebar, - state, - setHoverState, - isDropdownOpen, - cancelPendingCollapse, - ]); - - const routerState = useRouterState(); - const selectedItem = getSelectedSidebarPanel({ - hoverState, - sidebarState: state, - pathname: routerState.location.pathname, - }); - const showSelectedAppChats = shouldShowSelectedAppChatList({ - selectedPanel: selectedItem, - selectedAppId, - pathname: routerState.location.pathname, - }); - - const handleViewAllApps = () => { - setSelectedAppId(null); - setSelectedChatId(null); - navigate({ to: "/" }); - }; - - return ( - { - isPointerOverSidebar.current = true; - cancelPendingCollapse(); - setHoverState((current) => - current === "clear-hover" ? "no-hover" : current, - ); - }} - onMouseLeave={() => { - isPointerOverSidebar.current = false; - if (!isDropdownOpen) { - cancelPendingCollapse(); - collapseTimer.current = setTimeout(() => { - collapseTimer.current = null; - setHoverState("clear-hover"); - }, SIDEBAR_COLLAPSE_DELAY_MS); - } - }} - > - -
- {/* Left Column: Icon rail */} -
- { - setHoverState("clear-hover"); - }} - /> - -
- {/* Right Column: Contextual sub-list (only visible when expanded) */} -
- - {selectedItem === "Apps" && !showSelectedAppChats && ( - - - - )} - {showSelectedAppChats && ( - - - - )} - - - -
-
-
- - - - - setHelpDialog({ open: true })} - /> - - - - -
- ); -} - -function AppIcons({ - onHoverChange, - isExpanded, -}: { - onHoverChange: (state: AppSidebarHoverState) => void; - isExpanded: boolean; -}) { - const routerState = useRouterState(); - const pathname = routerState.location.pathname; - - const hoverForTitle = (title: AppSidebarItemTitle): AppSidebarHoverState => { - switch (title) { - case "Apps": - return "start-hover:app"; - case "Settings": - return "start-hover:settings"; - case "Library": - return "start-hover:library"; - default: - // Items without a sub-list (Templates, Plugins) dismiss any open - // preview so a stale list doesn't linger while hovering an unrelated icon. - return "clear-hover"; - } - }; - - return ( - - - - {items.map((item) => { - const isActive = isSidebarItemActive({ - title: item.title, - pathname, - }); - - return ( - - onHoverChange(hoverForTitle(item.title))} - /> - - ); - })} - - - - ); -} +// Upstream's sidebar is replaced whole at build by the shell's, hologram.screens/AppSidebar.tsx +// (hologram.screens.mjs SCREENS), so its body is not kept here; it is upstream's src/components/app-sidebar.tsx +// at the commit VENDORED.md names. The path and its typed export stay, so imports resolve and the typecheck's +// upstream baseline is upstream's own. +export function AppSidebar() { return null; } diff --git a/studio/vendor/dyad/vite.shell.config.mts b/studio/vendor/dyad/vite.shell.config.mts index f8bb2628..43d3d4bb 100644 --- a/studio/vendor/dyad/vite.shell.config.mts +++ b/studio/vendor/dyad/vite.shell.config.mts @@ -5,7 +5,7 @@ // npx vite build --config vite.shell.config.mts --base --outDir dist --emptyOutDir // then python3 ../../scripts/stamp_shell.py copies dist/assets into shell/assets. // -// The product is Prism AI Foundry, and the assistant in it is Prism: at build time every standalone "Dyad" word in the renderer's sources, +// The product is Prism Foundry, and the assistant in it is Prism: at build time every standalone "Dyad" word in the renderer's sources, // locales and markdown becomes "Prism", and upstream's logo becomes Hologram's mark. Identifiers // (DyadError, dyad-write, __dyadIpcEnvelope) are untouched, so the contracts with the host hold. // diff --git a/verification/private-workspace.md b/verification/private-workspace.md new file mode 100644 index 00000000..6bbe9df9 --- /dev/null +++ b/verification/private-workspace.md @@ -0,0 +1,54 @@ +# Private workspace + +Authority: `FA-91` in `model/ids.toml`, scenario in `features/suites/private-workspace.feature`. + +A visitor's work in Foundry is meant to be theirs alone: sealed on their devices under their Prism ID's +boundary key, and opened only for that ID. `app/src/Workspace.lex.tex` holds the decisions, and Foundry's Prism +kernel answers them: `ForgeKernel::dispatch` sends a request that starts with `workspace ` to +`Workspace::dispatchWorkspace` (through `dispatchApplication`, ahead of the protocols, so the in-tab verdict's +entry stays as `studio/tools/in_tab_verdict_author.mjs` writes it). + +The kernel answers five kinds of request: open a workspace, read a record, store a record, move the workspace +kept before an ID, and remove its plain copy. Each answer is `ok` or the first refusal, by name: +`workspaceDeviceRemoved`, `workspaceSessionExpired`, `workspaceNotOwner`, `workspaceKeyStale`, `workspaceClosed`, +`recordTampered`, `recordMisplaced`, `recordUnsealed`, `workspaceQuotaExceeded`, `workspaceAlreadyMoved`, +`sealedCopyNotCommitted`. Any other shape is `malformedWorkspaceRequest`; more than 128 bytes is +`workspaceRequestTooLarge`. `workspaceWireBoundary` states the wire. + +Two kinds of evidence: + +- Eight theorems, each that no request meets a `breaks` condition: a workspace opens only for its owner, only + with the current key, only with a live session, never on a removed device; a record is read only when + authentic and in place, stored only sealed and within quota; the move happens at most once; the plain copy goes + only after the sealed copy is committed. +- Nineteen `workspaceWords_` theorems Lean proves by evaluation, each also an acceptance vector the compiled guest + replays (`workspaceAcceptance`, ahead of `ruleAcceptance`). They cover every answer, plus a wrong version, a + trailing word and an unknown kind. + +`private_workspace_fa_91` in `crates/conformance/tests/in_tab_kernel_verdict.rs` holds the two together and to +dispatch: the dispatch arm is present, and the number of `workspaceWords_` theorems equals the number of workspace +vectors in the kernel (at least 19). `studio/tools/application_main_integration.test.mjs` counts every acceptance +vector in the kernel, now 355. + +`npx prism-code verify --lean --local` in `app/` verified all 42 modules (attestation +`dcc25ea17350c5d1d40968b11c45d07bcff7199e36e6f8ca9a1d675b595e25b0`). + +Mutation, 2026-11-16: + +1. The decision. Removing the owner check from `openCode` made `npx prism-code verify --lean --local` fail: Lean + rejected `workspaceWords_anotherIdRefused` (`src/Workspace.lex.tex:216`), which expects `workspaceNotOwner`. + Restored, byte-identical to the verified module. +2. The vectors. Dropping one workspace vector from `workspaceAcceptance` in `app/src/ForgeKernel.lex.tex` made + `cargo test -p repo-conformance --test in_tab_kernel_verdict` fail: `private_workspace_fa_91` panicked with + `left: 19, right: 18`. Restored, 3 passed. + +What this does not establish. The decisions are proved and the kernel answers them; nothing asks yet. No Studio +code sends a `workspace ` request, seals a record with the Prism ID's boundary key, or scopes the browser store +to an ID, so no visitor's workspace is private until that host work lands. Whether a device was removed, a +session is live or sealed bytes are authentic is the host's to compute from stitch's Prism ID +(`identity/prism-id.mjs`: `sealPrivate`, `openPrivate`) and Hologram's `seal_bytes` and `open_bytes`. + +Where it was run. `prismpm --project app verify` in the SDK image `prismpm.lock` pins did not finish on this +machine: its Lean stage allows 600 seconds, and compiling the SDK's runtime from cold took longer before reaching +any project module (`PP5007: application-lean timed out`). The proofs above used `prism-code` 0.8.0 with the +local Lean toolchain; CI runs the gate in the SDK image. From 158a30eeccb3fa36f126c6fbf679e7377a590be5 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:52:02 +0000 Subject: [PATCH 2/5] Keep the ratchet: the palette lives in the sidebar file, upstream's search dialog returns The non-Prism ratchet refuses any new non-Prism file, so the Search palette moves into hologram.screens/AppSidebar.tsx and upstream's AppSearchDialog.tsx is restored byte for byte. The home input's app picker is upstream's again. Co-Authored-By: Claude Opus 5.5 --- studio/vendor/dyad/VENDORED.md | 3 +- studio/vendor/dyad/hologram.screens.mjs | 2 - .../dyad/hologram.screens/AppSidebar.tsx | 90 +++++++++- .../dyad/hologram.screens/SearchDialog.tsx | 90 ---------- .../dyad/src/components/AppSearchDialog.tsx | 160 +++++++++++++++++- 5 files changed, 244 insertions(+), 101 deletions(-) delete mode 100644 studio/vendor/dyad/hologram.screens/SearchDialog.tsx diff --git a/studio/vendor/dyad/VENDORED.md b/studio/vendor/dyad/VENDORED.md index 84085187..18376856 100644 --- a/studio/vendor/dyad/VENDORED.md +++ b/studio/vendor/dyad/VENDORED.md @@ -31,8 +31,7 @@ Changes to reused files are listed here, one line each, so upstream can be track - The ui components are shadcn/ui new-york-v4 as the Hologram brand kit vendors it, not upstream's (`hologram.ui.mjs`, ours, used by `vite.shell.config.mts`): every import of a name the kit has (`@/components/ui/button`, or a relative `./ui/button`) resolves to the kit's file under `vendor/shadcn-ui/registry/new-york-v4/` (written by `tools/live_components.mjs --vendor`, digests in `vendor/shadcn-ui/VENDORED.sha256`), and the build refuses a bundle that holds Base UI or upstream's copy of a kit component. Upstream's own `src/components/ui/*` are untouched and never shipped; its five components the kit does not have (`ColorPicker`, `LoadingBar`, `NumberInput`, `SimpleAvatar`, `back-button`) are kept and are built from the kit's. Tailwind scans the kit's directory (`@source`, added to `globals.css` at build). - Every screen's calls to those components are rewritten at build from Base UI's props to Radix's (`hologram.radix.mjs`, ours): `render={}` and `as` become `asChild`, Accordion and ToggleGroup take `type`, `TooltipProvider delay` is `delayDuration`, `closeOnClick={false}` is `onSelect` preventing default, `keepMounted` is `forceMount`, a `SelectValue` render function is called with its Select's value, `MiniSelectTrigger` is the kit's `SelectTrigger` at `size="sm"`, a `CommandDialog` filter goes on a cmdk `Command` inside it, a relative ui import names `@/components/ui/`. The vendored files are untouched. `hologram.typecheck.mjs` (ours, with `tsconfig.hologram.json` and `tsconfig.hologram.dyad.json`) typechecks the rewritten screens against the kit's components and refuses an error upstream's own sources do not have, or a call the rewrite could not convert. - Featured app types are emitted from `shell/featured-apps.mjs` and its `hologram.featured-apps.mjs` re-export by the lockfile's TypeScript compiler, through `hologram.featured-apps.types.mjs --write`. The resulting `.d.mts` pair is checked without writes before the projected typecheck. `hologram.featured-apps.types.test.mjs` covers missing/stale declarations, export drift, broken re-exports and mandatory CI wiring; Studio runs it and the complete projected typecheck after verified shell closure and corpus. See `verification/featured-app-types.md` at the repository root. -- One search (Ctrl or Cmd K, and Search under Home in the sidebar): `src/components/AppSearchDialog.tsx` is replaced at build by ours (`hologram.screens/SearchDialog.tsx`), a centred command palette over the apps and chats already in memory, which the home input's app picker also opens. Upstream's file is reduced to a pointer, since the build never compiles it. -- `src/components/app-sidebar.tsx`, which `hologram.screens/AppSidebar.tsx` replaces whole at build, is likewise reduced to a pointer with its typed export. Ours adds Search under Home, More (the items the visitor tucks away, and Edit sidebar, kept in localStorage `holo.sidebar.v1`) and Prism ID at the foot. +- `src/components/app-sidebar.tsx`, which `hologram.screens/AppSidebar.tsx` replaces whole at build, is reduced to a pointer with its typed export, since the build never compiles it. Ours adds Search under Home (a centred palette over the apps and chats in memory, Ctrl or Cmd K), More (the items the visitor tucks away, and Edit sidebar, kept in localStorage `holo.sidebar.v1`) and Prism ID at the foot. - The shell's own screens, after shadcn's dashboard-01 block and built only from the kit's components, through `hologram.screens.mjs` (ours, applied by `vite.shell.config.mts` and by the typecheck): `src/components/app-sidebar.tsx` is replaced whole by `hologram.screens/AppSidebar.tsx` (an inset sidebar that collapses to icons: Prism's mark, a triangle of three faces drawn in the text colour, and the name "Prism Foundry" (collapsed to icons, the mark alone, centred over the icons), New app, Home, Apps, Templates, Library, Plugins, the user's apps with the open app's chats, Settings and Help, plus the site header), and `src/pages/apps.tsx` by `hologram.screens/AppsPage.tsx` (section cards with trend badges from the apps' and chats' own dates, tabs with counts, a data table with row selection, a row menu and upstream's bulk delete, and upstream's collection views and dialogs). `src/components/ui/back-button.tsx` is replaced by `hologram.screens/BackButton.tsx`, which draws nothing: the site header carries a breadcrumb (the kit's Breadcrumb) to the page above. Each is compiled at the path of the file it replaces. Patches, each refusing the build if its passage is gone (a retag patch renames one element and its closing tag, found by the TypeScript parser): `src/pages/settings.tsx` draws each settings section as the kit's Card and drops its own title (the header names the page); `src/pages/plugins.tsx`, `src/pages/templates.tsx` and `src/pages/library-home.tsx` take the inset's page spacing and keep their description and actions without a second title; `src/pages/app-details.tsx` sits on the kit's Card instead of a box styled as one, and shows its dates as dates; `src/app/layout.tsx` puts the page in the sidebar's `SidebarInset` under the site header and opens the sidebar by default; `src/components/ZoomSelector.tsx` names the chosen level's label alone in the trigger (Radix shows the chosen item whole, description included). `hologram.env.d.ts` (ours) types an imported `.svg` for the typecheck. - `src/pages/chat.tsx`, through `hologram.screens.mjs`: on a phone (the kit's `useIsMobile`, the sidebar's own 768 px breakpoint) the build screen returns `hologram.screens/MobileBuild.tsx` (ours, kit components only) instead of the two resizable panels: one pane at a time (chat, or the preview panel in its preview or publish mode, both kept mounted) and a bottom bar with back to the apps and Chat / Preview / Publish as the kit's `Tabs`. Two patches: one import line, and `const isMobile = useIsMobile(); if (isMobile) return ;` before the `PanelGroup`. Wider screens are unchanged. - The composer's + menu (`src/components/chat/AuxiliaryActionsMenu.tsx`), through `hologram.screens.mjs`: its Attach files and Themes submenus open in the kit's `DropdownMenuPortal`, and scroll within the screen when long. Inside the menu, which scrolls and is transformed while it animates in, they were clipped to its box, so their items could not be seen. The menu opens from the + at the composer's left (`align="start"`, 8 px from the screen's edge). A `showImport` prop adds "Import app" to the menu, opening the shell's `ImportAppDialog`. `src/components/chat/HomeChatInput.tsx` passes it, and `src/pages/home.tsx` drops its Import App button and that button's import, so Home's one entry point is the composer. The build screen's composer has no Import app item. diff --git a/studio/vendor/dyad/hologram.screens.mjs b/studio/vendor/dyad/hologram.screens.mjs index 914e7fd6..8b90b6d0 100644 --- a/studio/vendor/dyad/hologram.screens.mjs +++ b/studio/vendor/dyad/hologram.screens.mjs @@ -29,8 +29,6 @@ export const SCREENS = { "src/hooks/useAppThumbnails.ts": "hologram.screens/useAppThumbnails.ts", // The home's floor: the apps already made, or, before the first one, the gallery's templates. "src/components/FeaturedAppShowcase.tsx": "hologram.screens/FeaturedAppShowcase.tsx", - // One search: the sidebar's palette, which the home input's app picker also opens. - "src/components/AppSearchDialog.tsx": "hologram.screens/SearchDialog.tsx", }; // A page's body in the inset, as dashboard-01 spaces it: the site header names the page, so the page keeps diff --git a/studio/vendor/dyad/hologram.screens/AppSidebar.tsx b/studio/vendor/dyad/hologram.screens/AppSidebar.tsx index 439be25c..fcc7f177 100644 --- a/studio/vendor/dyad/hologram.screens/AppSidebar.tsx +++ b/studio/vendor/dyad/hologram.screens/AppSidebar.tsx @@ -15,6 +15,7 @@ import { House, LayoutGrid, Menu, + MessageSquare, Search, Settings, Star, @@ -27,10 +28,11 @@ import { Fragment, useEffect, useMemo, useState } from "react"; import { selectedAppIdAtom } from "@/atoms/appAtoms"; import { selectedChatIdAtom } from "@/atoms/chatAtoms"; -import { AppSearchDialog } from "@/components/AppSearchDialog"; import { helpDialogAtom } from "@/atoms/helpDialogAtom"; import { HelpDialog } from "@/components/HelpDialog"; import { useChats } from "@/hooks/useChats"; +import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command"; +import type { AppSearchResult } from "@/lib/schemas"; import { useLoadApps } from "@/hooks/useLoadApps"; import { useOpenApp } from "@/hooks/useOpenApp"; import { useSelectChat } from "@/hooks/useSelectChat"; @@ -285,7 +287,7 @@ export function AppSidebar() { - selectChat({ chatId, appId })} onNewApp={newApp} /> @@ -457,3 +459,87 @@ export function MobileTabBar() { ); } + +// The shell's one search (Ctrl or Cmd K, and Search under Home): a centred palette, as the kit's command dialog +// draws it. The apps and chats are already in memory, so it filters as you type, with no debounce and no round +// trip. Recent ones show before a query; New app is always one choice away. +const SEARCH_TABS = ["All", "Apps", "Chats"] as const; +const RECENT_FOUND = 6; + +function SearchPalette({ open, onOpenChange, onSelectApp, allApps, disableShortcut, onSelectChat, onNewApp }: { + open: boolean; + onOpenChange: (open: boolean) => void; + onSelectApp: (appId: number) => void; + allApps: AppSearchResult[]; + disableShortcut?: boolean; + onSelectChat?: (chatId: number, appId: number) => void; + onNewApp?: () => void; +}) { + const [tab, setTab] = useState<(typeof SEARCH_TABS)[number]>("All"); + const [query, setQuery] = useState(""); + const { chats } = useChats(null); + useEffect(() => { + if (disableShortcut) return; + const down = (e: KeyboardEvent) => { + if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); onOpenChange(!open); } + }; + document.addEventListener("keydown", down); + return () => document.removeEventListener("keydown", down); + }, [open, onOpenChange, disableShortcut]); + // Opening starts clean: an empty query shows the recent ones. + useEffect(() => { if (open) { setQuery(""); setTab("All"); } }, [open]); + const searching = query.trim() !== ""; + const names = new Map(allApps.map((a) => [a.id, a.name])); + const apps = tab === "Chats" ? [] : searching ? allApps : allApps.slice(0, RECENT_FOUND); + const recent = [...chats].sort((a, b) => +new Date(b.createdAt) - +new Date(a.createdAt)); + const found = !onSelectChat || tab === "Apps" ? [] : searching ? recent : recent.slice(0, RECENT_FOUND); + const then = (act: () => void) => () => { onOpenChange(false); act(); }; + return ( + + + {onSelectChat && ( +
+ {SEARCH_TABS.map((t) => ( + + ))} +
+ )} + {/* A fixed height, so the box never jumps while the results change under the cursor. */} + + No results + {apps.length > 0 && ( + + {apps.map((app) => ( + onSelectApp(app.id))} data-testid={`app-search-item-${app.id}`}> + + {app.name} + + ))} + + )} + {found.length > 0 && ( + + {found.map((chat) => ( + onSelectChat?.(chat.id, chat.appId))}> + + {chat.title || "New chat"} + {names.get(chat.appId) !== chat.title && {names.get(chat.appId)}} + + ))} + + )} + {onNewApp && tab === "All" && ( + + + + New app + + + )} + +
+ ); +} diff --git a/studio/vendor/dyad/hologram.screens/SearchDialog.tsx b/studio/vendor/dyad/hologram.screens/SearchDialog.tsx deleted file mode 100644 index ea1008a7..00000000 --- a/studio/vendor/dyad/hologram.screens/SearchDialog.tsx +++ /dev/null @@ -1,90 +0,0 @@ -// hologram-forge (ours, not upstream's; see VENDORED.md): the shell's one search, in place of -// src/components/AppSearchDialog.tsx (hologram.screens.mjs). A centred palette, as the kit's command dialog -// draws it. The apps and chats are already in memory, so it filters as you type, with no debounce and no -// round trip. From the home input it picks an app; from the sidebar it also finds chats and starts an app. -import { useEffect, useState } from "react"; -import { CirclePlus, LayoutGrid, MessageSquare } from "lucide-react"; -import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command"; -import { useChats } from "@/hooks/useChats"; -import type { AppSearchResult } from "@/lib/schemas"; - -const TABS = ["All", "Apps", "Chats"] as const; -const RECENT = 6; - -export function AppSearchDialog({ open, onOpenChange, onSelectApp, allApps, disableShortcut, onSelectChat, onNewApp }: { - open: boolean; - onOpenChange: (open: boolean) => void; - onSelectApp: (appId: number) => void; - allApps: AppSearchResult[]; - disableShortcut?: boolean; - onSelectChat?: (chatId: number, appId: number) => void; - onNewApp?: () => void; -}) { - const [tab, setTab] = useState<(typeof TABS)[number]>("All"); - const [query, setQuery] = useState(""); - const { chats } = useChats(null); - useEffect(() => { - if (disableShortcut) return; - const down = (e: KeyboardEvent) => { - if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); onOpenChange(!open); } - }; - document.addEventListener("keydown", down); - return () => document.removeEventListener("keydown", down); - }, [open, onOpenChange, disableShortcut]); - // Opening starts clean: an empty query shows the recent ones. - useEffect(() => { if (open) { setQuery(""); setTab("All"); } }, [open]); - const searching = query.trim() !== ""; - const names = new Map(allApps.map((a) => [a.id, a.name])); - const apps = tab === "Chats" ? [] : searching ? allApps : allApps.slice(0, RECENT); - const recent = [...chats].sort((a, b) => +new Date(b.createdAt) - +new Date(a.createdAt)); - const found = !onSelectChat || tab === "Apps" ? [] : searching ? recent : recent.slice(0, RECENT); - const then = (act: () => void) => () => { onOpenChange(false); act(); }; - return ( - - - {onSelectChat && ( -
- {TABS.map((t) => ( - - ))} -
- )} - {/* A fixed height, so the box never jumps while the results change under the cursor. */} - - No results - {apps.length > 0 && ( - - {apps.map((app) => ( - onSelectApp(app.id))} data-testid={`app-search-item-${app.id}`}> - - {app.name} - - ))} - - )} - {found.length > 0 && ( - - {found.map((chat) => ( - onSelectChat?.(chat.id, chat.appId))}> - - {chat.title || "New chat"} - {names.get(chat.appId) !== chat.title && {names.get(chat.appId)}} - - ))} - - )} - {onNewApp && tab === "All" && ( - - - - New app - - - )} - -
- ); -} diff --git a/studio/vendor/dyad/src/components/AppSearchDialog.tsx b/studio/vendor/dyad/src/components/AppSearchDialog.tsx index e68c648f..69ced8ed 100644 --- a/studio/vendor/dyad/src/components/AppSearchDialog.tsx +++ b/studio/vendor/dyad/src/components/AppSearchDialog.tsx @@ -1,6 +1,156 @@ -// Upstream's app search dialog is replaced whole at build by the shell's one search, -// hologram.screens/SearchDialog.tsx (hologram.screens.mjs SCREENS), so its body is not kept here; it is -// upstream's src/components/AppSearchDialog.tsx at the commit VENDORED.md names. The path and its typed export -// stay, so imports resolve and the typecheck's upstream baseline is upstream's own. +import { + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, +} from "./ui/command"; +import { useState, useEffect } from "react"; +import { useSearchApps } from "@/hooks/useSearchApps"; import type { AppSearchResult } from "@/lib/schemas"; -export function AppSearchDialog(_: { open: boolean; onOpenChange: (open: boolean) => void; onSelectApp: (appId: number) => void; allApps: AppSearchResult[]; disableShortcut?: boolean }) { return null; } + +type AppSearchDialogProps = { + open: boolean; + onOpenChange: (open: boolean) => void; + onSelectApp: (appId: number) => void; + allApps: AppSearchResult[]; + disableShortcut?: boolean; +}; + +export function AppSearchDialog({ + open, + onOpenChange, + onSelectApp, + allApps, + disableShortcut, +}: AppSearchDialogProps) { + const [searchQuery, setSearchQuery] = useState(""); + function useDebouncedValue(value: T, delay: number): T { + const [debounced, setDebounced] = useState(value); + useEffect(() => { + const handle = setTimeout(() => setDebounced(value), delay); + return () => clearTimeout(handle); + }, [value, delay]); + return debounced; + } + + const debouncedQuery = useDebouncedValue(searchQuery, 150); + const { apps: searchResults } = useSearchApps(debouncedQuery); + + // Show all apps if search is empty, otherwise show search results + const appsToShow: AppSearchResult[] = + debouncedQuery.trim() === "" ? allApps : searchResults; + + const commandFilter = ( + value: string, + search: string, + keywords?: string[], + ): number => { + const q = search.trim().toLowerCase(); + if (!q) return 1; + const v = (value || "").toLowerCase(); + if (v.includes(q)) { + // Higher score for earlier match in title/value + return 100 - Math.max(0, v.indexOf(q)); + } + const foundInKeywords = (keywords || []).some((k) => + (k || "").toLowerCase().includes(q), + ); + return foundInKeywords ? 50 : 0; + }; + + function getSnippet( + text: string, + query: string, + radius = 50, + ): { + before: string; + match: string; + after: string; + raw: string; + } { + const q = query.trim(); + const lowerText = text.toLowerCase(); + const lowerQuery = q.toLowerCase(); + const idx = lowerText.indexOf(lowerQuery); + if (idx === -1) { + const raw = + text.length > radius * 2 ? text.slice(0, radius * 2) + "…" : text; + return { before: "", match: "", after: "", raw }; + } + const start = Math.max(0, idx - radius); + const end = Math.min(text.length, idx + q.length + radius); + const before = (start > 0 ? "…" : "") + text.slice(start, idx); + const match = text.slice(idx, idx + q.length); + const after = + text.slice(idx + q.length, end) + (end < text.length ? "…" : ""); + return { before, match, after, raw: before + match + after }; + } + + useEffect(() => { + if (disableShortcut) return; + const down = (e: KeyboardEvent) => { + if (e.key === "k" && (e.metaKey || e.ctrlKey)) { + e.preventDefault(); + onOpenChange(!open); + } + }; + document.addEventListener("keydown", down); + return () => document.removeEventListener("keydown", down); + }, [open, onOpenChange, disableShortcut]); + + return ( + + + + + No results found. + + + {appsToShow.map((app) => { + const isSearch = searchQuery.trim() !== ""; + let snippet = null; + if (isSearch && app.matchedChatMessage) { + snippet = getSnippet(app.matchedChatMessage, searchQuery); + } else if (isSearch && app.matchedChatTitle) { + snippet = getSnippet(app.matchedChatTitle, searchQuery); + } + return ( + onSelectApp(app.id)} + value={app.name + (snippet ? ` ${snippet.raw}` : "")} + keywords={snippet ? [snippet.raw] : []} + data-testid={`app-search-item-${app.id}`} + > +
+ {app.name} + {snippet && ( + + {snippet.before} + + {snippet.match} + + {snippet.after} + + )} +
+
+ ); + })} +
+
+
+ ); +} From b1194ef2332b1c21f260e7198b6ade47782cdb05 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:08:26 +0000 Subject: [PATCH 3/5] Format the workspace vector-count assertion as rustfmt does Co-Authored-By: Claude Opus 5.5 --- crates/conformance/tests/in_tab_kernel_verdict.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/conformance/tests/in_tab_kernel_verdict.rs b/crates/conformance/tests/in_tab_kernel_verdict.rs index 97300cba..809ca9d6 100644 --- a/crates/conformance/tests/in_tab_kernel_verdict.rs +++ b/crates/conformance/tests/in_tab_kernel_verdict.rs @@ -63,6 +63,9 @@ fn private_workspace_fa_91() { let kernel = include_str!("../../../app/src/ForgeKernel.lex.tex"); assert!(kernel.contains("(Workspace::dispatchWorkspace (sliceOf value 10")); let theorems = workspace.matches("name: workspaceWords_").count(); - assert_eq!(theorems, kernel.matches("request := 0x776f726b737061636520").count()); + assert_eq!( + theorems, + kernel.matches("request := 0x776f726b737061636520").count() + ); assert!(theorems >= 19 && kernel.contains("(workspaceAcceptance))))")); } From e72a25dc9b6d0a1796b67b737befca9dddc54dbf Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:32:48 +0000 Subject: [PATCH 4/5] Move the workspace theorems to WorkspaceProofs, out of the application's imports ForgeKernel imports Workspace, so its linear_arithmetic proofs staged LexLeanRuntime.Laws into the application build, where Lean's C emitter loops (LexLean #465). The SDK's Lean stage timed out on CI twice (PP5007). WorkspaceProofs is an entrypoint nothing in the application imports, as ForgeKernelProofs is. lexlean fmt, lock and check pass on 43 modules in the pinned SDK image. Co-Authored-By: Claude Opus 5.5 --- app/lexlean.lock | 2 +- app/lexlean.toml | 2 +- app/src/Workspace.lex.tex | 272 ----------------- app/src/WorkspaceProofs.lex.tex | 279 ++++++++++++++++++ .../tests/in_tab_kernel_verdict.rs | 2 +- verification/private-workspace.md | 11 +- 6 files changed, 291 insertions(+), 277 deletions(-) create mode 100644 app/src/WorkspaceProofs.lex.tex diff --git a/app/lexlean.lock b/app/lexlean.lock index d6816ab3..bb514063 100644 --- a/app/lexlean.lock +++ b/app/lexlean.lock @@ -1,7 +1,7 @@ spec = "lexlean/lock/2" language = "1.2" compiler_semantics = "1427f8b629013648a480454d67202788f2303f5396f1d7c70a7c350ddab6f694" -project_config_sha256 = "0cd71e3405f0f73420859cad8a68606bf716bd40999629ff166c7b68e03c0204" +project_config_sha256 = "b2cf1460286e866102702db3cb075d8ec7ae59c3e6417d0e8fd9ef0c9058108f" lean_toolchain = "leanprover/lean4:v4.32.1" [[workspace_file]] diff --git a/app/lexlean.toml b/app/lexlean.toml index 8844678d..78173e05 100644 --- a/app/lexlean.toml +++ b/app/lexlean.toml @@ -3,7 +3,7 @@ name = "prism-forge-kernel" language = "1.2" module_prefix = "PrismForgeKernel" source_roots = ["src"] -entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/ForgeKernel.lex.tex", "src/ForgeKernelProofs.lex.tex", "src/PrismR4Proofs.lex.tex", "src/Quality.lex.tex", "src/Security.lex.tex", "src/Users.lex.tex"] +entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/ForgeKernel.lex.tex", "src/ForgeKernelProofs.lex.tex", "src/PrismR4Proofs.lex.tex", "src/Quality.lex.tex", "src/Security.lex.tex", "src/Users.lex.tex", "src/WorkspaceProofs.lex.tex"] build_root = ".lexlean" lockfile = "lexlean.lock" lean_workspace = "." diff --git a/app/src/Workspace.lex.tex b/app/src/Workspace.lex.tex index 01b39606..2fa7c21e 100644 --- a/app/src/Workspace.lex.tex +++ b/app/src/Workspace.lex.tex @@ -68,277 +68,5 @@ result: String, body: "Requests use workspace-space then lowercase little-endian uint32 hex words: version 1; the kind (0 open, 1 read a record, 2 store a record, 3 move the workspace kept before an id, 4 remove its plain copy); then one word per fact, 1 for yes and any other value for no. Open: this device was removed, the session is live, the id owns the workspace, the device holds the current boundary key. Read: the workspace is open, the sealed bytes are authentic, the record is the one its place names. Store: open, sealed, within quota. Move: open, already moved. Remove: open, the sealed copy is committed. The answer is ok or the first refusal: workspaceDeviceRemoved, workspaceSessionExpired, workspaceNotOwner, workspaceKeyStale, workspaceClosed, recordTampered, recordMisplaced, recordUnsealed, workspaceQuotaExceeded, workspaceAlreadyMoved, sealedCopyNotCommitted. Any other shape is malformedWorkspaceRequest, and more than 128 bytes is workspaceRequestTooLarge." } - -definition{ - name: breaksOpensOnlyForOwner, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - result: Bool, - body: ((not (owner =? 1)) && ((openCode removed live owner key) =? 0)) -} - -theorem{ - name: opensOnlyForOwnerHolds, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - statement: ((breaksOpensOnlyForOwner removed live owner key) = false), - proof: linear_arithmetic{definitions: [breaksOpensOnlyForOwner, openCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -definition{ - name: breaksOpensOnlyWithCurrentKey, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - result: Bool, - body: ((not (key =? 1)) && ((openCode removed live owner key) =? 0)) -} - -theorem{ - name: opensOnlyWithCurrentKeyHolds, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - statement: ((breaksOpensOnlyWithCurrentKey removed live owner key) = false), - proof: linear_arithmetic{definitions: [breaksOpensOnlyWithCurrentKey, openCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -definition{ - name: breaksOpensOnlyWithLiveSession, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - result: Bool, - body: ((not (live =? 1)) && ((openCode removed live owner key) =? 0)) -} - -theorem{ - name: opensOnlyWithLiveSessionHolds, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - statement: ((breaksOpensOnlyWithLiveSession removed live owner key) = false), - proof: linear_arithmetic{definitions: [breaksOpensOnlyWithLiveSession, openCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -definition{ - name: breaksRemovedDeviceNeverOpens, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - result: Bool, - body: ((removed =? 1) && ((openCode removed live owner key) =? 0)) -} - -theorem{ - name: removedDeviceNeverOpensHolds, - parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], - statement: ((breaksRemovedDeviceNeverOpens removed live owner key) = false), - proof: linear_arithmetic{definitions: [breaksRemovedDeviceNeverOpens, openCode]}, - axioms: [Quot.sound, propext] -} - -definition{ - name: breaksReadNeedsAuthentic, - parameters: [opened : Nat, authentic : Nat, bound : Nat], - result: Bool, - body: ((((not (opened =? 1)) || (not (authentic =? 1))) || (not (bound =? 1))) && ((readCode opened authentic bound) =? 0)) -} - -theorem{ - name: readNeedsAuthenticHolds, - parameters: [opened : Nat, authentic : Nat, bound : Nat], - statement: ((breaksReadNeedsAuthentic opened authentic bound) = false), - proof: linear_arithmetic{definitions: [breaksReadNeedsAuthentic, readCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -definition{ - name: breaksStoreNeedsSealed, - parameters: [opened : Nat, sealed : Nat, within : Nat], - result: Bool, - body: ((((not (opened =? 1)) || (not (sealed =? 1))) || (not (within =? 1))) && ((storeCode opened sealed within) =? 0)) -} - -theorem{ - name: storeNeedsSealedHolds, - parameters: [opened : Nat, sealed : Nat, within : Nat], - statement: ((breaksStoreNeedsSealed opened sealed within) = false), - proof: linear_arithmetic{definitions: [breaksStoreNeedsSealed, storeCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -definition{ - name: breaksMoveAtMostOnce, - parameters: [opened : Nat, moved : Nat], - result: Bool, - body: ((moved =? 1) && ((moveCode opened moved) =? 0)) -} - -theorem{ - name: moveAtMostOnceHolds, - parameters: [opened : Nat, moved : Nat], - statement: ((breaksMoveAtMostOnce opened moved) = false), - proof: linear_arithmetic{definitions: [breaksMoveAtMostOnce, moveCode]}, - axioms: [Quot.sound, propext] -} - -definition{ - name: breaksPlainRemovedAfterCommit, - parameters: [opened : Nat, committed : Nat], - result: Bool, - body: ((not (committed =? 1)) && ((removeCode opened committed) =? 0)) -} - -theorem{ - name: plainRemovedAfterCommitHolds, - parameters: [opened : Nat, committed : Nat], - statement: ((breaksPlainRemovedAfterCommit opened committed) = false), - proof: linear_arithmetic{definitions: [breaksPlainRemovedAfterCommit, removeCode]}, - axioms: [Classical.choice, Quot.sound, propext] -} - -theorem{ - name: workspaceWords_ownerOpens, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x6f6b), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_removedDeviceRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 0 (cons 1 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x776f726b737061636544657669636552656d6f766564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_expiredSessionRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 0 (cons 1 (cons 1 (nil Nat)))))))) = 0x776f726b737061636553657373696f6e45787069726564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_anotherIdRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 0 (cons 1 (nil Nat)))))))) = 0x776f726b73706163654e6f744f776e6572), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_staleKeyRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 1 (cons 0 (nil Nat)))))))) = 0x776f726b73706163654b65795374616c65), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_authenticRecordRead, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 1 (cons 1 (nil Nat))))))) = 0x6f6b), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_closedWorkspaceRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 1 (cons 0 (cons 1 (cons 1 (nil Nat))))))) = 0x776f726b7370616365436c6f736564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_tamperedRecordRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 0 (cons 1 (nil Nat))))))) = 0x7265636f726454616d7065726564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_misplacedRecordRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 1 (cons 0 (nil Nat))))))) = 0x7265636f72644d6973706c61636564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_sealedRecordStored, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 1 (cons 1 (nil Nat))))))) = 0x6f6b), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_unsealedRecordRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 0 (cons 1 (nil Nat))))))) = 0x7265636f7264556e7365616c6564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_overQuotaRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 1 (cons 0 (nil Nat))))))) = 0x776f726b737061636551756f74614578636565646564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_firstMoveAllowed, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 0 (nil Nat)))))) = 0x6f6b), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_secondMoveRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 1 (nil Nat)))))) = 0x776f726b7370616365416c72656164794d6f766564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_plainRemovedAfterCommit, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 4 (cons 1 (cons 1 (nil Nat)))))) = 0x6f6b), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_plainKeptBeforeCommit, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 4 (cons 1 (cons 0 (nil Nat)))))) = 0x7365616c6564436f70794e6f74436f6d6d6974746564), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_versionRefused, - parameters: [], - statement: ((workspaceAnswer (cons 2 (cons 0 (cons 0 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_trailingWordRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 0 (cons 0 (nil Nat))))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), - proof: reflexivity{}, - axioms: [] -} - -theorem{ - name: workspaceWords_unknownKindRefused, - parameters: [], - statement: ((workspaceAnswer (cons 1 (cons 9 (cons 1 (cons 1 (nil Nat)))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), - proof: reflexivity{}, - axioms: [] -} \end{semanticmodule} \end{lexlean} diff --git a/app/src/WorkspaceProofs.lex.tex b/app/src/WorkspaceProofs.lex.tex new file mode 100644 index 00000000..8fea7318 --- /dev/null +++ b/app/src/WorkspaceProofs.lex.tex @@ -0,0 +1,279 @@ +\begin{lexlean}{WorkspaceProofs} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{Workspace} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: breaksOpensOnlyForOwner, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + result: Bool, + body: ((not (owner =? 1)) && ((Workspace::openCode removed live owner key) =? 0)) +} + +theorem{ + name: opensOnlyForOwnerHolds, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + statement: ((breaksOpensOnlyForOwner removed live owner key) = false), + proof: linear_arithmetic{definitions: [Workspace::openCode, breaksOpensOnlyForOwner]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +definition{ + name: breaksOpensOnlyWithCurrentKey, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + result: Bool, + body: ((not (key =? 1)) && ((Workspace::openCode removed live owner key) =? 0)) +} + +theorem{ + name: opensOnlyWithCurrentKeyHolds, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + statement: ((breaksOpensOnlyWithCurrentKey removed live owner key) = false), + proof: linear_arithmetic{definitions: [Workspace::openCode, breaksOpensOnlyWithCurrentKey]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +definition{ + name: breaksOpensOnlyWithLiveSession, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + result: Bool, + body: ((not (live =? 1)) && ((Workspace::openCode removed live owner key) =? 0)) +} + +theorem{ + name: opensOnlyWithLiveSessionHolds, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + statement: ((breaksOpensOnlyWithLiveSession removed live owner key) = false), + proof: linear_arithmetic{definitions: [Workspace::openCode, breaksOpensOnlyWithLiveSession]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +definition{ + name: breaksRemovedDeviceNeverOpens, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + result: Bool, + body: ((removed =? 1) && ((Workspace::openCode removed live owner key) =? 0)) +} + +theorem{ + name: removedDeviceNeverOpensHolds, + parameters: [removed : Nat, live : Nat, owner : Nat, key : Nat], + statement: ((breaksRemovedDeviceNeverOpens removed live owner key) = false), + proof: linear_arithmetic{definitions: [Workspace::openCode, breaksRemovedDeviceNeverOpens]}, + axioms: [Quot.sound, propext] +} + +definition{ + name: breaksReadNeedsAuthentic, + parameters: [opened : Nat, authentic : Nat, bound : Nat], + result: Bool, + body: ((((not (opened =? 1)) || (not (authentic =? 1))) || (not (bound =? 1))) && ((Workspace::readCode opened authentic bound) =? 0)) +} + +theorem{ + name: readNeedsAuthenticHolds, + parameters: [opened : Nat, authentic : Nat, bound : Nat], + statement: ((breaksReadNeedsAuthentic opened authentic bound) = false), + proof: linear_arithmetic{definitions: [Workspace::readCode, breaksReadNeedsAuthentic]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +definition{ + name: breaksStoreNeedsSealed, + parameters: [opened : Nat, sealed : Nat, within : Nat], + result: Bool, + body: ((((not (opened =? 1)) || (not (sealed =? 1))) || (not (within =? 1))) && ((Workspace::storeCode opened sealed within) =? 0)) +} + +theorem{ + name: storeNeedsSealedHolds, + parameters: [opened : Nat, sealed : Nat, within : Nat], + statement: ((breaksStoreNeedsSealed opened sealed within) = false), + proof: linear_arithmetic{definitions: [Workspace::storeCode, breaksStoreNeedsSealed]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +definition{ + name: breaksMoveAtMostOnce, + parameters: [opened : Nat, moved : Nat], + result: Bool, + body: ((moved =? 1) && ((Workspace::moveCode opened moved) =? 0)) +} + +theorem{ + name: moveAtMostOnceHolds, + parameters: [opened : Nat, moved : Nat], + statement: ((breaksMoveAtMostOnce opened moved) = false), + proof: linear_arithmetic{definitions: [Workspace::moveCode, breaksMoveAtMostOnce]}, + axioms: [Quot.sound, propext] +} + +definition{ + name: breaksPlainRemovedAfterCommit, + parameters: [opened : Nat, committed : Nat], + result: Bool, + body: ((not (committed =? 1)) && ((Workspace::removeCode opened committed) =? 0)) +} + +theorem{ + name: plainRemovedAfterCommitHolds, + parameters: [opened : Nat, committed : Nat], + statement: ((breaksPlainRemovedAfterCommit opened committed) = false), + proof: linear_arithmetic{definitions: [Workspace::removeCode, breaksPlainRemovedAfterCommit]}, + axioms: [Classical.choice, Quot.sound, propext] +} + +theorem{ + name: workspaceWords_ownerOpens, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x6f6b), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_removedDeviceRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 0 (cons 1 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x776f726b737061636544657669636552656d6f766564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_expiredSessionRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 0 (cons 1 (cons 1 (nil Nat)))))))) = 0x776f726b737061636553657373696f6e45787069726564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_anotherIdRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 0 (cons 1 (nil Nat)))))))) = 0x776f726b73706163654e6f744f776e6572), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_staleKeyRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 0 (cons 0 (cons 1 (cons 1 (cons 0 (nil Nat)))))))) = 0x776f726b73706163654b65795374616c65), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_authenticRecordRead, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 1 (cons 1 (nil Nat))))))) = 0x6f6b), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_closedWorkspaceRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 1 (cons 0 (cons 1 (cons 1 (nil Nat))))))) = 0x776f726b7370616365436c6f736564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_tamperedRecordRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 0 (cons 1 (nil Nat))))))) = 0x7265636f726454616d7065726564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_misplacedRecordRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 1 (cons 1 (cons 1 (cons 0 (nil Nat))))))) = 0x7265636f72644d6973706c61636564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_sealedRecordStored, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 1 (cons 1 (nil Nat))))))) = 0x6f6b), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_unsealedRecordRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 0 (cons 1 (nil Nat))))))) = 0x7265636f7264556e7365616c6564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_overQuotaRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 2 (cons 1 (cons 1 (cons 0 (nil Nat))))))) = 0x776f726b737061636551756f74614578636565646564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_firstMoveAllowed, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 0 (nil Nat)))))) = 0x6f6b), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_secondMoveRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 1 (nil Nat)))))) = 0x776f726b7370616365416c72656164794d6f766564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_plainRemovedAfterCommit, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 4 (cons 1 (cons 1 (nil Nat)))))) = 0x6f6b), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_plainKeptBeforeCommit, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 4 (cons 1 (cons 0 (nil Nat)))))) = 0x7365616c6564436f70794e6f74436f6d6d6974746564), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_versionRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 2 (cons 0 (cons 0 (cons 1 (cons 1 (cons 1 (nil Nat)))))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_trailingWordRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 3 (cons 1 (cons 0 (cons 0 (nil Nat))))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), + proof: reflexivity{}, + axioms: [] +} + +theorem{ + name: workspaceWords_unknownKindRefused, + parameters: [], + statement: ((Workspace::workspaceAnswer (cons 1 (cons 9 (cons 1 (cons 1 (nil Nat)))))) = 0x6d616c666f726d6564576f726b737061636552657175657374), + proof: reflexivity{}, + axioms: [] +} +\end{semanticmodule} +\end{lexlean} diff --git a/crates/conformance/tests/in_tab_kernel_verdict.rs b/crates/conformance/tests/in_tab_kernel_verdict.rs index 809ca9d6..37396fe9 100644 --- a/crates/conformance/tests/in_tab_kernel_verdict.rs +++ b/crates/conformance/tests/in_tab_kernel_verdict.rs @@ -59,7 +59,7 @@ fn rule_judge_fa_90() { fn private_workspace_fa_91() { // Lean proves every workspaceWords theorem by evaluation (`just app`) and the kernel gate replays // each as an acceptance vector in the compiled guest; this holds the two to each other and to dispatch. - let workspace = include_str!("../../../app/src/Workspace.lex.tex"); + let workspace = include_str!("../../../app/src/WorkspaceProofs.lex.tex"); let kernel = include_str!("../../../app/src/ForgeKernel.lex.tex"); assert!(kernel.contains("(Workspace::dispatchWorkspace (sliceOf value 10")); let theorems = workspace.matches("name: workspaceWords_").count(); diff --git a/verification/private-workspace.md b/verification/private-workspace.md index 6bbe9df9..d5caa42a 100644 --- a/verification/private-workspace.md +++ b/verification/private-workspace.md @@ -3,7 +3,8 @@ Authority: `FA-91` in `model/ids.toml`, scenario in `features/suites/private-workspace.feature`. A visitor's work in Foundry is meant to be theirs alone: sealed on their devices under their Prism ID's -boundary key, and opened only for that ID. `app/src/Workspace.lex.tex` holds the decisions, and Foundry's Prism +boundary key, and opened only for that ID. `app/src/Workspace.lex.tex` holds the decisions and +`app/src/WorkspaceProofs.lex.tex` their theorems, and Foundry's Prism kernel answers them: `ForgeKernel::dispatch` sends a request that starts with `workspace ` to `Workspace::dispatchWorkspace` (through `dispatchApplication`, ahead of the protocols, so the in-tab verdict's entry stays as `studio/tools/in_tab_verdict_author.mjs` writes it). @@ -36,7 +37,7 @@ vector in the kernel, now 355. Mutation, 2026-11-16: 1. The decision. Removing the owner check from `openCode` made `npx prism-code verify --lean --local` fail: Lean - rejected `workspaceWords_anotherIdRefused` (`src/Workspace.lex.tex:216`), which expects `workspaceNotOwner`. + rejected `workspaceWords_anotherIdRefused` (`src/Workspace.lex.tex:216` then; the theorem is now in `src/WorkspaceProofs.lex.tex`), which expects `workspaceNotOwner`. Restored, byte-identical to the verified module. 2. The vectors. Dropping one workspace vector from `workspaceAcceptance` in `app/src/ForgeKernel.lex.tex` made `cargo test -p repo-conformance --test in_tab_kernel_verdict` fail: `private_workspace_fa_91` panicked with @@ -48,6 +49,12 @@ to an ID, so no visitor's workspace is private until that host work lands. Wheth session is live or sealed bytes are authentic is the host's to compute from stitch's Prism ID (`identity/prism-id.mjs`: `sealPrivate`, `openPrivate`) and Hologram's `seal_bytes` and `open_bytes`. +Why the theorems sit in their own module. `ForgeKernel` imports `Workspace`, so a `linear_arithmetic` proof +there stages `LexLeanRuntime.Laws` into the application build, where Lean's C emitter loops (LexLean #465; +`v2/build-speed/REPORT.md`). With the theorems in `Workspace`, the SDK's Lean stage timed out on CI twice +(`PP5007`, run 43915183780). `WorkspaceProofs` is an entrypoint nothing in the application imports, as +`ForgeKernelProofs` is. + Where it was run. `prismpm --project app verify` in the SDK image `prismpm.lock` pins did not finish on this machine: its Lean stage allows 600 seconds, and compiling the SDK's runtime from cold took longer before reaching any project module (`PP5007: application-lean timed out`). The proofs above used `prism-code` 0.8.0 with the From 7f339b381d71b42eb1b8751b79941f31d0e95ac1 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:46:55 +0000 Subject: [PATCH 5/5] Name the workspace acceptance rows where their theorems now live product.json's three workspaceWords rows point at WorkspaceProofs; the facets and lexlean.toml's entrypoints are projected again by foundry_model.mjs. lexlean fmt, lock and check pass on 43 modules in the pinned SDK image. Co-Authored-By: Claude Opus 5.5 --- app/lexlean.lock | 2 +- app/lexlean.toml | 2 +- app/product.json | 6 +++--- app/src/Compliance.lex.tex | 1 + app/src/Features.lex.tex | 15 ++++++++------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/lexlean.lock b/app/lexlean.lock index bb514063..d6816ab3 100644 --- a/app/lexlean.lock +++ b/app/lexlean.lock @@ -1,7 +1,7 @@ spec = "lexlean/lock/2" language = "1.2" compiler_semantics = "1427f8b629013648a480454d67202788f2303f5396f1d7c70a7c350ddab6f694" -project_config_sha256 = "b2cf1460286e866102702db3cb075d8ec7ae59c3e6417d0e8fd9ef0c9058108f" +project_config_sha256 = "0cd71e3405f0f73420859cad8a68606bf716bd40999629ff166c7b68e03c0204" lean_toolchain = "leanprover/lean4:v4.32.1" [[workspace_file]] diff --git a/app/lexlean.toml b/app/lexlean.toml index 78173e05..8844678d 100644 --- a/app/lexlean.toml +++ b/app/lexlean.toml @@ -3,7 +3,7 @@ name = "prism-forge-kernel" language = "1.2" module_prefix = "PrismForgeKernel" source_roots = ["src"] -entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/ForgeKernel.lex.tex", "src/ForgeKernelProofs.lex.tex", "src/PrismR4Proofs.lex.tex", "src/Quality.lex.tex", "src/Security.lex.tex", "src/Users.lex.tex", "src/WorkspaceProofs.lex.tex"] +entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/ForgeKernel.lex.tex", "src/ForgeKernelProofs.lex.tex", "src/PrismR4Proofs.lex.tex", "src/Quality.lex.tex", "src/Security.lex.tex", "src/Users.lex.tex"] build_root = ".lexlean" lockfile = "lexlean.lock" lean_workspace = "." diff --git a/app/product.json b/app/product.json index 567b11cc..e7e9237d 100644 --- a/app/product.json +++ b/app/product.json @@ -917,9 +917,9 @@ "store" ], "acceptance": [ - "Workspace::workspaceWords_ownerOpens", - "Workspace::workspaceWords_anotherIdRefused", - "Workspace::workspaceWords_tamperedRecordRefused" + "WorkspaceProofs::workspaceWords_ownerOpens", + "WorkspaceProofs::workspaceWords_anotherIdRefused", + "WorkspaceProofs::workspaceWords_tamperedRecordRefused" ] }, { diff --git a/app/src/Compliance.lex.tex b/app/src/Compliance.lex.tex index b5e08ae1..6c80d32a 100644 --- a/app/src/Compliance.lex.tex +++ b/app/src/Compliance.lex.tex @@ -30,6 +30,7 @@ \importmodule{WorkOwnership} \importmodule{WorkProtocol} \importmodule{Workspace} +\importmodule{WorkspaceProofs} \title{standards reference} \begin{semanticmodule} structure{ diff --git a/app/src/Features.lex.tex b/app/src/Features.lex.tex index e775b924..f89e6f33 100644 --- a/app/src/Features.lex.tex +++ b/app/src/Features.lex.tex @@ -26,6 +26,7 @@ \importmodule{WorkOwnership} \importmodule{WorkProtocol} \importmodule{Workspace} +\importmodule{WorkspaceProofs} \importmodule{Architecture} \importmodule{Foundation.Arch} \title{feature} @@ -1340,24 +1341,24 @@ } definition{ - name: acceptWorkspaceWorkspaceWordsOwnerOpens, + name: acceptWorkspaceProofsWorkspaceWordsOwnerOpens, parameters: [], result: String, - body: "Workspace::workspaceWords_ownerOpens" + body: "WorkspaceProofs::workspaceWords_ownerOpens" } definition{ - name: acceptWorkspaceWorkspaceWordsAnotherIdRefused, + name: acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused, parameters: [], result: String, - body: "Workspace::workspaceWords_anotherIdRefused" + body: "WorkspaceProofs::workspaceWords_anotherIdRefused" } definition{ - name: acceptWorkspaceWorkspaceWordsTamperedRecordRefused, + name: acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused, parameters: [], result: String, - body: "Workspace::workspaceWords_tamperedRecordRefused" + body: "WorkspaceProofs::workspaceWords_tamperedRecordRefused" } definition{ @@ -1672,7 +1673,7 @@ name: featurePrismId, parameters: [], result: Foundation.Arch::Feature, - body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (nil String))))))}) + body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceProofsWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (nil String))))))}) } definition{