@agentage/extension 0.16.0 → 0.18.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.
Files changed (147) hide show
  1. package/dist/api/download.d.ts +14 -0
  2. package/dist/api/download.js +10 -0
  3. package/dist/api/files-registry.d.ts +17 -0
  4. package/dist/api/files-registry.js +10 -0
  5. package/dist/api/files.d.ts +8 -0
  6. package/dist/api/files.js +82 -0
  7. package/dist/api/openapi-doc.js +21 -12
  8. package/dist/api/routes.d.ts +10 -1
  9. package/dist/api/routes.js +15 -2
  10. package/dist/auth/token-check.d.ts +1 -1
  11. package/dist/auth/verify-token.js +9 -9
  12. package/dist/context/test-context.d.ts +5 -1
  13. package/dist/context/test-context.js +2 -1
  14. package/dist/host/daemon/app-files.d.ts +13 -0
  15. package/dist/host/daemon/app-files.js +51 -0
  16. package/dist/host/daemon/app-header.d.ts +3 -0
  17. package/dist/host/daemon/app-header.js +12 -0
  18. package/dist/host/daemon/app-reload.d.ts +10 -0
  19. package/dist/host/daemon/app-reload.js +18 -0
  20. package/dist/host/daemon/child.d.ts +1 -0
  21. package/dist/host/daemon/child.js +7 -4
  22. package/dist/host/daemon/cli-user-watch.d.ts +8 -0
  23. package/dist/host/daemon/cli-user-watch.js +43 -0
  24. package/dist/host/daemon/cli-user.d.ts +2 -0
  25. package/dist/host/daemon/cli-user.js +42 -0
  26. package/dist/host/daemon/daemon.d.ts +1 -0
  27. package/dist/host/daemon/daemon.js +13 -1
  28. package/dist/host/daemon/health-routes.d.ts +2 -0
  29. package/dist/host/daemon/health-routes.js +29 -15
  30. package/dist/host/daemon/limits.d.ts +1 -0
  31. package/dist/host/daemon/limits.js +2 -0
  32. package/dist/host/daemon/routes.js +25 -7
  33. package/dist/host/daemon/seal.d.ts +6 -2
  34. package/dist/host/daemon/seal.js +9 -2
  35. package/dist/host/daemon/shell-events.d.ts +9 -0
  36. package/dist/host/daemon/shell-events.js +36 -0
  37. package/dist/host/daemon/shell-routes.d.ts +28 -0
  38. package/dist/host/daemon/shell-routes.js +63 -0
  39. package/dist/host/daemon/supervisor.d.ts +2 -0
  40. package/dist/host/daemon/supervisor.js +2 -1
  41. package/dist/host/data-lock.js +5 -5
  42. package/dist/host/host-env.js +14 -2
  43. package/dist/host/host-extension.js +4 -3
  44. package/dist/host/host-git-store.d.ts +10 -0
  45. package/dist/host/host-git-store.js +36 -0
  46. package/dist/host/host-migrations.d.ts +1 -1
  47. package/dist/host/host-migrations.js +2 -2
  48. package/dist/host/host-parts.d.ts +2 -2
  49. package/dist/host/host-parts.js +1 -1
  50. package/dist/host/host-url-store.d.ts +4 -2
  51. package/dist/host/host-url-store.js +18 -15
  52. package/dist/host/open-store.d.ts +6 -0
  53. package/dist/host/open-store.js +6 -0
  54. package/dist/index.d.ts +3 -1
  55. package/dist/index.js +3 -1
  56. package/dist/manifest/manifest.schema.d.ts +13 -0
  57. package/dist/manifest/manifest.schema.js +16 -2
  58. package/dist/manifest/parts.d.ts +7 -0
  59. package/dist/manifest/parts.js +5 -0
  60. package/dist/manifest/primitives.schema.js +3 -3
  61. package/dist/mcp/connector.d.ts +4 -0
  62. package/dist/mcp/connector.js +11 -0
  63. package/dist/mcp/mcp-app.d.ts +4 -1
  64. package/dist/mcp/mcp-app.js +28 -18
  65. package/dist/mcp/server.d.ts +6 -3
  66. package/dist/mcp/server.js +70 -18
  67. package/dist/mcp/tools.d.ts +40 -4
  68. package/dist/mcp/tools.js +34 -12
  69. package/dist/runtime/part-mounts.js +12 -6
  70. package/dist/runtime/run-part.js +22 -6
  71. package/dist/server/api-routes.d.ts +5 -2
  72. package/dist/server/api-routes.js +41 -14
  73. package/dist/server/app.d.ts +3 -0
  74. package/dist/server/app.js +11 -1
  75. package/dist/server/send-download.d.ts +3 -0
  76. package/dist/server/send-download.js +29 -0
  77. package/dist/shell/dist/index.html +46 -0
  78. package/dist/shell/dist/shell.css +2 -0
  79. package/dist/shell/dist/shell.js +68 -0
  80. package/dist/shell/dist/vendor/app.js +1 -0
  81. package/dist/shell/dist/vendor/chunk-AOJ3DQEL.js +14 -0
  82. package/dist/shell/dist/vendor/chunk-LW5HXGAJ.js +14 -0
  83. package/dist/shell/dist/vendor/chunk-PQJPUKWH.js +14 -0
  84. package/dist/shell/dist/vendor/chunk-SQE76S5B.js +1 -0
  85. package/dist/shell/dist/vendor/jsx-runtime.js +1 -0
  86. package/dist/shell/dist/vendor/react-dom-client.js +33 -0
  87. package/dist/shell/dist/vendor/react-dom.js +1 -0
  88. package/dist/shell/dist/vendor/react.js +1 -0
  89. package/dist/shell/package.json +5 -0
  90. package/dist/store/git-env.d.ts +11 -0
  91. package/dist/store/git-env.js +44 -0
  92. package/dist/store/store-url.d.ts +1 -1
  93. package/dist/store/store-url.js +2 -0
  94. package/dist/store/store.types.d.ts +3 -0
  95. package/dist/store/store.types.js +1 -1
  96. package/dist/testing/test-server.js +11 -12
  97. package/dist/tool/app-build.d.ts +13 -0
  98. package/dist/tool/app-build.js +126 -0
  99. package/dist/tool/app-load.d.ts +4 -0
  100. package/dist/tool/app-load.js +34 -0
  101. package/dist/tool/build.js +5 -2
  102. package/dist/tool/check.js +4 -2
  103. package/dist/tool/container-recipe.d.ts +9 -2
  104. package/dist/tool/container-recipe.js +14 -9
  105. package/dist/tool/container-stage.js +1 -1
  106. package/dist/tool/index.d.ts +1 -0
  107. package/dist/tool/index.js +1 -0
  108. package/dist/tool/main.d.ts +2 -0
  109. package/dist/tool/main.js +8 -1
  110. package/dist/tool/recipe.d.ts +1 -1
  111. package/dist/tool/recipe.js +16 -6
  112. package/dist/tool/record-extras.js +4 -3
  113. package/dist/tool/rules/folders.js +1 -1
  114. package/dist/tool/rules/sealing.js +4 -0
  115. package/dist/tool/rules/store.js +0 -3
  116. package/dist/tool/rules/surface.js +4 -1
  117. package/dist/tool/stage.js +2 -2
  118. package/dist/tool/up/compose.d.ts +4 -0
  119. package/dist/tool/up/compose.js +41 -3
  120. package/dist/tool/up/gateway.js +16 -3
  121. package/dist/tool/up/secrets.d.ts +1 -0
  122. package/dist/tool/up/secrets.js +13 -1
  123. package/dist/tool/up/up.js +8 -5
  124. package/dist/vendor/app/api.d.ts +9 -0
  125. package/dist/vendor/app/api.js +63 -0
  126. package/dist/vendor/app/app.types.d.ts +65 -0
  127. package/dist/vendor/app/app.types.js +1 -0
  128. package/dist/vendor/app/boundary.d.ts +15 -0
  129. package/dist/vendor/app/boundary.js +17 -0
  130. package/dist/vendor/app/context.d.ts +5 -0
  131. package/dist/vendor/app/context.js +22 -0
  132. package/dist/vendor/app/index.d.ts +7 -0
  133. package/dist/vendor/app/index.js +6 -0
  134. package/dist/vendor/app/region.d.ts +6 -0
  135. package/dist/vendor/app/region.js +14 -0
  136. package/dist/vendor/app/split.d.ts +20 -0
  137. package/dist/vendor/app/split.js +38 -0
  138. package/dist/vendor/app/state-store.d.ts +3 -0
  139. package/dist/vendor/app/state-store.js +35 -0
  140. package/dist/vendor/app/test-host.d.ts +29 -0
  141. package/dist/vendor/app/test-host.js +66 -0
  142. package/dist/vendor/app/theme.css +32 -0
  143. package/package.json +35 -2
  144. package/schemas/extension-discovery.schema.json +1 -1
  145. package/schemas/extension-package.schema.json +28 -1
  146. package/schemas/extension-record.schema.json +1 -1
  147. package/schemas/health.schema.json +1 -1
