@agentage/extension 0.11.0 → 0.11.1

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.
@@ -23,9 +23,17 @@ const BODY = z.union([z.string(), z.instanceof(Uint8Array)]);
23
23
  const ENTRY = z.union([
24
24
  BODY,
25
25
  z.object({ type: z.string().min(1), body: BODY }),
26
- z.object({ redirect: z.string().min(1) }),
26
+ // A host then a path: no userinfo, query or fragment, so nothing appended reaches the host.
27
+ z.object({ redirect: z.string().regex(/^https?:\/\/[^/?#@\\]+\/[^?#]*$/) }),
27
28
  ]);
28
- const SiteSchema = z.record(z.string().regex(/^\/[A-Za-z0-9._~$/-]*(\/\*)?$/), ENTRY);
29
+ const KEY = /^\/[A-Za-z0-9._~$/-]*$|^(?:\/[A-Za-z0-9._~$-]+)+\/\*$/;
30
+ const SiteSchema = z.record(z.string().regex(KEY), ENTRY).superRefine((site, ctx) => {
31
+ for (const [key, entry] of Object.entries(site)) {
32
+ const to = typeof entry === 'object' && 'redirect' in entry ? entry.redirect : '/';
33
+ if (key.endsWith('/*') && !to.endsWith('/'))
34
+ ctx.addIssue({ code: 'custom', path: [key, 'redirect'], message: 'a /* redirect ends in /' });
35
+ }
36
+ });
29
37
  const lookup = (site, path) => {
30
38
  if (site[path] !== undefined)
31
39
  return { entry: site[path], rest: '' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/extension",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "The agentage extension kit: create(ctx) per part (pages, ui, api, mcp, worker, cli), the store, /health, discovery, the envelope, and the build tool with up and token",
5
5
  "type": "module",
6
6
  "license": "MIT",