@flamecast/cli 0.1.0 → 0.2.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 CHANGED
@@ -53,10 +53,30 @@ Flags on `sessions create`:
53
53
  | Flag | Default | Notes |
54
54
  |---|---|---|
55
55
  | `--input <text>` | _(required)_ | First message to the agent. |
56
- | `--model <id>` | `anthropic/claude-haiku-4-5` | Free tier supports this model only; BYOK keys can use any Think-supported model. |
56
+ | `--config <file>` | _none_ | Path to a local JSON AgentConfig (runtime + mcp[] + instructions). Use this to attach MCPs. Conflicts with `--agent-id`. |
57
+ | `--model <id>` | `anthropic/claude-haiku-4-5` | Free tier supports this model only; BYOK keys can use any Think-supported model. Ignored when `--config` is set. |
57
58
  | `--agent-id <id>` | _none_ | Launch a saved agent instead of an inline runtime. |
58
59
  | `--async` | off | Return immediately; poll `sessions get` / `sessions events` for progress. |
59
60
 
61
+ Example `agent.json`:
62
+
63
+ ```json
64
+ {
65
+ "runtime": {
66
+ "id": "think",
67
+ "config": { "model": "anthropic/claude-haiku-4-5", "toolMode": "mcp" }
68
+ },
69
+ "mcp": [
70
+ { "name": "gmail", "server": { "url": "https://..." } },
71
+ { "name": "github", "server": { "url": "https://..." } }
72
+ ]
73
+ }
74
+ ```
75
+
76
+ ```bash
77
+ flamecast sessions create --config agent.json --input "Triage incoming support tickets."
78
+ ```
79
+
60
80
  ## Configuration
61
81
 
62
82
  Credentials live at `~/.config/flamecast/config.json` (respects `$XDG_CONFIG_HOME`). Delete the file or run `flamecast logout` to clear.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flamecast/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Command-line client for Flamecast. Drives the device-auth flow and wraps the public REST API.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/sessions.ts CHANGED
@@ -98,19 +98,49 @@ async function create(flags: Record<string, string | boolean>): Promise<number>
98
98
  const input = typeof flags.input === "string" ? flags.input : undefined
99
99
  if (!input) {
100
100
  process.stderr.write(
101
- "usage: flamecast sessions create --input <text> [--model <id>] [--agent-id <id>] [--async]\n",
101
+ "usage: flamecast sessions create --input <text> [--config <file>] [--model <id>] [--agent-id <id>] [--async]\n",
102
102
  )
103
103
  return 2
104
104
  }
105
+ const configPath = typeof flags.config === "string" ? flags.config : undefined
105
106
  const model = typeof flags.model === "string" ? flags.model : "anthropic/claude-haiku-4-5"
106
107
  const agentId = typeof flags["agent-id"] === "string" ? flags["agent-id"] : undefined
107
108
  const asyncFlag = flags.async === true || flags.async === "true"
108
109
  const gatewayKey = process.env.AI_GATEWAY_API_KEY
109
110
  const config = await authed()
110
111
 
112
+ if (configPath && agentId) {
113
+ process.stderr.write("--config and --agent-id are mutually exclusive\n")
114
+ return 2
115
+ }
116
+
111
117
  const body: Record<string, unknown> = { input, async: asyncFlag }
112
118
  if (agentId) {
113
119
  body.agentId = agentId
120
+ } else if (configPath) {
121
+ // Load an AgentConfig from a local JSON file. Use this to attach MCPs
122
+ // or otherwise customize the runtime beyond the --model shorthand.
123
+ let parsed: unknown
124
+ try {
125
+ const raw = await Bun.file(configPath).text()
126
+ parsed = JSON.parse(raw)
127
+ } catch (err) {
128
+ const msg = err instanceof Error ? err.message : String(err)
129
+ process.stderr.write(`read --config ${configPath}: ${msg}\n`)
130
+ return 1
131
+ }
132
+ if (!parsed || typeof parsed !== "object" || !("runtime" in parsed)) {
133
+ process.stderr.write(
134
+ `--config ${configPath}: missing top-level "runtime"\n`,
135
+ )
136
+ return 2
137
+ }
138
+ const agentSpec = parsed as Record<string, unknown>
139
+ const runtime = agentSpec.runtime as Record<string, unknown> | undefined
140
+ if (runtime && gatewayKey && !("auth" in runtime)) {
141
+ runtime.auth = { type: "api_key", key: gatewayKey }
142
+ }
143
+ body.agent = agentSpec
114
144
  } else {
115
145
  // runtime.auth is optional: the server fills it from its free-tier key
116
146
  // (subject to monthly caps) when omitted and the model is on the free
@@ -146,7 +176,8 @@ const SESSIONS_USAGE = `flamecast sessions <verb>
146
176
 
147
177
  Verbs:
148
178
  list List recent sessions
149
- create --input <text> [--model M] Launch a Think session
179
+ create --input <text> Launch a Think session
180
+ [--config FILE] [--model M]
150
181
  [--agent-id ID] [--async]
151
182
  get <sessionId> Show one session
152
183
  events <sessionId> Dump the event log