@glie/mcp-polaris 0.6.0 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +39 -5
  2. package/dist/index.js +275 -41
  3. package/package.json +15 -4
package/README.md CHANGED
@@ -47,15 +47,49 @@ it. The same token authenticates this server and the `polaris` CLI as you.
47
47
 
48
48
  ## Tools
49
49
 
50
- `polaris.me`, `polaris.project.*`, `polaris.milestone.*` (incl. `update` to
51
- refine a spec), `polaris.task.*` (incl. `update`, `transition`, `approve`),
52
- `polaris.stack.*` (`list` / `get` / `release` for the approval Release Candidate
53
- flow), `polaris.agent.*`, `polaris.claude_md.get`, `polaris.framework.list`, plus
54
- read-only context from the feed: `polaris.activity.list` (what happened) and
50
+ **Roadmap.** `polaris.me`, `polaris.project.*`, `polaris.milestone.*` (incl.
51
+ `update` to refine a spec, `attachment_*` to list/attach/remove the visual
52
+ references anchored in its body), `polaris.task.*` (incl. `update`,
53
+ `transition`, `approve`, `schedule`, `attachment_*` — same as the milestone's,
54
+ plus how a milestone reference gets forwarded here via
55
+ `source_attachment_id`), `polaris.stack.*` (`list` / `get` / `release` for the
56
+ approval Release Candidate flow), `polaris.agent.*`, `polaris.team.*`,
57
+ `polaris.claude_md.get`, `polaris.framework.list`.
58
+
59
+ **Helpdesk.** `polaris.ticket.*` (the customer conversation: `reply`, `pass`,
60
+ `frame_issue`, `link_issue`) and `polaris.issue.*` (the problem: `open`,
61
+ `transition`, `add_task`). N tickets can dedup onto one issue, and one issue
62
+ fans out into N tasks.
63
+
64
+ **Context, read-only.** `polaris.activity.list` (what happened) and
55
65
  `polaris.chat.get` / `polaris.chat.messages` (comments agents left on a scope).
56
66
 
57
67
  Run `tools/list` against the server for the full, current set.
58
68
 
69
+ ## Marketing creatives
70
+
71
+ A task inside an mkt campaign is a creative, and `polaris.task.create` takes the
72
+ four axes that describe one:
73
+
74
+ | Field | What it says | Values |
75
+ | --------- | --------------------------- | ----------------------------------------------- |
76
+ | `medium` | what the piece is | `image` / `video` / `text` |
77
+ | `surface` | where it publishes | `feed` / `stories` / `reels` / `shorts` / `article` / `newsletter` |
78
+ | `slides` | how many images it carries | 2 to 10, images only. A carousel is an image with plural |
79
+ | `aspect` | how it is framed | `1:1` / `4:5` / `9:16` / `16:9` / `2:3` |
80
+
81
+ Plus `channel` (Instagram, TikTok, LinkedIn, ...) and `scheduled_date`, the day
82
+ it publishes.
83
+
84
+ The pairs are checked at creation, not patched over at generation time: a
85
+ carousel with no `slides` is refused (it would ship a single image under a name
86
+ that promises several), `slides` on a non-image piece is refused, and an
87
+ `aspect` that the surface does not accept is refused. Omit `aspect` to take the
88
+ channel's usual one.
89
+
90
+ `format` is still written and read, as the label the board and the agents use,
91
+ but it is derived from the axes rather than defining them.
92
+
59
93
  ## License
60
94
 
61
95
  Apache-2.0
