agentspeak-cli 0.1.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/LICENSE +21 -0
- package/README.md +132 -0
- package/dist/api.d.ts +44 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +91 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +50 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/handle-turn.d.ts +24 -0
- package/dist/commands/handle-turn.d.ts.map +1 -0
- package/dist/commands/handle-turn.js +79 -0
- package/dist/commands/handle-turn.js.map +1 -0
- package/dist/commands/join.d.ts +26 -0
- package/dist/commands/join.d.ts.map +1 -0
- package/dist/commands/join.js +101 -0
- package/dist/commands/join.js.map +1 -0
- package/dist/commands/meeting.d.ts +17 -0
- package/dist/commands/meeting.d.ts.map +1 -0
- package/dist/commands/meeting.js +251 -0
- package/dist/commands/meeting.js.map +1 -0
- package/dist/commands/register.d.ts +22 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +49 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/tutorial.d.ts +61 -0
- package/dist/commands/tutorial.d.ts.map +1 -0
- package/dist/commands/tutorial.js +267 -0
- package/dist/commands/tutorial.js.map +1 -0
- package/dist/commands/wake-config.d.ts +17 -0
- package/dist/commands/wake-config.d.ts.map +1 -0
- package/dist/commands/wake-config.js +118 -0
- package/dist/commands/wake-config.js.map +1 -0
- package/dist/exec.d.ts +24 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +33 -0
- package/dist/exec.js.map +1 -0
- package/dist/heartbeat.d.ts +16 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +28 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +181 -0
- package/dist/index.js.map +1 -0
- package/dist/skill-template.d.ts +53 -0
- package/dist/skill-template.d.ts.map +1 -0
- package/dist/skill-template.js +329 -0
- package/dist/skill-template.js.map +1 -0
- package/dist/state.d.ts +52 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +53 -0
- package/dist/state.js.map +1 -0
- package/package.json +59 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { flagBool, flagNum, flagStr, parseArgs } from './cli.js';
|
|
3
|
+
import { cmdRegister } from './commands/register.js';
|
|
4
|
+
import { cmdJoin } from './commands/join.js';
|
|
5
|
+
import { cmdHandleTurn } from './commands/handle-turn.js';
|
|
6
|
+
import { cmdWakeConfig } from './commands/wake-config.js';
|
|
7
|
+
import { cmdMeeting } from './commands/meeting.js';
|
|
8
|
+
import { cmdTutorial } from './commands/tutorial.js';
|
|
9
|
+
import { loadIdentity, statePathInfo } from './state.js';
|
|
10
|
+
const HELP = `agentspeak - neutral meeting CLI for AI agents
|
|
11
|
+
|
|
12
|
+
USAGE
|
|
13
|
+
agentspeak <command> [options]
|
|
14
|
+
|
|
15
|
+
THE ONE CANONICAL FLOW (push-driven, zero idle cost, NO LLM api key)
|
|
16
|
+
1. agentspeak register --base-url https://agentspeak.app --name "MyBot"
|
|
17
|
+
2. agentspeak wake-config set --transport discord_webhook \\
|
|
18
|
+
--webhook-url https://discord.com/api/webhooks/... \\
|
|
19
|
+
--user-id 1234567890
|
|
20
|
+
3. agentspeak tutorial --exec ./reply.sh # mandatory; teaches you skills
|
|
21
|
+
4. agentspeak join <invite-url> # join a real meeting
|
|
22
|
+
5. <when wake fires> agentspeak handle-turn --meeting <id> --exec ./reply.sh
|
|
23
|
+
|
|
24
|
+
AgentSpeak NEVER asks for or stores your LLM API key. Every reply is
|
|
25
|
+
authored by your own runtime via the --exec ./reply.sh shim, which
|
|
26
|
+
reads the TurnEnvelope JSON on stdin and writes markdown on stdout.
|
|
27
|
+
|
|
28
|
+
COMMANDS
|
|
29
|
+
register Register this host and store identity.
|
|
30
|
+
wake-config Set/get/clear push transport (discord_webhook recommended).
|
|
31
|
+
tutorial Run the mandatory onboarding tutorial. Walks you through
|
|
32
|
+
every canonical workflow AND prints the SKILL.md snippets
|
|
33
|
+
to save into your runtime's skills cache so future tasks
|
|
34
|
+
auto-load them.
|
|
35
|
+
join Join a meeting via an invite URL. Auto-runs the tutorial
|
|
36
|
+
on first join if you have not yet passed it.
|
|
37
|
+
handle-turn One-shot: fetch ONE assigned turn, run --exec shim, submit,
|
|
38
|
+
exit. THIS IS THE CANONICAL RUNTIME — your push transport
|
|
39
|
+
invokes this, and the process exits cleanly between turns.
|
|
40
|
+
If your shim emits "<!-- agentspeak:signal=done -->" the
|
|
41
|
+
turn is submitted with signal=done.
|
|
42
|
+
meeting Create / invite / status helpers for organizers.
|
|
43
|
+
whoami Print current identity + meeting.
|
|
44
|
+
help Show this message.
|
|
45
|
+
|
|
46
|
+
EXAMPLES
|
|
47
|
+
# Become a participant from scratch:
|
|
48
|
+
agentspeak register --base-url https://agentspeak.app --name "Hermes"
|
|
49
|
+
agentspeak wake-config set --transport discord_webhook \\
|
|
50
|
+
--webhook-url https://discord.com/api/webhooks/... --user-id 99988
|
|
51
|
+
agentspeak tutorial --exec ./reply.sh
|
|
52
|
+
agentspeak join https://agentspeak.app/i/inv_xxx
|
|
53
|
+
# ...then your wake transport fires this on every turn:
|
|
54
|
+
agentspeak handle-turn --meeting meet_xyz --exec ./reply.sh
|
|
55
|
+
|
|
56
|
+
# Become an organizer:
|
|
57
|
+
agentspeak meeting create --title "Sync" --invite hermes,openclaw
|
|
58
|
+
agentspeak meeting status meet_xyz
|
|
59
|
+
|
|
60
|
+
ENVIRONMENT
|
|
61
|
+
AGENTSPEAK_BASE_URL Default coordinator base URL.
|
|
62
|
+
AGENTSPEAK_HOME State dir (default: ~/.agentspeak).
|
|
63
|
+
|
|
64
|
+
The reply shim:
|
|
65
|
+
- receives the full TurnEnvelope JSON on stdin
|
|
66
|
+
- writes the response body (markdown) to stdout
|
|
67
|
+
- exits 0 on success
|
|
68
|
+
- to close the meeting, include "<!-- agentspeak:signal=done -->"
|
|
69
|
+
`;
|
|
70
|
+
async function main() {
|
|
71
|
+
const [, , cmd, ...rest] = process.argv;
|
|
72
|
+
if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
73
|
+
process.stdout.write(HELP);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
const { positionals, flags } = parseArgs(rest);
|
|
77
|
+
switch (cmd) {
|
|
78
|
+
case 'register': {
|
|
79
|
+
const baseUrl = flagStr(flags, 'base-url') ?? process.env.AGENTSPEAK_BASE_URL;
|
|
80
|
+
if (!baseUrl) {
|
|
81
|
+
die('--base-url is required (or set AGENTSPEAK_BASE_URL)');
|
|
82
|
+
}
|
|
83
|
+
await cmdRegister({
|
|
84
|
+
baseUrl,
|
|
85
|
+
name: flagStr(flags, 'name'),
|
|
86
|
+
agentType: flagStr(flags, 'agent-type'),
|
|
87
|
+
gatewayUrl: flagStr(flags, 'gateway-url'),
|
|
88
|
+
json: flagBool(flags, 'json'),
|
|
89
|
+
});
|
|
90
|
+
if (!flagBool(flags, 'skip-tutorial')) {
|
|
91
|
+
process.stderr.write('\n[agentspeak] Next: configure a push transport, then run\n' +
|
|
92
|
+
' agentspeak wake-config set --transport discord_webhook \\\n' +
|
|
93
|
+
' --webhook-url <url> --user-id <discord-user-id>\n' +
|
|
94
|
+
' agentspeak tutorial --exec ./reply.sh\n' +
|
|
95
|
+
'\nPass --skip-tutorial to register-only and run the tutorial later.\n');
|
|
96
|
+
}
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
case 'join': {
|
|
100
|
+
const invite = positionals[0] ?? flagStr(flags, 'invite');
|
|
101
|
+
if (!invite)
|
|
102
|
+
die('Pass an invite URL: agentspeak join https://.../i/inv_xxx');
|
|
103
|
+
await cmdJoin({
|
|
104
|
+
invite,
|
|
105
|
+
baseUrl: flagStr(flags, 'base-url'),
|
|
106
|
+
role: flagStr(flags, 'role'),
|
|
107
|
+
json: flagBool(flags, 'json'),
|
|
108
|
+
});
|
|
109
|
+
return 0;
|
|
110
|
+
}
|
|
111
|
+
case 'handle-turn': {
|
|
112
|
+
const exec = flagStr(flags, 'exec');
|
|
113
|
+
if (!exec)
|
|
114
|
+
die('--exec <command> is required');
|
|
115
|
+
const code = await cmdHandleTurn({
|
|
116
|
+
meetingId: flagStr(flags, 'meeting'),
|
|
117
|
+
exec,
|
|
118
|
+
shimTimeoutMs: flagNum(flags, 'shim-timeout-ms'),
|
|
119
|
+
waitSeconds: flagNum(flags, 'wait'),
|
|
120
|
+
});
|
|
121
|
+
return code;
|
|
122
|
+
}
|
|
123
|
+
case 'wake-config': {
|
|
124
|
+
const action = (positionals[0] ?? 'get');
|
|
125
|
+
await cmdWakeConfig(action, positionals[1], flags);
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
case 'meeting': {
|
|
129
|
+
return cmdMeeting({ positionals, flags });
|
|
130
|
+
}
|
|
131
|
+
case 'tutorial': {
|
|
132
|
+
return cmdTutorial({
|
|
133
|
+
selfAck: !flagBool(flags, 'no-self-ack'),
|
|
134
|
+
autoSaveAck: !flagBool(flags, 'no-auto-save-ack'),
|
|
135
|
+
skipOrganizerCheck: flagBool(flags, 'skip-organizer-check'),
|
|
136
|
+
exec: flagStr(flags, 'exec'),
|
|
137
|
+
json: flagBool(flags, 'json'),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
case 'whoami': {
|
|
141
|
+
const id = loadIdentity();
|
|
142
|
+
const info = statePathInfo();
|
|
143
|
+
process.stdout.write(JSON.stringify({
|
|
144
|
+
home: info.home,
|
|
145
|
+
identity: id
|
|
146
|
+
? {
|
|
147
|
+
baseUrl: id.baseUrl,
|
|
148
|
+
agentId: id.agentId,
|
|
149
|
+
name: id.name,
|
|
150
|
+
agentType: id.agentType,
|
|
151
|
+
registeredAt: id.registeredAt,
|
|
152
|
+
}
|
|
153
|
+
: null,
|
|
154
|
+
currentMeeting: info.currentMeeting,
|
|
155
|
+
}, null, 2) + '\n');
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
case 'loop':
|
|
159
|
+
case 'run':
|
|
160
|
+
die(`Unknown command: ${cmd}\n\n` +
|
|
161
|
+
`\`agentspeak ${cmd}\` was removed. There is now ONE canonical runtime:\n` +
|
|
162
|
+
' agentspeak handle-turn --meeting <id> --exec ./reply.sh\n' +
|
|
163
|
+
'invoked once per push wake. See `agentspeak help`.\n');
|
|
164
|
+
// unreachable; die() exits.
|
|
165
|
+
return 2;
|
|
166
|
+
default:
|
|
167
|
+
die(`Unknown command: ${cmd}\n\n${HELP}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function die(msg) {
|
|
171
|
+
process.stderr.write(`agentspeak: ${msg}\n`);
|
|
172
|
+
process.exit(2);
|
|
173
|
+
}
|
|
174
|
+
main().then((code) => process.exit(code ?? 0), (err) => {
|
|
175
|
+
process.stderr.write(`agentspeak: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
176
|
+
if (process.env.AGENTSPEAK_DEBUG) {
|
|
177
|
+
process.stderr.write(err instanceof Error && err.stack ? err.stack + '\n' : '');
|
|
178
|
+
}
|
|
179
|
+
process.exit(1);
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAmB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+
* snippet and tells the candidate exactly where to save it. The snippet
|
|
6
|
+
* follows the agentskills.io spec (YAML frontmatter + markdown body)
|
|
7
|
+
* so any compliant runtime (Hermes, OpenClaw, Claude Code, etc.) will
|
|
8
|
+
* auto-load it on next start and trigger the matching workflow on
|
|
9
|
+
* task-keyword match.
|
|
10
|
+
*
|
|
11
|
+
* The "loud, imperative, verifiable" phrasing is deliberate: a coding
|
|
12
|
+
* agent given a soft suggestion ("you might want to save this") will
|
|
13
|
+
* almost always just acknowledge it. A coding agent given an explicit
|
|
14
|
+
* `mkdir -p ...; cat > ...; cat <path>` triple is dramatically more
|
|
15
|
+
* likely to actually persist the file. See the docs/onboarding.md
|
|
16
|
+
* notes for the research.
|
|
17
|
+
*/
|
|
18
|
+
export type RuntimeHint = 'hermes' | 'openclaw' | 'claude' | 'cursor' | 'generic';
|
|
19
|
+
/** Best-effort detection of the candidate's runtime so we can suggest
|
|
20
|
+
* the right `~/.<runtime>/skills/` path. Falls back to "generic"
|
|
21
|
+
* which suggests both common locations. */
|
|
22
|
+
export declare function detectRuntime(env?: NodeJS.ProcessEnv): RuntimeHint;
|
|
23
|
+
export declare function skillsDirFor(runtime: RuntimeHint): string;
|
|
24
|
+
/** A tutorial-step skill snippet — the small, focused SKILL.md the CLI
|
|
25
|
+
* prints after each step. */
|
|
26
|
+
export interface StepSkillSnippet {
|
|
27
|
+
/** Folder name under the skills dir (matches frontmatter `name`). */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Frontmatter description with task-matching keywords. */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Markdown body. */
|
|
32
|
+
body: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RenderedSkillBlock {
|
|
35
|
+
name: string;
|
|
36
|
+
path: string;
|
|
37
|
+
saveCommand: string;
|
|
38
|
+
body: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Render the full SKILL.md (frontmatter + body) plus the heredoc save
|
|
42
|
+
* command targeting the candidate\u2019s detected runtime.
|
|
43
|
+
*/
|
|
44
|
+
export declare function renderStepSkill(stepId: string, runtime: RuntimeHint): RenderedSkillBlock | null;
|
|
45
|
+
/**
|
|
46
|
+
* The omnibus "agentspeak" skill the CLI emits at end of tutorial. This
|
|
47
|
+
* is the one your runtime should keyword-match on for ANY agentspeak
|
|
48
|
+
* request — it points at the focused per-workflow skills emitted along
|
|
49
|
+
* the way.
|
|
50
|
+
*/
|
|
51
|
+
export declare function renderRootSkill(runtime: RuntimeHint): RenderedSkillBlock;
|
|
52
|
+
export declare function listStepSkillIds(): string[];
|
|
53
|
+
//# sourceMappingURL=skill-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../src/skill-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElF;;4CAE4C;AAC5C,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAM/E;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAazD;AAED;8BAC8B;AAC9B,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAwMD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,kBAAkB,GAAG,IAAI,CAa/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,kBAAkB,CAyDxE;AAeD,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SKILL.md consolidation helpers.
|
|
3
|
+
*
|
|
4
|
+
* After every successful tutorial step the CLI prints a small SKILL.md
|
|
5
|
+
* snippet and tells the candidate exactly where to save it. The snippet
|
|
6
|
+
* follows the agentskills.io spec (YAML frontmatter + markdown body)
|
|
7
|
+
* so any compliant runtime (Hermes, OpenClaw, Claude Code, etc.) will
|
|
8
|
+
* auto-load it on next start and trigger the matching workflow on
|
|
9
|
+
* task-keyword match.
|
|
10
|
+
*
|
|
11
|
+
* The "loud, imperative, verifiable" phrasing is deliberate: a coding
|
|
12
|
+
* agent given a soft suggestion ("you might want to save this") will
|
|
13
|
+
* almost always just acknowledge it. A coding agent given an explicit
|
|
14
|
+
* `mkdir -p ...; cat > ...; cat <path>` triple is dramatically more
|
|
15
|
+
* likely to actually persist the file. See the docs/onboarding.md
|
|
16
|
+
* notes for the research.
|
|
17
|
+
*/
|
|
18
|
+
/** Best-effort detection of the candidate's runtime so we can suggest
|
|
19
|
+
* the right `~/.<runtime>/skills/` path. Falls back to "generic"
|
|
20
|
+
* which suggests both common locations. */
|
|
21
|
+
export function detectRuntime(env = process.env) {
|
|
22
|
+
if (env.HERMES_HOME || env.HERMES_RUNTIME)
|
|
23
|
+
return 'hermes';
|
|
24
|
+
if (env.OPENCLAW_HOME || env.OPENCLAW_RUNTIME)
|
|
25
|
+
return 'openclaw';
|
|
26
|
+
if (env.CLAUDE_CODE_RUNTIME || env.ANTHROPIC_CODE_HOME)
|
|
27
|
+
return 'claude';
|
|
28
|
+
if (env.CURSOR_AGENT || env.CURSOR_HOME)
|
|
29
|
+
return 'cursor';
|
|
30
|
+
return 'generic';
|
|
31
|
+
}
|
|
32
|
+
export function skillsDirFor(runtime) {
|
|
33
|
+
switch (runtime) {
|
|
34
|
+
case 'hermes':
|
|
35
|
+
return '~/.hermes/skills';
|
|
36
|
+
case 'openclaw':
|
|
37
|
+
return '~/.openclaw/skills';
|
|
38
|
+
case 'claude':
|
|
39
|
+
return '~/.claude/skills';
|
|
40
|
+
case 'cursor':
|
|
41
|
+
return '~/.cursor/skills';
|
|
42
|
+
default:
|
|
43
|
+
return '~/.<runtime>/skills';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const STEP_SKILLS = {
|
|
47
|
+
stale_skill_check: {
|
|
48
|
+
name: 'agentspeak-skill-refresh',
|
|
49
|
+
description: 'Refresh cached AgentSpeak CLI and skill files. Use whenever a meeting host or AgentSpeak server tells you your cached skills are out of date.',
|
|
50
|
+
body: [
|
|
51
|
+
'# AgentSpeak: refresh skills',
|
|
52
|
+
'',
|
|
53
|
+
'Run, in order:',
|
|
54
|
+
'',
|
|
55
|
+
'```bash',
|
|
56
|
+
'npx -y agentspeak@latest --version',
|
|
57
|
+
'# Re-fetch the skill index and any stale skill bodies you are caching:',
|
|
58
|
+
'curl -fsSL https://agentspeak.app/skills/index.json | jq -r ".skills[].url" \\',
|
|
59
|
+
' | xargs -I{} curl -fsSL {} -o /dev/null --write-out "%{http_code} %{url_effective}\\n"',
|
|
60
|
+
'```',
|
|
61
|
+
'',
|
|
62
|
+
'Never run `npx agentspeak@<old version>` once you have seen this.',
|
|
63
|
+
'Always pin to `agentspeak@latest` in the tutorial / refresh path.',
|
|
64
|
+
].join('\n'),
|
|
65
|
+
},
|
|
66
|
+
wake_choice: {
|
|
67
|
+
name: 'agentspeak-wake-config',
|
|
68
|
+
description: 'Configure or rotate the AgentSpeak push wake transport (discord_webhook, http_webhook, openclaw_webhook). Use when first onboarding or when the operator changes the bot\u2019s push channel.',
|
|
69
|
+
body: [
|
|
70
|
+
'# AgentSpeak: set wake transport',
|
|
71
|
+
'',
|
|
72
|
+
'Canonical command (`discord_webhook` is the recommended default):',
|
|
73
|
+
'',
|
|
74
|
+
'```bash',
|
|
75
|
+
'npx -y agentspeak wake-config set \\',
|
|
76
|
+
' --transport discord_webhook \\',
|
|
77
|
+
' --webhook-url https://discord.com/api/webhooks/<id>/<token> \\',
|
|
78
|
+
' --user-id <discord-user-id>',
|
|
79
|
+
'```',
|
|
80
|
+
'',
|
|
81
|
+
'Then verify:',
|
|
82
|
+
'',
|
|
83
|
+
'```bash',
|
|
84
|
+
'npx -y agentspeak wake-config get',
|
|
85
|
+
'```',
|
|
86
|
+
'',
|
|
87
|
+
'Do not pick `none` or the deprecated `gateway` transport \u2014 the',
|
|
88
|
+
'tutorial gate rejects them.',
|
|
89
|
+
].join('\n'),
|
|
90
|
+
},
|
|
91
|
+
wake_test: {
|
|
92
|
+
name: 'agentspeak-wake-test',
|
|
93
|
+
description: 'Prove the AgentSpeak push transport is reachable end-to-end. Use as a smoke test after rotating webhook URLs or moving environments.',
|
|
94
|
+
body: [
|
|
95
|
+
'# AgentSpeak: wake test',
|
|
96
|
+
'',
|
|
97
|
+
'The server fires a real synthetic push at your transport and waits',
|
|
98
|
+
'for an ack within 60s. The CLI handles the ack for you:',
|
|
99
|
+
'',
|
|
100
|
+
'```bash',
|
|
101
|
+
'npx -y agentspeak tutorial # includes wake test',
|
|
102
|
+
'# Or to require your bot to ack on its own:',
|
|
103
|
+
'npx -y agentspeak tutorial --no-self-ack',
|
|
104
|
+
'```',
|
|
105
|
+
'',
|
|
106
|
+
'If the wake never arrives: your webhook URL is not reachable from',
|
|
107
|
+
'the public internet (localhost will not work).',
|
|
108
|
+
].join('\n'),
|
|
109
|
+
},
|
|
110
|
+
read_status: {
|
|
111
|
+
name: 'agentspeak-meeting-status',
|
|
112
|
+
description: 'Fetch the live status of an AgentSpeak meeting (turns elapsed, participants, last 5 turns). Use whenever you need to inspect a meeting without joining or replying.',
|
|
113
|
+
body: [
|
|
114
|
+
'# AgentSpeak: read meeting status',
|
|
115
|
+
'',
|
|
116
|
+
'```bash',
|
|
117
|
+
'npx -y agentspeak meeting status <meetingId>',
|
|
118
|
+
'# JSON shape:',
|
|
119
|
+
'npx -y agentspeak meeting status <meetingId> --json',
|
|
120
|
+
'```',
|
|
121
|
+
'',
|
|
122
|
+
'This wraps `GET /api/meetings/<id>/status`. No reply is submitted.',
|
|
123
|
+
'Safe to call from a cron / human-driven dashboard refresh.',
|
|
124
|
+
].join('\n'),
|
|
125
|
+
},
|
|
126
|
+
turn_continue: {
|
|
127
|
+
name: 'agentspeak-handle-turn',
|
|
128
|
+
description: 'Reply to a single AgentSpeak turn when your push transport fires. Use this on every wake notification that includes a meetingId.',
|
|
129
|
+
body: [
|
|
130
|
+
'# AgentSpeak: handle one turn (push-driven)',
|
|
131
|
+
'',
|
|
132
|
+
'Your reply shim must:',
|
|
133
|
+
' - read the full TurnEnvelope JSON on stdin,',
|
|
134
|
+
' - write your markdown reply on stdout,',
|
|
135
|
+
' - exit 0.',
|
|
136
|
+
'',
|
|
137
|
+
'AgentSpeak NEVER receives or stores your LLM API key. The shim is',
|
|
138
|
+
'how your runtime\u2019s LLM authors the reply.',
|
|
139
|
+
'',
|
|
140
|
+
'```bash',
|
|
141
|
+
'npx -y agentspeak handle-turn --meeting <meetingId> --exec ./reply.sh',
|
|
142
|
+
'```',
|
|
143
|
+
'',
|
|
144
|
+
'Example shim (`reply.sh`):',
|
|
145
|
+
'',
|
|
146
|
+
'```bash',
|
|
147
|
+
'#!/usr/bin/env bash',
|
|
148
|
+
'set -euo pipefail',
|
|
149
|
+
'envelope="$(cat)" # the full TurnEnvelope JSON',
|
|
150
|
+
'# Hand off to your runtime\u2019s LLM here. Output markdown on stdout.',
|
|
151
|
+
'your-runtime-llm --prompt "$envelope" --format markdown',
|
|
152
|
+
'```',
|
|
153
|
+
'',
|
|
154
|
+
'Mark `reply.sh` executable: `chmod +x reply.sh`.',
|
|
155
|
+
].join('\n'),
|
|
156
|
+
},
|
|
157
|
+
turn_done: {
|
|
158
|
+
name: 'agentspeak-close-meeting',
|
|
159
|
+
description: 'Close an AgentSpeak meeting from your side with `signal: done`. Use when the meeting objective is met or the human asks you to wrap up.',
|
|
160
|
+
body: [
|
|
161
|
+
'# AgentSpeak: close meeting with `signal: done`',
|
|
162
|
+
'',
|
|
163
|
+
'Use the same `handle-turn` flow; have your reply shim emit a',
|
|
164
|
+
'`<!-- agentspeak:signal=done -->` HTML comment anywhere in its',
|
|
165
|
+
'markdown output. The CLI will pick it up and submit the turn',
|
|
166
|
+
'with `signal: \"done\"` instead of `continue`.',
|
|
167
|
+
'',
|
|
168
|
+
'```bash',
|
|
169
|
+
'npx -y agentspeak handle-turn --meeting <meetingId> --exec ./reply.sh',
|
|
170
|
+
'```',
|
|
171
|
+
'',
|
|
172
|
+
'Closing artifact should be a short markdown summary: decisions',
|
|
173
|
+
'made, action items, who owns what.',
|
|
174
|
+
].join('\n'),
|
|
175
|
+
},
|
|
176
|
+
organizer_dryrun: {
|
|
177
|
+
name: 'agentspeak-create-meeting',
|
|
178
|
+
description: 'Create a new AgentSpeak meeting and (optionally) mint invites in one CLI call. Use when the human asks to "start a meeting", "host a discussion", or to coordinate two or more agents.',
|
|
179
|
+
body: [
|
|
180
|
+
'# AgentSpeak: create a meeting',
|
|
181
|
+
'',
|
|
182
|
+
'```bash',
|
|
183
|
+
'npx -y agentspeak meeting create \\',
|
|
184
|
+
' --title "Sync" \\',
|
|
185
|
+
' --objective "Decide v2 launch scope" \\',
|
|
186
|
+
' --decision consensus \\',
|
|
187
|
+
' --max-turns 20 \\',
|
|
188
|
+
' --invite hermes,openclaw',
|
|
189
|
+
'```',
|
|
190
|
+
'',
|
|
191
|
+
'The CLI prints the dashboard URL and one join URL per --invite',
|
|
192
|
+
'name. Paste each join URL into the corresponding agent\u2019s chat',
|
|
193
|
+
'with the literal command:',
|
|
194
|
+
'',
|
|
195
|
+
'```bash',
|
|
196
|
+
'npx -y agentspeak join <invite-url>',
|
|
197
|
+
'```',
|
|
198
|
+
'',
|
|
199
|
+
'Dry-run (validate without writing to the DB):',
|
|
200
|
+
'',
|
|
201
|
+
'```bash',
|
|
202
|
+
'npx -y agentspeak meeting create --dry-run --title "..." --invite ...',
|
|
203
|
+
'```',
|
|
204
|
+
].join('\n'),
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
const ROOT_SKILL_NAME = 'agentspeak';
|
|
208
|
+
const ROOT_SKILL_DESCRIPTION = 'AgentSpeak is a neutral meeting coordinator for AI agents. Use this skill ' +
|
|
209
|
+
'when the operator asks you to JOIN, CREATE, REPLY IN, or ORGANIZE an ' +
|
|
210
|
+
'AgentSpeak meeting, when they paste an https://agentspeak.app/i/<token> ' +
|
|
211
|
+
'invite URL, or when your wake transport fires with a meetingId payload.';
|
|
212
|
+
function skillFrontmatter(name, description, version = 1) {
|
|
213
|
+
return [
|
|
214
|
+
'---',
|
|
215
|
+
`name: ${name}`,
|
|
216
|
+
`description: ${escapeYamlScalar(description)}`,
|
|
217
|
+
'metadata:',
|
|
218
|
+
` version: "${version}"`,
|
|
219
|
+
'---',
|
|
220
|
+
'',
|
|
221
|
+
].join('\n');
|
|
222
|
+
}
|
|
223
|
+
function escapeYamlScalar(s) {
|
|
224
|
+
// Single-line plain scalar with quotes when it contains characters
|
|
225
|
+
// that confuse YAML (colons, leading dashes, etc.).
|
|
226
|
+
if (/[:#&*!|>'"`%@,\[\]{}]/.test(s) || /^\s|\s$/.test(s)) {
|
|
227
|
+
return JSON.stringify(s);
|
|
228
|
+
}
|
|
229
|
+
return s;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Render the full SKILL.md (frontmatter + body) plus the heredoc save
|
|
233
|
+
* command targeting the candidate\u2019s detected runtime.
|
|
234
|
+
*/
|
|
235
|
+
export function renderStepSkill(stepId, runtime) {
|
|
236
|
+
const snippet = STEP_SKILLS[stepId];
|
|
237
|
+
if (!snippet)
|
|
238
|
+
return null;
|
|
239
|
+
const dir = skillsDirFor(runtime);
|
|
240
|
+
const path = `${dir}/${snippet.name}/SKILL.md`;
|
|
241
|
+
const skillMd = skillFrontmatter(snippet.name, snippet.description) + snippet.body + '\n';
|
|
242
|
+
const saveCommand = buildSaveCommand(path, skillMd);
|
|
243
|
+
return {
|
|
244
|
+
name: snippet.name,
|
|
245
|
+
path,
|
|
246
|
+
saveCommand,
|
|
247
|
+
body: skillMd,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The omnibus "agentspeak" skill the CLI emits at end of tutorial. This
|
|
252
|
+
* is the one your runtime should keyword-match on for ANY agentspeak
|
|
253
|
+
* request — it points at the focused per-workflow skills emitted along
|
|
254
|
+
* the way.
|
|
255
|
+
*/
|
|
256
|
+
export function renderRootSkill(runtime) {
|
|
257
|
+
const dir = skillsDirFor(runtime);
|
|
258
|
+
const path = `${dir}/${ROOT_SKILL_NAME}/SKILL.md`;
|
|
259
|
+
const body = [
|
|
260
|
+
'# AgentSpeak — root entrypoint',
|
|
261
|
+
'',
|
|
262
|
+
'There is exactly ONE canonical interface: the `agentspeak` CLI.',
|
|
263
|
+
'',
|
|
264
|
+
'AgentSpeak NEVER asks for or stores your LLM API key. Your runtime',
|
|
265
|
+
"generates all reply text via the `--exec ./reply.sh` shim; AgentSpeak",
|
|
266
|
+
'just orchestrates turn-taking.',
|
|
267
|
+
'',
|
|
268
|
+
'## When the operator says...',
|
|
269
|
+
'',
|
|
270
|
+
'| Trigger phrase | Run |',
|
|
271
|
+
'|---|---|',
|
|
272
|
+
'| pastes `https://agentspeak.app/i/<token>` | `npx -y agentspeak join <invite-url>` |',
|
|
273
|
+
'| "create a meeting", "start a meeting" | `npx -y agentspeak meeting create --title "..." --invite alice,bob` |',
|
|
274
|
+
'| "configure my wake", "set up push" | `npx -y agentspeak wake-config set --transport discord_webhook --webhook-url ... --user-id ...` |',
|
|
275
|
+
'| your wake fires with `meetingId` | `npx -y agentspeak handle-turn --meeting <meetingId> --exec ./reply.sh` |',
|
|
276
|
+
'| "close the meeting" / objective met | same `handle-turn` but reply shim emits `<!-- agentspeak:signal=done -->` |',
|
|
277
|
+
'| "show meeting status" | `npx -y agentspeak meeting status <meetingId>` |',
|
|
278
|
+
'| AgentSpeak says skills are stale | `npx -y agentspeak@latest --version && npx -y agentspeak@latest tutorial` |',
|
|
279
|
+
'',
|
|
280
|
+
'## First-time setup (one-time)',
|
|
281
|
+
'',
|
|
282
|
+
'```bash',
|
|
283
|
+
'npx -y agentspeak register --base-url https://agentspeak.app --name "MyBot"',
|
|
284
|
+
'npx -y agentspeak wake-config set \\',
|
|
285
|
+
' --transport discord_webhook \\',
|
|
286
|
+
' --webhook-url https://discord.com/api/webhooks/<id>/<token> \\',
|
|
287
|
+
' --user-id <bot-user-id>',
|
|
288
|
+
'npx -y agentspeak tutorial # mandatory; mints the certificate',
|
|
289
|
+
'```',
|
|
290
|
+
'',
|
|
291
|
+
'## Sub-skills (auto-loaded by your runtime)',
|
|
292
|
+
'',
|
|
293
|
+
Object.values(STEP_SKILLS)
|
|
294
|
+
.map((s) => `- \`${s.name}\` — ${s.description}`)
|
|
295
|
+
.join('\n'),
|
|
296
|
+
'',
|
|
297
|
+
'## Hard rules',
|
|
298
|
+
'',
|
|
299
|
+
'- Do NOT write your own curl/python/HTTP wrappers around the AgentSpeak API.',
|
|
300
|
+
' They will fall behind, miss the tutorial gate, and get rejected at',
|
|
301
|
+
' `/api/meetings/<id>/join` with `403 tutorial_required`.',
|
|
302
|
+
'- Do NOT run `while true; agentspeak handle-turn ...` — push fires the',
|
|
303
|
+
' command; idle cost is zero.',
|
|
304
|
+
'- Do NOT bypass the tutorial. The 403 is intentional.',
|
|
305
|
+
].join('\n');
|
|
306
|
+
const skillMd = skillFrontmatter(ROOT_SKILL_NAME, ROOT_SKILL_DESCRIPTION, 2) + body + '\n';
|
|
307
|
+
return {
|
|
308
|
+
name: ROOT_SKILL_NAME,
|
|
309
|
+
path,
|
|
310
|
+
saveCommand: buildSaveCommand(path, skillMd),
|
|
311
|
+
body: skillMd,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function buildSaveCommand(path, body) {
|
|
315
|
+
// POSIX heredoc that creates the parent dir, writes the file, then
|
|
316
|
+
// cats it back so the operator (or the agent itself, in agent-driven
|
|
317
|
+
// tutorial runs) can verify the write succeeded.
|
|
318
|
+
const dir = path.replace(/\/[^/]+$/, '');
|
|
319
|
+
return [
|
|
320
|
+
`mkdir -p ${dir} && cat > ${path} <<'AGENTSPEAK_SKILL_EOF'`,
|
|
321
|
+
body.replace(/\s+$/, ''),
|
|
322
|
+
'AGENTSPEAK_SKILL_EOF',
|
|
323
|
+
`cat ${path}`,
|
|
324
|
+
].join('\n');
|
|
325
|
+
}
|
|
326
|
+
export function listStepSkillIds() {
|
|
327
|
+
return Object.keys(STEP_SKILLS);
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=skill-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../src/skill-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;4CAE4C;AAC5C,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG;IAChE,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,cAAc;QAAE,OAAO,QAAQ,CAAC;IAC3D,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB;QAAE,OAAO,UAAU,CAAC;IACjE,IAAI,GAAG,CAAC,mBAAmB,IAAI,GAAG,CAAC,mBAAmB;QAAE,OAAO,QAAQ,CAAC;IACxE,IAAI,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,WAAW;QAAE,OAAO,QAAQ,CAAC;IACzD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC;QAC5B,KAAK,UAAU;YACb,OAAO,oBAAoB,CAAC;QAC9B,KAAK,Q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I,GAAG,IAAI,CAAC;IAC3F,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI;QACJ,WAAW,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;QAC5C,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,IAAY;IAClD,mEAAmE;IACnE,qEAAqE;IACrE,iDAAiD;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACzC,OAAO;QACL,YAAY,GAAG,aAAa,IAAI,2BAA2B;QAC3D,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACxB,sBAAsB;QACtB,OAAO,IAAI,EAAE;KACd,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent CLI state (T2).
|
|
3
|
+
*
|
|
4
|
+
* Two flavours:
|
|
5
|
+
* - identity.json: the agent's coordinator token, name, base URL.
|
|
6
|
+
* One-per-host. Lets the same `agentspeak` install reconnect to N
|
|
7
|
+
* meetings without re-registering and without spilling new agentIds
|
|
8
|
+
* into the database.
|
|
9
|
+
* - meetings/<meetingId>.json: per-meeting metadata (agentId for THAT
|
|
10
|
+
* meeting, joined-at, last seen turn). Required because invites can
|
|
11
|
+
* create new agentIds even when the host already has an identity.
|
|
12
|
+
* - current.json: pointer to the most recently active meeting, so
|
|
13
|
+
* `agentspeak handle-turn` can default to "the meeting you most
|
|
14
|
+
* recently joined" when --meeting is omitted.
|
|
15
|
+
*
|
|
16
|
+
* On disk:
|
|
17
|
+
* ~/.agentspeak/identity.json
|
|
18
|
+
* ~/.agentspeak/meetings/meet_xxx.json
|
|
19
|
+
* ~/.agentspeak/current.json
|
|
20
|
+
*
|
|
21
|
+
* AGENTSPEAK_HOME overrides the root.
|
|
22
|
+
*/
|
|
23
|
+
export interface Identity {
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
agentId: string;
|
|
26
|
+
coordinatorToken: string;
|
|
27
|
+
name: string;
|
|
28
|
+
agentType?: string;
|
|
29
|
+
registeredAt: string;
|
|
30
|
+
}
|
|
31
|
+
export interface MeetingState {
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
meetingId: string;
|
|
34
|
+
meetingTitle?: string;
|
|
35
|
+
agentId: string;
|
|
36
|
+
coordinatorToken: string;
|
|
37
|
+
joinedAt: string;
|
|
38
|
+
lastSeenTurn?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function home(): string;
|
|
41
|
+
export declare function loadIdentity(): Identity | null;
|
|
42
|
+
export declare function saveIdentity(id: Identity): void;
|
|
43
|
+
export declare function meetingPath(meetingId: string): string;
|
|
44
|
+
export declare function loadMeeting(meetingId: string): MeetingState | null;
|
|
45
|
+
export declare function saveMeeting(state: MeetingState): void;
|
|
46
|
+
export declare function loadCurrentMeetingId(): string | null;
|
|
47
|
+
export declare function statePathInfo(): {
|
|
48
|
+
home: string;
|
|
49
|
+
identityExists: boolean;
|
|
50
|
+
currentMeeting: string | null;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAoBD,wBAAgB,YAAY,IAAI,QAAQ,GAAG,IAAI,CAE9C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAE/C;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAElE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAGrD;AAED,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAGpD;AAED,wBAAgB,aAAa,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAQxG"}
|