@@ -0,0 +1,29 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { AppRoute, AppUser, AsideKey, BottomBar, Notice, PageLink, StateStore } from './app.types.js';
3
+ export interface TestCall {
4
+ id: string;
5
+ path: string;
6
+ method: string;
7
+ headers: Record<string, string>;
8
+ body?: unknown;
9
+ }
10
+ export interface TestRecord {
11
+ notices: Notice[];
12
+ calls: TestCall[];
13
+ aside: AsideKey | null;
14
+ pages: string[];
15
+ pageLinks: PageLink[];
16
+ bottomBar: BottomBar | null;
17
+ }
18
+ export interface TestHostProps {
19
+ id: string;
20
+ children: ReactNode;
21
+ user?: AppUser | null;
22
+ scopes?: string[];
23
+ reply?: (call: TestCall) => unknown;
24
+ record?: TestRecord;
25
+ store?: StateStore;
26
+ route?: AppRoute;
27
+ }
28
+ export declare const createTestRecord: () => TestRecord;
29
+ export declare const TestHost: (props: TestHostProps) => import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import { AppContext } from './context.js';
4
+ import { createStateStore } from './state-store.js';
5
+ const REGIONS = ['lead', 'actions', 'aside', 'notices', 'bottom', 'side'];
6
+ const TEST_USER = { id: 'u-test', name: 'Test User' };
7
+ const NO_SCOPES = [];
8
+ const HOME = { path: '', query: {} };
9
+ const echo = (call) => ({ path: call.path });
10
+ export const createTestRecord = () => ({
11
+ notices: [],
12
+ calls: [],
13
+ aside: null,
14
+ pages: [],
15
+ pageLinks: [],
16
+ bottomBar: null,
17
+ });
18
+ const testRequest = (record, reply) => async (id, path, init) => {
19
+ const headers = Object.fromEntries(new Headers(init.headers).entries());
20
+ const body = typeof init.body === 'string' ? JSON.parse(init.body) : undefined;
21
+ const call = { id, path, method: init.method ?? 'GET', headers, body };
22
+ record.calls.push(call);
23
+ return new Response(JSON.stringify({ success: true, data: reply(call) }), {
24
+ headers: { 'Content-Type': 'application/json' },
25
+ });
26
+ };
27
+ const testShell = (record) => ({
28
+ notify: (n) => void record.notices.push(n),
29
+ openAside: (key) => void (record.aside = key),
30
+ closeAside: () => void (record.aside = null),
31
+ navigate: (page) => void record.pages.push(page),
32
+ setPages: (pages) => void (record.pageLinks = pages),
33
+ setBottomBar: (bar) => void (record.bottomBar = bar),
34
+ });
35
+ const useRegionHost = () => {
36
+ const [nodes] = useState(() => new Map());
37
+ const [listeners] = useState(() => new Set());
38
+ const host = useMemo(() => ({
39
+ node: (name) => nodes.get(name) ?? null,
40
+ subscribe: (fn) => (listeners.add(fn), () => void listeners.delete(fn)),
41
+ }), [nodes, listeners]);
42
+ const ref = (name) => (el) => {
43
+ if (el)
44
+ nodes.set(name, el);
45
+ else
46
+ nodes.delete(name);
47
+ listeners.forEach((fn) => fn());
48
+ };
49
+ return [host, ref];
50
+ };
51
+ // A small shell for unit tests of an app: the six regions as divs and an in-memory host.
52
+ export const TestHost = (props) => {
53
+ const [record] = useState(() => props.record ?? createTestRecord());
54
+ const [store] = useState(() => props.store ?? createStateStore());
55
+ const [regions, regionRef] = useRegionHost();
56
+ const { id, user = TEST_USER, scopes = NO_SCOPES, reply = echo, route = HOME } = props;
57
+ const value = useMemo(() => ({
58
+ id,
59
+ route,
60
+ store,
61
+ regions,
62
+ host: { user, scopes, request: testRequest(record, reply) },
63
+ shell: testShell(record),
64
+ }), [id, route, store, regions, user, scopes, record, reply]);
65
+ return (_jsxs(AppContext.Provider, { value: value, children: [_jsx("div", { "data-region": "main", children: props.children }), REGIONS.map((name) => (_jsx("div", { "data-region": name, ref: regionRef(name) }, name)))] }));
66
+ };
@@ -0,0 +1,32 @@
1
+ /* K11: the shell-samples/index.html hex values under the design-system token names, dark only. */
2
+ @theme {
3
+ --color-background: #1f2028;
4
+ --color-foreground: #ffffff;
5
+ --color-card: #2e3039;
6
+ --color-card-foreground: #ffffff;
7
+ --color-popover: #2e3039;
8
+ --color-popover-foreground: #ffffff;
9
+ --color-sidebar: #1f2028;
10
+ --color-sidebar-foreground: #ffffff;
11
+ --color-sidebar-border: #3a3d4a;
12
+ --color-primary: #f5a623;
13
+ --color-primary-foreground: #1f2028;
14
+ --color-primary-emphasis: #f5a623;
15
+ --color-primary-soft: rgb(245 166 35 / 0.12);
16
+ --color-primary-hover: #d97706;
17
+ --color-secondary: #2e3039;
18
+ --color-secondary-foreground: #ffffff;
19
+ --color-accent: #3a3d4a;
20
+ --color-accent-foreground: #ffffff;
21
+ --color-muted: #2e3039;
22
+ --color-muted-foreground: #a9adc1;
23
+ --color-destructive: #f08a7e;
24
+ --color-destructive-foreground: #1f2028;
25
+ --color-success: #5fd08f;
26
+ --color-success-foreground: #1f2028;
27
+ --color-border: #3a3d4a;
28
+ --color-input: #3a3d4a;
29
+ --color-ring: #f5a623;
30
+ --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
31
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/extension",
3
- "version": "0.16.0",
3
+ "version": "0.18.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",
@@ -40,6 +40,15 @@
40
40
  "types": "./dist/logs/index.d.ts",
41
41
  "default": "./dist/logs/index.js"
42
42
  },
