wawesome 0.14.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +61 -20
  2. package/dist/index.mjs +3194 -3039
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -477,11 +477,13 @@ concluding the platform cannot do it.
477
477
 
478
478
  | Tool | What it does | Needs |
479
479
  |:---------------------------|:------------------------------------------------------------------------|:--------------|
480
+ | `whoami` | The workspace, where it is administered, the words this credential carries, the Apps it reaches | nothing |
480
481
  | `list_templates` | The template catalogue, with what each one is for | nothing |
481
482
  | `get_template` | One template's files, environment contract and outbound providers | nothing |
482
- | `list_apps` | The Apps the credential reaches, with the slug each is addressed by | `read:apps` |
483
+ | `list_apps` | The Apps the credential reaches, each with its address and its dashboard page | `read:apps` |
483
484
  | `list_functions` | The Functions in one App, and what their live version carries | `read:functions` |
484
485
  | `list_versions` | A Function's Versions, and which one is live | `read:functions` |
486
+ | `get_function_source` | The code a Function is running, and the static files it carries | `read:functions` |
485
487
  | `get_usage` | The Tenant's usage and headroom | `read:tenant` |
486
488
  | `list_invocations` | Recent Invocations of a Function, failures included | `read:invocations` |
487
489
  | `get_invocation` | One Invocation by id | `read:invocations` |
@@ -492,10 +494,16 @@ concluding the platform cannot do it.
492
494
  | `rollback_function` | Puts a Version the Function already has back on its public address | `write:functions` |
493
495
  | `set_env_var` | Sets an App's environment variable, read at the next invocation | `write:env` |
494
496
  | `invoke_function` | Runs a deployed Function once and answers with the Invocation id | `write:runs` |
497
+ | `fetch_function` | Fetches one path from a Function's live Version and answers what it served | `write:runs` |
495
498
 
496
499
  A word that writes reaches the read of the same thing, so `write:functions` needs no `read:functions`
497
500
  beside it, and the presets below are named in exactly these words.
498
501
 
502
+ `whoami` is the one to call first. It answers the workspace, every word the credential carries and
503
+ the Apps it reaches, and it asks for nothing — so your agent can say what it is able to do before it
504
+ offers, rather than finding the edge by being refused in front of you. A member's session calling the
505
+ endpoint gets the same answer for the role they hold.
506
+
499
507
  A deploy is two calls. The first says which of your files the platform does not already hold, by
500
508
  content hash; your agent uploads those bytes to `PUT /v1/assets/{content_hash}` with the same
501
509
  credential and asks again, so a redeploy that changed only its code uploads nothing. The second
@@ -546,8 +554,10 @@ npx wawesome credentials mint agent --preset member -a prod
546
554
  ```
547
555
 
548
556
  Add `write:domains` where the project declares a custom domain the deploy should claim. Nothing gives
549
- an agent billing, a plan change, credential management or your workspace's slug: those are closed to
550
- every credential, whatever it carries.
557
+ an agent billing, a plan change, credential management or the ability to rename your workspace: those
558
+ are closed to every credential, whatever it carries. Reading the workspace's name and address is not
559
+ among them — `whoami` answers both to any credential, which is how the agent knows where what it
560
+ deploys will appear.
551
561
 
552
562
  Keep `-a` on all three. A credential restricted to one App is refused on every tool that names
553
563
  another, which is what stops an agent working on one client's project from touching another's.
@@ -602,6 +612,33 @@ URL, serving the code its callers already hold. The CLI remembers where this dir
602
612
  deployed and asks before that happens, naming both URLs. If you meant it, delete the old Function
603
613
  from the dashboard once nothing calls it.
604
614
 
615
+ ### A site with no handler
616
+
617
+ Leave `entry` out, write no `src/index.ts`, and point `"assets"` at the directory your build wrote
618
+ its pages into:
619
+
620
+ ```json
621
+ {
622
+ "app": "my-app",
623
+ "function": "root",
624
+ "assets": "dist"
625
+ }
626
+ ```
627
+
628
+ That deploys the pages and no code at all, and the site is live at your App's address. Nothing in the
629
+ file declares a kind: a project with a handler is one that has an entry point, and a project with
630
+ both deploys them together and rolls them back together.
631
+
632
+ An `entry` you did name and that is not there is a hard error, so a typo never quietly becomes a site
633
+ with nothing running behind it. Every deploy says which of the two it landed.
634
+
635
+ One thing the deploy will warn you about: everything beneath a Function's address reaches that
636
+ Function, so a page your root Function carries at `about/index.html` is shadowed by a sibling Function
637
+ named `about`. The deploy says so and names both addresses. It refuses nothing — the two Functions are
638
+ versioned independently, and either one may deploy first.
639
+
640
+ ### Static files
641
+
605
642
  Add `"assets"` to deploy static files beside your code:
606
643
 
607
644
  ```json
