@agentage/extension 0.15.0 → 0.15.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.
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/discovery/discovery.d.ts +10 -25
- package/dist/discovery/discovery.js +7 -1
- package/dist/discovery/discovery.schema.d.ts +45 -0
- package/dist/discovery/discovery.schema.js +33 -4
- package/dist/discovery/served-extras.d.ts +8 -0
- package/dist/discovery/served-extras.js +10 -0
- package/dist/host/daemon/add.d.ts +2 -0
- package/dist/host/daemon/add.js +10 -1
- package/dist/host/daemon/child-files.d.ts +2 -2
- package/dist/host/daemon/child-files.js +16 -8
- package/dist/host/daemon/child.d.ts +1 -1
- package/dist/host/daemon/child.js +8 -11
- package/dist/host/daemon/daemon-files.js +18 -3
- package/dist/host/daemon/daemon.js +3 -3
- package/dist/host/daemon/health-routes.d.ts +0 -1
- package/dist/host/daemon/health-routes.js +2 -2
- package/dist/host/daemon/installation.js +2 -4
- package/dist/host/daemon/json-file.d.ts +2 -0
- package/dist/host/daemon/json-file.js +38 -10
- package/dist/host/daemon/ops.js +4 -2
- package/dist/host/daemon/proxy.d.ts +6 -1
- package/dist/host/daemon/proxy.js +13 -4
- package/dist/host/daemon/redact-stream.d.ts +4 -0
- package/dist/host/daemon/redact-stream.js +24 -0
- package/dist/host/daemon/reload-marker.js +2 -1
- package/dist/host/daemon/reload.js +3 -4
- package/dist/host/daemon/routes.js +9 -5
- package/dist/host/daemon/seal-reach.js +1 -1
- package/dist/host/daemon/seal.d.ts +2 -2
- package/dist/host/daemon/seal.js +1 -1
- package/dist/host/daemon/start-checks.d.ts +1 -1
- package/dist/host/daemon/start-checks.js +6 -5
- package/dist/host/daemon/supervisor.d.ts +1 -4
- package/dist/host/daemon/supervisor.js +15 -17
- package/dist/host/host-extension.d.ts +3 -0
- package/dist/host/host-extension.js +12 -2
- package/dist/host/host-parts.d.ts +1 -1
- package/dist/host/host-parts.js +11 -4
- package/dist/host/serve-host.js +4 -3
- package/dist/manifest/parts.d.ts +2 -1
- package/dist/manifest/parts.js +1 -1
- package/dist/mcp/mcp-app.d.ts +0 -1
- package/dist/mcp/mcp-app.js +1 -1
- package/dist/runtime/part-mounts.d.ts +3 -1
- package/dist/runtime/part-mounts.js +7 -2
- package/dist/server/app.d.ts +2 -3
- package/dist/server/app.js +0 -1
- package/dist/tool/build.d.ts +1 -0
- package/dist/tool/build.js +3 -2
- package/dist/tool/check.d.ts +1 -1
- package/dist/tool/check.js +2 -1
- package/dist/tool/format.d.ts +1 -0
- package/dist/tool/format.js +3 -1
- package/dist/tool/record-extras.js +5 -12
- package/dist/worker/clock.d.ts +0 -1
- package/dist/worker/clock.js +1 -1
- package/dist/worker/scheduler.d.ts +1 -1
- package/dist/worker/scheduler.js +12 -2
- package/package.json +1 -1
- package/schemas/extension-discovery.schema.json +61 -34
- package/schemas/extension-record.schema.json +1 -1
- package/dist/host/daemon/reload-route.d.ts +0 -4
- package/dist/host/daemon/reload-route.js +0 -21
package/dist/tool/check.js
CHANGED
|
@@ -9,7 +9,7 @@ import { entryOf, normalizeParts } from '../manifest/parts.js';
|
|
|
9
9
|
import {} from '../manifest/primitives.schema.js';
|
|
10
10
|
import { formatIssues, readJsonIfExists } from '../manifest/read-manifest.js';
|
|
11
11
|
import { runCommand } from './exec.js';
|
|
12
|
-
import { problemLines } from './format.js';
|
|
12
|
+
import { problemLines, warningLines } from './format.js';
|
|
13
13
|
import { exportedPartCode } from './rules/folders.js';
|
|
14
14
|
import { sealing } from './rules/sealing.js';
|
|
15
15
|
import { store } from './rules/store.js';
|
|
@@ -137,4 +137,5 @@ export const assertConforms = async (dir, options = {}) => {
|
|
|
137
137
|
const lines = problemLines(report).map((line) => `check failed: ${line}`);
|
|
138
138
|
if (!report.conforms)
|
|
139
139
|
throw new Error(lines.join('\n'));
|
|
140
|
+
return warningLines(report);
|
|
140
141
|
};
|
package/dist/tool/format.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import { type BuildResult } from './build.js';
|
|
|
2
2
|
import { type CheckReport } from './check.js';
|
|
3
3
|
export declare const buildLines: (result: BuildResult, cwd?: string) => string[];
|
|
4
4
|
export declare const problemLines: (report: CheckReport) => string[];
|
|
5
|
+
export declare const warningLines: ({ warnings }: CheckReport) => string[];
|
|
5
6
|
export declare const checkLines: (report: CheckReport) => string[];
|
package/dist/tool/format.js
CHANGED
|
@@ -16,11 +16,13 @@ const partsLine = ({ container }) => {
|
|
|
16
16
|
// One line per image (the one image as "image"), the parts it runs and skips, then the record.
|
|
17
17
|
export const buildLines = (result, cwd = process.cwd()) => {
|
|
18
18
|
const rows = rowsOf(result);
|
|
19
|
+
const warned = result.warnings ?? [];
|
|
19
20
|
const width = Math.max(...rows.map((row) => row.tag.length)) + 2;
|
|
20
21
|
const lines = rows.map((row) => {
|
|
21
22
|
const state = row.digest ? `${shortDigest(row.digest)} pushed` : 'built';
|
|
22
23
|
return `${row.label.padEnd(8)}${row.tag.padEnd(width)}${state}`;
|
|
23
24
|
});
|
|
25
|
+
lines.unshift(...warned);
|
|
24
26
|
lines.push(...partsLine(result));
|
|
25
27
|
if (result.recordFile)
|
|
26
28
|
lines.push(`${'record'.padEnd(8)}${relative(cwd, result.recordFile)}`);
|
|
@@ -29,7 +31,7 @@ export const buildLines = (result, cwd = process.cwd()) => {
|
|
|
29
31
|
const where = ({ file, line }) => file ? `${file}${line ? `:${line}` : ''} ` : '';
|
|
30
32
|
const lineOf = (found) => `${found.rule}: ${where(found)}${found.problem}`;
|
|
31
33
|
export const problemLines = (report) => report.problems.map(lineOf);
|
|
32
|
-
const warningLines = ({ warnings = [] }) => warnings.map((found) => `warning ${lineOf(found)}`);
|
|
34
|
+
export const warningLines = ({ warnings = [] }) => warnings.map((found) => `warning ${lineOf(found)}`);
|
|
33
35
|
// What `agentage extension check` prints (sheet C2): the rules line and PASS, or each problem and FAIL; warnings first.
|
|
34
36
|
export const checkLines = (report) => {
|
|
35
37
|
const { rules, skipped, problems } = report;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { createRouteRegistry } from '../api/routes.js';
|
|
4
|
-
import { scopeOf } from '../auth/token-check.js';
|
|
5
4
|
import { createContext } from '../context/context.js';
|
|
6
5
|
import {} from '../discovery/discovery.js';
|
|
7
6
|
import { WidgetSchema } from '../discovery/discovery.schema.js';
|
|
8
7
|
import { openapiPath, readOpenapi } from '../discovery/openapi.js';
|
|
8
|
+
import { migrationsOf, toolRecords } from '../discovery/served-extras.js';
|
|
9
9
|
import { createLog } from '../log/log.js';
|
|
10
10
|
import { loadCreate } from '../manifest/entry.js';
|
|
11
11
|
import { readJsonIfExists } from '../manifest/read-manifest.js';
|
|
12
12
|
import {} from '../manifest/manifest.schema.js';
|
|
13
|
-
import {
|
|
14
|
-
import { createToolRegistry
|
|
15
|
-
import { sqlFiles } from '../store/migrations.js';
|
|
13
|
+
import { normalizeParts } from '../manifest/parts.js';
|
|
14
|
+
import { createToolRegistry } from '../mcp/tools.js';
|
|
16
15
|
import {} from '../store/store.types.js';
|
|
17
16
|
const WidgetsSchema = z.array(WidgetSchema).min(1);
|
|
18
17
|
const noStore = {
|
|
@@ -44,11 +43,7 @@ export const registeredRoutes = async (create, pkg) => {
|
|
|
44
43
|
};
|
|
45
44
|
export const toolsOf = async (dir, pkg) => {
|
|
46
45
|
const tools = await registeredTools(await loadCreate(dir, pkg, 'mcp'), pkg);
|
|
47
|
-
|
|
48
|
-
return tools.map((tool) => ({
|
|
49
|
-
name: prefixed(id, tool.name),
|
|
50
|
-
scope: scopeOf(id, tool.spec.scope),
|
|
51
|
-
}));
|
|
46
|
+
return toolRecords(pkg.agentage.id, tools);
|
|
52
47
|
};
|
|
53
48
|
const widgetsOf = async (dir) => {
|
|
54
49
|
const value = await readJsonIfExists(join(dir, 'dist', 'ui', 'widgets.json'));
|
|
@@ -57,7 +52,7 @@ const widgetsOf = async (dir) => {
|
|
|
57
52
|
// What the code serves, for the record: tools, widgets and the migration count.
|
|
58
53
|
export const recordExtras = async (dir, pkg) => {
|
|
59
54
|
const { code } = normalizeParts(pkg.agentage.parts);
|
|
60
|
-
const extras =
|
|
55
|
+
const extras = await migrationsOf(dir, pkg);
|
|
61
56
|
if (code.mcp) {
|
|
62
57
|
const tools = await toolsOf(dir, pkg);
|
|
63
58
|
if (tools.length > 0)
|
|
@@ -67,7 +62,5 @@ export const recordExtras = async (dir, pkg) => {
|
|
|
67
62
|
extras.widgets = await widgetsOf(dir);
|
|
68
63
|
if (code.api && (await readOpenapi(dir)))
|
|
69
64
|
extras.openapi = openapiPath(pkg.agentage.id);
|
|
70
|
-
if (migratesStore(pkg))
|
|
71
|
-
extras.migrations = (await sqlFiles(join(dir, 'migrations'))).length;
|
|
72
65
|
return extras;
|
|
73
66
|
};
|
package/dist/worker/clock.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const CLOCK_RATE_ENV = "AGENTAGE_CLOCK_RATE";
|
|
2
|
-
export declare const MAX_CLOCK_RATE = 3600;
|
|
3
2
|
export declare const parseClockRate: (raw: string | number | undefined) => number;
|
|
4
3
|
export declare const setHostClockRate: (rate: number) => void;
|
|
5
4
|
export declare const hostClockRate: () => number;
|
package/dist/worker/clock.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const CLOCK_RATE_ENV = 'AGENTAGE_CLOCK_RATE';
|
|
2
|
-
|
|
2
|
+
const MAX_CLOCK_RATE = 3600;
|
|
3
3
|
// The test clock (tests only): it scales run timestamps, job ms, timeoutMs and the late check. A rate of 60 makes one cron minute last one second; a bad value is refused, never ignored.
|
|
4
4
|
export const parseClockRate = (raw) => {
|
|
5
5
|
if (raw === undefined || raw === '')
|
package/dist/worker/scheduler.js
CHANGED
|
@@ -49,7 +49,13 @@ const runJob = async (entry, log, buffer) => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
// Never twice at once; every run saved with its log, a failed save is logged and the job goes on.
|
|
52
|
-
const execute = (s, entry) =>
|
|
52
|
+
const execute = (s, entry) => {
|
|
53
|
+
const run = requestScope.run({ agcid: uuidv7() }, () => executeScoped(s, entry));
|
|
54
|
+
s.running.add(run);
|
|
55
|
+
const gone = () => void s.running.delete(run);
|
|
56
|
+
run.then(gone, gone);
|
|
57
|
+
return run;
|
|
58
|
+
};
|
|
53
59
|
// Inside the run's scope: every log line of the job, its failure and its save share one agcid.
|
|
54
60
|
const executeScoped = async (s, entry) => {
|
|
55
61
|
const startedAt = s.now();
|
|
@@ -110,11 +116,15 @@ export const createScheduler = (deps) => {
|
|
|
110
116
|
rate,
|
|
111
117
|
entries: new Map(),
|
|
112
118
|
started: false,
|
|
119
|
+
running: new Set(),
|
|
113
120
|
};
|
|
114
121
|
return {
|
|
115
122
|
schedule: scheduleOn(s),
|
|
116
123
|
start: () => setStarted(s, true),
|
|
117
|
-
stop: () =>
|
|
124
|
+
stop: async () => {
|
|
125
|
+
setStarted(s, false);
|
|
126
|
+
await Promise.allSettled([...s.running]);
|
|
127
|
+
},
|
|
118
128
|
run: async (name) => {
|
|
119
129
|
const entry = s.entries.get(name);
|
|
120
130
|
return entry && !entry.running ? execute(s, entry) : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/extension",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -54,46 +54,73 @@
|
|
|
54
54
|
"additionalProperties": false
|
|
55
55
|
},
|
|
56
56
|
"api": {
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
"anyOf": [
|
|
58
|
+
{
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"image": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"maxLength": 256,
|
|
64
|
+
"pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?\\/[a-z0-9][a-z0-9-]*\\/[a-z][a-z0-9-]*-(pages|ui|api|mcp|worker)@sha256:[0-9a-f]{64}$"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"image"
|
|
69
|
+
],
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "object",
|
|
74
|
+
"properties": {},
|
|
75
|
+
"additionalProperties": false
|
|
63
76
|
}
|
|
64
|
-
|
|
65
|
-
"required": [
|
|
66
|
-
"image"
|
|
67
|
-
],
|
|
68
|
-
"additionalProperties": false
|
|
77
|
+
]
|
|
69
78
|
},
|
|
70
79
|
"mcp": {
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
"anyOf": [
|
|
81
|
+
{
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"image": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"maxLength": 256,
|
|
87
|
+
"pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?\\/[a-z0-9][a-z0-9-]*\\/[a-z][a-z0-9-]*-(pages|ui|api|mcp|worker)@sha256:[0-9a-f]{64}$"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": [
|
|
91
|
+
"image"
|
|
92
|
+
],
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {},
|
|
98
|
+
"additionalProperties": false
|
|
77
99
|
}
|
|
78
|
-
|
|
79
|
-
"required": [
|
|
80
|
-
"image"
|
|
81
|
-
],
|
|
82
|
-
"additionalProperties": false
|
|
100
|
+
]
|
|
83
101
|
},
|
|
84
102
|
"worker": {
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
"anyOf": [
|
|
104
|
+
{
|
|
105
|
+
"type": "object",
|
|
106
|
+
"properties": {
|
|
107
|
+
"image": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"maxLength": 256,
|
|
110
|
+
"pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?\\/[a-z0-9][a-z0-9-]*\\/[a-z][a-z0-9-]*-(pages|ui|api|mcp|worker)@sha256:[0-9a-f]{64}$"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"required": [
|
|
114
|
+
"image"
|
|
115
|
+
],
|
|
116
|
+
"additionalProperties": false
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {},
|
|
121
|
+
"additionalProperties": false
|
|
91
122
|
}
|
|
92
|
-
|
|
93
|
-
"required": [
|
|
94
|
-
"image"
|
|
95
|
-
],
|
|
96
|
-
"additionalProperties": false
|
|
123
|
+
]
|
|
97
124
|
},
|
|
98
125
|
"store": {
|
|
99
126
|
"type": "object",
|
|
@@ -122,7 +149,7 @@
|
|
|
122
149
|
"additionalProperties": false
|
|
123
150
|
},
|
|
124
151
|
"image": {
|
|
125
|
-
"description": "The one image (build --container). A record has part images or this image: never both, never none.",
|
|
152
|
+
"description": "The one image (build --container). A build record has part images or this image: never both, never none.",
|
|
126
153
|
"type": "string",
|
|
127
154
|
"maxLength": 256,
|
|
128
155
|
"pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?(\\/[a-z0-9][a-z0-9_.-]*)+\\/[a-z][a-z0-9-]*@sha256:[0-9a-f]{64}$"
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"additionalProperties": false
|
|
123
123
|
},
|
|
124
124
|
"image": {
|
|
125
|
-
"description": "The one image (build --container). A record has part images or this image: never both, never none.",
|
|
125
|
+
"description": "The one image (build --container). A build record has part images or this image: never both, never none.",
|
|
126
126
|
"type": "string",
|
|
127
127
|
"maxLength": 256,
|
|
128
128
|
"pattern": "^[a-z0-9][a-z0-9.-]*(:[0-9]{1,5})?(\\/[a-z0-9][a-z0-9_.-]*)+\\/[a-z][a-z0-9-]*@sha256:[0-9a-f]{64}$"
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Express } from 'express';
|
|
2
|
-
import { type Entries } from './entries.js';
|
|
3
|
-
import { type SupervisorDeps } from './supervisor.js';
|
|
4
|
-
export declare const reloadRoute: (app: Express, deps: SupervisorDeps, entries: Entries, readable: () => Promise<void>) => void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import express, {} from 'express';
|
|
2
|
-
import { ok } from '../../envelope/envelope.js';
|
|
3
|
-
import { BODY_LIMIT } from '../../server/app.js';
|
|
4
|
-
import {} from './entries.js';
|
|
5
|
-
import { waitAtMost } from './queue.js';
|
|
6
|
-
import { reloadExtension } from './reload.js';
|
|
7
|
-
import { stopsNow } from './stopping.js';
|
|
8
|
-
import {} from './supervisor.js';
|
|
9
|
-
// In the change queue (a second reload waits); refused like every change while installation.json is unreadable.
|
|
10
|
-
export const reloadRoute = (app, deps, entries, readable) => {
|
|
11
|
-
app.post('/host/extensions/:id/reload', express.json({ limit: BODY_LIMIT }), async (req, res) => {
|
|
12
|
-
const id = String(req.params['id']);
|
|
13
|
-
const run = () => waitAtMost(deps.queue, deps.installMs, async () => {
|
|
14
|
-
if (deps.stopping.signal.aborted)
|
|
15
|
-
throw stopsNow();
|
|
16
|
-
await readable();
|
|
17
|
-
return reloadExtension(deps, entries, id, req.body);
|
|
18
|
-
});
|
|
19
|
-
res.json(ok(await deps.pending.track({ op: 'reload', id }, run)));
|
|
20
|
-
});
|
|
21
|
-
};
|