43
+ "./app": {
44
+ "types": "./dist/vendor/app/index.d.ts",
45
+ "default": "./dist/vendor/app/index.js"
46
+ },
47
+ "./app/test-host": {
48
+ "types": "./dist/vendor/app/test-host.d.ts",
49
+ "default": "./dist/vendor/app/test-host.js"
50
+ },
51
+ "./app/theme.css": "./dist/vendor/app/theme.css",
43
52
  "./migrate": {
44
53
  "default": "./dist/store/migrate.js"
45
54
  },
@@ -70,14 +79,38 @@
70
79
  },
71
80
  "peerDependencies": {
72
81
  "@electric-sql/pglite": "^0.5.0",
73
- "express": "^5.1.0"
82
+ "@tailwindcss/postcss": "^4.3.0",
83
+ "esbuild": ">=0.25.0",
84
+ "express": "^5.1.0",
85
+ "postcss": "^8.5.0",
86
+ "react": "^19.0.0",
87
+ "react-dom": "^19.0.0",
88
+ "tailwindcss": "^4.3.0"
74
89
  },
75
90
  "peerDependenciesMeta": {
76
91
  "@electric-sql/pglite": {
77
92
  "optional": true
78
93
  },
94
+ "@tailwindcss/postcss": {
95
+ "optional": true
96
+ },
97
+ "esbuild": {
98
+ "optional": true
99
+ },
79
100
  "express": {
80
101
  "optional": true
102
+ },
103
+ "postcss": {
104
+ "optional": true
105
+ },
106
+ "react": {
107
+ "optional": true
108
+ },
109
+ "react-dom": {
110
+ "optional": true
111
+ },
112
+ "tailwindcss": {
113
+ "optional": true
81
114
  }
82
115
  },