@@ -623,28 +660,32 @@ Files are served straight from object storage; your Function is never invoked fo
623
660
  invocation is recorded. They answer on your App's own hostname and nowhere else. On the
624
661
  development path form (`/x/<tenant>/<app>/<function>/...`) the same address reaches your handler
625
662
  as it always has, because a file on an origin every workspace shares would be same-origin with
626
- all of them. Each carries `Cache-Control: public, max-age=31536000, immutable` and an
627
- `ETag`, so name your build output by content hash. A file's bytes must never change under a name a
628
- browser has already cached for a year. The content type comes from the extension against a fixed
629
- allowlist and is never sniffed; anything off it is served as a download.
663
+ all of them. A file beneath `assets/` carries `Cache-Control: public, max-age=31536000, immutable`,
664
+ so name your build output by content hash: its bytes must never change under a name a browser has
665
+ already cached for a year. A file outside `assets/` keeps one name across every deploy, so it carries
666
+ `max-age=300` instead — five minutes is inside the reach of a deploy and of a rollback, which a year
667
+ is not. The content type comes from the extension against a fixed allowlist and is never sniffed;
668
+ anything off it is served as a download.
630
669
 
631
670
  Two rules to know about:
632
671
 
633
672
  - **Everything beneath `assets/` is static**, whatever the deploy carries. A request there never
634
673
  reaches your handler, and an unknown path under it is a 404 rather than a route for you to answer.
635
- - **At most 100 files may sit outside `assets/`.** Those paths travel on the version record so a
636
- request can be routed without a lookup per file. Put bulk output under `assets/`, where a file
637
- costs nothing; `favicon.ico`, `robots.txt` and a `.well-known/` directory are what the rest is
638
- for.
639
-
640
- **HTML is refused at deploy time.** Your Function renders its own markup, and a document served from
641
- your App's own origin is the sharpest same-origin risk a static file carries.
642
-
643
- **An SVG is served inert.** The rule behind the refusal above is that nothing you deploy as a file
644
- becomes a page on your App's own origin, and an SVG opened directly in a browser would become one.
645
- It runs script, and it renders whatever HTML a `<foreignObject>` holds. It is served rather than
646
- refused because making it inert costs the file nothing. An `<img src="logo.svg">` never ran that
647
- script and is never checked against the policy, so your drawings render as they always did. Every
674
+ - **A file outside `assets/` answers at its own name**, however many of them a deploy carries.
675
+ `favicon.ico`, `robots.txt` and a `.well-known/` directory are what that is for; hashed build
676
+ output belongs under `assets/`.
677
+
678
+ **A page is a file like any other.** An `index.html` your build wrote is deployed, hashed, retained
679
+ and billed exactly as your other files are, and it is what a directory-style address resolves to: a
680
+ path whose last segment carries no extension is served the `index.html` beneath it, so `/`, `/about`,
681
+ `/about/` and `/blog/hello` each answer with a page. A page revalidates rather than being pinned for a
682
+ year, wherever it sits, so deploying and refreshing is a loop that works.
683
+
684
+ **An SVG is served inert.** Nothing you deploy as a resource should be able to run script on your
685
+ App's own origin, and an SVG opened directly in a browser can: it runs script, and it renders whatever
686
+ HTML a `<foreignObject>` holds. It is served rather than refused because making it inert costs the
687
+ file nothing. An `<img src="logo.svg">` never ran that script and is never checked against the
688
+ policy, so your drawings render as they always did. Every
648
689
  SVG and XML file carries `Content-Security-Policy: script-src 'none'; sandbox`, and only navigating
649
690
  straight to one loses anything. Such a file is sandboxed onto an origin of its own, so its links no
650
691
  longer navigate and a page embedding it through `<object>` or `<iframe>` cannot reach into its DOM.