Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
import { PULL_REQUEST_ACTION_LABELS, PULL_REQUEST_RULE_KINDS } from '../../../../lib/pullRequestActions.js';
// Display labels for the GitHub inbox's triage (server/lib/githubNotificationTriage.js).
// `needs-you` has no chip: it is the inbox's default state.
export const DECISION_VIEW = {
suspect: { tone: 'error', label: 'Suspect' },
'surface-high': { tone: 'error', label: 'High priority' },
surface: { tone: 'accent', label: 'Worth a look' },
'suggest-review': { tone: 'accent', label: 'Suggest Do:Review' },
'suggest-untrusted-review': { tone: 'warning', label: 'Suggest Untrusted:Review' },
'suggest-mark-read': { tone: 'muted', label: 'Closed or merged' },
'handled-by-pr-workflow': { tone: 'success', label: 'PR workflow has it' },
duplicate: { tone: 'muted', label: 'Duplicate' },
'suggest-done': { tone: 'muted', label: 'Suggest done' },
'suggest-mute': { tone: 'muted', label: 'Suggest mute' },
'handed-off': { tone: 'success', label: 'Handed off' },
};
// Suggestions that are also an action: the chip is a button that does it.
// `agent` opens Resolve with agent's picker (the thread's own lane decides
// Do:Review or Untrusted:Review); the rest apply that inbox action.
export const DECISION_ACTIONS = {
'suggest-review': { action: 'agent', label: 'Do:Review' },
'suggest-untrusted-review': { action: 'agent', label: 'Untrusted:Review' },
'suggest-done': { action: 'done', label: 'Mark done' },
'suggest-mark-read': { action: 'done', label: 'Mark done' },
duplicate: { action: 'done', label: 'Mark done' },
'suggest-mute': { action: 'mute', label: 'Mute' },
};
export const TRUST_VIEW = {
yours: { tone: 'success', label: 'You' },
trusted: { tone: 'success', label: 'Trusted' },
outside: { tone: 'warning', label: 'Outside' },
};
// Why a thread got its decision, one line per rule.
export const RULE_LABELS = {
'spam-signal': 'A spam check matched, so nothing will act on it automatically',
'security-alert': 'Security alerts always surface first',
'deployment-approval': 'A deployment is waiting for your approval',
'invitation-never-accepted': 'Invitations surface and are never accepted automatically',
'finished-thread': 'The issue or pull request is already closed or merged',
'ci-default-branch': 'CI failed on the default branch',
'ci-watched-by-pr-workflow': 'CI on a branch of a PortOS managed app, which its PR workflow handles',
'own-pr-in-managed-repo': 'Activity on your own PR in a PortOS managed app, which its PR workflow handles',
'ci-other': 'CI result outside the default branch of a repo PortOS does not manage',
'review-trusted-author': 'Review requested by you or a collaborator with write access',
'review-outside-author': 'Review requested on your repo by someone without write access',
'review-elsewhere': 'Review requested on a repo you do not own',
'mention-elsewhere': 'Mentioned in a repo you do not own',
default: 'No rule applied, so it waits for you',
learned: 'You handled threads like this the same way before',
'ai-surface': 'Assist read it and thinks you should see it',
'ai-done': 'Assist read it and found nothing for you to do',
'ai-suggest-mute': 'Assist read it and thinks the thread is noise',
};
// Why Assist did not sort a thread, by the code the screening path returns.
export const AI_SKIP_LABELS = {
'github-notification-provider-not-allowed': 'No AI provider this account allows is available',
'untrusted-content-blocked': 'The abuse guard flagged its text',
'untrusted-content-too-large': 'Its text is over the screening limit',
};
export const ACTION_LABELS = {
done: 'Marked done',
read: 'Marked read',
mute: 'Muted',
'handed-off': 'Handed off',
};
// The lanes Autopilot hands threads to, and the app tab each one reports on.
export const LANE_VIEW = {
'pr-reviewer': { label: 'Untrusted:Review', tab: 'pull-requests' },
'issue-watcher': { label: 'the issue watcher', tab: 'tasks' },
'dependency-updates': { label: 'dependency updates', tab: 'tasks' },
// A one-off CoS task in a scratch clone, for a repo no app manages.
'security-fix': { label: 'a security fix agent', tab: null },
'do-review': { label: 'a Do:Review agent', tab: 'pull-requests' },
// A one-off CoS task in a scratch clone for any other vouched thread (#13191).
'notification-resolve': { label: 'a CoS agent', tab: null },
};
// The notification kinds an automation rule can name (GITHUB_AGENT_RULE_KINDS on the server).
export const AGENT_RULE_KINDS = [
{ value: 'review-request', label: 'Review requests', hint: 'A review request starts a review-only Do:Review run that publishes an inline review. An outside pull request in one of your apps goes to Untrusted:Review instead.' },
{ value: 'security-alert', label: 'Security alerts', hint: 'A security alert starts a run that updates the vulnerable dependencies, opens a pull request and merges it when checks pass. A rule never marks one done or mutes it.' },
{ value: 'issue-activity', label: 'Issue activity', hint: 'Outside activity on an issue in one of your apps goes to its issue watcher.' },
{ value: 'ci-activity', label: 'CI activity', hint: 'A workflow run or check suite notice. By default Autopilot and Assist mark these done. An agent looks into a failure only in a repo of yours.' },
{ value: 'own-pr', label: 'Your pull requests', hint: 'Activity on a pull request you opened. An agent takes it only when everyone in the thread is you or trusted.' },
{ value: 'dependabot-pr', label: 'Dependabot pull requests', hint: 'Verified Dependabot pull requests. Merge when checks pass rechecks the current head, CI and review requirements every scheduled run, then merges directly without an AI call.' },
{ value: 'pull-request', label: 'Other pull requests', hint: 'Subscribed pull-request activity. Run Do:Review or the screened Untrusted:Review task used by your apps.' },
{ value: 'mention', label: 'Mentions', hint: 'You or your team were mentioned. An agent takes it only when everyone in the thread is you or trusted.' },
{ value: 'release', label: 'Releases', hint: 'A new release in a repo you watch.' },
{ value: 'other', label: 'Everything else', hint: 'Any other notification: comments, discussions, commits and subscriptions. An agent takes it only when everyone in the thread is you or trusted.' },
];
// What an automation rule does (GITHUB_AGENT_RULE_ACTIONS on the server).
export const RULE_ACTIONS = [
{ value: 'agent', label: 'Start a CoS agent' },
...Object.entries(PULL_REQUEST_ACTION_LABELS).map(([value, label]) => ({ value, label: value === 'merge' ? 'Merge when checks pass' : label })),
{ value: 'done', label: 'Mark done' },
{ value: 'mute', label: 'Mute the thread' },
{ value: 'leave', label: 'Leave in the inbox' },
];
// Security alerts are never marked done or muted by a rule.
export const actionsForKind = kind => RULE_ACTIONS.filter(({ value }) => {
if (kind === 'security-alert') return value === 'agent' || value === 'leave';
if (value === 'merge') return kind === 'dependabot-pr';
return !['do-review', 'untrusted-review'].includes(value) || PULL_REQUEST_RULE_KINDS.includes(kind);
});
// A rule's action; a legacy `agent` boolean reads as agent / leave.
export const ruleActionOf = (rule) => rule?.action || (rule?.agent === true ? 'agent' : 'leave');
// Why Resolve with agent is unavailable for a thread (agentHandoff on the server).
export const AGENT_REFUSED_LABELS = {
'private-account': 'Allow agents on this Private account in Accounts to resolve it with an agent',
'no-managed-app': 'Add this repo as a PortOS app to resolve it with an agent',
'outside-content': 'Outside content goes only to the screened Untrusted:Review and issue watcher lanes',
'comment-unchecked': 'Its latest comment has not been checked yet; new activity on the thread re-checks it',
'deployment-approval': 'Only you approve deployments: use Review deployment',
invitation: 'Only you accept or decline invitations',
'security-alert': 'Security alerts go only to their dependency update or security fix agents',
finished: 'Nothing is left to do here: mark it done',
'handed-off': 'An agent already has this thread',
'no-repo': 'It names no repository for an agent to work in',
suspect: 'Suspect threads never go to an agent',
};
// Why Autopilot left a thread with you instead of handing it off.
export const HANDOFF_SKIP_LABELS = {
'private-account': 'Agents are not allowed on this Private account (Accounts)',
'no-managed-app': 'No PortOS app manages this repo',
'lane-unavailable': 'The lane would not take it',
};
export const LEARNED_DECISION_LABELS = {
surface: 'Show me',
'suggest-done': 'Mark done',
'suggest-mute': 'Mute',
};
export const SIGNAL_LABELS = {
'new-account': 'Actor account is less than 30 days old',
'first-time-actor': 'Actor has no history in this repo',
'mass-mention': 'The latest comment mentions many people',
'unrelated-repo': 'First notification from a repo you have no tie to',
};
// Why you are on a thread, as a sentence plus the color that marks how it asks
// for action: red needs a fix or a decision now, amber wants a reply, blue wants
// a review, green is your own work, gray is background.
export const REASON_WHY = {
approval_requested: { tone: 'error', text: 'A deployment is waiting for your approval' },
assign: { tone: 'warning', text: 'Assigned to you' },
author: { tone: 'success', text: 'You opened this and it has new activity' },
ci_activity: { tone: 'error', text: 'A CI run or check finished' },
comment: { tone: 'warning', text: 'Someone commented on a thread you follow' },
invitation: { tone: 'warning', text: 'You were invited to a repository' },
manual: { tone: 'muted', text: 'You subscribed to this thread' },
mention: { tone: 'warning', text: 'You were mentioned' },
review_requested: { tone: 'accent', text: 'Your review was requested' },
security_alert: { tone: 'error', text: 'A security alert on your dependencies' },
state_change: { tone: 'muted', text: 'It was opened, closed or merged' },
subscribed: { tone: 'muted', text: 'You are watching this repository' },
team_mention: { tone: 'warning', text: 'Your team was mentioned' },
};
// The row's left accent edge per tone.
export const TONE_EDGE = {
error: 'border-l-port-error',
warning: 'border-l-port-warning',
accent: 'border-l-port-accent',
success: 'border-l-port-success',
muted: 'border-l-port-border',
};
// GitHub's mergeable_state for an open PR, as what it means for you.
export const MERGE_STATE_VIEW = {
clean: { tone: 'success', label: 'Ready to merge' },
has_hooks: { tone: 'success', label: 'Ready to merge' },
unstable: { tone: 'warning', label: 'Checks failing' },
blocked: { tone: 'error', label: 'Blocked: needs review or checks' },
behind: { tone: 'warning', label: 'Behind base branch' },
dirty: { tone: 'error', label: 'Merge conflicts' },
draft: { tone: 'muted', label: 'Draft' },
};
/**
* The state chip for a thread's issue or pull request, or null when the forge
* did not report one (CI, releases, invitations).
*/
export function subjectStatusChip(subjectType, status) {
if (!status?.state) return null;
if (status.state === 'merged') return { tone: 'accent', label: 'Merged', key: 'merged' };
// A closed issue is resolved work (the row icon is purple); only an unmerged closed PR reads as a failure.
if (status.state === 'closed') return { tone: subjectType === 'PullRequest' ? 'error' : 'muted', label: 'Closed', key: 'closed' };
if (subjectType === 'PullRequest' && status.draft) return { tone: 'muted', label: 'Draft', key: 'draft' };
if (subjectType === 'PullRequest') {
const merge = MERGE_STATE_VIEW[status.mergeState];
return merge ? { ...merge, key: status.mergeState } : { tone: 'success', label: 'Open', key: 'open' };
}
return status.state === 'open' ? { tone: 'success', label: 'Open', key: 'open' } : null;
}