package/dist/index.js CHANGED
@@ -53,9 +53,11 @@ var INSTRUCTIONS = [
53
53
  "\u2022 polaris.claude_md.get(project_key) \u2014 read the project's conventions BEFORE you touch its tasks.",
54
54
  "",
55
55
  "STATE MACHINES \u2014 transitions are enforced; only legal moves succeed:",
56
- "\u2022 Task: draft \u2192 backlog \u2192 dev \u2192 test \u2192 approval \u2192 release \u2192 done (any \u2192 canceled)",
56
+ "\u2022 Task: draft \u2192 backlog \u2192 dev \u2192 test \u2192 approval \u2192 release \u2192 done (any \u2192 canceled;",
57
+ " canceled \u2192 draft and done \u2192 approval undo the last step)",
57
58
  " dev = an agent implements it & opens a PR \xB7 test = QA \xB7 approval = a human reviews \xB7 release = merged to dev/shipped.",
58
- "\u2022 Milestone: draft \u2192 discovery \u2192 loop \u2192 release \u2192 done (any \u2192 canceled)",
59
+ "\u2022 Milestone: draft \u2192 discovery \u2192 loop \u2192 release \u2192 done (any \u2192 canceled;",
60
+ " canceled \u2192 discovery brings back a milestone closed by mistake)",
59
61
  " discovery = answer the framework Q&A to split it into tasks \xB7 loop = build/test/approve \xB7 release = ship.",
60
62
  "\u2022 Stack (Release Candidate): 2+ approval tasks of ONE milestone on an rc branch, tested & shipped together \u2014",
61
63
  " liquid (assembling) \u2192 blocked (a member conflicts) | frozen (human-resolved) \u2192 released (any \u2192 canceled).",
@@ -80,8 +82,8 @@ var INSTRUCTIONS = [
80
82
  '\u2022 "Break a milestone into tasks" \u2192 polaris.milestone.qa_list / qa_answer (while in discovery)',
81
83
  `\u2022 "Triage support / what's waiting?" \u2192 polaris.ticket.list (status, project_key) \u2014 P1 first`,
82
84
  '\u2022 "Reply to a customer / hand off" \u2192 polaris.ticket.reply then polaris.ticket.pass(to)',
83
- '\u2022 "Turn a report into work" \u2192 polaris.ticket.frame_issue \u2192 polaris.issue.add_task \xD7N',
84
- '\u2022 "Same bug reported again" \u2192 polaris.ticket.link_issue (dedup onto the open issue)',
85
+ '\u2022 "Turn a report into work" \u2192 polaris.ticket.frame_issue \u2192 polaris.issue.add_task \xD7N (framing is HUMAN-only; the helpdesker proposes it)',
86
+ '\u2022 "Same bug reported again" \u2192 polaris.ticket.link_issue (dedup onto the open issue; HUMAN-only) \u2192 say we already have it \u2192 close the duplicate ticket',
85
87
  "",
86
88
  "Identifiers: projects by `key` (string, e.g. saasA); milestones/tasks/agents/stacks by numeric `id`. Writes need a token; reads work anonymously."
87
89
  ].join(`
@@ -128,6 +130,18 @@ var TOOLS = [
128
130
  ]),
129
131
  call: async (args) => (await apiCall("POST", "/api/projects", args)).body
130
132
  },
133
+ {
134
+ name: "polaris.project.arm",
135
+ description: "Arm a project for auto-approval (human-only): while armed, dev work that reaches `approval` CLEAN is approved on your behalf \u2014 no per-task click \u2014 and follows the normal path to release. Escalated tasks, mkt creatives, and support work still wait for a person; a merge that fails leaves the task in `approval`. Idempotent.",
136
+ inputSchema: objSchema({ key: strSchema("project key (e.g. saasA)") }, ["key"]),
137
+ call: async (args) => (await apiCall("POST", `/api/projects/${args.key}/arm`)).body
138
+ },
139
+ {
140
+ name: "polaris.project.disarm",
141
+ description: "Disarm a project (human-only). Immediate effect: the next task to reach `approval` waits for a person again. Work already parked in `approval` is untouched. Idempotent.",
142
+ inputSchema: objSchema({ key: strSchema("project key (e.g. saasA)") }, ["key"]),
143
+ call: async (args) => (await apiCall("POST", `/api/projects/${args.key}/disarm`)).body
144
+ },
131
145
  {
132
146
  name: "polaris.milestone.list",
133
147
  description: "List milestones in a project.",
@@ -142,11 +156,16 @@ var TOOLS = [
142
156
  },
143
157
  {
144
158
  name: "polaris.milestone.update",
145
- description: "Correct or refine a milestone's spec \u2014 PATCH its description_md (and optionally name), same idea as polaris.task.update. Use it to sharpen the brief for better scoping. Needs a token.",
159
+ description: "Correct or refine a milestone's spec \u2014 PATCH its description_md (and optionally name), same idea as polaris.task.update. On a mkt campaign the market can also be corrected, while it is still in draft or discovery: after that the creatives are already bound to accounts. The campaign's rhythm, budget and channels live in the description \u2014 write them there and the briefer reads them. Needs a token.",
146
160
  inputSchema: objSchema({
147
161
  id: intSchema(),
148
162
  name: strSchema(),
149
- description_md: strSchema("full markdown brief; replaces the current description")
163
+ description_md: strSchema("full markdown brief; replaces the current description"),
164
+ market: {
165
+ type: "array",
166
+ items: { type: "string", enum: ["BR", "US", "EU"] },
167
+ description: "mkt: target markets; replaces the current list"
168
+ }
150
169
  }, ["id"]),
151
170
  call: async (args) => {
152
171
  const body = {};
@@ -154,6 +173,8 @@ var TOOLS = [
154
173
  body.name = args.name;
155
174
  if (typeof args.description_md === "string")
156
175
  body.description_md = args.description_md;
176
+ if ("market" in args)
177
+ body.market = args.market;
157
178
  return (await apiCall("PATCH", `/api/milestones/${args.id}`, body)).body;
158
179
  }
159
180
  },
@@ -181,6 +202,60 @@ var TOOLS = [
181
202
  answer_md: args.answer_md
182
203
  })).body
183
204
  },
205
+ {
206
+ name: "polaris.milestone.attachment_list",
207
+ description: "List this milestone's IMAGE attachments \u2014 anchored in its description_md by a `ref:N` marker, or attached but not yet placed in the text. A link is not here: it's plain `[text](url)` markdown written straight into description_md, no row, no marker \u2014 read it off the text like any other prose. Each image carries a `marker` ready to paste into description_md, an `attachment_id` (the underlying file \u2014 pass it to attachment_create elsewhere to attach the SAME image with no re-upload), and an `alt` (a plain description of what it shows, often blank) \u2014 intent (what to do with it) always lives in the description_md text around the marker, never in `alt`.",
208
+ inputSchema: objSchema({ id: intSchema("milestone id") }, ["id"]),
209
+ call: async (args) => (await apiCall("GET", `/api/milestones/${args.id}/attachments`)).body
210
+ },
211
+ {
212
+ name: "polaris.milestone.attachment_presign",
213
+ description: "Step 1 of attaching an image to a milestone: reserve an upload key. Returns file_key + upload_url \u2014 PUT the raw image bytes to upload_url YOURSELF (curl/fetch from your shell; this call does not carry bytes), then call polaris.milestone.attachment_create with the same file_key. A link isn't an attachment at all \u2014 just write `[text](url)` straight into the milestone's description_md.",
214
+ inputSchema: objSchema({
215
+ id: intSchema("milestone id"),
216
+ mime: strSchema("image/png | image/jpeg | image/webp"),
217
+ size_bytes: intSchema()
218
+ }, ["id", "mime", "size_bytes"]),
219
+ call: async (args) => (await apiCall("POST", `/api/milestones/${args.id}/attachments/presign`, {
220
+ mime: args.mime,
221
+ size_bytes: args.size_bytes
222
+ })).body
223
+ },
224
+ {
225
+ name: "polaris.milestone.attachment_create",
226
+ description: "Attach an IMAGE to a milestone. Two shapes: a fresh upload (file_key from attachment_presign + mime + size_bytes + filename, alt optional); or attaching an EXISTING file already uploaded elsewhere (attachment_id \u2014 from another attachment's `attachment_id` field \u2014 alt optional) which is how a milestone reference gets forwarded onto a task without re-uploading its bytes. The same file can be attached to any number of milestones/tasks this way (N:N) \u2014 each attachment gets its own `alt` here, independent of what it says anywhere else it's attached. A link is NOT this call \u2014 write `[text](url)` straight into the milestone's description_md, no attachment row at all. `alt` only describes what the image shows \u2014 it is never an instruction; what to DO with it lives in the body prose around the marker this call returns, which you paste into description_md yourself (an attachment nobody placed in the text is as good as absent). Read that prose to decide: the default, when it just describes what the reference IS, is to pass it along as-is; only when it explicitly asks for something derived (a description, a summary) should you use it as input instead and write that into the task's own text.",
227
+ inputSchema: objSchema({
228
+ id: intSchema("milestone id"),
229
+ alt: strSchema("what the image shows, plainly \u2014 never an instruction"),
230
+ filename: strSchema("required for a fresh upload \u2014 the file's own name"),
231
+ file_key: strSchema("from attachment_presign"),
232
+ mime: strSchema(),
233
+ size_bytes: intSchema(),
234
+ attachment_id: intSchema("attach an EXISTING file (its attachment_id) instead of file_key/mime/size_bytes/filename \u2014 no re-upload")
235
+ }, ["id"]),
236
+ call: async (args) => {
237
+ const { id, ...body } = args;
238
+ return (await apiCall("POST", `/api/milestones/${id}/attachments`, body)).body;
239
+ }
240
+ },
241
+ {
242
+ name: "polaris.milestone.attachment_update",
243
+ description: "Edit the alt text on a milestone attachment \u2014 the only field worth changing after upload; the image itself and its filename stay what was actually uploaded. Only THIS attachment (this milestone) changes \u2014 the same file attached elsewhere keeps its own alt.",
244
+ inputSchema: objSchema({ id: intSchema("milestone id"), seq: intSchema(), alt: strSchema() }, [
245
+ "id",
246
+ "seq",
247
+ "alt"
248
+ ]),
249
+ call: async (args) => (await apiCall("PATCH", `/api/milestones/${args.id}/attachments/${args.seq}`, {
250
+ alt: args.alt
251
+ })).body
252
+ },
253
+ {
254
+ name: "polaris.milestone.attachment_delete",
255
+ description: "Remove an attachment from a milestone by its seq. Only removes it from THIS milestone \u2014 the underlying file, and any other milestone/task it's attached to, are untouched.",
256
+ inputSchema: objSchema({ id: intSchema("milestone id"), seq: intSchema() }, ["id", "seq"]),
257
+ call: async (args) => (await apiCall("DELETE", `/api/milestones/${args.id}/attachments/${args.seq}`)).body
258
+ },
184
259
  {
185
260
  name: "polaris.task.list",
186
261
  description: `Find tasks \u2014 the agent's entry point. Pass assignee_agent_id="self" (or assignee_human_id="self" for a human) to get what is YOURS; add status=dev (etc.) to see only active work. Other filters: milestone_id, product_key, team.`,
@@ -220,20 +295,79 @@ var TOOLS = [
220
295
  },
221
296
  {
222
297
  name: "polaris.task.create",
223
- description: "Create a task within a milestone. For a marketing CREATIVE (a task in an mkt campaign): channel + format + scheduled_date (the publish day / calendar slot) + platform (if this creative is individually paid).",
298
+ description: "Create a task within a milestone. For a marketing CREATIVE (a task in an mkt campaign): channel + format + scheduled_date (the publish day / calendar slot) + platform (if this creative is individually paid). A CAROUSEL (format=carrossel) also requires `slides` (2..10) \u2014 without it the call is refused, because a carousel with no declared size ships one image.",
224
299
  inputSchema: objSchema({
225
300
  milestone_id: intSchema(),
226
301
  name: strSchema(),
227
302
  description_md: strSchema(),
228
- status: strSchema("draft|backlog|dev|test|approval|release (default draft)"),
303
+ status: strSchema("draft \u2014 the only status a task can be created in; it reaches the rest by being moved, one legal step at a time (polaris.task.transition)"),
229
304
  channel: strSchema("mkt: Instagram, TikTok, LinkedIn, \u2026"),
230
- format: strSchema("mkt: post, reel, story, artigo, \u2026"),
305
+ format: strSchema("mkt: post, carrossel, reel, story, artigo, \u2026"),
306
+ slides: intSchema("mkt: REQUIRED when format is a carousel \u2014 how many images the piece has (2..10). " + "It is a contract: the generator delivers exactly this many. Omit for every other format."),
307
+ medium: strSchema("mkt: what the piece IS \u2014 image | video | text. The engine follows it (Codex, Remotion, " + "the writer). A carousel is `image` with slides > 1: only an image has more than one."),
308
+ surface: strSchema("mkt: where it publishes \u2014 feed | stories | reels | shorts | article | newsletter. It is " + "what separates a reel from a story: same medium, same 9:16, different place (and a " + "story is gone in 24h)."),
309
+ aspect: strSchema("mkt: the piece's SHAPE \u2014 1:1 | 4:5 | 9:16 | 16:9 | 2:3. The format says what the piece " + "IS (post, carrossel, reel), this says how it is framed, and they are independent: a " + "carousel can be vertical, a reel can be square. Omit to take the channel's usual one."),
310
+ output_type: strSchema("pr|post|video|email|generic \u2014 the delivery medium. Omit it: the format decides (reel/v\xEDdeo/short \u2192 video). Only pass it to override."),
231
311
  scheduled_date: strSchema("mkt: publish day (ISO date) \u2014 the calendar slot"),
232
312
  platform: strSchema("mkt: ad platform if this creative is individually paid"),
233
313
  asset_url: strSchema("mkt: URL of the produced creative asset (image/video) for the reviewer")
234
314
  }, ["milestone_id", "name"]),
235
315
  call: async (args) => (await apiCall("POST", "/api/tasks", args)).body
236
316
  },
317
+ {
318
+ name: "polaris.task.attachment_list",
319
+ description: "List this task's IMAGE attachments, including ones a milestone reference forwarded here (attached by attachment_id, no re-upload) plus anything attached directly to this task. A link is not here: it's plain `[text](url)` markdown written straight into the task's description_md, no row, no marker. Each image carries a `marker` ready to paste into description_md, an `attachment_id` (the underlying file \u2014 pass it to attachment_create elsewhere to attach the SAME image with no re-upload), and an `alt` (a plain description of what it shows, often blank) \u2014 intent (what to do with it) always lives in the description_md text around the marker, never in `alt`.",
320
+ inputSchema: objSchema({ id: intSchema("task id") }, ["id"]),
321
+ call: async (args) => (await apiCall("GET", `/api/tasks/${args.id}/attachments`)).body
322
+ },
323
+ {
324
+ name: "polaris.task.attachment_presign",
325
+ description: "Step 1 of attaching an image to a task: reserve an upload key. Returns file_key + upload_url \u2014 PUT the raw image bytes to upload_url YOURSELF (curl/fetch from your shell; this call does not carry bytes), then call polaris.task.attachment_create with the same file_key. A link isn't an attachment at all \u2014 just write `[text](url)` straight into the task's description_md.",
326
+ inputSchema: objSchema({
327
+ id: intSchema("task id"),
328
+ mime: strSchema("image/png | image/jpeg | image/webp"),
329
+ size_bytes: intSchema()
330
+ }, ["id", "mime", "size_bytes"]),
331
+ call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/attachments/presign`, {
332
+ mime: args.mime,
333
+ size_bytes: args.size_bytes
334
+ })).body
335
+ },
336
+ {
337
+ name: "polaris.task.attachment_create",
338
+ description: "Attach an IMAGE to a task. Two shapes: a fresh upload (file_key from attachment_presign + mime + size_bytes + filename, alt optional); or attaching an EXISTING file already uploaded elsewhere (attachment_id \u2014 from another attachment's `attachment_id` field \u2014 alt optional, no re-upload). This is how the BRIEF forwards a milestone's image onto a task it's planning. The same file can be attached to any number of milestones/tasks (N:N) \u2014 each attachment gets its own `alt` here, independent of what it says anywhere else it's attached. A link is NOT this call: write `[text](url)` straight into the task's description_md \u2014 for a milestone link, just copy the markdown across, there's nothing to attach. `alt` only describes what the image shows \u2014 never an instruction. Read the milestone's OWN body prose around its marker for intent (alt never carries it), and once attached here, paste the `marker` this call returns into the task's description_md yourself, with that instruction right after it \u2014 an attachment nobody placed in the text is as good as absent. Default: forward as-is; only when that prose explicitly asks for something derived (a description, a summary) should you use it as input instead and write that into this task's own description_md.",
339
+ inputSchema: objSchema({
340
+ id: intSchema("task id"),
341
+ alt: strSchema("what the image shows, plainly \u2014 never an instruction"),
342
+ filename: strSchema("required for a fresh upload \u2014 the file's own name"),
343
+ file_key: strSchema("from attachment_presign"),
344
+ mime: strSchema(),
345
+ size_bytes: intSchema(),
346
+ attachment_id: intSchema("attach an EXISTING file (its attachment_id) instead of file_key/mime/size_bytes/filename \u2014 no re-upload")
347
+ }, ["id"]),
348
+ call: async (args) => {
349
+ const { id, ...body } = args;
350
+ return (await apiCall("POST", `/api/tasks/${id}/attachments`, body)).body;
351
+ }
352
+ },
353
+ {
354
+ name: "polaris.task.attachment_update",
355
+ description: "Edit the alt text on a task attachment \u2014 the only field worth changing after upload; the image itself and its filename stay what was actually uploaded. Only THIS attachment (this task) changes \u2014 the same file attached elsewhere keeps its own alt.",
356
+ inputSchema: objSchema({ id: intSchema("task id"), seq: intSchema(), alt: strSchema() }, [
357
+ "id",
358
+ "seq",
359
+ "alt"
360
+ ]),
361
+ call: async (args) => (await apiCall("PATCH", `/api/tasks/${args.id}/attachments/${args.seq}`, {
362
+ alt: args.alt
363
+ })).body
364
+ },
365
+ {
366
+ name: "polaris.task.attachment_delete",
367
+ description: "Remove an attachment from a task by its seq. Only removes it from THIS task \u2014 the underlying file, and any other milestone/task it's attached to, are untouched.",
368
+ inputSchema: objSchema({ id: intSchema("task id"), seq: intSchema() }, ["id", "seq"]),
369
+ call: async (args) => (await apiCall("DELETE", `/api/tasks/${args.id}/attachments/${args.seq}`)).body
370
+ },
237
371
  {
238
372
  name: "polaris.task.update",
239
373
  description: "Correct or refine a task's spec \u2014 PATCH its description_md (and optionally name). For a marketing creative, set asset_url to the produced asset (image/video) so the reviewer can download and review it. It is NOT a log of what was done (leave that as a comment). Needs a token.",
@@ -241,7 +375,8 @@ var TOOLS = [
241
375
  id: intSchema(),
242
376
  name: strSchema(),
243
377
  description_md: strSchema("full markdown brief; replaces the current description"),
244
- asset_url: strSchema("mkt: URL of the produced creative asset (image/video) for the reviewer")
378
+ asset_url: strSchema("mkt: URL of the produced creative asset (image/video) for the reviewer"),
379
+ output_type: strSchema("pr|post|video|email|generic \u2014 fix the delivery medium of a task filed with the wrong one (it routes the worker to the video or the image pipeline).")
245
380
  }, ["id"]),
246
381
  call: async (args) => {
247
382
  const body = {};
@@ -251,21 +386,41 @@ var TOOLS = [
251
386
  body.description_md = args.description_md;
252
387
  if (typeof args.asset_url === "string")
253
388
  body.asset_url = args.asset_url;
389
+ if (typeof args.output_type === "string")
390
+ body.output_type = args.output_type;
254
391
  return (await apiCall("PATCH", `/api/tasks/${args.id}`, body)).body;
255
392
  }
256
393
  },
257
394
  {
258
395
  name: "polaris.task.transition",
259
- description: "Move a task to its next status when you finish a stage (e.g. dev\u2192test once your PR is up). Enforced flow: draft\u2192backlog\u2192dev\u2192test\u2192approval\u2192release\u2192done (any\u2192canceled). Illegal jumps are rejected. The approval\u2192release gate is polaris.task.approve (human-only).",
396
+ description: "Move a task to its next status when you finish a stage (e.g. dev\u2192test once your PR is up). Enforced flow: draft\u2192backlog\u2192dev\u2192test\u2192approval\u2192release\u2192done (any\u2192canceled). Illegal jumps are rejected. Neither terminal state is a dead end: canceled\u2192draft and done\u2192approval undo the last step, so a mistaken close is recoverable without touching the database. The approval\u2192release gate is polaris.task.approve (human-only).",
260
397
  inputSchema: objSchema({ id: intSchema(), status: strSchema() }, ["id", "status"]),
261
398
  call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/state`, { status: args.status })).body
262
399
  },
