Phase 11, part 1: agents and their keys
Agents are users of kind agent, each given modules to read, or to read and act on, and the CRM scope. Admins make them under Settings → Agents, on every edition; keys (sm_…) are shown once and kept as hashes, can expire, be rotated (the old one works a day) or revoked, and record their last use. /mcp takes agent keys and offers each agent only the tools its scopes allow. On the local edition, mcp-token is the key of a built-in Hermes agent with the CRM and the Market. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -165,6 +165,26 @@ CREATE TABLE audit_log (
|
||||
CREATE INDEX audit_log_at ON audit_log(at);
|
||||
CREATE INDEX audit_log_user ON audit_log(user_id, at);
|
||||
ALTER TABLE outreach ADD COLUMN created_by INTEGER NOT NULL DEFAULT 0;
|
||||
`,
|
||||
},
|
||||
// 37
|
||||
{
|
||||
Note: "agents' keys, and a description for each agent",
|
||||
SQLite: `
|
||||
CREATE TABLE agent_keys (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
hash TEXT NOT NULL UNIQUE, -- the SHA-256 of the key; the key itself is shown once
|
||||
prefix TEXT NOT NULL, -- its first characters, to tell keys apart
|
||||
created_at TEXT NOT NULL,
|
||||
expires_at TEXT NOT NULL DEFAULT '', -- '' for never
|
||||
retires_at TEXT NOT NULL DEFAULT '', -- replaced by a newer key: works until then
|
||||
revoked_at TEXT NOT NULL DEFAULT '',
|
||||
used_at TEXT NOT NULL DEFAULT '',
|
||||
used_from TEXT NOT NULL DEFAULT '' -- the address of its last use
|
||||
);
|
||||
CREATE INDEX agent_keys_user ON agent_keys(user_id);
|
||||
ALTER TABLE users ADD COLUMN description TEXT NOT NULL DEFAULT '';
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user