@agentage/extension 0.17.0 → 0.18.2

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 (122) hide show
  1. package/README.md +3 -0
  2. package/dist/api/download.d.ts +14 -0
  3. package/dist/api/download.js +10 -0
  4. package/dist/api/openapi-doc.js +21 -12
  5. package/dist/api/routes.d.ts +4 -1
  6. package/dist/api/routes.js +12 -1
  7. package/dist/host/daemon/app-files.d.ts +13 -0
  8. package/dist/host/daemon/app-files.js +51 -0
  9. package/dist/host/daemon/app-header.d.ts +3 -0
  10. package/dist/host/daemon/app-header.js +12 -0
  11. package/dist/host/daemon/app-reload.d.ts +10 -0
  12. package/dist/host/daemon/app-reload.js +18 -0
  13. package/dist/host/daemon/child.d.ts +1 -0
  14. package/dist/host/daemon/child.js +1 -0
  15. package/dist/host/daemon/cli-user-watch.d.ts +9 -0
  16. package/dist/host/daemon/cli-user-watch.js +47 -0
  17. package/dist/host/daemon/cli-user.d.ts +2 -0
  18. package/dist/host/daemon/cli-user.js +42 -0
  19. package/dist/host/daemon/daemon.d.ts +1 -0
  20. package/dist/host/daemon/daemon.js +16 -2
  21. package/dist/host/daemon/health-routes.d.ts +2 -0
  22. package/dist/host/daemon/health-routes.js +16 -7
  23. package/dist/host/daemon/limits.d.ts +1 -0
  24. package/dist/host/daemon/limits.js +2 -0
  25. package/dist/host/daemon/routes.d.ts +2 -1
  26. package/dist/host/daemon/routes.js +25 -10
  27. package/dist/host/daemon/shell-events.d.ts +9 -0
  28. package/dist/host/daemon/shell-events.js +36 -0
  29. package/dist/host/daemon/shell-routes.d.ts +28 -0
  30. package/dist/host/daemon/shell-routes.js +63 -0
  31. package/dist/host/daemon/supervisor.d.ts +2 -0
  32. package/dist/host/daemon/supervisor.js +2 -1
  33. package/dist/host/data-lock.js +5 -5
  34. package/dist/host/host-env.js +14 -2
  35. package/dist/host/host-extension.js +3 -5
  36. package/dist/host/host-migrations.d.ts +1 -1
  37. package/dist/host/host-migrations.js +2 -2
  38. package/dist/host/host-store.d.ts +1 -0
  39. package/dist/host/host-store.js +1 -1
  40. package/dist/host/host-url-store.d.ts +2 -1
  41. package/dist/host/host-url-store.js +18 -15
  42. package/dist/host/open-store.d.ts +6 -0
  43. package/dist/host/open-store.js +6 -0
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.js +2 -1
  46. package/dist/manifest/manifest.schema.d.ts +13 -0
  47. package/dist/manifest/manifest.schema.js +16 -2
  48. package/dist/manifest/parts.d.ts +7 -0
  49. package/dist/manifest/parts.js +5 -0
  50. package/dist/manifest/primitives.schema.js +2 -2
  51. package/dist/mcp/mcp-app.d.ts +1 -0
  52. package/dist/mcp/mcp-app.js +1 -1
  53. package/dist/mcp/server.js +19 -5
  54. package/dist/mcp/tools.d.ts +19 -1
  55. package/dist/mcp/tools.js +12 -0
  56. package/dist/runtime/run-part.js +22 -6
  57. package/dist/server/api-routes.js +33 -8
  58. package/dist/server/send-download.d.ts +3 -0
  59. package/dist/server/send-download.js +29 -0
  60. package/dist/shell/dist/index.html +46 -0
  61. package/dist/shell/dist/shell.css +2 -0
  62. package/dist/shell/dist/shell.js +68 -0
  63. package/dist/shell/dist/vendor/app.js +1 -0
  64. package/dist/shell/dist/vendor/chunk-AOJ3DQEL.js +14 -0
  65. package/dist/shell/dist/vendor/chunk-LW5HXGAJ.js +14 -0
  66. package/dist/shell/dist/vendor/chunk-PQJPUKWH.js +14 -0
  67. package/dist/shell/dist/vendor/chunk-SQE76S5B.js +1 -0
  68. package/dist/shell/dist/vendor/jsx-runtime.js +1 -0
  69. package/dist/shell/dist/vendor/react-dom-client.js +33 -0
  70. package/dist/shell/dist/vendor/react-dom.js +1 -0
  71. package/dist/shell/dist/vendor/react.js +1 -0
  72. package/dist/shell/package.json +5 -0
  73. package/dist/tool/app-build.d.ts +13 -0
  74. package/dist/tool/app-build.js +126 -0
  75. package/dist/tool/app-load.d.ts +4 -0
  76. package/dist/tool/app-load.js +34 -0
  77. package/dist/tool/build.js +5 -2
  78. package/dist/tool/check.js +10 -2
  79. package/dist/tool/container-recipe.d.ts +4 -0
  80. package/dist/tool/container-recipe.js +10 -6
  81. package/dist/tool/index.d.ts +1 -0
  82. package/dist/tool/index.js +1 -0
  83. package/dist/tool/main.d.ts +2 -0
  84. package/dist/tool/main.js +8 -1
  85. package/dist/tool/recipe.d.ts +1 -1
  86. package/dist/tool/recipe.js +16 -6
  87. package/dist/tool/rules/app-deps.d.ts +3 -0
  88. package/dist/tool/rules/app-deps.js +25 -0
  89. package/dist/tool/rules/folders.js +1 -1
  90. package/dist/tool/rules/sealing.js +4 -0
  91. package/dist/tool/stage.js +2 -2
  92. package/dist/tool/up/compose.d.ts +4 -0
  93. package/dist/tool/up/compose.js +41 -3
  94. package/dist/tool/up/gateway.js +16 -3
  95. package/dist/tool/up/secrets.d.ts +1 -0
  96. package/dist/tool/up/secrets.js +13 -1
  97. package/dist/tool/up/up.js +8 -5
  98. package/dist/vendor/app/api.d.ts +9 -0
  99. package/dist/vendor/app/api.js +63 -0
  100. package/dist/vendor/app/app.types.d.ts +79 -0
  101. package/dist/vendor/app/app.types.js +1 -0
  102. package/dist/vendor/app/boundary.d.ts +15 -0
  103. package/dist/vendor/app/boundary.js +17 -0
  104. package/dist/vendor/app/context.d.ts +5 -0
  105. package/dist/vendor/app/context.js +24 -0
  106. package/dist/vendor/app/index.d.ts +7 -0
  107. package/dist/vendor/app/index.js +6 -0
  108. package/dist/vendor/app/region.d.ts +6 -0
  109. package/dist/vendor/app/region.js +14 -0
  110. package/dist/vendor/app/split.d.ts +20 -0
  111. package/dist/vendor/app/split.js +38 -0
  112. package/dist/vendor/app/state-store.d.ts +3 -0
  113. package/dist/vendor/app/state-store.js +35 -0
  114. package/dist/vendor/app/test-host.d.ts +31 -0
  115. package/dist/vendor/app/test-host.js +68 -0
  116. package/dist/vendor/app/theme.css +32 -0
  117. package/dist/vendor/logs/events-client.js +38 -13
  118. package/package.json +39 -2
  119. package/schemas/extension-discovery.schema.json +1 -1
  120. package/schemas/extension-package.schema.json +28 -1
  121. package/schemas/extension-record.schema.json +1 -1
  122. package/schemas/health.schema.json +1 -1