263
400
  {
264
401
  name: "polaris.task.approve",
265
- description: "The human review gate: approve a task in `approval` \u2192 it advances toward release. Human-only. To ship several approval tasks of one milestone together, group them into a stack and use polaris.stack.release instead.",
402
+ description: "The human review gate: a task in `approval` advances to `release` \u2014 cleared to go out, not gone out. Human-only, and valid for everything: a mkt creative approves the same way, and is then either scheduled (auto-publish at its time) or marked published once it has gone out. To ship several approval tasks together, group them into a stack and use polaris.stack.release.",
266
403
  inputSchema: objSchema({ id: intSchema() }, ["id"]),
267
404
  call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/approve`)).body
268
405
  },
406
+ {
407
+ name: "polaris.task.schedule",
408
+ description: "Schedule a mkt creative for publication: approval \u2192 agendado, and the publisher takes it to `done` when its time arrives. The creative must be bound to an active social account (resolved from its market + channel) and have a publish_at in the future. Its copy is frozen while scheduled \u2014 editing it requires unscheduling first.",
409
+ inputSchema: objSchema({ id: intSchema() }, ["id"]),
410
+ call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/schedule`)).body
411
+ },
412
+ {
413
+ name: "polaris.task.unschedule",
414
+ description: "Unschedule a mkt creative: agendado \u2192 approval. Refused once the post is live. The creative returns to approval for edits or re-scheduling.",
415
+ inputSchema: objSchema({ id: intSchema() }, ["id"]),
416
+ call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/unschedule`)).body
417
+ },
418
+ {
419
+ name: "polaris.task.mark_published",
420
+ description: "The creative has gone out: `release` \u2192 `done`, optionally with the permalink of the post. This is the LAST transition, not a shortcut \u2014 approve it into `release` first (cleared to go out), then mark it published once it actually has. Recorded as a manual human action; use it when the post went out outside the scheduler.",
421
+ inputSchema: objSchema({ id: intSchema() }, ["id"]),
422
+ call: async (args) => (await apiCall("POST", `/api/tasks/${args.id}/mark-published`)).body
423
+ },
269
424
  {
270
425
  name: "polaris.task.dep_add",
271
426
  description: "Add a dependency edge (cycle-checked).",
@@ -340,13 +495,13 @@ var TOOLS = [
340
495
  },
341
496
  {
342
497
  name: "polaris.ticket.frame_issue",
343
- description: "Frame a NEW issue (the problem) from this ticket's conversation \u2014 the helpdesk twin of a milestone. A note is added to the thread. Then decompose it via polaris.issue.add_task.",
498
+ description: "Frame a NEW issue (the problem) from this ticket's conversation \u2014 the helpdesk twin of a milestone. A note is added to the thread. Then decompose it via polaris.issue.add_task. HUMAN ONLY: an agent token gets 403 (agent_cannot_admin) \u2014 the helpdesker proposes the issue during triage and a human validates it with a button.",
344
499
  inputSchema: objSchema({ id: intSchema(), title: strSchema() }, ["id", "title"]),
345
500
  call: async (args) => (await apiCall("POST", `/api/tickets/${args.id}/issues`, { title: args.title })).body
346
501
  },
347
502
  {
348
503
  name: "polaris.ticket.link_issue",
349
- description: "Link this ticket to an EXISTING issue (dedup \u2014 it's a duplicate report of a problem already being worked).",
504
+ description: "Link this ticket to an EXISTING issue (dedup \u2014 it's a duplicate report of a problem already being worked). Then tell the customer we already have the problem, point them to follow it in the product, and close this ticket after sending. HUMAN ONLY: an agent token gets 403 (agent_cannot_admin) \u2014 the helpdesker proposes the link, a human accepts it.",
350
505
  inputSchema: objSchema({ id: intSchema(), issue_id: intSchema() }, ["id", "issue_id"]),
351
506
  call: async (args) => (await apiCall("POST", `/api/tickets/${args.id}/issues/link`, { issue_id: args.issue_id })).body
352
507
  },
@@ -501,6 +656,30 @@ var TOOLS = [
501
656
  return r.body;
502
657
  }
503
658
  },
659
+ {
660
+ name: "polaris.revision.list",
661
+ description: "History of an object's markdown field, newest first \u2014 what the text was BEFORE and AFTER each change, who changed it and how (human, descriptioner, revert). Use it to answer \"what did the descriptioner actually change in this milestone?\", which the activity feed cannot tell you. Scopes: milestone|task|issue|agent use `id`; agent_function uses `key` (e.g. 'planner').",
662
+ inputSchema: objSchema({
663
+ scope: strSchema("milestone|task|issue|agent|agent_function"),
664
+ id: intSchema("object id \u2014 every scope except agent_function"),
665
+ key: strSchema("text key \u2014 agent_function only, e.g. 'planner'")
666
+ }, ["scope"]),
667
+ call: async (args) => {
668
+ const qs = new URLSearchParams;
669
+ qs.set("scope", String(args.scope));
670
+ if (args.id !== undefined && args.id !== null)
671
+ qs.set("id", String(args.id));
672
+ if (args.key !== undefined && args.key !== null)
673
+ qs.set("key", String(args.key));
674
+ return (await apiCall("GET", `/api/revisions?${qs}`)).body;
675
+ }
676
+ },
677
+ {
678
+ name: "polaris.revision.revert",
679
+ description: "Restore a markdown field to its value BEFORE the given revision. Not a rollback \u2014 it writes normally, so it records its own revision with source='revert' and can itself be reverted. Needs a token.",
680
+ inputSchema: objSchema({ id: intSchema("revision id") }, ["id"]),
681
+ call: async (args) => (await apiCall("POST", `/api/revisions/${args.id}/revert`)).body
682
+ },
504
683
  {
505
684
  name: "polaris.chat.get",
506
685
  description: "Resolve the chat thread for a scope (e.g. task 42) and return its id. Idempotent (get-or-create). You rarely need this directly \u2014 polaris.chat.messages takes the scope and resolves the id for you.",
@@ -529,11 +708,10 @@ var TOOLS = [
529
708
  },
530
709
  {
531
710
  name: "polaris.project.update",
532
- description: "Update a project (human-only): repo_url, description_md, name, status (active|paused|archived), owner_human_id.",
711
+ description: "Update a project (human-only): repo_url, name, status (active|paused|archived), owner_human_id. Brand/context live in the CLAUDE.md \u2014 use polaris.project.claude_md_set.",
533
712
  inputSchema: objSchema({
534
713
  key: strSchema("project key"),
535
714
  name: strSchema(),
536
- description_md: strSchema(),
537
715
  repo_url: strSchema("github.com repo URL"),
538
716
  status: strSchema("active|paused|archived"),
539
717
  owner_human_id: intSchema()
@@ -549,6 +727,55 @@ var TOOLS = [
549
727
  inputSchema: objSchema({ key: strSchema("project key"), content: strSchema("full CLAUDE.md markdown") }, ["key", "content"]),
550
728
  call: async (args) => (await apiCall("PUT", `/api/projects/${args.key}/claude-md`, { content: args.content })).body
551
729
  },
730
+ {
731
+ name: "polaris.presence.list",
732
+ description: "Where a product exists in the world: the channels it publishes on and the directories it is listed in, each with its state (missing \u2192 exists \u2192 connected). Read this before writing a campaign \u2014 a channel that is not connected cannot be published to.",
733
+ inputSchema: objSchema({ key: strSchema("project key") }, ["key"]),
734
+ call: async (args) => (await apiCall("GET", `/api/projects/${args.key}/presences`)).body
735
+ },
736
+ {
737
+ name: "polaris.presence.add",
738
+ description: "Add a place to a project (human-only). kind: channel (we publish there) | listing (we keep an entry there). Idempotent on slug: adding the same place twice fills in what was left empty. Never send a password you were not given.",
739
+ inputSchema: objSchema({
740
+ key: strSchema("project key"),
741
+ kind: strSchema("channel | listing"),
742
+ slug: strSchema("instagram \xB7 linkedin \xB7 reddit \xB7 g2 \xB7 capterra \u2026"),
743
+ label: strSchema("human name, e.g. Instagram"),
744
+ url: strSchema("public profile or listing URL"),
745
+ handle: strSchema("@handle or account name"),
746
+ state: strSchema("missing | exists | connected (channel only)"),
747
+ login_email: strSchema(),
748
+ notes: strSchema()
749
+ }, ["key", "kind", "slug", "label"]),
750
+ call: async (args) => {
751
+ const { key, ...body } = args;
752
+ return (await apiCall("POST", `/api/projects/${key}/presences`, body)).body;
753
+ }
754
+ },
755
+ {
756
+ name: "polaris.presence.update",
757
+ description: "Edit one presence \u2014 its URL, handle, owner, notes or state (human-only).",
758
+ inputSchema: objSchema({
759
+ key: strSchema("project key"),
760
+ id: intSchema("presence id"),
761
+ label: strSchema(),
762
+ url: strSchema(),
763
+ handle: strSchema(),
764
+ state: strSchema("missing | exists | connected"),
765
+ login_email: strSchema(),
766
+ notes: strSchema()
767
+ }, ["key", "id"]),
768
+ call: async (args) => {
769
+ const { key, id, ...body } = args;
770
+ return (await apiCall("PATCH", `/api/projects/${key}/presences/${id}`, body)).body;
771
+ }
772
+ },
773
+ {
774
+ name: "polaris.presence.verify",
775
+ description: "Stamp a presence as CHECKED AGAINST THE TRUTH of the product (human-only). Use it after actually looking: on a directory listing the risk is not staleness, it is the feature checklist claiming something the product does not do.",
776
+ inputSchema: objSchema({ key: strSchema("project key"), id: intSchema() }, ["key", "id"]),
777
+ call: async (args) => (await apiCall("POST", `/api/projects/${args.key}/presences/${args.id}/verify`, {})).body
778
+ },
552
779
  {
553
780
  name: "polaris.agent.create",
554
781
  description: "Create an agent/employee (human-only). function: developer|tester|planner|helpdesker; product = project key; team = dev|mkt; domain optional (roadmap|helpdesk|both).",
@@ -564,12 +791,22 @@ var TOOLS = [
564
791
  },
565
792
  {
566
793
  name: "polaris.agent.update",
567
- description: "Update an agent (human-only): name (rename), domain (roadmap|helpdesk|both), or mantra_md. The stable agent_id_slug never changes.",
794
+ description: "Update an agent (human-only): name (rename), domain (roadmap|helpdesk|both), mantra_md, or resource_limits. The stable agent_id_slug never changes. resource_limits (CPU/RAM/disk, enforced via the agent's systemd unit) is null-or-object: null clears every field back to the default; an object states ALL fields (memory_max_mb, cpu_quota_pct, disk_quota_mb \u2014 each an integer, or null for that field's default). Takes effect on the agent's next re-provision, not instantly.",
568
795
  inputSchema: objSchema({
569
796
  id: intSchema(),
570
797
  name: strSchema(),
571
798
  domain: strSchema("roadmap|helpdesk|both"),
572
- mantra_md: strSchema()
799
+ mantra_md: strSchema(),
800
+ resource_limits: {
801
+ type: ["object", "null"],
802
+ description: "CPU/RAM/disk caps. null = defaults for all fields. Object must state every field (int or null): memory_max_mb, cpu_quota_pct, disk_quota_mb.",
803
+ properties: {
804
+ memory_max_mb: { type: ["integer", "null"] },
805
+ cpu_quota_pct: { type: ["integer", "null"] },
806
+ disk_quota_mb: { type: ["integer", "null"] }
807
+ },
808
+ additionalProperties: false
809
+ }
573
810
  }, ["id"]),
574
811
  call: async (args) => {
575
812
  const { id, ...patch } = args;
@@ -609,9 +846,27 @@ var TOOLS = [
609
846
  ]),
610
847
  call: async (args) => (await apiCall("POST", `/api/agents/${args.id}/claude-login/code`, { code: args.code })).body
611
848
  },
849
+ {
850
+ name: "polaris.agent.claude_logout",
851
+ description: "Log an agent out of Claude (human-only): deletes its stored credentials and clears the login. Use when claude_login_status is 'expired' to force a clean re-login.",
852
+ inputSchema: objSchema({ id: intSchema("agent id") }, ["id"]),
853
+ call: async (args) => (await apiCall("POST", `/api/agents/${args.id}/claude-login/logout`)).body
854
+ },
855
+ {
856
+ name: "polaris.agent.codex_login",
857
+ description: "Kick off a generator agent's Codex device-login (human-only). Poll agent.get for codex_login_url, then approve it in the browser \u2014 no code to paste back.",
858
+ inputSchema: objSchema({ id: intSchema("agent id") }, ["id"]),
859
+ call: async (args) => (await apiCall("POST", `/api/agents/${args.id}/codex-login`)).body
860
+ },
861
+ {
862
+ name: "polaris.agent.codex_logout",
863
+ description: "Log an agent out of Codex (human-only): deletes its stored auth and clears the login. Use when codex_login_status is 'expired' to force a clean re-login.",
864
+ inputSchema: objSchema({ id: intSchema("agent id") }, ["id"]),
865
+ call: async (args) => (await apiCall("POST", `/api/agents/${args.id}/codex-login/logout`)).body
866
+ },
612
867
  {
613
868
  name: "polaris.milestone.create",
614
- description: "Create a milestone. team=dev|mkt; end_date = deadline (ISO date, required). For a marketing CAMPAIGN (team=mkt) these extra fields carry the plan: market (BR/US/EU), cadence (per-channel rules Discovery expands into dated creatives), max_creatives (cap on that expansion), and paid + platforms + budget for a paid campaign.",
869
+ description: "Create a milestone. team=dev|mkt; end_date = deadline (ISO date, required). For a marketing CAMPAIGN (team=mkt), `market` says which markets it serves \u2014 that is what routes each creative to an account. Everything else about the campaign (rhythm, channels, budget, angle) goes in `description_md`: the briefer reads it and cuts the creatives, each with its own day.",
615
870
  inputSchema: objSchema({
616
871
  project_key: strSchema(),
617
872
  name: strSchema(),
@@ -624,28 +879,7 @@ var TOOLS = [
624
879
  type: "array",
625
880
  items: { type: "string" },
626
881
  description: "mkt: target markets \u2014 any of BR, US, EU"
627
- },
628
- cadence: {
629
- type: "array",
630
- description: "mkt: per-channel cadence rules Discovery expands into dated creatives",
631
- items: {
632
- type: "object",
633
- properties: {
634
- channel: { type: "string", description: "Instagram, TikTok, LinkedIn, \u2026" },
635
- format: { type: "string", description: "post, reel, story, artigo, \u2026" },
636
- n: { type: "integer", description: "count per period" },
637
- per: { type: "string", description: "day | week" }
638
- }
639
- }
640
- },
641
- max_creatives: intSchema("mkt: cap on how many creatives Discovery/cadence may generate"),
642
- paid: { type: "boolean", description: "mkt: is the whole campaign paid?" },
643
- platforms: {
644
- type: "array",
645
- items: { type: "string" },
646
- description: "mkt paid: any of Meta, Google, Reddit, LinkedIn, TikTok, YouTube"
647
- },
648
- budget: { type: "number", description: "mkt: campaign ad-spend budget (\u20AC)" }
882
+ }
649
883
  }, ["project_key", "name", "team", "end_date"]),
650
884
  call: async (args) => (await apiCall("POST", "/api/milestones", args)).body
651
885
  },
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@glie/mcp-polaris",
3
- "version": "0.6.0",
4
- "description": "Model Context Protocol (stdio) server exposing Polaris — glie's ops platform — as native tools in Claude Code and any MCP client.",
3
+ "version": "0.8.0",
4
+ "description": "Model Context Protocol (stdio) server exposing Polaris, glie's ops platform, as native tools in Claude Code and any MCP client.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "glie <carlos@glie.ai>",
7
7
  "type": "module",
8
8
  "bin": {
9
9
  "mcp-polaris": "dist/index.js"
10
10
  },
11
- "files": ["dist", "README.md", "LICENSE"],
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
12
16
  "engines": {
13
17
  "node": ">=18"
14
18
  },
@@ -21,7 +25,14 @@
21
25
  "directory": "packages/mcp-polaris"
22
26
  },
23
27
  "homepage": "https://polaris.glie.ai",
24
- "keywords": ["mcp", "model-context-protocol", "claude", "claude-code", "polaris", "glie"],
28
+ "keywords": [
29
+ "mcp",
30
+ "model-context-protocol",
31
+ "claude",
32
+ "claude-code",
33
+ "polaris",
34
+ "glie"
35
+ ],
25
36
  "scripts": {
26
37
  "build": "bun run build.ts",
27
38
  "prepublishOnly": "bun run build.ts"