@nanocollective/roster 0.1.0-beta.3 → 0.1.0-beta.30
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 +8 -0
- package/dist/agents-POITEZRI.js +232 -0
- package/dist/chunk-FF2WBNNW.js +370 -0
- package/dist/chunk-GDAJPOHK.js +562 -0
- package/dist/cli.js +3391 -1239
- package/dist/compose-5DBEHSEV.js +17 -0
- package/dist/connectors-5E5ZMGZV.js +23 -0
- package/dist/worker/assets/assets/css/astryx.css +948 -0
- package/dist/worker/assets/assets/css/base.css +51 -110
- package/dist/worker/assets/assets/css/brain.css +26 -2
- package/dist/worker/assets/assets/css/connectors.css +58 -0
- package/dist/worker/assets/assets/css/graph.css +9 -12
- package/dist/worker/assets/assets/css/health.css +4 -7
- package/dist/worker/assets/assets/css/home.css +145 -60
- package/dist/worker/assets/assets/css/inbox.css +11 -0
- package/dist/worker/assets/assets/css/layout.css +18 -22
- package/dist/worker/assets/assets/css/markdown.css +22 -1
- package/dist/worker/assets/assets/css/routines.css +40 -0
- package/dist/worker/assets/assets/css/runs.css +5 -3
- package/dist/worker/assets/assets/css/search.css +3 -6
- package/dist/worker/assets/assets/css/setup.css +3 -15
- package/dist/worker/assets/assets/js/api.js +3 -0
- package/dist/worker/assets/assets/js/app.js +25 -1
- package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
- package/dist/worker/assets/assets/js/dom.js +1 -1
- package/dist/worker/assets/assets/js/homesort.js +66 -20
- package/dist/worker/assets/assets/js/icons.js +6 -0
- package/dist/worker/assets/assets/js/md.js +7 -2
- package/dist/worker/assets/assets/js/refcard.js +216 -0
- package/dist/worker/assets/assets/js/refresh.js +4 -2
- package/dist/worker/assets/assets/js/report.js +51 -0
- package/dist/worker/assets/assets/js/select.js +362 -0
- package/dist/worker/assets/assets/js/state.js +14 -1
- package/dist/worker/assets/assets/js/views/connectors.js +423 -0
- package/dist/worker/assets/assets/js/views/graph.js +67 -28
- package/dist/worker/assets/assets/js/views/home.js +378 -176
- package/dist/worker/assets/assets/js/views/inbox.js +68 -16
- package/dist/worker/assets/assets/js/views/org.js +2 -0
- package/dist/worker/assets/assets/js/views/people.js +109 -0
- package/dist/worker/assets/assets/js/views/routines.js +378 -0
- package/dist/worker/assets/assets/js/views/runs.js +3 -1
- package/dist/worker/assets/docs-images/brain.jpg +0 -0
- package/dist/worker/assets/docs-images/home.jpg +0 -0
- package/dist/worker/assets/docs-images/org.jpg +0 -0
- package/dist/worker/assets/docs-images/prompt.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
- package/dist/worker/assets/docs-images/staff.jpg +0 -0
- package/dist/worker/assets/index.html +19 -3
- package/dist/worker/index.js +4478 -1098
- package/docs/README.md +2 -0
- package/docs/architecture.md +23 -4
- package/docs/commands.md +111 -9
- package/docs/concepts.md +2 -1
- package/docs/connectors.md +169 -0
- package/docs/cost.md +1 -1
- package/docs/developing.md +3 -3
- package/docs/doctor-codes.md +8 -2
- package/docs/export.md +4 -3
- package/docs/extending.md +1 -1
- package/docs/getting-started.md +20 -3
- package/docs/hosting.md +67 -3
- package/docs/images/brain.jpg +0 -0
- package/docs/images/home.jpg +0 -0
- package/docs/images/org.jpg +0 -0
- package/docs/images/prompt.jpg +0 -0
- package/docs/images/setup-org.jpg +0 -0
- package/docs/images/setup-plan.jpg +0 -0
- package/docs/images/staff.jpg +0 -0
- package/docs/memory.md +3 -2
- package/docs/org-yaml.md +58 -5
- package/docs/portal.md +52 -11
- package/docs/prompts.md +3 -2
- package/docs/routines.md +65 -0
- package/docs/security.md +37 -4
- package/docs/session-workflow.md +31 -8
- package/docs/staff-yaml.md +7 -3
- package/docs/troubleshooting.md +1 -1
- package/docs/upgrading.md +1 -1
- package/docs/writing-a-charter.md +1 -1
- package/package.json +8 -1
- package/templates/brain/.gitattributes +3 -0
- package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +24 -15
- package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +12 -10
- package/templates/brain/CHARTER.md +2 -2
- package/templates/brain/STATE.md +16 -0
- package/templates/brain/memory/INDEX.md +1 -1
- package/templates/brain/staff.yaml +3 -0
- package/templates/ops/.gitattributes +3 -0
- package/templates/ops/.github/workflows/session.yaml +92 -13
- package/templates/ops/agents.mjs +38 -11
- package/templates/ops/compose.mjs +60 -2
- package/templates/ops/connectors.mjs +722 -0
- package/templates/ops/org/operating.md +10 -0
- package/templates/ops/org/voice.md +21 -3
- package/templates/ops/prompts/_identity.md +20 -0
- package/templates/ops/prompts/daily.md +70 -19
- package/templates/ops/prompts/mention.md +7 -2
- package/templates/ops/status-week.mjs +169 -0
- package/templates/portal/css/astryx.css +948 -0
- package/templates/portal/css/base.css +51 -110
- package/templates/portal/css/brain.css +26 -2
- package/templates/portal/css/connectors.css +58 -0
- package/templates/portal/css/graph.css +9 -12
- package/templates/portal/css/health.css +4 -7
- package/templates/portal/css/home.css +145 -60
- package/templates/portal/css/inbox.css +11 -0
- package/templates/portal/css/layout.css +18 -22
- package/templates/portal/css/markdown.css +22 -1
- package/templates/portal/css/routines.css +40 -0
- package/templates/portal/css/runs.css +5 -3
- package/templates/portal/css/search.css +3 -6
- package/templates/portal/css/setup.css +3 -15
- package/templates/portal/index.html +19 -3
- package/templates/portal/js/api.js +3 -0
- package/templates/portal/js/app.js +25 -1
- package/templates/portal/js/astryx-ui.js +34 -0
- package/templates/portal/js/dom.js +1 -1
- package/templates/portal/js/homesort.js +66 -20
- package/templates/portal/js/icons.js +6 -0
- package/templates/portal/js/md.js +7 -2
- package/templates/portal/js/refcard.js +216 -0
- package/templates/portal/js/refresh.js +4 -2
- package/templates/portal/js/report.js +51 -0
- package/templates/portal/js/select.js +362 -0
- package/templates/portal/js/state.js +14 -1
- package/templates/portal/js/views/connectors.js +423 -0
- package/templates/portal/js/views/graph.js +67 -28
- package/templates/portal/js/views/home.js +378 -176
- package/templates/portal/js/views/inbox.js +68 -16
- package/templates/portal/js/views/org.js +2 -0
- package/templates/portal/js/views/people.js +109 -0
- package/templates/portal/js/views/routines.js +378 -0
- package/templates/portal/js/views/runs.js +3 -1
- package/templates/skill/SKILL.md +115 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanocollective/roster",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.30",
|
|
4
4
|
"description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,10 +35,17 @@
|
|
|
35
35
|
"build:worker": "node scripts/build-worker.mjs"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@astryxdesign/core": "0.7.11",
|
|
39
|
+
"@astryxdesign/theme-neutral": "0.7.11",
|
|
38
40
|
"@biomejs/biome": "^2.5.12",
|
|
41
|
+
"@stylexjs/stylex": "^0.19.1",
|
|
39
42
|
"@types/node": "^22.10.2",
|
|
40
43
|
"c8": "^12.0.0",
|
|
44
|
+
"jsdom": "^31.0.0",
|
|
41
45
|
"knip": "^6.34.0",
|
|
46
|
+
"libsodium-wrappers": "^0.8.4",
|
|
47
|
+
"react": "^19.3.1",
|
|
48
|
+
"react-dom": "^19.3.1",
|
|
42
49
|
"tsup": "^8.3.5",
|
|
43
50
|
"tsx": "^4.19.2",
|
|
44
51
|
"typescript": "^5.7.2"
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
name: %%STAFF_UPPER%% daily run
|
|
2
2
|
|
|
3
|
-
# Generated by roster. The body lives in %%OPS_REPO%%/.github/workflows/session.yaml.
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Generated by roster from staff.yaml. The body lives in %%OPS_REPO%%/.github/workflows/session.yaml.
|
|
4
|
+
# The schedule is staff.yaml's `schedule:` (the daily round) and `routines:`; change those, in
|
|
5
|
+
# the portal or with `roster routine`, rather than this file.
|
|
6
6
|
#
|
|
7
7
|
# NOTE: %%TOKENS%% are filled by `roster hire`; GitHub's own ${{ }} are left alone.
|
|
8
8
|
|
|
9
|
-
# The trigger
|
|
10
|
-
# by this name.
|
|
11
|
-
run-name: "%%STAFF%% ${{ github.event_name == 'schedule' && 'daily' || inputs.trigger || 'manual' }}"
|
|
9
|
+
# The trigger, as the Actions list shows it: "cto daily", "cto routine monday-plan". The daily
|
|
10
|
+
# limit counts follow-on runs by this name.
|
|
11
|
+
run-name: "%%STAFF%% ${{ github.event_name == 'schedule' && (%%ROUTINE%% != '' && format('routine {0}', %%ROUTINE%%) || 'daily') || inputs.routine != '' && format('routine {0}', inputs.routine) || inputs.trigger || 'manual' }}"
|
|
12
12
|
|
|
13
13
|
on:
|
|
14
|
+
# The daily round first, then one line per routine. The cron that fired says which it was.
|
|
14
15
|
schedule:
|
|
15
|
-
|
|
16
|
+
%%SCHEDULES%%
|
|
16
17
|
# By hand, from Run once now, or as a follow-on: a daily run that ended with the next step
|
|
17
|
-
# ready starts one more, up to max_runs_per_day.
|
|
18
|
+
# ready starts one more, up to max_runs_per_day. `routine` runs one routine now.
|
|
18
19
|
workflow_dispatch:
|
|
19
20
|
inputs:
|
|
20
21
|
trigger:
|
|
@@ -22,6 +23,11 @@ on:
|
|
|
22
23
|
required: false
|
|
23
24
|
default: manual
|
|
24
25
|
type: string
|
|
26
|
+
routine:
|
|
27
|
+
description: "a routine's id, to run that routine now"
|
|
28
|
+
required: false
|
|
29
|
+
default: ""
|
|
30
|
+
type: string
|
|
25
31
|
|
|
26
32
|
# A second run while one is in flight would fight it over the tracker and the branch state. A
|
|
27
33
|
# follow-on is started from inside the run before it, so it waits here until that one ends.
|
|
@@ -41,19 +47,22 @@ jobs:
|
|
|
41
47
|
contents: read
|
|
42
48
|
issues: write
|
|
43
49
|
actions: write
|
|
50
|
+
id-token: write
|
|
44
51
|
uses: %%OPS_REPO%%/.github/workflows/session.yaml@main
|
|
45
52
|
with:
|
|
46
53
|
staff: %%STAFF%%
|
|
47
54
|
kind: daily
|
|
48
|
-
trigger: ${{ github.event_name == 'schedule' && 'daily' || inputs.trigger || 'manual' }}
|
|
55
|
+
trigger: ${{ github.event_name == 'schedule' && (%%ROUTINE%% != '' && 'routine' || 'daily') || inputs.routine != '' && 'routine' || inputs.trigger || 'manual' }}
|
|
56
|
+
routine: ${{ github.event_name == 'schedule' && %%ROUTINE%% || inputs.routine || '' }}
|
|
49
57
|
max_runs_per_day: %%MAX_RUNS%%
|
|
50
58
|
ops_repo: %%OPS_REPO%%
|
|
51
59
|
model: %%MODEL%%
|
|
52
60
|
timeout_minutes: %%TIMEOUT%%
|
|
53
61
|
allowed_tools: "%%ALLOWED_TOOLS%%"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
secret_prefix: %%SECRET_PREFIX%%
|
|
63
|
+
public_secret_prefix: %%PUBLIC_SECRET_PREFIX%%
|
|
64
|
+
agent_secret: %%AGENT_SECRET%%
|
|
65
|
+
# Inherited rather than listed, so a connector's key added later reaches the run without
|
|
66
|
+
# this file changing. session.yaml reads the App's pair and the agent credential by the
|
|
67
|
+
# names above, and each connector's key by the name its connector gives it.
|
|
68
|
+
secrets: inherit
|
|
@@ -16,7 +16,7 @@ name: %%STAFF_UPPER%% on a mention
|
|
|
16
16
|
# skipped.
|
|
17
17
|
run-name: >-
|
|
18
18
|
%%STAFF%% ${{
|
|
19
|
-
(contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
19
|
+
(contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
20
20
|
(contains(github.event.comment.body, '%%MENTION%%') ||
|
|
21
21
|
(github.event_name == 'issues' && contains(github.event.issue.body, '%%MENTION%%'))))
|
|
22
22
|
&& 'mention'
|
|
@@ -72,10 +72,10 @@ jobs:
|
|
|
72
72
|
cancel-in-progress: false
|
|
73
73
|
if: >-
|
|
74
74
|
(
|
|
75
|
-
contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
75
|
+
contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
76
76
|
(
|
|
77
77
|
(github.event_name == 'issue_comment' &&
|
|
78
|
-
contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.comment.user.login) &&
|
|
78
|
+
contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.comment.user.login) &&
|
|
79
79
|
contains(github.event.comment.body, '%%MENTION%%')) ||
|
|
80
80
|
(github.event_name == 'issues' &&
|
|
81
81
|
contains(github.event.issue.body, '%%MENTION%%'))
|
|
@@ -97,11 +97,12 @@ jobs:
|
|
|
97
97
|
contents: read
|
|
98
98
|
issues: write
|
|
99
99
|
actions: write
|
|
100
|
+
id-token: write
|
|
100
101
|
uses: %%OPS_REPO%%/.github/workflows/session.yaml@main
|
|
101
102
|
with:
|
|
102
103
|
staff: %%STAFF%%
|
|
103
104
|
kind: mention
|
|
104
|
-
trigger: ${{ contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) && 'mention' || 'peer' }}
|
|
105
|
+
trigger: ${{ contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) && 'mention' || 'peer' }}
|
|
105
106
|
max_runs_per_day: %%MAX_RUNS%%
|
|
106
107
|
ops_repo: %%OPS_REPO%%
|
|
107
108
|
model: %%MODEL%%
|
|
@@ -109,9 +110,10 @@ jobs:
|
|
|
109
110
|
allowed_tools: "%%ALLOWED_TOOLS%%"
|
|
110
111
|
issue_number: ${{ github.event.issue.number }}
|
|
111
112
|
comment_id: ${{ github.event.comment.id }}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
secret_prefix: %%SECRET_PREFIX%%
|
|
114
|
+
public_secret_prefix: %%PUBLIC_SECRET_PREFIX%%
|
|
115
|
+
agent_secret: %%AGENT_SECRET%%
|
|
116
|
+
# Inherited rather than listed, so a connector's key added later reaches the run without
|
|
117
|
+
# this file changing. session.yaml reads the App's pair and the agent credential by the
|
|
118
|
+
# names above, and each connector's key by the name its connector gives it.
|
|
119
|
+
secrets: inherit
|
|
@@ -45,5 +45,5 @@ Only the additions. `org/guardrails.md` is already binding on everyone.
|
|
|
45
45
|
|
|
46
46
|
## Where the rest of it lives
|
|
47
47
|
|
|
48
|
-
Point at `memory/INDEX.md`, `log/decisions.md`, the pinned status issue, and
|
|
49
|
-
surfaces this role declares in `staff.yaml`.
|
|
48
|
+
Point at `memory/INDEX.md`, `log/decisions.md`, `STATE.md`, the pinned status issue, and
|
|
49
|
+
whatever surfaces this role declares in `staff.yaml`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Where I am
|
|
2
|
+
|
|
3
|
+
%%NAME%%'s handover between runs. Every daily run reads it first and rewrites it last. What
|
|
4
|
+
people read is the pinned status issue.
|
|
5
|
+
|
|
6
|
+
## Situation
|
|
7
|
+
|
|
8
|
+
Just hired. Nothing done yet.
|
|
9
|
+
|
|
10
|
+
## Next, in order
|
|
11
|
+
|
|
12
|
+
1. Read the charter and the org's priorities, and pick the first piece of work.
|
|
13
|
+
|
|
14
|
+
## Parked
|
|
15
|
+
|
|
16
|
+
Nothing.
|
|
@@ -18,7 +18,7 @@ The grammar, which `roster lint` enforces:
|
|
|
18
18
|
|
|
19
19
|
- **`<slug>`** · [<%%HUMAN_MARKER%%|measured|derived>] <the fact, one line>. **So:** <what it changes>. · [note](notes/<slug>.md)
|
|
20
20
|
|
|
21
|
-
`log/decisions.md` = why things were decided.
|
|
21
|
+
`log/decisions.md` = why things were decided. `STATE.md` = what is outstanding.
|
|
22
22
|
**Nothing is copied between them.**
|
|
23
23
|
|
|
24
24
|
---
|
|
@@ -10,6 +10,9 @@ brain: %%BRAIN%%
|
|
|
10
10
|
status_issue: %%STATUS_ISSUE%%
|
|
11
11
|
|
|
12
12
|
schedule: "%%SCHEDULE%%"
|
|
13
|
+
# Times this staff member wakes beyond the daily round, each with its own job in
|
|
14
|
+
# routines/<id>.md. Times are UTC. Edit them in the portal or with `roster routine`.
|
|
15
|
+
routines: []
|
|
13
16
|
model: %%MODEL%%
|
|
14
17
|
timeout_minutes: %%TIMEOUT%%
|
|
15
18
|
mention_timeout_minutes: %%MENTION_TIMEOUT%%
|
|
@@ -19,7 +19,7 @@ on:
|
|
|
19
19
|
required: false
|
|
20
20
|
default: daily
|
|
21
21
|
type: string
|
|
22
|
-
# What started the run: daily | manual | follow-on | mention | peer. Peer and follow-on
|
|
22
|
+
# What started the run: daily | routine | manual | follow-on | mention | peer. Peer and follow-on
|
|
23
23
|
# runs start without a person asking, so they are the ones held to max_runs_per_day.
|
|
24
24
|
trigger:
|
|
25
25
|
required: false
|
|
@@ -45,6 +45,29 @@ on:
|
|
|
45
45
|
required: false
|
|
46
46
|
default: "Bash,Read,Write,Edit,Glob,Grep,WebFetch,WebSearch"
|
|
47
47
|
type: string
|
|
48
|
+
# Which of the caller's secrets are this staff member's. A caller passes its secrets with
|
|
49
|
+
# `secrets: inherit`, so that a connector's key reaches the run without the caller naming
|
|
50
|
+
# it, and `secrets: inherit` cannot rename: CTO_APP_ID stays CTO_APP_ID. These say which
|
|
51
|
+
# names to read. Empty on a caller written before connectors, which maps the secrets by
|
|
52
|
+
# hand instead, and then the mapped names below are the ones read.
|
|
53
|
+
secret_prefix:
|
|
54
|
+
required: false
|
|
55
|
+
default: ""
|
|
56
|
+
type: string
|
|
57
|
+
public_secret_prefix:
|
|
58
|
+
required: false
|
|
59
|
+
default: ""
|
|
60
|
+
type: string
|
|
61
|
+
agent_secret:
|
|
62
|
+
required: false
|
|
63
|
+
default: ""
|
|
64
|
+
type: string
|
|
65
|
+
# The routine this run is, by id: routines/<id>.md in the brain says what to do. Empty on
|
|
66
|
+
# the daily round, and on a caller generated before routines existed.
|
|
67
|
+
routine:
|
|
68
|
+
required: false
|
|
69
|
+
default: ""
|
|
70
|
+
type: string
|
|
48
71
|
# Trigger context. Empty on a scheduled run; set when a comment woke us.
|
|
49
72
|
issue_number:
|
|
50
73
|
required: false
|
|
@@ -54,11 +77,13 @@ on:
|
|
|
54
77
|
required: false
|
|
55
78
|
default: ""
|
|
56
79
|
type: string
|
|
80
|
+
# None of these is required, because a caller that inherits passes them under its own names
|
|
81
|
+
# (see secret_prefix above), and GitHub checks `required` against the names declared here.
|
|
57
82
|
secrets:
|
|
58
83
|
APP_ID:
|
|
59
|
-
required:
|
|
84
|
+
required: false
|
|
60
85
|
APP_PRIVATE_KEY:
|
|
61
|
-
required:
|
|
86
|
+
required: false
|
|
62
87
|
PUBLIC_APP_ID:
|
|
63
88
|
required: false
|
|
64
89
|
PUBLIC_APP_PRIVATE_KEY:
|
|
@@ -133,15 +158,18 @@ jobs:
|
|
|
133
158
|
|
|
134
159
|
# `issues: write` is for the failure notice alone, which falls back to this job's own token
|
|
135
160
|
# when the App's cannot be minted. `actions: write` starts a follow-on run. A called workflow
|
|
136
|
-
# cannot raise what its caller granted, so the callers ask for the same.
|
|
161
|
+
# cannot raise what its caller granted, so the callers ask for the same. `id-token: write`
|
|
162
|
+
# lets a run prove to the hosted portal which repo it is, which is how it collects a
|
|
163
|
+
# signed-in connector's access token without a shared secret.
|
|
137
164
|
permissions:
|
|
138
165
|
contents: read
|
|
139
166
|
issues: write
|
|
140
167
|
actions: write
|
|
168
|
+
id-token: write
|
|
141
169
|
|
|
142
170
|
# secrets are not usable in a step-level `if`, so the presence check is hoisted here.
|
|
143
171
|
env:
|
|
144
|
-
HAS_PUBLIC_APP: ${{ secrets.PUBLIC_APP_ID != '' }}
|
|
172
|
+
HAS_PUBLIC_APP: ${{ (secrets.PUBLIC_APP_ID || secrets[format('{0}_APP_ID', inputs.public_secret_prefix)]) != '' }}
|
|
145
173
|
# Nothing is listening once the agent ends its turn: the session is over and a background
|
|
146
174
|
# job dies with the runner. Claude Code moves any command past its timeout (ten minutes by
|
|
147
175
|
# default) into the background, and an agent told "you will be notified" ends its turn to
|
|
@@ -160,8 +188,8 @@ jobs:
|
|
|
160
188
|
id: private
|
|
161
189
|
uses: actions/create-github-app-token@v2
|
|
162
190
|
with:
|
|
163
|
-
app-id: ${{ secrets.APP_ID }}
|
|
164
|
-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
191
|
+
app-id: ${{ secrets.APP_ID || secrets[format('{0}_APP_ID', inputs.secret_prefix)] }}
|
|
192
|
+
private-key: ${{ secrets.APP_PRIVATE_KEY || secrets[format('{0}_APP_PRIVATE_KEY', inputs.secret_prefix)] }}
|
|
165
193
|
owner: ${{ github.repository_owner }}
|
|
166
194
|
|
|
167
195
|
# A PR opened with the default GITHUB_TOKEN does not trigger pull_request workflows, so CI
|
|
@@ -171,8 +199,8 @@ jobs:
|
|
|
171
199
|
if: env.HAS_PUBLIC_APP == 'true'
|
|
172
200
|
uses: actions/create-github-app-token@v2
|
|
173
201
|
with:
|
|
174
|
-
app-id: ${{ secrets.PUBLIC_APP_ID }}
|
|
175
|
-
private-key: ${{ secrets.PUBLIC_APP_PRIVATE_KEY }}
|
|
202
|
+
app-id: ${{ secrets.PUBLIC_APP_ID || secrets[format('{0}_APP_ID', inputs.public_secret_prefix)] }}
|
|
203
|
+
private-key: ${{ secrets.PUBLIC_APP_PRIVATE_KEY || secrets[format('{0}_APP_PRIVATE_KEY', inputs.public_secret_prefix)] }}
|
|
176
204
|
owner: ${{ github.repository_owner }}
|
|
177
205
|
|
|
178
206
|
# Tell the human it was heard. This is the only signal between the request and the reply
|
|
@@ -310,6 +338,18 @@ jobs:
|
|
|
310
338
|
cache: pnpm
|
|
311
339
|
cache-dependency-path: ${{ steps.plan.outputs.package_json }}
|
|
312
340
|
|
|
341
|
+
# A status issue lasts a week. The first daily run of a week opens the new one, pins it and
|
|
342
|
+
# moves staff.yaml on, before the prompt is composed from staff.yaml; the prompt is told
|
|
343
|
+
# which earlier week still needs its summary. `daily` only: a mention is not a session.
|
|
344
|
+
# Never fatal: without it the run writes to last week's issue.
|
|
345
|
+
- name: Open this week's status issue
|
|
346
|
+
id: week
|
|
347
|
+
if: inputs.kind == 'daily'
|
|
348
|
+
continue-on-error: true
|
|
349
|
+
env:
|
|
350
|
+
GH_TOKEN: ${{ steps.private.outputs.token }}
|
|
351
|
+
run: node roster-ops/status-week.mjs --staff "${{ inputs.staff }}" --ops roster-ops --brains . >> "$GITHUB_OUTPUT"
|
|
352
|
+
|
|
313
353
|
# Composed at run time rather than baked in, so editing org/voice.md reaches every staff
|
|
314
354
|
# member on their next run without regenerating anything.
|
|
315
355
|
- name: Compose the prompt
|
|
@@ -320,7 +360,9 @@ jobs:
|
|
|
320
360
|
"comment_id":"${{ inputs.comment_id }}",
|
|
321
361
|
"repo":"${{ github.repository }}",
|
|
322
362
|
"actor":"${{ github.actor }}",
|
|
323
|
-
"trigger":"${{ inputs.trigger }}"
|
|
363
|
+
"trigger":"${{ inputs.trigger }}",
|
|
364
|
+
"routine":"${{ inputs.routine }}",
|
|
365
|
+
"previous_status_issue":"${{ steps.week.outputs.previous }}"}
|
|
324
366
|
run: |
|
|
325
367
|
node roster-ops/compose.mjs --staff "${{ inputs.staff }}" --kind "${{ inputs.kind }}" --ops roster-ops --brains . > .roster-prompt.txt
|
|
326
368
|
{
|
|
@@ -334,7 +376,7 @@ jobs:
|
|
|
334
376
|
# forty lines into a log, after the checkout has already happened.
|
|
335
377
|
- name: Check the agent has a credential
|
|
336
378
|
env:
|
|
337
|
-
A: ${{ secrets.AGENT_TOKEN }}
|
|
379
|
+
A: ${{ secrets.AGENT_TOKEN || secrets[inputs.agent_secret] }}
|
|
338
380
|
B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
339
381
|
run: |
|
|
340
382
|
if [ -z "$A" ] && [ -z "$B" ]; then
|
|
@@ -342,10 +384,47 @@ jobs:
|
|
|
342
384
|
exit 1
|
|
343
385
|
fi
|
|
344
386
|
|
|
387
|
+
# The services this staff member may use (`connectors:` in org.yaml), written as the
|
|
388
|
+
# running agent's own MCP config, with each key read from the caller's secrets. The file
|
|
389
|
+
# goes in the runner's temp directory, outside every checkout, so no commit can carry it.
|
|
390
|
+
# Never fatal: a connector without its key is left out and named in the summary, and the
|
|
391
|
+
# run goes ahead without it.
|
|
392
|
+
#
|
|
393
|
+
# `toJSON(secrets)` is read by this step alone. Nothing else in the job sees the secrets
|
|
394
|
+
# it does not name, and the agent sees only the keys of its own connectors, inside the file.
|
|
395
|
+
- name: Connect services
|
|
396
|
+
id: connectors
|
|
397
|
+
if: hashFiles('roster-ops/connectors.mjs') != ''
|
|
398
|
+
continue-on-error: true
|
|
399
|
+
env:
|
|
400
|
+
ROSTER_SECRETS: ${{ toJSON(secrets) }}
|
|
401
|
+
ROSTER_PORTAL_TOKEN_URL: ${{ vars.ROSTER_PORTAL_URL }}
|
|
402
|
+
run: node roster-ops/connectors.mjs --staff "${{ inputs.staff }}" --ops roster-ops --brains . --out "$RUNNER_TEMP/roster-connectors" >> "$GITHUB_OUTPUT"
|
|
403
|
+
|
|
345
404
|
- name: Work out which agent runs this
|
|
346
405
|
id: agent
|
|
406
|
+
env:
|
|
407
|
+
ROSTER_CONNECTORS: ${{ steps.connectors.outputs.file }}
|
|
347
408
|
run: node roster-ops/agents.mjs --staff "${{ inputs.staff }}" --ops roster-ops --brains . >> "$GITHUB_OUTPUT"
|
|
348
409
|
|
|
410
|
+
# On a pull request the action treats its working directory as the PR's checkout: it
|
|
411
|
+
# re-points `origin`, runs `git diff HEAD` and restores .claude/ and CLAUDE.md from the
|
|
412
|
+
# base branch. Here the working directory is the workspace root, which holds the checkouts
|
|
413
|
+
# but is not one, so its git calls fail and the run dies before the agent starts. An empty
|
|
414
|
+
# repo with one commit and an `origin` gives it something to work on. Every path is
|
|
415
|
+
# ignored, so the checkouts inside it never show as untracked. Nothing from the PR is at
|
|
416
|
+
# the root, so the restore has nothing to protect against.
|
|
417
|
+
- name: Give the action a repo to work in
|
|
418
|
+
if: steps.agent.outputs.kind == 'action' && (github.event.issue.pull_request || github.event.pull_request)
|
|
419
|
+
run: |
|
|
420
|
+
set -euo pipefail
|
|
421
|
+
[ -d .git ] && exit 0
|
|
422
|
+
git init --quiet
|
|
423
|
+
echo '*' >> .git/info/exclude
|
|
424
|
+
git -c user.name=roster -c user.email=roster@users.noreply.github.com \
|
|
425
|
+
commit --quiet --allow-empty -m "workspace root"
|
|
426
|
+
git remote add origin "https://github.com/${{ github.repository }}.git"
|
|
427
|
+
|
|
349
428
|
# `uses:` cannot be an expression, so an Action-based runner has to be written out
|
|
350
429
|
# literally. This is the reference one; every other agent goes through the step below.
|
|
351
430
|
- name: Run the session
|
|
@@ -356,7 +435,7 @@ jobs:
|
|
|
356
435
|
GH_TOKEN: ${{ steps.private.outputs.token }}
|
|
357
436
|
PUBLIC_TOKEN: ${{ steps.public.outputs.token }}
|
|
358
437
|
with:
|
|
359
|
-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN || secrets.AGENT_TOKEN }}
|
|
438
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN || secrets.AGENT_TOKEN || secrets[inputs.agent_secret] }}
|
|
360
439
|
# The action refuses to run for a bot unless it is named here. A peer's ask is opened
|
|
361
440
|
# by that peer's App, so on a peer run, and only then, the one bot that opened it is
|
|
362
441
|
# allowed. The caller has already checked it is an App, not this staff member's own,
|
|
@@ -392,7 +471,7 @@ jobs:
|
|
|
392
471
|
AGENT_FLAGS: ${{ steps.agent.outputs.flags }}
|
|
393
472
|
# Kept for a custom `run` written before permissions existed.
|
|
394
473
|
AGENT_TOOLS: ${{ inputs.allowed_tools }}
|
|
395
|
-
AGENT_TOKEN: ${{ secrets.AGENT_TOKEN }}
|
|
474
|
+
AGENT_TOKEN: ${{ secrets.AGENT_TOKEN || secrets[inputs.agent_secret] }}
|
|
396
475
|
FALLBACK_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
397
476
|
TOKEN_ENV: ${{ steps.agent.outputs.token_env }}
|
|
398
477
|
INSTALL: ${{ steps.agent.outputs.install }}
|
package/templates/ops/agents.mjs
CHANGED
|
@@ -136,7 +136,7 @@ export const PRESETS = {
|
|
|
136
136
|
* anything written out longhand. A tenant that needs an agent nobody has heard of writes
|
|
137
137
|
* `install`, `run` and `token_env` and never touches this file.
|
|
138
138
|
*/
|
|
139
|
-
export function resolveAgent(org, staff = {}) {
|
|
139
|
+
export function resolveAgent(org, staff = {}, extra = {}) {
|
|
140
140
|
const asked = staff.agent ?? org.agent ?? {};
|
|
141
141
|
const spec = typeof asked === "string" ? { id: asked } : asked;
|
|
142
142
|
const id = spec.id ?? "claude-code-action";
|
|
@@ -163,7 +163,7 @@ export function resolveAgent(org, staff = {}) {
|
|
|
163
163
|
token_env: merged.token_env,
|
|
164
164
|
// The staff member's own model wins; then the agent's default. Empty means "the agent's".
|
|
165
165
|
model: staff.model ?? merged.model ?? "",
|
|
166
|
-
flags: flagsFor(merged, spec, org, staff),
|
|
166
|
+
flags: flagsFor(merged, spec, org, staff, extra),
|
|
167
167
|
config: merged.config ?? null,
|
|
168
168
|
};
|
|
169
169
|
}
|
|
@@ -183,24 +183,27 @@ export const LEVELS = ["read-only", "workspace", "full"];
|
|
|
183
183
|
* `options` is the escape hatch, in that agent's own vocabulary, spelled onto its command line
|
|
184
184
|
* by the preset. Anything roster does not model is still reachable without waiting for us.
|
|
185
185
|
*/
|
|
186
|
-
function flagsFor(merged, spec, org, staff) {
|
|
186
|
+
function flagsFor(merged, spec, org, staff, extra = {}) {
|
|
187
187
|
const out = [];
|
|
188
|
-
const asked =
|
|
189
|
-
if (!LEVELS.includes(asked)) {
|
|
190
|
-
throw new Error(`unknown permissions "${asked}". One of: ${LEVELS.join(", ")}`);
|
|
191
|
-
}
|
|
188
|
+
const asked = permissionOf(org, staff);
|
|
192
189
|
|
|
193
190
|
/* `allowed_tools` predates the levels and is Claude's own vocabulary, so it still wins for
|
|
194
191
|
an agent that takes a tool list. Nothing translates it for the others: a list written for
|
|
195
192
|
one tool is not a permission level for another, and guessing would be worse than saying so. */
|
|
196
193
|
const tools = staff.allowed_tools ?? org.defaults?.allowed_tools;
|
|
197
194
|
const table = merged.permissions;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
/* A connector's tools join the list, or Claude would be handed an MCP server and forbidden
|
|
196
|
+
to call it. Only for an agent that takes a list: the others gate a server by its config. */
|
|
197
|
+
const more = (extra.tools ?? []).filter(Boolean);
|
|
198
|
+
if (table === CLAUDE_TOOLS) {
|
|
199
|
+
const base = tools
|
|
200
|
+
? (Array.isArray(tools) ? tools.join(",") : String(tools)).replace(/\s+/g, "")
|
|
201
|
+
: CLAUDE_TOOLS[asked].match(/"([^"]*)"/)[1];
|
|
202
|
+
out.push(`--allowedTools "${[base, ...more].filter(Boolean).join(",")}"`);
|
|
201
203
|
} else if (table) {
|
|
202
204
|
out.push(table[asked]);
|
|
203
205
|
}
|
|
206
|
+
if (extra.flags) out.push(extra.flags);
|
|
204
207
|
|
|
205
208
|
const options = { ...(spec.options ?? {}), ...(staff.options ?? {}) };
|
|
206
209
|
const speller = merged.option;
|
|
@@ -217,10 +220,24 @@ function flagsFor(merged, spec, org, staff) {
|
|
|
217
220
|
return out.filter(Boolean).join(" ");
|
|
218
221
|
}
|
|
219
222
|
|
|
223
|
+
/** The level a staff member runs at: their own, else the agent's, else the org's, else full. */
|
|
224
|
+
export function permissionOf(org, staff = {}) {
|
|
225
|
+
const agent = staff.agent ?? org.agent;
|
|
226
|
+
const spec = agent && typeof agent === "object" ? agent : {};
|
|
227
|
+
const level = staff.permissions ?? spec.permissions ?? org.permissions ?? "full";
|
|
228
|
+
if (!LEVELS.includes(level)) {
|
|
229
|
+
throw new Error(`unknown permissions "${level}". One of: ${LEVELS.join(", ")}`);
|
|
230
|
+
}
|
|
231
|
+
return level;
|
|
232
|
+
}
|
|
233
|
+
|
|
220
234
|
function strip(o) {
|
|
221
235
|
const out = {};
|
|
222
236
|
for (const [k, v] of Object.entries(o)) if (v !== undefined && v !== null && v !== "") out[k] = v;
|
|
223
237
|
delete out.id;
|
|
238
|
+
// The spec's `permissions` is a level, one word, and permissionOf reads it from the spec.
|
|
239
|
+
// Merged in, it would replace the preset's table of spellings and leave no flags at all.
|
|
240
|
+
delete out.permissions;
|
|
224
241
|
return out;
|
|
225
242
|
}
|
|
226
243
|
|
|
@@ -248,7 +265,17 @@ if (import.meta.url === `file://${process.argv[1]}`) {
|
|
|
248
265
|
/* A staff member with no manifest is doctor's problem; the org's default still resolves. */
|
|
249
266
|
}
|
|
250
267
|
|
|
251
|
-
|
|
268
|
+
/* What connectors.mjs wired up for this run, if anything: flags for the command line and
|
|
269
|
+
tool names for the allowlist. Paths only; the keys are in files this never reads. */
|
|
270
|
+
let wiring = {};
|
|
271
|
+
if (process.env.ROSTER_CONNECTORS) {
|
|
272
|
+
try {
|
|
273
|
+
wiring = JSON.parse(readFileSync(process.env.ROSTER_CONNECTORS, "utf8"));
|
|
274
|
+
} catch {
|
|
275
|
+
process.stderr.write("agents: the connectors' wiring could not be read, so none are used\n");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const agent = resolveAgent(org, manifest, wiring);
|
|
252
279
|
const out = [
|
|
253
280
|
`kind=${agent.kind}`,
|
|
254
281
|
`id=${agent.id}`,
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
import * as nodeFs from "node:fs";
|
|
15
15
|
import { join, dirname, resolve } from "node:path";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
// Beside this file in a tenant, but read without failing when it is not: an ops repo vendored
|
|
18
|
+
// before connectors existed still composes, with no services in its prompts.
|
|
19
|
+
const { connectorsOf } = await import("./connectors.mjs").catch(() => ({ connectorsOf: () => [] }));
|
|
17
20
|
|
|
18
21
|
// ---------------------------------------------------------------------------
|
|
19
22
|
// A strict, tiny YAML subset: nested maps, lists of scalars, lists of inline
|
|
@@ -242,7 +245,9 @@ function truthy(v) {
|
|
|
242
245
|
// Who the staff answer to
|
|
243
246
|
//
|
|
244
247
|
// One person was written as `human:`. More than one is a `humans:` list. Both are read, the
|
|
245
|
-
// singular still works, and the first entry is the one the prose addresses.
|
|
248
|
+
// singular still works, and the first entry is the one the prose addresses. Anyone marked
|
|
249
|
+
// `view_only` reads along and nothing more: they are left out of everything that says who the
|
|
250
|
+
// staff answer to, and named only so a staff member knows what not to act on. Duplicated in
|
|
246
251
|
// roster's own src/lib/humans.ts rather than imported, for the same reason the YAML parser
|
|
247
252
|
// above is: a run must not depend on npm or on a network call.
|
|
248
253
|
// ---------------------------------------------------------------------------
|
|
@@ -260,11 +265,30 @@ export function readHumans(org) {
|
|
|
260
265
|
name: name || github,
|
|
261
266
|
marker: String(entry.marker ?? "").trim() || defaultMarker(name || github),
|
|
262
267
|
role: entry.role ?? undefined,
|
|
268
|
+
...(handlesOf(entry.handles).length ? { handles: handlesOf(entry.handles) } : {}),
|
|
269
|
+
...(entry.view_only === true ? { viewOnly: true } : {}),
|
|
263
270
|
});
|
|
264
271
|
}
|
|
265
272
|
return out;
|
|
266
273
|
}
|
|
267
274
|
|
|
275
|
+
/** `handles: [marketing, content]`, or one string, as a list of what that person looks after. */
|
|
276
|
+
function handlesOf(v) {
|
|
277
|
+
const list = Array.isArray(v) ? v : v ? String(v).split(",") : [];
|
|
278
|
+
return list.map((x) => String(x ?? "").trim()).filter(Boolean);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** Who looks after what, one line each, for when there is more than one person to ask. */
|
|
282
|
+
export function handlesList(humans) {
|
|
283
|
+
if (humans.length < 2 || !humans.some((h) => h.handles?.length)) return "";
|
|
284
|
+
return humans
|
|
285
|
+
.map((h) => {
|
|
286
|
+
const who = `- **${h.name}**${h.github ? ` (@${h.github}, label \`${h.marker}\`)` : ""}`;
|
|
287
|
+
return h.handles?.length ? `${who}: ${h.handles.join(", ")}` : `${who}: anything else`;
|
|
288
|
+
})
|
|
289
|
+
.join("\n");
|
|
290
|
+
}
|
|
291
|
+
|
|
268
292
|
/** "Will (@will-lamerton) and Sam (@sam)", for a sentence in a prompt. */
|
|
269
293
|
export function humanSentence(humans) {
|
|
270
294
|
const parts = humans.map((h) => (h.github ? `${h.name} (@${h.github})` : h.name));
|
|
@@ -342,13 +366,33 @@ export function compose({
|
|
|
342
366
|
follow_on: trigger === "follow-on",
|
|
343
367
|
};
|
|
344
368
|
|
|
369
|
+
// A routine run carries the routine's id; what to do is the person's own words in
|
|
370
|
+
// routines/<id>.md. Read as a value, never rendered as a template, like the in-flight list.
|
|
371
|
+
const routineId = String(event.routine ?? "");
|
|
372
|
+
let routine = null;
|
|
373
|
+
if (/^[a-z0-9][a-z0-9-]{0,39}$/.test(routineId)) {
|
|
374
|
+
const file = join(brainDir, "routines", `${routineId}.md`);
|
|
375
|
+
if (existsSync(file)) {
|
|
376
|
+
const text = readFileSync(file, "utf8").trimStart();
|
|
377
|
+
const heading = /^#\s+(.+)\n?/.exec(text);
|
|
378
|
+
routine = {
|
|
379
|
+
id: routineId,
|
|
380
|
+
title: heading ? heading[1].trim() : routineId,
|
|
381
|
+
body: (heading ? text.slice(heading[0].length) : text).trim(),
|
|
382
|
+
};
|
|
383
|
+
} else {
|
|
384
|
+
routine = { id: routineId, title: routineId, body: "", missing: true };
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
345
388
|
// What people have open on the product repos, gathered by inflight.mjs just before this runs.
|
|
346
389
|
// Read as a value and never rendered as a template: it is PR titles, which are a person's
|
|
347
390
|
// words, and a `{{` in one must not be able to break composition.
|
|
348
391
|
const inflightFile = join(runDir ?? join(brainsDir, ".roster-run"), "inflight.md");
|
|
349
392
|
const inflight = existsSync(inflightFile) ? readFileSync(inflightFile, "utf8").trim() : "";
|
|
350
393
|
|
|
351
|
-
const
|
|
394
|
+
const everyone = readHumans(org);
|
|
395
|
+
const humans = everyone.filter((h) => !h.viewOnly);
|
|
352
396
|
const ctx = {
|
|
353
397
|
org,
|
|
354
398
|
event,
|
|
@@ -373,6 +417,7 @@ export function compose({
|
|
|
373
417
|
peers,
|
|
374
418
|
peer: peers[0] ?? null,
|
|
375
419
|
kind,
|
|
420
|
+
routine,
|
|
376
421
|
// Convenience strings the fragments lean on, computed once here so a
|
|
377
422
|
// fragment never has to do string work.
|
|
378
423
|
peer_list: peers.map((p) => `- \`${p.dir}/\` - the ${p.name}'s brain`).join("\n"),
|
|
@@ -382,6 +427,19 @@ export function compose({
|
|
|
382
427
|
human_list: humanSentence(humans),
|
|
383
428
|
inflight,
|
|
384
429
|
humans_extra: humanSentence(humans.slice(1)),
|
|
430
|
+
// Who looks after what, when an org has said. Empty for one person, and the rule goes.
|
|
431
|
+
humans_handles: handlesList(humans),
|
|
432
|
+
// Who can read along and cannot rule. Empty, and the paragraph gone, when nobody is.
|
|
433
|
+
humans_viewing: humanSentence(everyone.filter((h) => h.viewOnly)),
|
|
434
|
+
// The services this staff member may use, as a list for the prompt. Empty, and the section
|
|
435
|
+
// gone, when they have none. Whether each one's key is present is only known in the run.
|
|
436
|
+
connectors: connectorsOf(org, staff)
|
|
437
|
+
.filter((c) => !c.problem)
|
|
438
|
+
.map((c) => {
|
|
439
|
+
const ro = c.readOnly || self.permissions === "read-only";
|
|
440
|
+
return `- **${c.name}**, as the \`${c.id}\` MCP server${ro ? ", read only" : ""}`;
|
|
441
|
+
})
|
|
442
|
+
.join("\n"),
|
|
385
443
|
};
|
|
386
444
|
|
|
387
445
|
// "staff:foo.md" resolves inside the staff member's own brain repo, which is how a
|