@@ -40,27 +40,52 @@ export const batchesOf = (events) => {
40
40
  }
41
41
  return batch.length > 0 ? [...batches, batch] : batches;
42
42
  };
43
+ const ONE_IMAGE = '/api/logs/events';
44
+ const LEGACY = '/api/v1/events';
45
+ // The path that answered, per url: a logs host on the one image has no /api/v1/events (404), v13 has no /api/logs/events.
46
+ const paths = new Map();
43
47
  class IngestError extends Error {
44
48
  status;
45
- constructor(status) {
46
- super(`POST /api/v1/events answered ${status}`);
49
+ constructor(status, path = LEGACY, what = `answered ${status}`) {
50
+ super(`POST ${path} ${what}`);
47
51
  this.status = status;
48
52
  }
49
53
  }
50
54
  // A network error, 429 or 5xx is tried once more; a 4xx would fail the same way again.
51
55
  const retries = (err) => !(err instanceof IngestError) || err.status === 429 || err.status >= 500;
56
+ const request = (o, body, path) => (o.fetch ?? fetch)(`${o.url.replace(/\/+$/, '')}${path}`, {
57
+ method: 'POST',
58
+ headers: { authorization: `Bearer ${o.token}`, 'content-type': 'application/json' },
59
+ body,
60
+ signal: AbortSignal.timeout(o.timeoutMs ?? 5000),
61
+ });
62
+ // Statuses the ingest route itself answers: a different route would be a 404 or a proxy's 401, 403, 429 or 5xx.
63
+ const OWN_4XX = new Set([400, 413, 422]);
64
+ const resultOf = (reply) => {
65
+ const data = reply?.data;
66
+ return typeof data?.accepted === 'number' && typeof data.rejected === 'number'
67
+ ? { accepted: data.accepted, rejected: data.rejected }
68
+ : undefined;
69
+ };
52
70
  const sendOnce = async (o, body) => {
53
- const res = await (o.fetch ?? fetch)(`${o.url.replace(/\/+$/, '')}/api/v1/events`, {
54
- method: 'POST',
55
- headers: { authorization: `Bearer ${o.token}`, 'content-type': 'application/json' },
56
- body,
57
- signal: AbortSignal.timeout(o.timeoutMs ?? 5000),
58
- });
59
- if (!res.ok)
60
- throw new IngestError(res.status);
61
- // A 2xx was taken: an unreadable answer is never retried, it would post the rows twice.
62
- const reply = (await res.json().catch(() => ({})));
63
- return reply.data ?? { accepted: 0, rejected: 0 };
71
+ const key = o.url.replace(/\/+$/, '');
72
+ let path = paths.get(key) ?? ONE_IMAGE;
73
+ let res = await request(o, body, path);
74
+ if (res.status === 404 && path === ONE_IMAGE) {
75
+ path = LEGACY;
76
+ res = await request(o, body, path);
77
+ }
78
+ if (!res.ok) {
79
+ if (OWN_4XX.has(res.status))
80
+ paths.set(key, path);
81
+ throw new IngestError(res.status, path);
82
+ }
83
+ // A 2xx was taken: an unreadable or unknown answer is never retried, it would post the rows twice.
84
+ const result = resultOf(await res.json().catch(() => null));
85
+ if (!result)
86
+ throw new IngestError(res.status, path, 'answered a body that is not the ingest result');
87
+ paths.set(key, path);
88
+ return result;
64
89
  };
65
90
  const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
66
91
  const send = (o, body) => sendOnce(o, body).catch(async (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/extension",
3
- "version": "0.17.0",
3
+ "version": "0.18.2",
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
  },
@@ -69,15 +78,43 @@
69
78
  "zod": "^4.2.0"
70
79
  },
71
80
  "peerDependencies": {
81
+ "@agentage/design-system": "^0.20",
72
82
  "@electric-sql/pglite": "^0.5.0",
73
- "express": "^5.1.0"
83
+ "@tailwindcss/postcss": "^4.3.0",
84
+ "esbuild": ">=0.25.0",
85
+ "express": "^5.1.0",
86
+ "postcss": "^8.5.0",
87
+ "react": "^19.0.0",
88
+ "react-dom": "^19.0.0",
89
+ "tailwindcss": "^4.3.0"
74
90
  },
75
91
  "peerDependenciesMeta": {
92
+ "@agentage/design-system": {
93
+ "optional": true
94
+ },
76
95
  "@electric-sql/pglite": {
77
96
  "optional": true
78
97
  },
98
+ "@tailwindcss/postcss": {
99
+ "optional": true
100
+ },
101
+ "esbuild": {
102
+ "optional": true
103
+ },
79
104
  "express": {
80
105
  "optional": true
106
+ },
107
+ "postcss": {
108
+ "optional": true
109
+ },
110
+ "react": {
111
+ "optional": true
112
+ },
113
+ "react-dom": {
114
+ "optional": true
115
+ },
116
+ "tailwindcss": {
117
+ "optional": true
81
118
  }
82
119
  },
83
120
  "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",