@mono-agent/agent-app 0.5.0 → 0.6.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/README.md +5 -0
- package/dist/adapter-send-tools.d.ts +7 -7
- package/dist/adapter-send-tools.d.ts.map +1 -1
- package/dist/adapter-send-tools.js +59 -50
- package/dist/adapter-send-tools.js.map +1 -1
- package/dist/app.js +8 -8
- package/dist/app.js.map +1 -1
- package/dist/background.d.ts +4 -0
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +8 -3
- package/dist/background.js.map +1 -1
- package/dist/channel-fact-format.d.ts +12 -0
- package/dist/channel-fact-format.d.ts.map +1 -0
- package/dist/channel-fact-format.js +24 -0
- package/dist/channel-fact-format.js.map +1 -0
- package/dist/channels.js +3 -3
- package/dist/channels.js.map +1 -1
- package/dist/cli.d.ts +14 -10
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +198 -181
- package/dist/cli.js.map +1 -1
- package/dist/config-reference.js +4 -4
- package/dist/config-reference.js.map +1 -1
- package/dist/consumer-contract.d.ts.map +1 -1
- package/dist/consumer-contract.js +5 -3
- package/dist/consumer-contract.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +126 -5
- package/dist/doctor.js.map +1 -1
- package/dist/init.d.ts +11 -22
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +25 -116
- package/dist/init.js.map +1 -1
- package/dist/interaction-bridge.d.ts +3 -3
- package/dist/interaction-bridge.d.ts.map +1 -1
- package/dist/memory-recall.d.ts +2 -2
- package/dist/memory-recall.d.ts.map +1 -1
- package/dist/memory-recall.js +3 -3
- package/dist/memory-recall.js.map +1 -1
- package/dist/modules/base.d.ts +25 -0
- package/dist/modules/base.d.ts.map +1 -0
- package/dist/{recipes → modules}/base.js +16 -11
- package/dist/modules/base.js.map +1 -0
- package/dist/modules/catalog.d.ts +12 -0
- package/dist/modules/catalog.d.ts.map +1 -0
- package/dist/modules/catalog.js +412 -0
- package/dist/modules/catalog.js.map +1 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +5 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/known-tools.d.ts +44 -0
- package/dist/modules/known-tools.d.ts.map +1 -0
- package/dist/modules/known-tools.js +88 -0
- package/dist/modules/known-tools.js.map +1 -0
- package/dist/modules/types.d.ts +73 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/{recipes → modules}/types.js +3 -3
- package/dist/{recipes → modules}/types.js.map +1 -1
- package/dist/posted-message-index.d.ts +2 -2
- package/dist/posted-message-index.js +2 -2
- package/dist/wizard/answers.d.ts +85 -0
- package/dist/wizard/answers.d.ts.map +1 -0
- package/dist/wizard/answers.js +231 -0
- package/dist/wizard/answers.js.map +1 -0
- package/dist/wizard/from-flags.d.ts +26 -0
- package/dist/wizard/from-flags.d.ts.map +1 -0
- package/dist/wizard/from-flags.js +44 -0
- package/dist/wizard/from-flags.js.map +1 -0
- package/dist/wizard/index.d.ts +11 -0
- package/dist/wizard/index.d.ts.map +1 -0
- package/dist/wizard/index.js +6 -0
- package/dist/wizard/index.js.map +1 -0
- package/dist/wizard/presets.d.ts +40 -0
- package/dist/wizard/presets.d.ts.map +1 -0
- package/dist/wizard/presets.js +85 -0
- package/dist/wizard/presets.js.map +1 -0
- package/dist/wizard/prompts.d.ts +52 -0
- package/dist/wizard/prompts.d.ts.map +1 -0
- package/dist/wizard/prompts.js +141 -0
- package/dist/wizard/prompts.js.map +1 -0
- package/dist/wizard/run.d.ts +19 -0
- package/dist/wizard/run.d.ts.map +1 -0
- package/dist/wizard/run.js +345 -0
- package/dist/wizard/run.js.map +1 -0
- package/package.json +17 -16
- package/schema/mono-agent.config.schema.json +5 -3
- package/skills/mono-agent-composer/SKILL.md +7 -7
- package/skills/mono-agent-composer/references/config-blueprint.md +7 -7
- package/skills/mono-agent-composer/references/discovery-questions.md +8 -6
- package/skills/mono-agent-composer/references/feature-coverage.md +10 -8
- package/skills/mono-agent-composer/references/package-map.md +5 -5
- package/skills/mono-agent-composer/references/playbooks.md +22 -22
- package/skills/mono-agent-composer/references/validation.md +3 -3
- package/dist/recipes/base.d.ts +0 -15
- package/dist/recipes/base.d.ts.map +0 -1
- package/dist/recipes/base.js.map +0 -1
- package/dist/recipes/catalog.d.ts +0 -4
- package/dist/recipes/catalog.d.ts.map +0 -1
- package/dist/recipes/catalog.js +0 -525
- package/dist/recipes/catalog.js.map +0 -1
- package/dist/recipes/index.d.ts +0 -11
- package/dist/recipes/index.d.ts.map +0 -1
- package/dist/recipes/index.js +0 -14
- package/dist/recipes/index.js.map +0 -1
- package/dist/recipes/types.d.ts +0 -70
- package/dist/recipes/types.d.ts.map +0 -1
- package/dist/setup.d.ts +0 -29
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -97
- package/dist/setup.js.map +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for tool names, shared by the wizard, doctor, and
|
|
3
|
+
* tests. Names are exact and case-sensitive, verified against the runtime's
|
|
4
|
+
* `pi-bridge.js` (built-ins) and `adapter-send-tools.ts` (adapter send tools).
|
|
5
|
+
*/
|
|
6
|
+
import { ALLOW_ALL_TOOLS } from "@mono-agent/config";
|
|
7
|
+
/** Re-export the allow-all sentinel so agent-app callers share one canonical value. */
|
|
8
|
+
export { ALLOW_ALL_TOOLS };
|
|
9
|
+
/** Built-in tools gated by `tools.allowedTools` (pi-bridge.js). */
|
|
10
|
+
export declare const BUILTIN_TOOL_NAMES: readonly ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "WebFetch", "WebSearch"];
|
|
11
|
+
/** Adapter send tools — require BOTH an `allowedTools` entry AND an enabled channel. */
|
|
12
|
+
export declare const ADAPTER_SEND_TOOL_NAMES: readonly ["SlackSendMessage", "TelegramSendMessage", "TelegramAskButtons", "TelegramSendFile", "AskUser"];
|
|
13
|
+
/**
|
|
14
|
+
* Old snake_case tool names accepted as INPUT aliases so existing fleet/user
|
|
15
|
+
* configs keep working after the PascalCase rename. Each maps to its canonical
|
|
16
|
+
* new name; `telegram_send_document`/`telegram_send_photo` both collapse to the
|
|
17
|
+
* single `TelegramSendFile` tool. The allow/deny matcher and doctor normalize
|
|
18
|
+
* through this map — the new PascalCase names are the only ones ever registered,
|
|
19
|
+
* emitted, or recommended.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LEGACY_TOOL_ALIASES: Record<string, string>;
|
|
22
|
+
/** The canonical new name for a tool, resolving a legacy snake_case alias if given. */
|
|
23
|
+
export declare function canonicalToolName(name: string): string;
|
|
24
|
+
/** Safe read-only default pre-checked for every new agent. */
|
|
25
|
+
export declare const DEFAULT_SAFE_TOOLS: readonly ["Read", "Glob", "Grep"];
|
|
26
|
+
export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
|
|
27
|
+
export type AdapterSendToolName = (typeof ADAPTER_SEND_TOOL_NAMES)[number];
|
|
28
|
+
/**
|
|
29
|
+
* True when `name` is a built-in, an adapter send tool, or a canonical alias-value
|
|
30
|
+
* name (exact, case-sensitive match). Legacy snake_case alias KEYS are also accepted
|
|
31
|
+
* so an old config keeps validating cleanly through the rename.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isKnownToolName(name: string): boolean;
|
|
34
|
+
/** True when `list` contains the global allow-all sentinel (`"*"`). */
|
|
35
|
+
export declare function isAllowAllTools(list: readonly string[]): boolean;
|
|
36
|
+
/** True when `name` targets an MCP server tool (`mcp__…`) — cannot be validated offline. */
|
|
37
|
+
export declare function isMcpToolName(name: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The closest known tool name for a typo, case-insensitive (e.g. `read` → `Read`),
|
|
40
|
+
* else undefined. Used by doctor for "did you mean" hints. Matches
|
|
41
|
+
* case-insensitively against the known set (BUILTIN ∪ ADAPTER_SEND ∪ alias values).
|
|
42
|
+
*/
|
|
43
|
+
export declare function suggestToolName(name: string): string | undefined;
|
|
44
|
+
//# sourceMappingURL=known-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-tools.d.ts","sourceRoot":"","sources":["../../src/modules/known-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,uFAAuF;AACvF,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,qFASrB,CAAC;AAEX,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,2GAM1B,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAUtD,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,mCAAoC,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAa3E;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAEhE;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGhE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for tool names, shared by the wizard, doctor, and
|
|
3
|
+
* tests. Names are exact and case-sensitive, verified against the runtime's
|
|
4
|
+
* `pi-bridge.js` (built-ins) and `adapter-send-tools.ts` (adapter send tools).
|
|
5
|
+
*/
|
|
6
|
+
import { ALLOW_ALL_TOOLS } from "@mono-agent/config";
|
|
7
|
+
/** Re-export the allow-all sentinel so agent-app callers share one canonical value. */
|
|
8
|
+
export { ALLOW_ALL_TOOLS };
|
|
9
|
+
/** Built-in tools gated by `tools.allowedTools` (pi-bridge.js). */
|
|
10
|
+
export const BUILTIN_TOOL_NAMES = [
|
|
11
|
+
"Read",
|
|
12
|
+
"Write",
|
|
13
|
+
"Edit",
|
|
14
|
+
"Glob",
|
|
15
|
+
"Grep",
|
|
16
|
+
"Bash",
|
|
17
|
+
"WebFetch",
|
|
18
|
+
"WebSearch",
|
|
19
|
+
];
|
|
20
|
+
/** Adapter send tools — require BOTH an `allowedTools` entry AND an enabled channel. */
|
|
21
|
+
export const ADAPTER_SEND_TOOL_NAMES = [
|
|
22
|
+
"SlackSendMessage",
|
|
23
|
+
"TelegramSendMessage",
|
|
24
|
+
"TelegramAskButtons",
|
|
25
|
+
"TelegramSendFile",
|
|
26
|
+
"AskUser",
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Old snake_case tool names accepted as INPUT aliases so existing fleet/user
|
|
30
|
+
* configs keep working after the PascalCase rename. Each maps to its canonical
|
|
31
|
+
* new name; `telegram_send_document`/`telegram_send_photo` both collapse to the
|
|
32
|
+
* single `TelegramSendFile` tool. The allow/deny matcher and doctor normalize
|
|
33
|
+
* through this map — the new PascalCase names are the only ones ever registered,
|
|
34
|
+
* emitted, or recommended.
|
|
35
|
+
*/
|
|
36
|
+
export const LEGACY_TOOL_ALIASES = {
|
|
37
|
+
slack_send_message: "SlackSendMessage",
|
|
38
|
+
telegram_send_message: "TelegramSendMessage",
|
|
39
|
+
telegram_ask: "TelegramAskButtons",
|
|
40
|
+
telegram_send_document: "TelegramSendFile",
|
|
41
|
+
telegram_send_photo: "TelegramSendFile",
|
|
42
|
+
ask_user: "AskUser",
|
|
43
|
+
memory_recall: "MemoryRecall",
|
|
44
|
+
read_skill: "ReadSkill",
|
|
45
|
+
ask_collaborator: "AskCollaborator",
|
|
46
|
+
};
|
|
47
|
+
/** The canonical new name for a tool, resolving a legacy snake_case alias if given. */
|
|
48
|
+
export function canonicalToolName(name) {
|
|
49
|
+
return LEGACY_TOOL_ALIASES[name] ?? name;
|
|
50
|
+
}
|
|
51
|
+
/** Safe read-only default pre-checked for every new agent. */
|
|
52
|
+
export const DEFAULT_SAFE_TOOLS = ["Read", "Glob", "Grep"];
|
|
53
|
+
/**
|
|
54
|
+
* All offline-knowable tool names: built-ins, adapter send tools, AND the canonical
|
|
55
|
+
* PascalCase names that only exist as alias VALUES (`ReadSkill`, `AskCollaborator`,
|
|
56
|
+
* `MemoryRecall`). Folding in the alias values keeps the new
|
|
57
|
+
* canonical names at least as "known" as their deprecated snake_case spellings — a
|
|
58
|
+
* config listing `ReadSkill` must validate as cleanly as one listing `read_skill`.
|
|
59
|
+
*/
|
|
60
|
+
const KNOWN_TOOL_NAMES = [
|
|
61
|
+
...new Set([...BUILTIN_TOOL_NAMES, ...ADAPTER_SEND_TOOL_NAMES, ...Object.values(LEGACY_TOOL_ALIASES)]),
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* True when `name` is a built-in, an adapter send tool, or a canonical alias-value
|
|
65
|
+
* name (exact, case-sensitive match). Legacy snake_case alias KEYS are also accepted
|
|
66
|
+
* so an old config keeps validating cleanly through the rename.
|
|
67
|
+
*/
|
|
68
|
+
export function isKnownToolName(name) {
|
|
69
|
+
return name === ALLOW_ALL_TOOLS || KNOWN_TOOL_NAMES.includes(name) || name in LEGACY_TOOL_ALIASES;
|
|
70
|
+
}
|
|
71
|
+
/** True when `list` contains the global allow-all sentinel (`"*"`). */
|
|
72
|
+
export function isAllowAllTools(list) {
|
|
73
|
+
return list.includes(ALLOW_ALL_TOOLS);
|
|
74
|
+
}
|
|
75
|
+
/** True when `name` targets an MCP server tool (`mcp__…`) — cannot be validated offline. */
|
|
76
|
+
export function isMcpToolName(name) {
|
|
77
|
+
return name.startsWith("mcp__");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The closest known tool name for a typo, case-insensitive (e.g. `read` → `Read`),
|
|
81
|
+
* else undefined. Used by doctor for "did you mean" hints. Matches
|
|
82
|
+
* case-insensitively against the known set (BUILTIN ∪ ADAPTER_SEND ∪ alias values).
|
|
83
|
+
*/
|
|
84
|
+
export function suggestToolName(name) {
|
|
85
|
+
const lowered = name.toLowerCase();
|
|
86
|
+
return KNOWN_TOOL_NAMES.find((known) => known.toLowerCase() === lowered);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=known-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-tools.js","sourceRoot":"","sources":["../../src/modules/known-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,uFAAuF;AACvF,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,WAAW;CACH,CAAC;AAEX,wFAAwF;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,kBAAkB;IAClB,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,SAAS;CACD,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,kBAAkB,EAAE,kBAAkB;IACtC,qBAAqB,EAAE,qBAAqB;IAC5C,YAAY,EAAE,oBAAoB;IAClC,sBAAsB,EAAE,kBAAkB;IAC1C,mBAAmB,EAAE,kBAAkB;IACvC,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,cAAc;IAC7B,UAAU,EAAE,WAA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of capability a module contributes, used to group the wizard's steps. */
|
|
4
|
+
export type ModuleKind = "channel" | "memory" | "sandbox" | "observability" | "provider";
|
|
5
|
+
/**
|
|
6
|
+
* A value a module templates against. Non-secret inputs carry a default and may
|
|
7
|
+
* be overridden by the wizard/CLI; secret inputs are never written into JSON —
|
|
8
|
+
* they only emit a `.env.example` placeholder via {@link CapabilityModule.envExampleLines}.
|
|
9
|
+
* (Same shape as the old `RecipeInput`.)
|
|
10
|
+
*/
|
|
11
|
+
export interface ModuleInput {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly description: string;
|
|
15
|
+
/** Default used when the wizard/CLI does not override the input. */
|
|
16
|
+
readonly default?: string;
|
|
17
|
+
/** Secret inputs are externalized to `.env.example`, never inlined in JSON. */
|
|
18
|
+
readonly secret?: boolean;
|
|
19
|
+
/** The `MONO_AGENT_*` env var a secret input maps to (for `.env.example`). */
|
|
20
|
+
readonly envVar?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Resolved input values keyed by {@link ModuleInput.id}. */
|
|
23
|
+
export type ModuleInputValues = Readonly<Record<string, string | undefined>>;
|
|
24
|
+
/** An auxiliary file a module scaffolds beside the config (e.g. a cron job markdown). */
|
|
25
|
+
export interface GeneratedFile {
|
|
26
|
+
/** Path relative to the agent folder. */
|
|
27
|
+
readonly path: string;
|
|
28
|
+
readonly contents: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A capability a module promises once its secrets are filled in. The composer
|
|
32
|
+
* checks each expectation against the doctor report and reports the module as
|
|
33
|
+
* incomplete when a required section is not yet at the promised status.
|
|
34
|
+
*/
|
|
35
|
+
export interface ModuleValidateExpectation {
|
|
36
|
+
/** Doctor section id: `runtime|memory|sandbox|tools|observability|channel:<driver>`. */
|
|
37
|
+
readonly sectionId: string;
|
|
38
|
+
/** The status the section must reach for the module to be considered live. */
|
|
39
|
+
readonly mustBe: ValidationStatus;
|
|
40
|
+
/** Human note explaining what to do if the expectation is unmet. */
|
|
41
|
+
readonly note?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A composable capability: a partial config fragment plus the inputs, secrets,
|
|
45
|
+
* tools, and validate-expectations it owns. The composer spreads fragments onto
|
|
46
|
+
* a shared base skeleton — a module never writes secrets into the config and only
|
|
47
|
+
* emits JSON the existing loader already accepts.
|
|
48
|
+
*/
|
|
49
|
+
export interface CapabilityModule {
|
|
50
|
+
/** `channel:telegram`, `memory:bujo`, `sandbox`, `observability:phoenix`, ... */
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly kind: ModuleKind;
|
|
53
|
+
readonly title: string;
|
|
54
|
+
/** One-line wizard hint. */
|
|
55
|
+
readonly summary: string;
|
|
56
|
+
readonly riskLevel: "low" | "medium" | "high";
|
|
57
|
+
/** The `docs/playbooks/<file>` this module mirrors, parity-checked to exist. */
|
|
58
|
+
readonly playbook?: string;
|
|
59
|
+
readonly inputs: readonly ModuleInput[];
|
|
60
|
+
/** Partial config this module contributes; composed onto the base skeleton. */
|
|
61
|
+
readonly configFragment: (values: ModuleInputValues) => Partial<MonoAgentConfigJson> & Record<string, unknown>;
|
|
62
|
+
/** `.env.example` placeholder lines for this module's secrets (no trailing newline per line). */
|
|
63
|
+
readonly envExampleLines?: (values: ModuleInputValues) => readonly string[];
|
|
64
|
+
/** `allowedTools` entries this capability wants (pre-checked in the wizard tools step). */
|
|
65
|
+
readonly recommendedTools?: readonly string[];
|
|
66
|
+
/** Extra files to scaffold (cron job markdown, etc.). */
|
|
67
|
+
readonly files?: (values: ModuleInputValues) => readonly GeneratedFile[];
|
|
68
|
+
/** Capabilities the composer checks once secrets are supplied. */
|
|
69
|
+
readonly validateExpectations: readonly ModuleValidateExpectation[];
|
|
70
|
+
}
|
|
71
|
+
/** Resolve declared input defaults, then layer overrides on top. */
|
|
72
|
+
export declare function resolveModuleInputs(module: CapabilityModule, overrides?: ModuleInputValues): ModuleInputValues;
|
|
73
|
+
//# sourceMappingURL=types.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AM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/G,iGAAiG;IACjG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,SAAS,MAAM,EAAE,CAAC;IAC5E,2FAA2F;IAC3F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,SAAS,aAAa,EAAE,CAAC;IACzE,kEAAkE;IAClE,QAAQ,CAAC,oBAAoB,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACrE;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,SAAS,GAAE,iBAAsB,GAChC,iBAAiB,CAYnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** Resolve declared input defaults, then layer
|
|
2
|
-
export function
|
|
1
|
+
/** Resolve declared input defaults, then layer overrides on top. */
|
|
2
|
+
export function resolveModuleInputs(module, overrides = {}) {
|
|
3
3
|
const values = {};
|
|
4
|
-
for (const input of
|
|
4
|
+
for (const input of module.inputs) {
|
|
5
5
|
values[input.id] = overrides[input.id] ?? input.default;
|
|
6
6
|
}
|
|
7
7
|
// Preserve overrides that don't correspond to a declared input (forward-compat).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/modules/types.ts"],"names":[],"mappings":"AA8EA,oEAAoE;AACpE,MAAM,UAAU,mBAAmB,CACjC,MAAwB,EACxB,YAA+B,EAAE;IAEjC,MAAM,MAAM,GAAuC,EAAE,CAAC;IACtD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC;IAC1D,CAAC;IACD,iFAAiF;IACjF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACrD,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Why this exists: a scheduled/proactive post (e.g. a daily digest) runs under a
|
|
7
7
|
* synthetic conversationId (e.g. `scheduled-scan`) and posts via
|
|
8
|
-
* `
|
|
8
|
+
* `SlackSendMessage`, which registers no `slack:` conversation. When the user
|
|
9
9
|
* replies, the Slack adapter derives `slack:<channel>:<posted-ts>` — an id with no
|
|
10
10
|
* history. This index closes that gap: the producer records `(channel, ts) →
|
|
11
11
|
* producing conversationId`; the consumer (inbound dispatch) looks it up and
|
|
12
12
|
* aliases the reply onto the producing conversation.
|
|
13
13
|
*
|
|
14
14
|
* Storage is an append-only JSONL file inside the run-artifact dir. Append-only
|
|
15
|
-
* keeps cross-process writes safe: the `
|
|
15
|
+
* keeps cross-process writes safe: the `SlackSendMessage` child process and the
|
|
16
16
|
* adapter both only ever append (small `O_APPEND` writes are atomic), and only the
|
|
17
17
|
* single adapter process compacts. A `.jsonl` file is ignored by the
|
|
18
18
|
* `.summary.json` artifact scanners (see `seen-conversations.ts`), so it never
|
|
@@ -7,14 +7,14 @@ import { dirname, join } from "node:path";
|
|
|
7
7
|
*
|
|
8
8
|
* Why this exists: a scheduled/proactive post (e.g. a daily digest) runs under a
|
|
9
9
|
* synthetic conversationId (e.g. `scheduled-scan`) and posts via
|
|
10
|
-
* `
|
|
10
|
+
* `SlackSendMessage`, which registers no `slack:` conversation. When the user
|
|
11
11
|
* replies, the Slack adapter derives `slack:<channel>:<posted-ts>` — an id with no
|
|
12
12
|
* history. This index closes that gap: the producer records `(channel, ts) →
|
|
13
13
|
* producing conversationId`; the consumer (inbound dispatch) looks it up and
|
|
14
14
|
* aliases the reply onto the producing conversation.
|
|
15
15
|
*
|
|
16
16
|
* Storage is an append-only JSONL file inside the run-artifact dir. Append-only
|
|
17
|
-
* keeps cross-process writes safe: the `
|
|
17
|
+
* keeps cross-process writes safe: the `SlackSendMessage` child process and the
|
|
18
18
|
* adapter both only ever append (small `O_APPEND` writes are atomic), and only the
|
|
19
19
|
* single adapter process compacts. A `.jsonl` file is ignored by the
|
|
20
20
|
* `.summary.json` artifact scanners (see `seen-conversations.ts`), so it never
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { MonoAgentConfigJson } from "@mono-agent/config";
|
|
2
|
+
import { type CapabilityModule, type GeneratedFile, type ModuleInputValues, type ModuleValidateExpectation } from "../modules/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The complete set of choices the wizard (or a preset) makes. This is the single
|
|
5
|
+
* input to {@link composeWizardPlan}: everything the composer needs to emit a full
|
|
6
|
+
* `mono-agent.config.json`, `.env.example`, and follow-up files is derived from it.
|
|
7
|
+
*/
|
|
8
|
+
export interface WizardAnswers {
|
|
9
|
+
readonly model: string;
|
|
10
|
+
readonly fallbackModels: readonly string[];
|
|
11
|
+
/** Channel module ids, e.g. `["channel:webhook","channel:telegram"]`. */
|
|
12
|
+
readonly channels: readonly string[];
|
|
13
|
+
/** Memory module id, or `undefined` for no memory section. */
|
|
14
|
+
readonly memory?: string;
|
|
15
|
+
readonly sandbox: boolean;
|
|
16
|
+
readonly observability: boolean;
|
|
17
|
+
/** Final tool selection written into `tools.allowedTools`. */
|
|
18
|
+
readonly allowedTools: readonly string[];
|
|
19
|
+
/** Per module id → non-secret input overrides. Secret inputs are stripped by the composer. */
|
|
20
|
+
readonly moduleInputs: Readonly<Record<string, ModuleInputValues>>;
|
|
21
|
+
}
|
|
22
|
+
/** Folder-derived context the base skeleton needs (not from wizard inputs). */
|
|
23
|
+
export interface ComposeContext {
|
|
24
|
+
readonly dirBasename: string;
|
|
25
|
+
readonly skillsRootExists: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One secret the composed agent still needs. The CLI prints the checklist as
|
|
29
|
+
* `- <label>: <description>` and points the operator at `<envVar>` in `.env`.
|
|
30
|
+
*/
|
|
31
|
+
export interface SecretChecklistItem {
|
|
32
|
+
readonly moduleId: string;
|
|
33
|
+
readonly label: string;
|
|
34
|
+
readonly envVar: string;
|
|
35
|
+
readonly description: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The single artifact of config generation: the JSON to write (with `$schema`),
|
|
39
|
+
* the optional `.env.example`, follow-up files, the secret checklist, the selected
|
|
40
|
+
* modules, the validate expectations, and any authoring warnings.
|
|
41
|
+
*/
|
|
42
|
+
export interface WizardPlan {
|
|
43
|
+
readonly configJson: MonoAgentConfigJson;
|
|
44
|
+
/** Joined module `envExampleLines` plus a trailing newline; `undefined` when none. */
|
|
45
|
+
readonly envExample?: string;
|
|
46
|
+
readonly files: readonly GeneratedFile[];
|
|
47
|
+
readonly secrets: readonly SecretChecklistItem[];
|
|
48
|
+
readonly selectedModules: readonly CapabilityModule[];
|
|
49
|
+
readonly validateExpectations: readonly ModuleValidateExpectation[];
|
|
50
|
+
readonly warnings: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The recommended `allowedTools` for these answers: the read-only safe defaults
|
|
54
|
+
* plus every selected module's `recommendedTools`, deduped and ordered by the
|
|
55
|
+
* canonical BUILTIN∪ADAPTER position. Deterministic — no Set-iteration reliance.
|
|
56
|
+
*/
|
|
57
|
+
export declare function recommendedToolSelection(answers: WizardAnswers): readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* The tools this agent auto-provisions regardless of `tools.allowedTools` — the
|
|
60
|
+
* "always on" set the wizard surfaces so the operator understands they are NOT gated
|
|
61
|
+
* by the allow-list choice. Today that is `MemoryRecall` when the memory tier enables
|
|
62
|
+
* recall (journal/bujo/supermemory). `ReadSkill` (skills configured) and MCP-server
|
|
63
|
+
* tools are also always-on when present, but the basic wizard authors neither, so they
|
|
64
|
+
* never appear here.
|
|
65
|
+
*/
|
|
66
|
+
export declare function alwaysOnTools(answers: WizardAnswers): readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* The wizard's starting answers with `overrides` shallow-merged on top. Unless an
|
|
69
|
+
* explicit `allowedTools` override is supplied, `allowedTools` defaults to allow-all
|
|
70
|
+
* (`["*"]`) — the single choke point that flips the silent scaffold, every preset, and
|
|
71
|
+
* every non-interactive `--flag` path to allow-all. An explicit override is preserved
|
|
72
|
+
* verbatim: `["*"]`, a specific list, or `[]` (the chat-only case).
|
|
73
|
+
*/
|
|
74
|
+
export declare function defaultAnswers(overrides?: Partial<WizardAnswers>): WizardAnswers;
|
|
75
|
+
/** Overrides for one module: the shared model plus its non-secret input values. */
|
|
76
|
+
export declare function moduleOverrides(module: CapabilityModule, answers: WizardAnswers): Record<string, string | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* The single config-generation path: turn wizard answers into a complete
|
|
79
|
+
* `WizardPlan`. Fragments are composed onto the adapter-neutral base skeleton;
|
|
80
|
+
* secret inputs are stripped before any fragment runs, so a secret value can never
|
|
81
|
+
* reach the JSON. The composed default config is byte-equal to today's `init.ts`
|
|
82
|
+
* scaffold except `tools.allowedTools` (filled from the wizard's tools selection).
|
|
83
|
+
*/
|
|
84
|
+
export declare function composeWizardPlan(answers: WizardAnswers, ctx: ComposeContext): WizardPlan;
|
|
85
|
+
//# sourceMappingURL=answers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answers.d.ts","sourceRoot":"","sources":["../../src/wizard/answers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAKL,KAAK,gBAAgB,EAIrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAE/B,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,8FAA8F;IAC9F,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;CACpE;AAED,+EAA+E;AAC/E,MAAM,WAAW,cA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gB,iBAAiB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,GAAG,UAAU,CAqEzF"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { monoAgentConfigWithSchema } from "../config-reference.js";
|
|
2
|
+
import { ADAPTER_SEND_TOOL_NAMES, ALLOW_ALL_TOOLS, baseConfig, BUILTIN_TOOL_NAMES, DEFAULT_MODEL, DEFAULT_SAFE_TOOLS, findModule, resolveModuleInputs, } from "../modules/index.js";
|
|
3
|
+
/** Tools ordered canonically: built-ins first, then adapter send tools. */
|
|
4
|
+
const ORDERED_TOOL_NAMES = [...BUILTIN_TOOL_NAMES, ...ADAPTER_SEND_TOOL_NAMES];
|
|
5
|
+
const ZERO_TOOLS_WARNING = "Zero tools selected — the agent will be chat-only: it cannot read files, run commands, or send proactive messages.";
|
|
6
|
+
/**
|
|
7
|
+
* The module ids selected by these answers, in composer order: auto-derived
|
|
8
|
+
* providers first (from a `pi:ollama:*`/`pi:lmstudio:*` model), then channels (in
|
|
9
|
+
* answer order), then the memory tier, then sandbox, then observability.
|
|
10
|
+
*/
|
|
11
|
+
function selectedModuleIds(answers) {
|
|
12
|
+
const ids = [];
|
|
13
|
+
if (/^pi:ollama:/u.test(answers.model)) {
|
|
14
|
+
ids.push("provider:ollama");
|
|
15
|
+
}
|
|
16
|
+
if (/^pi:lmstudio:/u.test(answers.model)) {
|
|
17
|
+
ids.push("provider:lmstudio");
|
|
18
|
+
}
|
|
19
|
+
for (const channel of answers.channels) {
|
|
20
|
+
ids.push(channel);
|
|
21
|
+
}
|
|
22
|
+
if (answers.memory !== undefined) {
|
|
23
|
+
ids.push(answers.memory);
|
|
24
|
+
}
|
|
25
|
+
if (answers.sandbox) {
|
|
26
|
+
ids.push("sandbox");
|
|
27
|
+
}
|
|
28
|
+
if (answers.observability) {
|
|
29
|
+
ids.push("observability:phoenix");
|
|
30
|
+
}
|
|
31
|
+
return ids;
|
|
32
|
+
}
|
|
33
|
+
/** Resolve the selected module ids to modules, skipping unknown ids defensively. */
|
|
34
|
+
function selectedModules(answers) {
|
|
35
|
+
const modules = [];
|
|
36
|
+
for (const id of selectedModuleIds(answers)) {
|
|
37
|
+
const module = findModule(id);
|
|
38
|
+
if (module !== undefined) {
|
|
39
|
+
modules.push(module);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return modules;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The recommended `allowedTools` for these answers: the read-only safe defaults
|
|
46
|
+
* plus every selected module's `recommendedTools`, deduped and ordered by the
|
|
47
|
+
* canonical BUILTIN∪ADAPTER position. Deterministic — no Set-iteration reliance.
|
|
48
|
+
*/
|
|
49
|
+
export function recommendedToolSelection(answers) {
|
|
50
|
+
const union = new Set(DEFAULT_SAFE_TOOLS);
|
|
51
|
+
for (const module of selectedModules(answers)) {
|
|
52
|
+
for (const tool of module.recommendedTools ?? []) {
|
|
53
|
+
union.add(tool);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return ORDERED_TOOL_NAMES.filter((name) => union.has(name));
|
|
57
|
+
}
|
|
58
|
+
/** The read-only recall tool auto-provisioned from `memory.recallTool.enabled`. */
|
|
59
|
+
const MEMORY_RECALL_TOOL = "MemoryRecall";
|
|
60
|
+
/**
|
|
61
|
+
* True when the selected memory tier auto-provisions the read-only `MemoryRecall`
|
|
62
|
+
* tool (its fragment sets `memory.recallTool.enabled`). Derived from the catalog so
|
|
63
|
+
* it never drifts from the memory modules themselves — journal/bujo/supermemory do,
|
|
64
|
+
* lite does not.
|
|
65
|
+
*/
|
|
66
|
+
function memoryProvisionsRecall(memoryId) {
|
|
67
|
+
if (memoryId === undefined) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const module = findModule(memoryId);
|
|
71
|
+
if (module?.kind !== "memory") {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const fragment = module.configFragment({ model: DEFAULT_MODEL });
|
|
75
|
+
return fragment.memory?.recallTool?.enabled === true;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The tools this agent auto-provisions regardless of `tools.allowedTools` — the
|
|
79
|
+
* "always on" set the wizard surfaces so the operator understands they are NOT gated
|
|
80
|
+
* by the allow-list choice. Today that is `MemoryRecall` when the memory tier enables
|
|
81
|
+
* recall (journal/bujo/supermemory). `ReadSkill` (skills configured) and MCP-server
|
|
82
|
+
* tools are also always-on when present, but the basic wizard authors neither, so they
|
|
83
|
+
* never appear here.
|
|
84
|
+
*/
|
|
85
|
+
export function alwaysOnTools(answers) {
|
|
86
|
+
const tools = [];
|
|
87
|
+
if (memoryProvisionsRecall(answers.memory)) {
|
|
88
|
+
tools.push(MEMORY_RECALL_TOOL);
|
|
89
|
+
}
|
|
90
|
+
return tools;
|
|
91
|
+
}
|
|
92
|
+
const BASE_ANSWERS = {
|
|
93
|
+
model: DEFAULT_MODEL,
|
|
94
|
+
fallbackModels: [],
|
|
95
|
+
channels: ["channel:webhook"],
|
|
96
|
+
// `memory` is intentionally omitted (no memory section) — with
|
|
97
|
+
// exactOptionalPropertyTypes an optional key must be absent, not `undefined`.
|
|
98
|
+
sandbox: false,
|
|
99
|
+
observability: false,
|
|
100
|
+
allowedTools: [ALLOW_ALL_TOOLS],
|
|
101
|
+
moduleInputs: {},
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* The wizard's starting answers with `overrides` shallow-merged on top. Unless an
|
|
105
|
+
* explicit `allowedTools` override is supplied, `allowedTools` defaults to allow-all
|
|
106
|
+
* (`["*"]`) — the single choke point that flips the silent scaffold, every preset, and
|
|
107
|
+
* every non-interactive `--flag` path to allow-all. An explicit override is preserved
|
|
108
|
+
* verbatim: `["*"]`, a specific list, or `[]` (the chat-only case).
|
|
109
|
+
*/
|
|
110
|
+
export function defaultAnswers(overrides) {
|
|
111
|
+
const merged = { ...BASE_ANSWERS, ...overrides };
|
|
112
|
+
const allowedTools = overrides?.allowedTools ?? [ALLOW_ALL_TOOLS];
|
|
113
|
+
return { ...merged, allowedTools };
|
|
114
|
+
}
|
|
115
|
+
/** Overrides for one module: the shared model plus its non-secret input values. */
|
|
116
|
+
export function moduleOverrides(module, answers) {
|
|
117
|
+
const overrides = {
|
|
118
|
+
model: answers.model,
|
|
119
|
+
...(answers.moduleInputs[module.id] ?? {}),
|
|
120
|
+
};
|
|
121
|
+
// Defense in depth: a secret-declared value must never reach a fragment or the JSON.
|
|
122
|
+
for (const input of module.inputs) {
|
|
123
|
+
if (input.secret === true) {
|
|
124
|
+
delete overrides[input.id];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return overrides;
|
|
128
|
+
}
|
|
129
|
+
/** Merge a module fragment onto the working config, concatenating `channels.plugins`. */
|
|
130
|
+
function applyFragment(config, fragment) {
|
|
131
|
+
for (const [key, value] of Object.entries(fragment)) {
|
|
132
|
+
if (key === "channels") {
|
|
133
|
+
const existing = config.channels ?? {};
|
|
134
|
+
const incoming = value ?? {};
|
|
135
|
+
const existingPlugins = Array.isArray(existing.plugins) ? existing.plugins : [];
|
|
136
|
+
const incomingPlugins = Array.isArray(incoming.plugins) ? incoming.plugins : [];
|
|
137
|
+
const plugins = [...existingPlugins, ...incomingPlugins];
|
|
138
|
+
config.channels = {
|
|
139
|
+
...existing,
|
|
140
|
+
...incoming,
|
|
141
|
+
...(plugins.length > 0 ? { plugins } : {}),
|
|
142
|
+
};
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
config[key] = value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The single config-generation path: turn wizard answers into a complete
|
|
150
|
+
* `WizardPlan`. Fragments are composed onto the adapter-neutral base skeleton;
|
|
151
|
+
* secret inputs are stripped before any fragment runs, so a secret value can never
|
|
152
|
+
* reach the JSON. The composed default config is byte-equal to today's `init.ts`
|
|
153
|
+
* scaffold except `tools.allowedTools` (filled from the wizard's tools selection).
|
|
154
|
+
*/
|
|
155
|
+
export function composeWizardPlan(answers, ctx) {
|
|
156
|
+
const modules = selectedModules(answers);
|
|
157
|
+
const config = {
|
|
158
|
+
...baseConfig(ctx, answers.model, answers.fallbackModels),
|
|
159
|
+
};
|
|
160
|
+
const files = [];
|
|
161
|
+
const secrets = [];
|
|
162
|
+
const envLines = [];
|
|
163
|
+
const validateExpectations = [{ sectionId: "runtime", mustBe: "ok" }];
|
|
164
|
+
let providerOllamaSelected = false;
|
|
165
|
+
for (const module of modules) {
|
|
166
|
+
if (module.id === "provider:ollama") {
|
|
167
|
+
providerOllamaSelected = true;
|
|
168
|
+
}
|
|
169
|
+
const values = resolveModuleInputs(module, moduleOverrides(module, answers));
|
|
170
|
+
applyFragment(config, module.configFragment(values));
|
|
171
|
+
for (const line of module.envExampleLines?.(values) ?? []) {
|
|
172
|
+
envLines.push(line);
|
|
173
|
+
}
|
|
174
|
+
for (const file of module.files?.(values) ?? []) {
|
|
175
|
+
files.push(file);
|
|
176
|
+
}
|
|
177
|
+
for (const input of module.inputs) {
|
|
178
|
+
if (input.secret === true && input.envVar !== undefined) {
|
|
179
|
+
secrets.push({
|
|
180
|
+
moduleId: module.id,
|
|
181
|
+
label: input.label,
|
|
182
|
+
envVar: input.envVar,
|
|
183
|
+
description: input.description,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
for (const expectation of module.validateExpectations) {
|
|
188
|
+
validateExpectations.push(expectation);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
config.tools = {
|
|
192
|
+
...(config.tools ?? {}),
|
|
193
|
+
allowedTools: [...answers.allowedTools],
|
|
194
|
+
disallowedTools: [],
|
|
195
|
+
};
|
|
196
|
+
// The local-ollama endpoint mirrors the old recipe: only when the ollama
|
|
197
|
+
// provider is present AND memory embeddings actually target ollama.
|
|
198
|
+
const memory = config.memory;
|
|
199
|
+
if (providerOllamaSelected && memory?.embeddings !== undefined && memory.embeddings.provider === "ollama") {
|
|
200
|
+
config.memory = {
|
|
201
|
+
...memory,
|
|
202
|
+
embeddings: { ...memory.embeddings, endpoint: "http://localhost:11434" },
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const configJson = monoAgentConfigWithSchema(config);
|
|
206
|
+
const envExample = envLines.length > 0 ? `${envLines.join("\n")}\n` : undefined;
|
|
207
|
+
const warnings = answers.allowedTools.length === 0 ? [ZERO_TOOLS_WARNING] : [];
|
|
208
|
+
return {
|
|
209
|
+
configJson,
|
|
210
|
+
...(envExample === undefined ? {} : { envExample }),
|
|
211
|
+
files,
|
|
212
|
+
secrets,
|
|
213
|
+
selectedModules: modules,
|
|
214
|
+
validateExpectations: dedupeExpectations(validateExpectations),
|
|
215
|
+
warnings,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Dedupe validate expectations by `sectionId`, keeping the first occurrence. */
|
|
219
|
+
function dedupeExpectations(expectations) {
|
|
220
|
+
const seen = new Set();
|
|
221
|
+
const out = [];
|
|
222
|
+
for (const expectation of expectations) {
|
|
223
|
+
if (seen.has(expectation.sectionId)) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
seen.add(expectation.sectionId);
|
|
227
|
+
out.push(expectation);
|
|
228
|
+
}
|
|
229
|
+
return out;
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=answers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answers.js","sourceRoot":"","sources":["../../src/wizard/answers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,kBAAkB,EAElB,aAAa,EACb,kBAAkB,EAClB,UAAU,EAIV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAuD7B,2EAA2E;AAC3E,MAAM,kBAAkB,GAAsB,CAAC,GAAG,kBAAkB,EAAE,GAAG,uBAAuB,CAAC,CAAC;AAElG,MAAM,kBAAkB,GACtB,oHAAoH,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AC,EAAE,CAAC;YACpC,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type WizardAnswers } from "./answers.js";
|
|
2
|
+
/** Channels `mono-agent init --with <csv>` can switch on, by their short flag name. */
|
|
3
|
+
export declare const WITH_CHANNELS: readonly ["telegram", "slack", "webhook", "openaiApi", "cron"];
|
|
4
|
+
export type WithChannel = (typeof WITH_CHANNELS)[number];
|
|
5
|
+
/** True when `value` is a `--with` channel flag name. */
|
|
6
|
+
export declare function isWithChannel(value: string): value is WithChannel;
|
|
7
|
+
/** The non-interactive `init`/preset flags, before they are mapped onto answers. */
|
|
8
|
+
export interface AnswersFromCliArgs {
|
|
9
|
+
readonly model?: string;
|
|
10
|
+
readonly fallbackModels?: readonly string[];
|
|
11
|
+
readonly memory?: "lite" | "journal" | "bujo";
|
|
12
|
+
/** Validated `--with` channel flag names (see {@link WithChannel}). */
|
|
13
|
+
readonly withChannels?: readonly string[];
|
|
14
|
+
/** Preset id whose answers seed the base selection (already validated by the caller). */
|
|
15
|
+
readonly presetId?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Map the non-interactive `init` flags (and an optional preset) onto full wizard
|
|
19
|
+
* answers, running once through the single {@link defaultAnswers} path so
|
|
20
|
+
* `allowedTools` is recomputed from the final capability selection. A preset seeds
|
|
21
|
+
* the base answers (its partial, so it never pins tools); each explicit flag
|
|
22
|
+
* overrides that; `--with` channels are unioned onto the preset/default channels.
|
|
23
|
+
* The caller resolves an unknown `presetId` and errors before calling this.
|
|
24
|
+
*/
|
|
25
|
+
export declare function answersFromCli(args: AnswersFromCliArgs): WizardAnswers;
|
|
26
|
+
//# sourceMappingURL=from-flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from-flags.d.ts","sourceRoot":"","sources":["../../src/wizard/from-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlE,uFAAuF;AACvF,eAAO,MAAM,aAAa,gEAAiE,CAAC;AAC5F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE;AAWD,oFAAoF;AACpF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAC9C,uEAAuE;IACvE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,aAAa,CAqBtE"}
|