melchizedek-agents 1.1.0 → 1.3.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/.env.example +19 -0
- package/AGENT_SETUP.md +3 -1
- package/CHANGELOG.md +373 -0
- package/DOCUMENTATION.md +193 -21
- package/ONBOARDING.md +378 -0
- package/QUICKSTART.md +15 -2
- package/README.md +26 -3
- package/config/agents/examples/connectors.yaml +82 -0
- package/config/agents/examples/council.yaml +1 -1
- package/config/agents/examples/critic.yaml +8 -8
- package/config/agents/examples/image_production.yaml +4 -3
- package/config/agents/syndicate.schema.json +389 -33
- package/config/agents/syndicateSchema.yaml +18 -6
- package/config/agents/templates/intake_extractor.yaml +3 -2
- package/config/agents/templates/systems_operator.yaml +5 -2
- package/dist/lib/a2a/app.d.ts +12 -0
- package/dist/lib/a2a/app.js +25 -11
- package/dist/lib/a2a/executor.js +14 -6
- package/dist/lib/a2a/oauthSetup.d.ts +16 -0
- package/dist/lib/a2a/oauthSetup.js +77 -8
- package/dist/lib/agentDialect.d.ts +18 -8
- package/dist/lib/agentDialect.js +36 -19
- package/dist/lib/chatgpt/adapter.d.ts +50 -0
- package/dist/lib/chatgpt/adapter.js +107 -0
- package/dist/lib/chatgpt/cli.d.ts +23 -0
- package/dist/lib/chatgpt/cli.js +77 -0
- package/dist/lib/chatgpt/oauth.d.ts +103 -0
- package/dist/lib/chatgpt/oauth.js +448 -0
- package/dist/lib/chatgpt/state.d.ts +98 -0
- package/dist/lib/chatgpt/state.js +145 -0
- package/dist/lib/chatgpt/store.d.ts +24 -0
- package/dist/lib/chatgpt/store.js +94 -0
- package/dist/lib/compile.d.ts +38 -7
- package/dist/lib/compile.js +97 -62
- package/dist/lib/compileNative.d.ts +11 -3
- package/dist/lib/compileNative.js +18 -1
- package/dist/lib/dispatch.js +6 -2
- package/dist/lib/doctor.d.ts +107 -0
- package/dist/lib/doctor.js +217 -7
- package/dist/lib/loadSyndicate.d.ts +15 -0
- package/dist/lib/mcp/server.d.ts +195 -0
- package/dist/lib/mcp/server.js +564 -0
- package/dist/lib/memory/supabaseMemoryService.js +2 -2
- package/dist/lib/models/adapterResolver.js +6 -1
- package/dist/lib/models/capabilities.d.ts +9 -0
- package/dist/lib/models/capabilities.js +24 -0
- package/dist/lib/models/chatCompletionsAdapter.d.ts +11 -3
- package/dist/lib/models/chatCompletionsAdapter.js +19 -5
- package/dist/lib/models/claudeAdapter.js +4 -0
- package/dist/lib/models/contract.d.ts +5 -2
- package/dist/lib/models/gateway.d.ts +3 -2
- package/dist/lib/models/gateway.js +8 -4
- package/dist/lib/models/gatewayAdapter.d.ts +7 -1
- package/dist/lib/models/gatewayAdapter.js +8 -0
- package/dist/lib/models/geminiAdapter.js +8 -2
- package/dist/lib/models/genaiMapping.d.ts +8 -4
- package/dist/lib/models/genaiMapping.js +23 -9
- package/dist/lib/models/gptAdapter.d.ts +4 -2
- package/dist/lib/models/gptAdapter.js +11 -4
- package/dist/lib/models/grokAdapter.d.ts +3 -1
- package/dist/lib/models/grokAdapter.js +11 -3
- package/dist/lib/models/kimiAdapter.d.ts +2 -1
- package/dist/lib/models/kimiAdapter.js +3 -3
- package/dist/lib/models/reasoning.d.ts +30 -2
- package/dist/lib/models/reasoning.js +56 -5
- package/dist/lib/onboarding.d.ts +135 -0
- package/dist/lib/onboarding.js +578 -0
- package/dist/lib/runtime/approvals.d.ts +2 -0
- package/dist/lib/runtime/approvals.js +4 -3
- package/dist/lib/runtime/credentials.d.ts +6 -0
- package/dist/lib/runtime/native/agentLoop.d.ts +5 -2
- package/dist/lib/runtime/native/agentLoop.js +2 -0
- package/dist/lib/runtime/native/checkpoint.d.ts +12 -5
- package/dist/lib/runtime/native/checkpoint.js +13 -19
- package/dist/lib/runtime/native/delegate.d.ts +82 -1
- package/dist/lib/runtime/native/delegate.js +157 -2
- package/dist/lib/runtime/native/interrupts.d.ts +88 -5
- package/dist/lib/runtime/native/interrupts.js +220 -30
- package/dist/lib/runtime/syndicateTurn.d.ts +4 -2
- package/dist/lib/runtime/syndicateTurn.js +324 -77
- package/dist/lib/runtime/turnControl.d.ts +41 -0
- package/dist/lib/session/transcript.d.ts +9 -0
- package/dist/lib/session/transcript.js +20 -1
- package/dist/lib/skills.d.ts +18 -0
- package/dist/lib/skills.js +73 -1
- package/dist/lib/storage/postgres/index.d.ts +6 -1
- package/dist/lib/storage/postgres/index.js +1 -1
- package/dist/lib/storage/postgres/taskQueue.d.ts +7 -3
- package/dist/lib/storage/postgres/taskQueue.js +10 -3
- package/dist/lib/syndicateSchema.d.ts +184 -9
- package/dist/lib/syndicateSchema.js +143 -29
- package/dist/lib/tools/auth.d.ts +13 -1
- package/dist/lib/tools/auth.js +10 -2
- package/dist/lib/tools/credentialHosts.d.ts +88 -0
- package/dist/lib/tools/credentialHosts.js +165 -0
- package/dist/lib/tools/credentialUses.d.ts +98 -0
- package/dist/lib/tools/credentialUses.js +120 -0
- package/dist/lib/tools/generateImageTool.js +2 -1
- package/dist/lib/tools/inspectImageTool.js +1 -1
- package/dist/lib/tools/mcpToolFactory.d.ts +29 -1
- package/dist/lib/tools/mcpToolFactory.js +72 -26
- package/dist/lib/tools/mcpTransports.d.ts +12 -0
- package/dist/lib/tools/mcpTransports.js +11 -0
- package/dist/lib/tools/oauthConsent.d.ts +18 -3
- package/dist/lib/tools/oauthConsent.js +57 -15
- package/dist/lib/tools/oauthDiscovery.d.ts +202 -0
- package/dist/lib/tools/oauthDiscovery.js +616 -0
- package/dist/lib/tools/oauthHosts.d.ts +2 -0
- package/dist/lib/tools/oauthHosts.js +2 -2
- package/dist/lib/tools/oauthTools.d.ts +54 -13
- package/dist/lib/tools/oauthTools.js +106 -23
- package/dist/lib/tools/openapiTools.d.ts +7 -0
- package/dist/lib/tools/openapiTools.js +49 -3
- package/dist/lib/tools/taskTools.d.ts +32 -2
- package/dist/lib/tools/taskTools.js +93 -33
- package/dist/lib/tools/xApiSearchTool.js +2 -2
- package/dist/lib/workflow/turn.d.ts +22 -3
- package/dist/lib/workflow/turn.js +151 -31
- package/dist/lib/workflow.d.ts +10 -7
- package/dist/lib/workflow.js +10 -7
- package/dist/scripts/a2a_server.d.ts +2 -2
- package/dist/scripts/a2a_server.js +19 -2
- package/dist/scripts/assistant_worker.d.ts +2 -0
- package/dist/scripts/assistant_worker.js +24 -5
- package/dist/scripts/doctor.d.ts +4 -2
- package/dist/scripts/doctor.js +6 -4
- package/dist/scripts/mcp_server.d.ts +12 -0
- package/dist/scripts/mcp_server.js +345 -0
- package/dist/scripts/setup.d.ts +25 -0
- package/dist/scripts/setup.js +181 -0
- package/dist/scripts/skills_install.d.ts +3 -1
- package/dist/scripts/skills_install.js +17 -2
- package/dist/scripts/syndicate_chat.js +12 -3
- package/dist/scripts/yaml_codemod.d.ts +12 -2
- package/dist/scripts/yaml_codemod.js +115 -33
- package/package.json +8 -2
- package/skills/README.md +11 -2
- package/skills/briefs/_shared.md +1 -1
- package/skills/briefs/melchizedek-models.md +4 -2
- package/skills/briefs/skills-readme.md +3 -1
- package/skills/melchizedek-models/SKILL.md +6 -2
- package/skills/melchizedek-onboard/SKILL.md +71 -0
- package/skills/melchizedek-onboard-cloud/SKILL.md +38 -0
- package/skills/melchizedek-onboard-keys/SKILL.md +47 -0
- package/skills/melchizedek-onboard-local/SKILL.md +41 -0
- package/skills/melchizedek-onboard-serve/SKILL.md +43 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/onboarding.ts — the authentication levels and their startup guides.
|
|
3
|
+
*
|
|
4
|
+
* WHY this file exists:
|
|
5
|
+
* A newcomer arrives with something: no key, one provider's key, several, a
|
|
6
|
+
* gateway key, a cloud account, a server to put in front of other people,
|
|
7
|
+
* a ChatGPT plan on their own machine (Sign in with ChatGPT, ADR 0126), or
|
|
8
|
+
* a Claude.ai / Gemini CLI / Codex CLI sign-in. Each of those is a
|
|
9
|
+
* different first ten minutes. This module names those levels once, from
|
|
10
|
+
* what the engine actually supports (lib/models/providerMap.ts,
|
|
11
|
+
* endpoints.ts, gateway.ts, the A2A server's identity modes and the OAuth
|
|
12
|
+
* grant setup), and renders one startup guide per level. The
|
|
13
|
+
* `melchizedek-setup` menu prints these guides and ONBOARDING.md is
|
|
14
|
+
* generated from the same function, so the two cannot drift
|
|
15
|
+
* (tests/onboarding.test.ts holds them equal).
|
|
16
|
+
*
|
|
17
|
+
* DETECTION IS THE DOCTOR'S:
|
|
18
|
+
* `detectLevels` reads a DoctorResult (lib/doctor.ts: the providers line,
|
|
19
|
+
* the gateway, the cloud endpoints, the serving and OAuth lines). It never
|
|
20
|
+
* reads a key itself, so `--auto` cannot disagree with the doctor.
|
|
21
|
+
*
|
|
22
|
+
* WHAT IT NEVER DOES:
|
|
23
|
+
* print a value. Guides carry variable NAMES and SHAPES; detection carries
|
|
24
|
+
* names and set/unset. Writing `.env` (writeEnvForLevel) copies
|
|
25
|
+
* `.env.example`, leaves every chosen name blank, refuses to overwrite an
|
|
26
|
+
* existing file, and refuses unless `git check-ignore` says `.env` is
|
|
27
|
+
* ignored (secrets-hygiene).
|
|
28
|
+
*/
|
|
29
|
+
import type { DoctorResult, Tier } from './doctor.ts';
|
|
30
|
+
export type LevelId = 'local' | 'one-provider' | 'several-providers' | 'gateway' | 'cloud-platform' | 'byok' | 'caller-tokens' | 'oauth-grants' | 'chatgpt-signin' | 'subscription-signin';
|
|
31
|
+
/** How a command is spelled: in a project that installed the package, or in a clone of the repository. */
|
|
32
|
+
export type CommandForm = 'package' | 'clone';
|
|
33
|
+
export interface EnvLine {
|
|
34
|
+
name: string;
|
|
35
|
+
/** The shape of the value, never a value. */
|
|
36
|
+
shape: string;
|
|
37
|
+
/** What setting it does. */
|
|
38
|
+
purpose: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Level {
|
|
41
|
+
id: LevelId;
|
|
42
|
+
/** The menu line: what the user has. */
|
|
43
|
+
menu: string;
|
|
44
|
+
title: string;
|
|
45
|
+
summary: string;
|
|
46
|
+
env: EnvLine[];
|
|
47
|
+
/** What the doctor shows when this level is set up. */
|
|
48
|
+
confirm: string;
|
|
49
|
+
/** Shipped syndicates that run at this level, rendered by `shippedFor`. */
|
|
50
|
+
runs: (shipped: ShippedIndex) => string[];
|
|
51
|
+
first: Record<CommandForm, string[]>;
|
|
52
|
+
notes: string[];
|
|
53
|
+
/** The onboarding skill a coding agent follows for this level. */
|
|
54
|
+
skill: string;
|
|
55
|
+
/** False for an entry that is not a way to run the engine (the unsupported subscription sign-ins). */
|
|
56
|
+
detectable: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Shipped templates and examples by the tier their models imply, and which declare an OAuth grant. */
|
|
59
|
+
export interface ShippedIndex {
|
|
60
|
+
byTier: Partial<Record<Tier, string[]>>;
|
|
61
|
+
withGrants: string[];
|
|
62
|
+
/** Files that carry a commented-out `oauth2:` grant to start from. */
|
|
63
|
+
grantExamples: string[];
|
|
64
|
+
templates: string[];
|
|
65
|
+
}
|
|
66
|
+
/** The package (or clone) root: the directory holding config/agents/syndicate.schema.json. */
|
|
67
|
+
export declare function packageRoot(from?: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Index the shipped templates and examples by tier, using the doctor's own
|
|
70
|
+
* diagnosis (lib/doctor.ts `diagnoseSyndicate`: the tier the models imply,
|
|
71
|
+
* and the OAuth grants the tools declare). The tier does not depend on the
|
|
72
|
+
* environment, so the index is the same wherever it is computed.
|
|
73
|
+
*/
|
|
74
|
+
export declare function shippedIndex(root?: string): ShippedIndex;
|
|
75
|
+
export declare const LEVELS: readonly Level[];
|
|
76
|
+
export declare function levelById(id: string): Level | undefined;
|
|
77
|
+
/** Every variable name the guides mention. */
|
|
78
|
+
export declare function guideEnvNames(): string[];
|
|
79
|
+
/** One level's startup guide, as Markdown (the terminal prints the same text). */
|
|
80
|
+
export declare function renderGuide(level: Level, form: CommandForm, shipped?: ShippedIndex): string;
|
|
81
|
+
/** The menu: one numbered line per level. */
|
|
82
|
+
export declare function renderMenu(): string;
|
|
83
|
+
/** ONBOARDING.md, generated in full from the levels (package spelling). */
|
|
84
|
+
export declare function renderOnboardingDoc(shipped?: ShippedIndex): string;
|
|
85
|
+
export interface LevelDetection {
|
|
86
|
+
id: LevelId;
|
|
87
|
+
detected: boolean;
|
|
88
|
+
/** Names and set/unset only. */
|
|
89
|
+
evidence: string;
|
|
90
|
+
/** The doctor's problems for this level, by variable name. */
|
|
91
|
+
problems: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Which levels the environment is set up for, read from the doctor's result.
|
|
95
|
+
* Local is always available (whether Ollama is running is not checked).
|
|
96
|
+
*/
|
|
97
|
+
export declare function detectLevels(result: DoctorResult): LevelDetection[];
|
|
98
|
+
/** The highest detected level (the last in menu order). */
|
|
99
|
+
export declare function highestLevel(detections: LevelDetection[]): Level;
|
|
100
|
+
/** `--auto`: what the environment has (names only), then the guide for the highest level. */
|
|
101
|
+
export declare function renderAuto(result: DoctorResult, form: CommandForm, shipped?: ShippedIndex): string;
|
|
102
|
+
export type EnvWriteResult = {
|
|
103
|
+
status: 'written';
|
|
104
|
+
path: string;
|
|
105
|
+
added: string[];
|
|
106
|
+
} | {
|
|
107
|
+
status: 'exists';
|
|
108
|
+
path: string;
|
|
109
|
+
} | {
|
|
110
|
+
status: 'not-ignored';
|
|
111
|
+
path: string;
|
|
112
|
+
reason: string;
|
|
113
|
+
} | {
|
|
114
|
+
status: 'no-template';
|
|
115
|
+
path: string;
|
|
116
|
+
};
|
|
117
|
+
/** True when git confirms `.env` in `cwd` is ignored (exit 0 from `git check-ignore`). */
|
|
118
|
+
export declare function gitIgnoresEnv(cwd: string): {
|
|
119
|
+
ignored: boolean;
|
|
120
|
+
reason: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Create `.env` from `.env.example` for a level: the template verbatim, then
|
|
124
|
+
* every name the level lists that the template does not already assign, left
|
|
125
|
+
* blank. Never overwrites, never writes a value, and refuses unless git
|
|
126
|
+
* confirms `.env` is ignored. The file is created mode 600.
|
|
127
|
+
*/
|
|
128
|
+
export declare function writeEnvForLevel(level: Level, opts?: {
|
|
129
|
+
cwd?: string;
|
|
130
|
+
root?: string;
|
|
131
|
+
checkIgnored?: (cwd: string) => {
|
|
132
|
+
ignored: boolean;
|
|
133
|
+
reason: string;
|
|
134
|
+
};
|
|
135
|
+
}): EnvWriteResult;
|