83
116
  "keywords": [
@@ -7,7 +7,7 @@
7
7
  "id": {
8
8
  "type": "string",
9
9
  "maxLength": 32,
10
- "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
10
+ "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|app|shell|host|health|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
11
11
  },
12
12
  "version": {
13
13
  "type": "string",
@@ -33,7 +33,7 @@
33
33
  "id": {
34
34
  "type": "string",
35
35
  "maxLength": 32,
36
- "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
36
+ "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|app|shell|host|health|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
37
37
  },
38
38
  "parts": {
39
39
  "type": "object",
@@ -74,6 +74,9 @@
74
74
  }
75
75
  ]
76
76
  },
77
+ "app": {
78
+ "type": "boolean"
79
+ },
77
80
  "api": {
78
81
  "anyOf": [
79
82
  {
@@ -180,6 +183,30 @@
180
183
  },
181
184
  "additionalProperties": false
182
185
  },
186
+ "app": {
187
+ "type": "object",
188
+ "properties": {
189
+ "title": {
190
+ "type": "string",
191
+ "minLength": 1,
192
+ "maxLength": 40
193
+ },
194
+ "icon": {
195
+ "type": "string",
196
+ "maxLength": 64,
197
+ "pattern": "^[a-z][a-z0-9-]*$"
198
+ },
199
+ "order": {
200
+ "type": "integer",
201
+ "minimum": 0,
202
+ "maximum": 1000
203
+ }
204
+ },
205
+ "required": [
206
+ "title"
207
+ ],
208
+ "additionalProperties": false
209
+ },
183
210
  "commands": {
184
211
  "minItems": 1,
185
212
  "type": "array",
@@ -7,7 +7,7 @@
7
7
  "id": {
8
8
  "type": "string",
9
9
  "maxLength": 32,
10
- "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
10
+ "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|app|shell|host|health|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
11
11
  },
12
12
  "version": {
13
13
  "type": "string",
@@ -21,7 +21,7 @@
21
21
  "extension": {
22
22
  "type": "string",
23
23
  "maxLength": 32,
24
- "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
24
+ "pattern": "^(?!(?:auth|www|api|sync|mail|mcp|ui|app|shell|host|health|git|setup|status|update|extension|add|remove|help|con|prn|aux|nul|com[0-9]|lpt[0-9])$)[a-z][a-z0-9-]*$"
25
25
  },
26
26
  "part": {
27
27
  "type": "string",