@agentage/extension 0.4.2 → 0.5.0
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/context/context.d.ts +3 -0
- package/dist/context/context.js +3 -1
- package/dist/context/secrets.d.ts +5 -0
- package/dist/context/secrets.js +15 -0
- package/dist/context/test-context.d.ts +1 -0
- package/dist/context/test-context.js +1 -0
- package/dist/discovery/discovery.d.ts +2 -1
- package/dist/discovery/discovery.js +4 -1
- package/dist/discovery/discovery.schema.d.ts +3 -2
- package/dist/discovery/discovery.schema.js +3 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/log/log.js +2 -1
- package/dist/manifest/manifest.schema.d.ts +4 -4
- package/dist/manifest/manifest.schema.js +3 -1
- package/dist/manifest/parts.d.ts +3 -1
- package/dist/manifest/parts.js +8 -2
- package/dist/manifest/primitives.schema.d.ts +14 -2
- package/dist/manifest/primitives.schema.js +8 -1
- package/dist/mcp/mcp-app.js +1 -1
- package/dist/runtime/part-runners.js +2 -2
- package/dist/runtime/run-part.d.ts +1 -0
- package/dist/runtime/run-part.js +7 -3
- package/dist/server/app.js +6 -1
- package/dist/tool/record-extras.js +2 -2
- package/dist/tool/rules/store.js +8 -2
- package/dist/tool/stage.js +2 -2
- package/dist/tool/up/compose.d.ts +15 -0
- package/dist/tool/up/compose.js +11 -6
- package/dist/tool/up/down.js +2 -0
- package/dist/tool/up/local-record.d.ts +2 -1
- package/dist/tool/up/secrets.d.ts +6 -0
- package/dist/tool/up/secrets.js +36 -0
- package/dist/tool/up/up.js +9 -6
- package/package.json +1 -1
- package/schemas/extension-discovery.schema.json +2 -2
- package/schemas/extension-package.schema.json +4 -4
- package/schemas/extension-record.schema.json +11 -2
|
@@ -2,6 +2,7 @@ import { type Caller } from '../auth/token-check.js';
|
|
|
2
2
|
import { type ExtensionPackage } from '../manifest/manifest.schema.js';
|
|
3
3
|
import { type Log } from '../log/log.js';
|
|
4
4
|
import { type Store } from '../store/store.types.js';
|
|
5
|
+
import { type Secrets } from './secrets.js';
|
|
5
6
|
export type ServerPartKind = 'pages' | 'api' | 'mcp' | 'worker';
|
|
6
7
|
export type SettingValue = string | number | boolean;
|
|
7
8
|
export interface ExtensionInfo {
|
|
@@ -19,6 +20,7 @@ export interface PartContext {
|
|
|
19
20
|
readonly log: Log;
|
|
20
21
|
readonly settings: Readonly<Record<string, SettingValue>>;
|
|
21
22
|
readonly store: Store;
|
|
23
|
+
readonly secrets: Secrets;
|
|
22
24
|
}
|
|
23
25
|
export declare const NO_STORE: Store;
|
|
24
26
|
export declare const settingDefaults: (pkg: ExtensionPackage) => Record<string, SettingValue>;
|
|
@@ -30,5 +32,6 @@ export interface ContextInput {
|
|
|
30
32
|
log?: Log;
|
|
31
33
|
settings?: Record<string, SettingValue>;
|
|
32
34
|
store?: Store;
|
|
35
|
+
secrets?: Secrets;
|
|
33
36
|
}
|
|
34
37
|
export declare const createContext: (input: ContextInput) => PartContext;
|
package/dist/context/context.js
CHANGED
|
@@ -2,6 +2,7 @@ import { callerOf } from '../auth/token-check.js';
|
|
|
2
2
|
import {} from '../manifest/manifest.schema.js';
|
|
3
3
|
import { createLog } from '../log/log.js';
|
|
4
4
|
import {} from '../store/store.types.js';
|
|
5
|
+
import {} from './secrets.js';
|
|
5
6
|
// ctx.store is always there; without a store part in the manifest it says so on first use.
|
|
6
7
|
export const NO_STORE = {
|
|
7
8
|
query: async () => {
|
|
@@ -21,5 +22,6 @@ export const createContext = (input) => {
|
|
|
21
22
|
const log = input.log ?? createLog({ extension: pkg.agentage.id, part });
|
|
22
23
|
const settings = Object.freeze({ ...settingDefaults(pkg), ...input.settings });
|
|
23
24
|
const auth = Object.freeze({ caller: callerOf });
|
|
24
|
-
|
|
25
|
+
const secrets = input.secrets ?? {};
|
|
26
|
+
return Object.freeze({ extension, auth, log, settings, store: store ?? NO_STORE, secrets });
|
|
25
27
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface Secrets {
|
|
2
|
+
}
|
|
3
|
+
export declare const SECRETS_DIR = "/run/secrets";
|
|
4
|
+
export declare const camelName: (name: string) => string;
|
|
5
|
+
export declare const readSecrets: (names: readonly string[], dir: string, part: string) => Promise<Readonly<Record<string, string>>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export const SECRETS_DIR = '/run/secrets';
|
|
4
|
+
export const camelName = (name) => name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
5
|
+
const valueOf = (file) => readFile(file, 'utf8').then((text) => text.replace(/\r?\n$/, ''), () => '');
|
|
6
|
+
// Each declared name from its mounted file; a missing or empty file stops the part, named, never valued.
|
|
7
|
+
export const readSecrets = async (names, dir, part) => {
|
|
8
|
+
const read = names.map(async (name) => [name, await valueOf(join(dir, name))]);
|
|
9
|
+
const pairs = await Promise.all(read);
|
|
10
|
+
const missing = pairs.find(([, value]) => value === '');
|
|
11
|
+
if (missing)
|
|
12
|
+
throw new Error(`${part} refused to start: secret ${missing[0]} has no value`);
|
|
13
|
+
const secrets = Object.fromEntries(pairs.map(([name, value]) => [camelName(name), value]));
|
|
14
|
+
return Object.freeze(secrets);
|
|
15
|
+
};
|
|
@@ -28,6 +28,7 @@ export interface TestCommandContext extends CliContext {
|
|
|
28
28
|
export interface TestContextOptions {
|
|
29
29
|
extension?: Partial<ExtensionInfo>;
|
|
30
30
|
settings?: Record<string, SettingValue>;
|
|
31
|
+
secrets?: Record<string, string>;
|
|
31
32
|
store?: boolean | {
|
|
32
33
|
dir: string;
|
|
33
34
|
};
|
|
@@ -41,10 +41,11 @@ export declare const discoveryDocument: (record: ExtensionRecord, host: string)
|
|
|
41
41
|
image: string;
|
|
42
42
|
} | undefined;
|
|
43
43
|
store?: {
|
|
44
|
-
kind: "postgres" | "
|
|
44
|
+
kind: "postgres" | "signoz" | "git";
|
|
45
45
|
migrations?: number | undefined;
|
|
46
46
|
} | undefined;
|
|
47
47
|
};
|
|
48
|
+
secrets?: string[] | undefined;
|
|
48
49
|
openapi?: string | undefined;
|
|
49
50
|
tools?: {
|
|
50
51
|
name: string;
|
|
@@ -15,7 +15,7 @@ const partsOf = (pkg, images, migrations) => {
|
|
|
15
15
|
};
|
|
16
16
|
// From the manifest, the build, the images by digest and what the code serves.
|
|
17
17
|
export const recordOf = (pkg, build, images, extras = {}) => {
|
|
18
|
-
const { id, commands } = pkg.agentage;
|
|
18
|
+
const { id, commands, secrets } = pkg.agentage;
|
|
19
19
|
const { commit, buildTime } = build;
|
|
20
20
|
const parts = partsOf(pkg, images, extras.migrations);
|
|
21
21
|
const record = { id, version: pkg.version, commit, buildTime, parts };
|
|
@@ -27,6 +27,8 @@ export const recordOf = (pkg, build, images, extras = {}) => {
|
|
|
27
27
|
record.commands = commands.map((command) => command.name);
|
|
28
28
|
if (extras.widgets)
|
|
29
29
|
record.widgets = extras.widgets;
|
|
30
|
+
if (secrets?.length)
|
|
31
|
+
record.secrets = secrets;
|
|
30
32
|
return record;
|
|
31
33
|
};
|
|
32
34
|
export const validateRecord = (value) => {
|
|
@@ -42,5 +44,6 @@ export const loadRecord = async (file) => {
|
|
|
42
44
|
};
|
|
43
45
|
export const discoveryDocument = (record, host) => {
|
|
44
46
|
const { id, version, commit, buildTime, ...rest } = record;
|
|
47
|
+
delete rest.secrets;
|
|
45
48
|
return { id, version, commit, buildTime, host, ...rest };
|
|
46
49
|
};
|
|
@@ -6,6 +6,7 @@ export declare const WidgetSchema: z.ZodObject<{
|
|
|
6
6
|
module: z.ZodString;
|
|
7
7
|
}, z.core.$strict>;
|
|
8
8
|
export declare const ExtensionRecordSchema: z.ZodObject<{
|
|
9
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
10
|
id: z.ZodString;
|
|
10
11
|
version: z.ZodString;
|
|
11
12
|
commit: z.ZodString;
|
|
@@ -29,8 +30,8 @@ export declare const ExtensionRecordSchema: z.ZodObject<{
|
|
|
29
30
|
store: z.ZodOptional<z.ZodObject<{
|
|
30
31
|
kind: z.ZodEnum<{
|
|
31
32
|
postgres: "postgres";
|
|
32
|
-
git: "git";
|
|
33
33
|
signoz: "signoz";
|
|
34
|
+
git: "git";
|
|
34
35
|
}>;
|
|
35
36
|
migrations: z.ZodOptional<z.ZodInt>;
|
|
36
37
|
}, z.core.$strict>>;
|
|
@@ -72,8 +73,8 @@ export declare const DiscoveryDocumentSchema: z.ZodObject<{
|
|
|
72
73
|
store: z.ZodOptional<z.ZodObject<{
|
|
73
74
|
kind: z.ZodEnum<{
|
|
74
75
|
postgres: "postgres";
|
|
75
|
-
git: "git";
|
|
76
76
|
signoz: "signoz";
|
|
77
|
+
git: "git";
|
|
77
78
|
}>;
|
|
78
79
|
migrations: z.ZodOptional<z.ZodInt>;
|
|
79
80
|
}, z.core.$strict>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { CommandNameSchema, CommitSchema, ExtensionIdSchema, IMAGE_PART_KINDS, PrefixedToolNameSchema, StoreKindSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
2
|
+
import { CommandNameSchema, CommitSchema, ExtensionIdSchema, IMAGE_PART_KINDS, PrefixedToolNameSchema, SecretNameSchema, StoreKindSchema, VersionSchema, } from '../manifest/primitives.schema.js';
|
|
3
3
|
// registry host[:port]/owner/{id}-{part}@sha256: deployed by digest, a version's images never change.
|
|
4
4
|
const ImageDigestRefSchema = z
|
|
5
5
|
.string()
|
|
@@ -53,8 +53,9 @@ const imagesNameTheirExtension = (doc) => IMAGE_PART_KINDS.every((kind) => {
|
|
|
53
53
|
});
|
|
54
54
|
const IMAGE_RULE = { message: 'every image is {id}-{part}', path: ['parts'] };
|
|
55
55
|
// The build record: written by `build --push` into the package and the release asset; no host.
|
|
56
|
+
// Secret names are for the estate's mounts only; discovery leaves them out.
|
|
56
57
|
export const ExtensionRecordSchema = z
|
|
57
|
-
.strictObject(recordShape)
|
|
58
|
+
.strictObject({ ...recordShape, secrets: z.array(SecretNameSchema).min(1).optional() })
|
|
58
59
|
.refine(imagesNameTheirExtension, IMAGE_RULE);
|
|
59
60
|
// What a deployment serves at /.well-known/agentage-extension.json: the record plus its host.
|
|
60
61
|
export const DiscoveryDocumentSchema = z
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { type ArgValue } from './command/args.js';
|
|
|
2
2
|
export { type CliContext, type CliCreate, type CommandExtension, type CommandHandler, } from './command/command.types.js';
|
|
3
3
|
export { type Out } from './command/out.js';
|
|
4
4
|
export { type ExtensionInfo, type PartContext, type ServerPartKind, type SettingValue, } from './context/context.js';
|
|
5
|
+
export { type Secrets } from './context/secrets.js';
|
|
5
6
|
export { createTestContext, type LogEntry, type TestCommandContext, type TestCommandOptions, type TestContext, type TestContextOptions, } from './context/test-context.js';
|
|
6
7
|
export { DiscoveryDocumentSchema, ExtensionRecordSchema, type DiscoveryDocument, type ExtensionRecord, } from './discovery/discovery.schema.js';
|
|
7
8
|
export { AGCID_HEADER, isAgcid } from './agcid/agcid.js';
|
|
@@ -13,6 +14,7 @@ export { HealthSchema, type HealthBody, type HealthStatus } from './health/healt
|
|
|
13
14
|
export { type Log, type LogFields } from './log/log.js';
|
|
14
15
|
export { PackageSchema, type CommandSpec, type ExtensionPackage, } from './manifest/manifest.schema.js';
|
|
15
16
|
export { imageParts } from './manifest/parts.js';
|
|
17
|
+
export { SERVED_KINDS, STORE_KINDS, type StoreKind } from './manifest/primitives.schema.js';
|
|
16
18
|
export { readManifest, validateManifest } from './manifest/read-manifest.js';
|
|
17
19
|
export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, type McpSnapshot, type ProtocolVersion, } from './mcp/snapshot.js';
|
|
18
20
|
export { type McpContext, type ToolHandler, type ToolRegistrar, type ToolSpec, } from './mcp/tools.js';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export {} from './command/args.js';
|
|
|
2
2
|
export {} from './command/command.types.js';
|
|
3
3
|
export {} from './command/out.js';
|
|
4
4
|
export {} from './context/context.js';
|
|
5
|
+
export {} from './context/secrets.js';
|
|
5
6
|
export { createTestContext, } from './context/test-context.js';
|
|
6
7
|
export { DiscoveryDocumentSchema, ExtensionRecordSchema, } from './discovery/discovery.schema.js';
|
|
7
8
|
export { AGCID_HEADER, isAgcid } from './agcid/agcid.js';
|
|
@@ -13,6 +14,7 @@ export { HealthSchema } from './health/health.schema.js';
|
|
|
13
14
|
export {} from './log/log.js';
|
|
14
15
|
export { PackageSchema, } from './manifest/manifest.schema.js';
|
|
15
16
|
export { imageParts } from './manifest/parts.js';
|
|
17
|
+
export { SERVED_KINDS, STORE_KINDS } from './manifest/primitives.schema.js';
|
|
16
18
|
export { readManifest, validateManifest } from './manifest/read-manifest.js';
|
|
17
19
|
export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, } from './mcp/snapshot.js';
|
|
18
20
|
export {} from './mcp/tools.js';
|
package/dist/log/log.js
CHANGED
|
@@ -8,7 +8,8 @@ const errorFields = (error) => {
|
|
|
8
8
|
// Spread twice: the key order stays, and a field never overwrites time, level, msg, tags or agcid.
|
|
9
9
|
const line = (level, message, tags, fields) => {
|
|
10
10
|
const agcid = currentAgcid();
|
|
11
|
-
const
|
|
11
|
+
const ids = { 'extension.id': tags.extension, 'extension.part': tags.part };
|
|
12
|
+
const own = { time: new Date().toISOString(), level, msg: message, ...ids };
|
|
12
13
|
const fixed = agcid ? { ...own, agcid } : own;
|
|
13
14
|
return `${JSON.stringify({ ...fixed, ...fields, ...fixed })}\n`;
|
|
14
15
|
};
|
|
@@ -23,13 +23,13 @@ declare const PartsSchema: z.ZodObject<{
|
|
|
23
23
|
}, z.core.$strict>]>>;
|
|
24
24
|
store: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
25
25
|
postgres: "postgres";
|
|
26
|
-
git: "git";
|
|
27
26
|
signoz: "signoz";
|
|
27
|
+
git: "git";
|
|
28
28
|
}>, z.ZodObject<{
|
|
29
29
|
kind: z.ZodEnum<{
|
|
30
30
|
postgres: "postgres";
|
|
31
|
-
git: "git";
|
|
32
31
|
signoz: "signoz";
|
|
32
|
+
git: "git";
|
|
33
33
|
}>;
|
|
34
34
|
}, z.core.$strict>]>>;
|
|
35
35
|
}, z.core.$strict>;
|
|
@@ -77,13 +77,13 @@ export declare const PackageSchema: z.ZodObject<{
|
|
|
77
77
|
}, z.core.$strict>]>>;
|
|
78
78
|
store: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
79
79
|
postgres: "postgres";
|
|
80
|
-
git: "git";
|
|
81
80
|
signoz: "signoz";
|
|
81
|
+
git: "git";
|
|
82
82
|
}>, z.ZodObject<{
|
|
83
83
|
kind: z.ZodEnum<{
|
|
84
84
|
postgres: "postgres";
|
|
85
|
-
git: "git";
|
|
86
85
|
signoz: "signoz";
|
|
86
|
+
git: "git";
|
|
87
87
|
}>;
|
|
88
88
|
}, z.core.$strict>]>>;
|
|
89
89
|
}, z.core.$strict>;
|
|
@@ -4,7 +4,9 @@ const CodePartSchema = z.union([
|
|
|
4
4
|
z.boolean(),
|
|
5
5
|
z.strictObject({ entry: PackagePathSchema.optional() }),
|
|
6
6
|
]);
|
|
7
|
-
const StorePartSchema = z.union([StoreKindSchema, z.strictObject({ kind: StoreKindSchema })]
|
|
7
|
+
const StorePartSchema = z.union([StoreKindSchema, z.strictObject({ kind: StoreKindSchema })], {
|
|
8
|
+
error: `one of ${StoreKindSchema.options.join(', ')}`,
|
|
9
|
+
});
|
|
8
10
|
const ROUTED = ['pages', 'ui', 'api', 'mcp'];
|
|
9
11
|
const PartsSchema = z
|
|
10
12
|
.strictObject({
|
package/dist/manifest/parts.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export interface NormalizedParts {
|
|
|
9
9
|
export declare const normalizeParts: (parts: Parts) => NormalizedParts;
|
|
10
10
|
export declare const imageParts: (pkg: ExtensionPackage) => ImagePartKind[];
|
|
11
11
|
export declare const entryOf: (pkg: ExtensionPackage, part: ImagePartKind | "cli") => string;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const storeOf: (pkg: ExtensionPackage) => StoreKind | undefined;
|
|
13
|
+
export declare const hasStore: (pkg: ExtensionPackage, kind: StoreKind) => boolean;
|
|
14
|
+
export declare const migratesStore: (pkg: ExtensionPackage) => boolean;
|
package/dist/manifest/parts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from './manifest.schema.js';
|
|
2
|
-
import { IMAGE_PART_KINDS } from './primitives.schema.js';
|
|
2
|
+
import { IMAGE_PART_KINDS, STORE_KINDS, } from './primitives.schema.js';
|
|
3
3
|
const normalizeCode = (part) => {
|
|
4
4
|
if (part === undefined || part === false)
|
|
5
5
|
return undefined;
|
|
@@ -22,4 +22,10 @@ export const imageParts = (pkg) => {
|
|
|
22
22
|
return IMAGE_PART_KINDS.filter((kind) => code[kind] !== undefined);
|
|
23
23
|
};
|
|
24
24
|
export const entryOf = (pkg, part) => normalizeParts(pkg.agentage.parts).code[part]?.entry ?? `./dist/${part}/index.js`;
|
|
25
|
-
export const
|
|
25
|
+
export const storeOf = (pkg) => normalizeParts(pkg.agentage.parts).store;
|
|
26
|
+
export const hasStore = (pkg, kind) => storeOf(pkg) === kind;
|
|
27
|
+
// The migrate rule: the api image carries migrations/ and a migrate job only for such a kind.
|
|
28
|
+
export const migratesStore = (pkg) => {
|
|
29
|
+
const kind = storeOf(pkg);
|
|
30
|
+
return kind !== undefined && STORE_KINDS[kind].migrations;
|
|
31
|
+
};
|
|
@@ -8,14 +8,26 @@ export declare const CommandNameSchema: z.ZodString;
|
|
|
8
8
|
export declare const SettingKeySchema: z.ZodString;
|
|
9
9
|
export declare const SecretNameSchema: z.ZodString;
|
|
10
10
|
export declare const PackagePathSchema: z.ZodString;
|
|
11
|
+
export declare const STORE_KINDS: {
|
|
12
|
+
readonly postgres: {
|
|
13
|
+
readonly migrations: true;
|
|
14
|
+
};
|
|
15
|
+
readonly signoz: {
|
|
16
|
+
readonly migrations: false;
|
|
17
|
+
};
|
|
18
|
+
readonly git: {
|
|
19
|
+
readonly migrations: false;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const SERVED_KINDS: readonly StoreKind[];
|
|
11
23
|
export declare const StoreKindSchema: z.ZodEnum<{
|
|
12
24
|
postgres: "postgres";
|
|
13
|
-
git: "git";
|
|
14
25
|
signoz: "signoz";
|
|
26
|
+
git: "git";
|
|
15
27
|
}>;
|
|
16
28
|
export declare const FULL_SHA: RegExp;
|
|
17
29
|
export declare const CommitSchema: z.ZodString;
|
|
18
30
|
export declare const PrefixedToolNameSchema: z.ZodString;
|
|
19
31
|
export declare const IMAGE_PART_KINDS: readonly ["pages", "ui", "api", "mcp", "worker"];
|
|
20
32
|
export type ImagePartKind = (typeof IMAGE_PART_KINDS)[number];
|
|
21
|
-
export type StoreKind =
|
|
33
|
+
export type StoreKind = keyof typeof STORE_KINDS;
|
|
@@ -44,7 +44,14 @@ export const PackagePathSchema = z
|
|
|
44
44
|
.string()
|
|
45
45
|
.max(256)
|
|
46
46
|
.regex(/^\.\/[A-Za-z0-9._/-]+$/);
|
|
47
|
-
export const
|
|
47
|
+
export const STORE_KINDS = {
|
|
48
|
+
postgres: { migrations: true },
|
|
49
|
+
signoz: { migrations: false },
|
|
50
|
+
git: { migrations: false },
|
|
51
|
+
};
|
|
52
|
+
// STORE_KINDS[kind].migrations: the api image carries a migrate job. SERVED_KINDS moves with the estate.
|
|
53
|
+
export const SERVED_KINDS = ['postgres', 'signoz'];
|
|
54
|
+
export const StoreKindSchema = z.enum(Object.keys(STORE_KINDS));
|
|
48
55
|
export const FULL_SHA = /^[0-9a-f]{40}$/;
|
|
49
56
|
export const CommitSchema = z.string().regex(FULL_SHA, { message: 'full 40-hex git sha' });
|
|
50
57
|
export const PrefixedToolNameSchema = z
|
package/dist/mcp/mcp-app.js
CHANGED
|
@@ -59,7 +59,7 @@ const webRequest = (req, body) => {
|
|
|
59
59
|
};
|
|
60
60
|
const send = async (response, res, auth) => {
|
|
61
61
|
res.status(response.status);
|
|
62
|
-
response.headers.forEach((value, key) => void res.setHeader(key, value));
|
|
62
|
+
response.headers.forEach((value, key) => void (key !== 'set-cookie' && res.setHeader(key, value)));
|
|
63
63
|
// After the SDK headers: its SSE answer sets no-cache, which a token-checked answer overrides.
|
|
64
64
|
if (auth)
|
|
65
65
|
res.setHeader('Cache-Control', 'no-store');
|
|
@@ -3,7 +3,7 @@ import {} from 'express';
|
|
|
3
3
|
import {} from '../context/context.js';
|
|
4
4
|
import {} from '../manifest/manifest.schema.js';
|
|
5
5
|
import { loadCreate } from '../manifest/entry.js';
|
|
6
|
-
import {
|
|
6
|
+
import { hasStore } from '../manifest/parts.js';
|
|
7
7
|
import {} from '../manifest/primitives.schema.js';
|
|
8
8
|
import { createMcpApp } from '../mcp/mcp-app.js';
|
|
9
9
|
import { createToolRegistry } from '../mcp/tools.js';
|
|
@@ -42,7 +42,7 @@ const ui = async (input) => ({
|
|
|
42
42
|
const worker = async (input) => {
|
|
43
43
|
const ctx = input.ctx();
|
|
44
44
|
const log = runLog(ctx.log);
|
|
45
|
-
const runs =
|
|
45
|
+
const runs = hasStore(input.pkg, 'postgres') ? storeRuns(ctx.store) : memoryRuns();
|
|
46
46
|
const scheduler = createScheduler({ runs, log });
|
|
47
47
|
await callCreate(input, 'worker', { ...ctx, log, schedule: scheduler.schedule });
|
|
48
48
|
const checks = { ...input.base.checks, ...scheduler.checks() };
|
package/dist/runtime/run-part.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {} from 'node:http';
|
|
2
2
|
import { createContext } from '../context/context.js';
|
|
3
|
+
import { readSecrets, SECRETS_DIR } from '../context/secrets.js';
|
|
3
4
|
import { settingsFromEnv } from '../context/settings.js';
|
|
4
5
|
import { DEFAULT_RECORD_FILE, loadRecord } from '../discovery/discovery.js';
|
|
5
6
|
import {} from '../discovery/discovery.schema.js';
|
|
@@ -8,7 +9,7 @@ import { readOpenapi } from '../discovery/openapi.js';
|
|
|
8
9
|
import { createLog } from '../log/log.js';
|
|
9
10
|
import {} from '../manifest/entry.js';
|
|
10
11
|
import {} from '../manifest/manifest.schema.js';
|
|
11
|
-
import {
|
|
12
|
+
import { hasStore, imageParts } from '../manifest/parts.js';
|
|
12
13
|
import {} from '../manifest/primitives.schema.js';
|
|
13
14
|
import { readManifest } from '../manifest/read-manifest.js';
|
|
14
15
|
import {} from '../server/app.js';
|
|
@@ -31,7 +32,7 @@ export const partOf = (pkg, part) => {
|
|
|
31
32
|
return part;
|
|
32
33
|
};
|
|
33
34
|
// ui serves files and gets no ctx; every other part gets the store when the manifest has postgres.
|
|
34
|
-
const storeFor = ({ pkg, part, env, log }) => part !== 'ui' &&
|
|
35
|
+
const storeFor = ({ pkg, part, env, log }) => part !== 'ui' && hasStore(pkg, 'postgres') ? createStore(env, log) : undefined;
|
|
35
36
|
const contextFor = (start, part, store) => createContext({
|
|
36
37
|
pkg: start.pkg,
|
|
37
38
|
part,
|
|
@@ -40,6 +41,7 @@ const contextFor = (start, part, store) => createContext({
|
|
|
40
41
|
log: start.log,
|
|
41
42
|
settings: settingsFromEnv(start.pkg, start.env, start.log),
|
|
42
43
|
store,
|
|
44
|
+
secrets: start.secrets,
|
|
43
45
|
});
|
|
44
46
|
// Built on first use, so the ui runner, which never asks, has no ctx at all.
|
|
45
47
|
const lazyContext = (start, store) => {
|
|
@@ -88,7 +90,9 @@ export const runPart = async (options) => {
|
|
|
88
90
|
const pkg = await readManifest(options.dir);
|
|
89
91
|
const part = partOf(pkg, options.part);
|
|
90
92
|
const log = createLog({ extension: pkg.agentage.id, part });
|
|
91
|
-
const
|
|
93
|
+
const names = part === 'ui' ? [] : (pkg.agentage.secrets ?? []);
|
|
94
|
+
const secrets = await readSecrets(names, options.secretsDir ?? SECRETS_DIR, part);
|
|
95
|
+
const start = { pkg, part, env: options.env, log, secrets };
|
|
92
96
|
const { app, stop } = await RUNNERS[part](await inputFor(options, start));
|
|
93
97
|
if (stop)
|
|
94
98
|
for (const signal of options.serve?.signals ?? ['SIGTERM', 'SIGINT'])
|
package/dist/server/app.js
CHANGED
|
@@ -19,6 +19,11 @@ export const PUBLIC_CORS = {
|
|
|
19
19
|
allowedHeaders: ['Authorization', 'Content-Type', 'agcid', 'traceparent', 'If-Match'],
|
|
20
20
|
exposedHeaders: ['agcid', 'ETag', 'Retry-After', 'RateLimit', 'WWW-Authenticate'],
|
|
21
21
|
};
|
|
22
|
+
// api-standards section 5: parts take bearer tokens only, so no handler or log ever sees a cookie.
|
|
23
|
+
const dropCookie = (req, _res, next) => {
|
|
24
|
+
delete req.headers.cookie;
|
|
25
|
+
next();
|
|
26
|
+
};
|
|
22
27
|
export const BODY_LIMIT = '1mb';
|
|
23
28
|
const requestOrigin = (req) => `${req.protocol}://${req.get('host') ?? ''}`;
|
|
24
29
|
const discoveryHandler = (options) => {
|
|
@@ -40,7 +45,7 @@ export const createPartApp = (options) => {
|
|
|
40
45
|
const app = express();
|
|
41
46
|
// The gateway calls parts over a private network; its X-Forwarded-Proto then sets req.protocol.
|
|
42
47
|
app.set('trust proxy', 'loopback, linklocal, uniquelocal');
|
|
43
|
-
app.use(agcidMiddleware, helmet(options.helmet));
|
|
48
|
+
app.use(dropCookie, agcidMiddleware, helmet(options.helmet));
|
|
44
49
|
app.get('/health', healthHandler(options));
|
|
45
50
|
if (options.part !== 'worker') {
|
|
46
51
|
app.use('/.well-known', cors(PUBLIC_CORS));
|
|
@@ -9,7 +9,7 @@ import { createLog } from '../log/log.js';
|
|
|
9
9
|
import { loadCreate } from '../manifest/entry.js';
|
|
10
10
|
import { readJsonIfExists } from '../manifest/read-manifest.js';
|
|
11
11
|
import {} from '../manifest/manifest.schema.js';
|
|
12
|
-
import {
|
|
12
|
+
import { migratesStore, normalizeParts } from '../manifest/parts.js';
|
|
13
13
|
import { createToolRegistry, prefixed } from '../mcp/tools.js';
|
|
14
14
|
import { sqlFiles } from '../store/migrations.js';
|
|
15
15
|
import {} from '../store/store.types.js';
|
|
@@ -59,7 +59,7 @@ export const recordExtras = async (dir, pkg) => {
|
|
|
59
59
|
extras.widgets = await widgetsOf(dir);
|
|
60
60
|
if (code.api && (await readOpenapi(dir)))
|
|
61
61
|
extras.openapi = OPENAPI_PATH;
|
|
62
|
-
if (
|
|
62
|
+
if (migratesStore(pkg))
|
|
63
63
|
extras.migrations = (await sqlFiles(join(dir, 'migrations'))).length;
|
|
64
64
|
return extras;
|
|
65
65
|
};
|
package/dist/tool/rules/store.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { migratesStore, storeOf } from '../../manifest/parts.js';
|
|
4
|
+
import { SERVED_KINDS } from '../../manifest/primitives.schema.js';
|
|
4
5
|
import { sqlFiles } from '../../store/migrations.js';
|
|
5
6
|
import {} from '../check.js';
|
|
6
7
|
import {} from '../exec.js';
|
|
@@ -41,8 +42,13 @@ const dockerAnswers = (run) => run('docker', ['version'], { quiet: true }).then(
|
|
|
41
42
|
export const store = {
|
|
42
43
|
name: 'store',
|
|
43
44
|
run: async ({ dir, pkg, run, requireDocker }) => {
|
|
44
|
-
|
|
45
|
+
const kind = storeOf(pkg);
|
|
46
|
+
if (!kind)
|
|
45
47
|
return { skipped: 'no store' };
|
|
48
|
+
if (!SERVED_KINDS.includes(kind))
|
|
49
|
+
return [{ problem: `kind ${kind} is not served yet; served: ${SERVED_KINDS.join(', ')}` }];
|
|
50
|
+
if (!migratesStore(pkg))
|
|
51
|
+
return { skipped: `kind ${kind} has no migrations` };
|
|
46
52
|
const files = await sqlFiles(join(dir, 'migrations'));
|
|
47
53
|
const meta = await metaCommands(dir, files);
|
|
48
54
|
if (files.length === 0 || meta.length > 0)
|
package/dist/tool/stage.js
CHANGED
|
@@ -2,7 +2,7 @@ import { access, cp, mkdir, mkdtemp, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { dirname, isAbsolute, join, normalize, sep } from 'node:path';
|
|
4
4
|
import {} from '../manifest/manifest.schema.js';
|
|
5
|
-
import { entryOf,
|
|
5
|
+
import { entryOf, migratesStore } from '../manifest/parts.js';
|
|
6
6
|
import {} from '../manifest/primitives.schema.js';
|
|
7
7
|
import { OPENAPI_FILE } from '../discovery/openapi.js';
|
|
8
8
|
import { serverPartRecipe } from './recipe.js';
|
|
@@ -40,7 +40,7 @@ const copyDeps = async (dir, root, pkg) => {
|
|
|
40
40
|
await copyInto(join(dir, path), join(root, 'deps', path));
|
|
41
41
|
};
|
|
42
42
|
// The api image runs the migrate job, so it alone carries the migrations; seeds never ship.
|
|
43
|
-
const migrates = (pkg, part) => part === 'api' &&
|
|
43
|
+
const migrates = (pkg, part) => part === 'api' && migratesStore(pkg);
|
|
44
44
|
// What a part image carries: its own dist/{part}, the shared dist/lib, and for api the migrations.
|
|
45
45
|
export const appPaths = async (dir, pkg, part) => {
|
|
46
46
|
const paths = ['package.json', join('dist', part)];
|
|
@@ -7,8 +7,23 @@ export interface ComposeInput {
|
|
|
7
7
|
recordFile: string;
|
|
8
8
|
gatewayFile: string;
|
|
9
9
|
seedsDir?: string;
|
|
10
|
+
secretFiles?: Record<string, string>;
|
|
10
11
|
}
|
|
11
12
|
export declare const composeFile: (input: ComposeInput) => {
|
|
13
|
+
secrets: {
|
|
14
|
+
[k: string]: {
|
|
15
|
+
file: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
name: string;
|
|
19
|
+
services: Record<string, unknown>;
|
|
20
|
+
volumes: {
|
|
21
|
+
store: {};
|
|
22
|
+
} | {
|
|
23
|
+
store?: undefined;
|
|
24
|
+
};
|
|
25
|
+
} | {
|
|
26
|
+
secrets?: undefined;
|
|
12
27
|
name: string;
|
|
13
28
|
services: Record<string, unknown>;
|
|
14
29
|
volumes: {
|
package/dist/tool/up/compose.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from '../../manifest/manifest.schema.js';
|
|
2
|
-
import {
|
|
2
|
+
import { hasStore, imageParts } from '../../manifest/parts.js';
|
|
3
3
|
import {} from '../../manifest/primitives.schema.js';
|
|
4
4
|
import { DEV_AUDIENCE, DEV_ISSUER, UP_ISSUER } from './dev-issuer-app.js';
|
|
5
5
|
import { GATEWAY_PORT, ISSUER_PORT, PART_PORT, TRAEFIK_COMMAND, TRAEFIK_IMAGE } from './gateway.js';
|
|
@@ -15,7 +15,9 @@ const partEnv = (pkg, part) => ({
|
|
|
15
15
|
AGENTAGE_ISSUER: UP_ISSUER,
|
|
16
16
|
AGENTAGE_AUDIENCE: DEV_AUDIENCE,
|
|
17
17
|
AGENTAGE_RECORD_FILE: RECORD_TARGET,
|
|
18
|
-
...(
|
|
18
|
+
...(hasStore(pkg, 'postgres') && part !== 'ui'
|
|
19
|
+
? { AGENTAGE_STORE_URL: storeUrl(pkg.agentage.id) }
|
|
20
|
+
: {}),
|
|
19
21
|
...(part === 'ui' ? { AGENTAGE_DEV_ISSUER: DEV_ISSUER } : {}),
|
|
20
22
|
});
|
|
21
23
|
const QUICK_CHECK = { interval: '2s', timeout: '3s', retries: 30 };
|
|
@@ -28,15 +30,17 @@ const storeService = (id) => ({
|
|
|
28
30
|
const HEALTHY = { condition: 'service_healthy' };
|
|
29
31
|
// api and mcp read the issuer's keys and revoked list before they serve.
|
|
30
32
|
const dependsOn = (pkg, part) => ({
|
|
31
|
-
...(
|
|
33
|
+
...(hasStore(pkg, 'postgres') && part !== 'ui' ? { store: HEALTHY } : {}),
|
|
32
34
|
...(part === 'api' || part === 'mcp' ? { issuer: HEALTHY } : {}),
|
|
33
35
|
});
|
|
34
36
|
const partService = (input, part) => ({
|
|
35
37
|
image: input.tags[part],
|
|
36
38
|
environment: partEnv(input.pkg, part),
|
|
37
39
|
volumes: [`${input.recordFile}:${RECORD_TARGET}:ro`],
|
|
40
|
+
...(part !== 'ui' && input.secretFiles ? { secrets: Object.keys(input.secretFiles) } : {}),
|
|
38
41
|
depends_on: dependsOn(input.pkg, part),
|
|
39
42
|
});
|
|
43
|
+
const secretsOf = (files) => Object.fromEntries(Object.entries(files).map(([name, file]) => [name, { file }]));
|
|
40
44
|
const fixedServices = (input, anyImage) => ({
|
|
41
45
|
gateway: {
|
|
42
46
|
image: TRAEFIK_IMAGE,
|
|
@@ -69,11 +73,12 @@ export const composeFile = (input) => {
|
|
|
69
73
|
for (const part of parts)
|
|
70
74
|
services[part] = partService(input, part);
|
|
71
75
|
Object.assign(services, fixedServices(input, input.tags[parts[0] ?? 'api'] ?? ''));
|
|
72
|
-
if (
|
|
76
|
+
if (hasStore(input.pkg, 'postgres')) {
|
|
73
77
|
services['store'] = storeService(input.pkg.agentage.id);
|
|
74
78
|
if (input.tags['api'])
|
|
75
79
|
services['migrate'] = migrateService(input);
|
|
76
80
|
}
|
|
77
|
-
const volumes =
|
|
78
|
-
|
|
81
|
+
const volumes = hasStore(input.pkg, 'postgres') ? { store: {} } : {};
|
|
82
|
+
const secrets = input.secretFiles ? { secrets: secretsOf(input.secretFiles) } : {};
|
|
83
|
+
return { name: input.project, services, volumes, ...secrets };
|
|
79
84
|
};
|
package/dist/tool/up/down.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rm } from 'node:fs/promises';
|
|
1
2
|
import { join } from 'node:path';
|
|
2
3
|
import { readManifest } from '../../manifest/read-manifest.js';
|
|
3
4
|
import { quietly, runCommand } from '../exec.js';
|
|
@@ -41,6 +42,7 @@ export const down = async (options = {}, run = runCommand) => {
|
|
|
41
42
|
const log = result.stderr ?? '';
|
|
42
43
|
if (result.code !== 0)
|
|
43
44
|
throw new Error(`docker compose down failed: ${log.trim()}`);
|
|
45
|
+
await rm(join(dir, LOCAL_DIR, 'secrets'), { recursive: true, force: true });
|
|
44
46
|
const removed = removedOf(log);
|
|
45
47
|
options.onLine?.(stepLine('removed', summary(removed, options.keepData), target.project));
|
|
46
48
|
return { project: target.project, ...removed };
|
|
@@ -28,10 +28,11 @@ export declare const writeLocalRecord: (dir: string, pkg: ExtensionPackage, buil
|
|
|
28
28
|
image: string;
|
|
29
29
|
} | undefined;
|
|
30
30
|
store?: {
|
|
31
|
-
kind: "postgres" | "
|
|
31
|
+
kind: "postgres" | "signoz" | "git";
|
|
32
32
|
migrations?: number | undefined;
|
|
33
33
|
} | undefined;
|
|
34
34
|
};
|
|
35
|
+
secrets?: string[] | undefined;
|
|
35
36
|
openapi?: string | undefined;
|
|
36
37
|
tools?: {
|
|
37
38
|
name: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ExtensionPackage } from '../../manifest/manifest.schema.js';
|
|
2
|
+
import { type Env } from '../../runtime/build-info.js';
|
|
3
|
+
export declare const secretEnvName: (name: string) => string;
|
|
4
|
+
export declare const writeUpSecrets: (dir: string, pkg: ExtensionPackage, env: Env) => Promise<{
|
|
5
|
+
[k: string]: string;
|
|
6
|
+
} | undefined>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { chmod, mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import {} from '../../manifest/manifest.schema.js';
|
|
4
|
+
import { readJsonIfExists } from '../../manifest/read-manifest.js';
|
|
5
|
+
import {} from '../../runtime/build-info.js';
|
|
6
|
+
import { LOCAL_DIR } from './local-record.js';
|
|
7
|
+
const FILE = `${LOCAL_DIR}/secrets.json`;
|
|
8
|
+
export const secretEnvName = (name) => `AGENTAGE_SECRET_${name.toUpperCase().replace(/-/g, '_')}`;
|
|
9
|
+
// A parse error quotes the text, so any error is replaced by one that names only the file.
|
|
10
|
+
const fileValues = (dir) => readJsonIfExists(join(dir, FILE)).then((value) => (value ?? {}), (err) => {
|
|
11
|
+
const why = err.code ? 'cannot be read' : 'is not valid JSON';
|
|
12
|
+
return Promise.reject(new Error(`up stopped: ${FILE} ${why}`));
|
|
13
|
+
});
|
|
14
|
+
const valueOf = (name, env, file) => {
|
|
15
|
+
const value = env[secretEnvName(name)] || file[name];
|
|
16
|
+
if (typeof value === 'string' && value !== '')
|
|
17
|
+
return value;
|
|
18
|
+
throw new Error(`up stopped: secret ${name} has no value: set ${secretEnvName(name)} or "${name}" in ${FILE}`);
|
|
19
|
+
};
|
|
20
|
+
// Each value as a file compose mounts at /run/secrets/<name>; the env wins over the file.
|
|
21
|
+
export const writeUpSecrets = async (dir, pkg, env) => {
|
|
22
|
+
const names = pkg.agentage.secrets ?? [];
|
|
23
|
+
if (names.length === 0)
|
|
24
|
+
return undefined;
|
|
25
|
+
const file = await fileValues(dir);
|
|
26
|
+
const files = names.map((name) => ({
|
|
27
|
+
name,
|
|
28
|
+
path: join(dir, LOCAL_DIR, 'secrets', name),
|
|
29
|
+
value: valueOf(name, env, file),
|
|
30
|
+
}));
|
|
31
|
+
await mkdir(join(dir, LOCAL_DIR, 'secrets'), { recursive: true, mode: 0o700 });
|
|
32
|
+
// 0644 in a 0700 folder: the part's node user reads the bind mount; chmod fixes an older file.
|
|
33
|
+
for (const { path, value } of files)
|
|
34
|
+
await writeFile(path, value, { mode: 0o644 }).then(() => chmod(path, 0o644));
|
|
35
|
+
return Object.fromEntries(files.map(({ name, path }) => [name, path]));
|
|
36
|
+
};
|
package/dist/tool/up/up.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import {} from '../../manifest/manifest.schema.js';
|
|
4
|
-
import {
|
|
4
|
+
import { hasStore, imageParts, normalizeParts } from '../../manifest/parts.js';
|
|
5
5
|
import { readManifest } from '../../manifest/read-manifest.js';
|
|
6
6
|
import {} from '../../runtime/build-info.js';
|
|
7
7
|
import { build } from '../build.js';
|
|
@@ -14,6 +14,7 @@ import { GATEWAY_PORT, gatewayConfig, ISSUER_PORT, PART_PATHS, partPath } from '
|
|
|
14
14
|
import { plural, stepLine } from './lines.js';
|
|
15
15
|
import { assertDiscoverable, LOCAL_DIR, writeLocalRecord } from './local-record.js';
|
|
16
16
|
import { assertPortsFree } from './ports.js';
|
|
17
|
+
import { writeUpSecrets } from './secrets.js';
|
|
17
18
|
import { projectName, workingCopy } from './project.js';
|
|
18
19
|
import { storePhrase, summaryOf } from './store-line.js';
|
|
19
20
|
import { waitHealthy } from './wait.js';
|
|
@@ -24,8 +25,9 @@ const renderFiles = async (s, recordFile, tags) => {
|
|
|
24
25
|
const seeds = join(s.dir, 'seeds');
|
|
25
26
|
const seedsDir = (await exists(seeds)) ? seeds : undefined;
|
|
26
27
|
await jsonFile(gatewayFile, gatewayConfig(imageParts(s.pkg), s.pkg.version));
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const { pkg, secretFiles, target } = s;
|
|
29
|
+
const project = target.project;
|
|
30
|
+
await jsonFile(target.file, composeFile({ pkg, project, tags, recordFile, gatewayFile, seedsDir, secretFiles }));
|
|
29
31
|
};
|
|
30
32
|
const buildStep = async (s, env) => {
|
|
31
33
|
const built = await build({ dir: s.dir, env }, { run: s.deps.run });
|
|
@@ -64,7 +66,8 @@ const sessionOf = async (options, deps) => {
|
|
|
64
66
|
const file = join(dir, LOCAL_DIR, 'compose.json');
|
|
65
67
|
const target = { file, project: projectName(pkg.agentage.id, dir) };
|
|
66
68
|
const line = (label, what, detail) => options.onLine?.(stepLine(label, what, detail));
|
|
67
|
-
|
|
69
|
+
const secretFiles = await writeUpSecrets(dir, pkg, options.env ?? process.env);
|
|
70
|
+
return { dir, pkg, target, line, deps: { ...deps, run: quietly(deps.run) }, secretFiles };
|
|
68
71
|
};
|
|
69
72
|
// The laptop shape of a deployment: the release images, a local record, store, issuer, gateway.
|
|
70
73
|
export const up = async (options = {}, deps = { run: runCommand }) => {
|
|
@@ -74,10 +77,10 @@ export const up = async (options = {}, deps = { run: runCommand }) => {
|
|
|
74
77
|
await buildStep(s, options.env ?? process.env);
|
|
75
78
|
// Again after the build: another up may have started meanwhile, and the store comes next.
|
|
76
79
|
await assertPortsFree(s.deps.run, s.target.project);
|
|
77
|
-
if (
|
|
80
|
+
if (hasStore(s.pkg, 'postgres'))
|
|
78
81
|
await storeStep(s);
|
|
79
82
|
await partsStep(s);
|
|
80
|
-
const parts = imageParts(s.pkg).length + (
|
|
83
|
+
const parts = imageParts(s.pkg).length + (hasStore(s.pkg, 'postgres') ? 1 : 0) + cliParts(s.pkg);
|
|
81
84
|
const seconds = Math.round((Date.now() - started) / 1000);
|
|
82
85
|
s.line('ready', `${plural(parts, 'part')} healthy`, `${seconds} s`);
|
|
83
86
|
return { parts, seconds, project: s.target.project };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|
|
@@ -152,8 +152,8 @@
|
|
|
152
152
|
"type": "string",
|
|
153
153
|
"enum": [
|
|
154
154
|
"postgres",
|
|
155
|
-
"
|
|
156
|
-
"
|
|
155
|
+
"signoz",
|
|
156
|
+
"git"
|
|
157
157
|
]
|
|
158
158
|
},
|
|
159
159
|
{
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"type": "string",
|
|
164
164
|
"enum": [
|
|
165
165
|
"postgres",
|
|
166
|
-
"
|
|
167
|
-
"
|
|
166
|
+
"signoz",
|
|
167
|
+
"git"
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
},
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"type": "string",
|
|
103
103
|
"enum": [
|
|
104
104
|
"postgres",
|
|
105
|
-
"
|
|
106
|
-
"
|
|
105
|
+
"signoz",
|
|
106
|
+
"git"
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
109
|
"migrations": {
|
|
@@ -182,6 +182,15 @@
|
|
|
182
182
|
"maxLength": 32,
|
|
183
183
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
184
184
|
}
|
|
185
|
+
},
|
|
186
|
+
"secrets": {
|
|
187
|
+
"minItems": 1,
|
|
188
|
+
"type": "array",
|
|
189
|
+
"items": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"maxLength": 48,
|
|
192
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
193
|
+
}
|
|
185
194
|
}
|
|
186
195
|
},
|
|
187
196
|
"required": [
|