Skip to content

Add pending notices to command responses#3

Open
Jhacarreiro wants to merge 1 commit into
wonderwhy-er:mainfrom
Jhacarreiro:feat/pending-notices
Open

Add pending notices to command responses#3
Jhacarreiro wants to merge 1 commit into
wonderwhy-er:mainfrom
Jhacarreiro:feat/pending-notices

Conversation

@Jhacarreiro

Copy link
Copy Markdown

Summary

Adds a lightweight in-memory pending notices mechanism so local tools can leave short messages that are automatically attached to future terminal command responses.

New routes:

  • POST /api/notices
  • GET /api/notices/pending
  • POST /api/notices/:id/ack

Terminal command responses now include a notices array when notices are pending.

Why

When ChatGPT is using Server Commander as a terminal bridge, other local processes may know useful context: for example, "you are editing the generated file, not the live file" or "a long-running task has moved to a different state".

Without a side channel, the GPT has to explicitly ask for a separate inbox. With pending notices, the context is attached to the next command response automatically.

Example

Create a notice:

POST /api/notices
Content-Type: application/json

{
  "level": "warning",
  "source": "local-supervisor",
  "text": "Check that you are editing the live config file, not a generated copy.",
  "ttlSeconds": 1800
}

A future terminal response includes:

{
  "message": "Command executed successfully.",
  "output": "...",
  "notices": [
    {
      "id": "notice_...",
      "level": "warning",
      "source": "local-supervisor",
      "text": "Check that you are editing the live config file, not a generated copy.",
      "deliveredCount": 1
    }
  ]
}

Acknowledge it:

POST /api/notices/{id}/ack

Notes

  • Notices are stored in memory only.
  • Notices expire after ttlSeconds, defaulting to one hour.
  • Levels are intentionally small and generic: info, warning, error, interrupt.
  • This does not change command execution behavior.

Validation

node --check api/notices.js
node --check api/terminal.js
node --check serverModules/apiRoutes.js

Also smoke-tested notice creation, pending retrieval and acknowledgement using the exported handlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant