@agentage/extension 0.20.3 → 0.20.4
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.
- package/README.md +2 -1
- package/dist/discovery/combine.d.ts +3 -2
- package/dist/discovery/combine.js +8 -4
- package/dist/discovery/host-document.schema.d.ts +9 -0
- package/dist/discovery/host-document.schema.js +3 -0
- package/dist/internal/index.d.ts +4 -3
- package/dist/internal/index.js +3 -2
- package/package.json +1 -1
- package/schemas/host-document.schema.json +18 -0
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@ The agentage extension kit. Each server and cli part (pages, api, mcp, worker, c
|
|
|
5
5
|
correlation id, the response envelope, the store pool, the scheduler and argument parsing.
|
|
6
6
|
`@agentage/extension/tool` is the tool behind `agentage extension check | build | up --docker | down | token`.
|
|
7
7
|
`@agentage/extension/host` is the host and the daemon, `@agentage/extension/contracts` the wire
|
|
8
|
-
schemas.
|
|
8
|
+
schemas. The host document has the optional key `program { version, commit }` since 0.20.4: a cloud
|
|
9
|
+
app host fills it with its program; the daemon leaves it out.
|
|
9
10
|
`@agentage/extension/logs` is the event line (`EventSchema`, `parseLine`, `createLogger`,
|
|
10
11
|
`createEventsClient`, `KINDS`, `LEVELS`, `USER_TYPES`), built into the kit's own tarball.
|
|
11
12
|
`@agentage/extension/core` is the one client of the core's services (see "The core client").
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Answer, type Refusal } from './combine-answers.js';
|
|
2
|
-
import { type Expose, type HostDocument, type HostKind } from './host-document.schema.js';
|
|
2
|
+
import { type Expose, type HostDocument, type HostKind, type Program } from './host-document.schema.js';
|
|
3
3
|
import { type Route } from './route-table.js';
|
|
4
4
|
export { entryOfDocument, type Answer, type Refusal } from './combine-answers.js';
|
|
5
5
|
export { type Route } from './route-table.js';
|
|
@@ -27,5 +27,6 @@ export interface CombineInput {
|
|
|
27
27
|
installation: HostInstallation;
|
|
28
28
|
answers: Answer[];
|
|
29
29
|
states?: Record<string, CallerState>;
|
|
30
|
+
program?: Program;
|
|
30
31
|
}
|
|
31
|
-
export declare const combineHost: (
|
|
32
|
+
export declare const combineHost: (input: CombineInput) => Combined;
|
|
@@ -20,10 +20,13 @@ const entryOf = (row, served, told) => {
|
|
|
20
20
|
const parts = SERVES_KINDS.filter((kind) => docs.some((d) => d.parts.includes(kind)));
|
|
21
21
|
return { ...docs.reduceRight((later, doc) => ({ ...later, ...doc })), parts, expose, state };
|
|
22
22
|
};
|
|
23
|
-
const documentOf = (
|
|
23
|
+
const documentOf = (input, entries) => {
|
|
24
|
+
const { installation, kind, program } = input;
|
|
24
25
|
const { shell } = installation;
|
|
25
26
|
const named = shell && { shell: { package: shell.package, version: shell.version } };
|
|
26
|
-
|
|
27
|
+
const own = program && { program: { version: program.version, commit: program.commit } };
|
|
28
|
+
const { host } = installation;
|
|
29
|
+
return HostDocumentSchema.parse({ host, kind, ...own, ...named, extensions: entries });
|
|
27
30
|
};
|
|
28
31
|
const pagesRefusal = (route, site) => ({
|
|
29
32
|
upstream: route.upstream,
|
|
@@ -32,13 +35,14 @@ const pagesRefusal = (route, site) => ({
|
|
|
32
35
|
});
|
|
33
36
|
// No I/O: the installation and each container's answer in; the host document and routes out.
|
|
34
37
|
// Throws only on an installation the host schema refuses (two rows of one id); a bad answer is refused.
|
|
35
|
-
export const combineHost = (
|
|
38
|
+
export const combineHost = (input) => {
|
|
39
|
+
const { installation, answers, states } = input;
|
|
36
40
|
const { byId, refused } = sortAnswers(installation.extensions, answers);
|
|
37
41
|
const rows = installation.extensions.map((row) => {
|
|
38
42
|
const served = byId.get(row.id) ?? [];
|
|
39
43
|
return { entry: entryOf(row, served, states?.[row.id]), served };
|
|
40
44
|
});
|
|
41
|
-
const document = documentOf(
|
|
45
|
+
const document = documentOf(input, rows.map((r) => r.entry));
|
|
42
46
|
const { routes, dropped } = routeTable(rows);
|
|
43
47
|
const site = routes.find((r) => r.part === 'pages');
|
|
44
48
|
return { document, routes, refused: [...refused, ...dropped.map((r) => pagesRefusal(r, site))] };
|
|
@@ -57,12 +57,20 @@ export declare const ExtensionEntrySchema: z.ZodObject<{
|
|
|
57
57
|
down: "down";
|
|
58
58
|
}>;
|
|
59
59
|
}, z.core.$strict>;
|
|
60
|
+
export declare const ProgramSchema: z.ZodObject<{
|
|
61
|
+
version: z.ZodString;
|
|
62
|
+
commit: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
60
64
|
export declare const HostDocumentSchema: z.ZodObject<{
|
|
61
65
|
host: z.ZodString;
|
|
62
66
|
kind: z.ZodEnum<{
|
|
63
67
|
cloud: "cloud";
|
|
64
68
|
local: "local";
|
|
65
69
|
}>;
|
|
70
|
+
program: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
version: z.ZodString;
|
|
72
|
+
commit: z.ZodString;
|
|
73
|
+
}, z.core.$strict>>;
|
|
66
74
|
shell: z.ZodOptional<z.ZodObject<{
|
|
67
75
|
package: z.ZodString;
|
|
68
76
|
version: z.ZodString;
|
|
@@ -116,3 +124,4 @@ export type HostDocument = z.infer<typeof HostDocumentSchema>;
|
|
|
116
124
|
export type HostEntry = HostDocument['extensions'][number];
|
|
117
125
|
export type HostKind = (typeof HOST_KINDS)[number];
|
|
118
126
|
export type Expose = z.infer<typeof ExposeSchema>;
|
|
127
|
+
export type Program = z.infer<typeof ProgramSchema>;
|
|
@@ -36,6 +36,8 @@ export const ExtensionEntrySchema = z
|
|
|
36
36
|
.refine(toolsAreOwn, TOOLS_RULE);
|
|
37
37
|
// The shell is a library the host serves: named here only, never a row of extensions.
|
|
38
38
|
const ShellSchema = z.strictObject({ package: PackageNameSchema, version: VersionSchema });
|
|
39
|
+
// The app host program that serves this document (a cloud host); the daemon leaves it out.
|
|
40
|
+
export const ProgramSchema = z.strictObject({ version: VersionSchema, commit: CommitSchema });
|
|
39
41
|
const uniqueIds = ({ extensions }) => new Set(extensions.map((e) => e.id)).size === extensions.length;
|
|
40
42
|
// GET /.well-known/agentage-host.json: one app host, built from the documents of its extensions.
|
|
41
43
|
export const HostDocumentSchema = z
|
|
@@ -45,6 +47,7 @@ export const HostDocumentSchema = z
|
|
|
45
47
|
.max(63)
|
|
46
48
|
.regex(/^[a-z][a-z0-9-]*$/),
|
|
47
49
|
kind: z.enum(HOST_KINDS),
|
|
50
|
+
program: ProgramSchema.optional(),
|
|
48
51
|
shell: ShellSchema.optional(),
|
|
49
52
|
extensions: z.array(ExtensionEntrySchema),
|
|
50
53
|
})
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { agcidMiddleware } from '../agcid/scope.js';
|
|
|
2
2
|
export { download } from '../api/download.js';
|
|
3
3
|
export { type ApiContext } from '../api/routes.js';
|
|
4
4
|
export { fits, type Setting } from '../context/settings.js';
|
|
5
|
-
export { type Answer, type CallerState, combineHost, type CombineInput, } from '../discovery/combine.js';
|
|
5
|
+
export { type Answer, type CallerState, combineHost, type CombineInput, type HostInstallation, } from '../discovery/combine.js';
|
|
6
6
|
export { DiscoveryDocumentSchema } from '../discovery/discovery.schema.js';
|
|
7
|
-
export { HostDocumentSchema, type HostEntry } from '../discovery/host-document.schema.js';
|
|
7
|
+
export { ExposeSchema, HostDocumentSchema, type HostEntry, type Program, } from '../discovery/host-document.schema.js';
|
|
8
8
|
export { SERVES_KINDS } from '../discovery/served.schema.js';
|
|
9
9
|
export { fail, ok } from '../envelope/envelope.js';
|
|
10
10
|
export { parse } from '../envelope/parse.js';
|
|
@@ -19,10 +19,11 @@ export { serveHost } from '../host/serve-host.js';
|
|
|
19
19
|
export { createLog, type Log } from '../log/log.js';
|
|
20
20
|
export { type ExtensionPackage } from '../manifest/manifest.schema.js';
|
|
21
21
|
export { hasStore, hostParts, mountedIn, secretNames } from '../manifest/parts.js';
|
|
22
|
-
export { ExtensionIdSchema, SecretNameSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
22
|
+
export { CommitSchema, ExtensionIdSchema, PackageNameSchema, SecretNameSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
23
23
|
export { readManifest } from '../manifest/read-manifest.js';
|
|
24
24
|
export { BODY_LIMIT } from '../server/app.js';
|
|
25
25
|
export { errorHandler, notFound } from '../server/errors.js';
|
|
26
|
+
export { requestLine } from '../server/request-line.js';
|
|
26
27
|
export { closeNow, listen } from '../server/serve.js';
|
|
27
28
|
export { startOn, startTestServer, type TestServer } from '../testing/test-server.js';
|
|
28
29
|
export { KIT_VERSION } from '../tool/kit-version.js';
|
package/dist/internal/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export {} from '../api/routes.js';
|
|
|
5
5
|
export { fits } from '../context/settings.js';
|
|
6
6
|
export { combineHost, } from '../discovery/combine.js';
|
|
7
7
|
export { DiscoveryDocumentSchema } from '../discovery/discovery.schema.js';
|
|
8
|
-
export { HostDocumentSchema } from '../discovery/host-document.schema.js';
|
|
8
|
+
export { ExposeSchema, HostDocumentSchema, } from '../discovery/host-document.schema.js';
|
|
9
9
|
export { SERVES_KINDS } from '../discovery/served.schema.js';
|
|
10
10
|
export { fail, ok } from '../envelope/envelope.js';
|
|
11
11
|
export { parse } from '../envelope/parse.js';
|
|
@@ -20,10 +20,11 @@ export { serveHost } from '../host/serve-host.js';
|
|
|
20
20
|
export { createLog } from '../log/log.js';
|
|
21
21
|
export {} from '../manifest/manifest.schema.js';
|
|
22
22
|
export { hasStore, hostParts, mountedIn, secretNames } from '../manifest/parts.js';
|
|
23
|
-
export { ExtensionIdSchema, SecretNameSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
23
|
+
export { CommitSchema, ExtensionIdSchema, PackageNameSchema, SecretNameSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
24
24
|
export { readManifest } from '../manifest/read-manifest.js';
|
|
25
25
|
export { BODY_LIMIT } from '../server/app.js';
|
|
26
26
|
export { errorHandler, notFound } from '../server/errors.js';
|
|
27
|
+
export { requestLine } from '../server/request-line.js';
|
|
27
28
|
export { closeNow, listen } from '../server/serve.js';
|
|
28
29
|
export { startOn, startTestServer } from '../testing/test-server.js';
|
|
29
30
|
export { KIT_VERSION } from '../tool/kit-version.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/extension",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.4",
|
|
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",
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
"cloud"
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
|
+
"program": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"version": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
|
|
25
|
+
},
|
|
26
|
+
"commit": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"pattern": "^[0-9a-f]{40}$"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": [
|
|
32
|
+
"version",
|
|
33
|
+
"commit"
|
|
34
|
+
],
|
|
35
|
+
"additionalProperties": false
|
|
36
|
+
},
|
|
19
37
|
"shell": {
|
|
20
38
|
"type": "object",
|
|
21
39
|
"properties": {
|