mainsequence 9.0.27.dev71__py3-none-any.whl → 9.0.29.dev72__py3-none-any.whl

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 (23) hide show
  1. agent_scaffold/skills/mainsequence-inference/SKILL.md +12 -9
  2. agent_scaffold/skills/maintenance/bug_auditor/SKILL.md +11 -7
  3. agent_scaffold/skills/maintenance/code_repository_maintenance/SKILL.md +15 -13
  4. agent_scaffold/skills/platform_operations/access_control_and_sharing/SKILL.md +275 -27
  5. agent_scaffold/skills/platform_operations/orchestration_and_releases/SKILL.md +11 -0
  6. agent_scaffold/skills/sdk_code_repository_execution/SKILL.md +3 -6
  7. mainsequence/cli/api.py +860 -912
  8. mainsequence/cli/cli.py +1287 -851
  9. mainsequence/client/__init__.py +2 -0
  10. mainsequence/client/access_catalog.py +335 -0
  11. mainsequence/client/agent_runtime_models.py +29 -3
  12. mainsequence/client/base.py +10 -1
  13. mainsequence/client/models_foundry.py +186 -11
  14. mainsequence/client/models_helpers.py +64 -7
  15. mainsequence/client/models_user.py +189 -73
  16. mainsequence/client/object_access.py +581 -0
  17. mainsequence/runtime_credential_exchange.py +7 -7
  18. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/METADATA +1 -1
  19. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/RECORD +23 -21
  20. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/WHEEL +0 -0
  21. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/entry_points.txt +0 -0
  22. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/licenses/LICENSE +0 -0
  23. {mainsequence-9.0.27.dev71.dist-info → mainsequence-9.0.29.dev72.dist-info}/top_level.txt +0 -0
@@ -50,15 +50,18 @@ credential storage and must not appear in messages or `provider_options`.
50
50
 
51
51
  Pass optional `custom_id="openai-work"` to `client.complete()` to select that named
52
52
  credential within the caller's Environment. Omit it to retain the first available
53
- owned credential, then the first shared credential. A missing or ambiguous explicit
54
- name fails; do not retry using a different credential. Recorded requests retain the
55
- exact credential UID for replay. Custom endpoints use their existing provider
56
- identifier and do not accept `custom_id`.
57
-
58
- Sharing a configured provider authorizes recipients, including workload users,
59
- to use its credentials and receive them in local Tau. They may copy those credentials;
60
- revoking a share cannot remove copies already delivered. Explain this before
61
- guiding someone through sharing. This inference client executes on the server;
53
+ owned credential, then the first credential of another person that the caller may
54
+ use through its policies. A missing or ambiguous explicit name fails; do not retry
55
+ using a different credential. Recorded requests retain the exact credential UID for
56
+ replay. Custom endpoints use their existing provider identifier and do not accept
57
+ `custom_id`.
58
+
59
+ A credential's `user` policy authorizes its holders, including workload users,
60
+ to use it and receive it in local Tau; a custom model provider's `user` policy lets
61
+ them send requests through it and receive its stored authentication in local Tau.
62
+ Holders may copy a delivered credential or authentication; detaching the policy
63
+ cannot remove copies already delivered. Explain this before guiding someone
64
+ through giving the `user` policy. This inference client executes on the server;
62
65
  provider management remains with the existing provider clients.
63
66
 
64
67
  ## Construct a completion envelope
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: doc-bug-auditor
3
- description: Reviews a Main Sequence CodeRepository for status, blockers, failures, and completion.
3
+ description: Diagnose failures and assess requested work in the current repository using code, logs, tests, and the installed Main Sequence SDK. Use for failure classification, SDK contract mismatches, and evidence-based completion checks.
4
4
  ---
5
5
 
6
6
  # Main Sequence Bug Auditor
@@ -17,6 +17,11 @@ Use this skill to inspect a checked-out Main Sequence CodeRepository and determi
17
17
 
18
18
  This skill is for diagnosis and assessment. Default behavior is read-only unless the task explicitly asks for edits.
19
19
 
20
+ Limit the assessment to the requested work in the current repository. Use this
21
+ skill directly; no prior routing skill or platform catalog is required. Local
22
+ diagnosis needs no signed-in session. Authenticate only when the requested
23
+ investigation requires live platform verification.
24
+
20
25
  ## This Skill Can Do
21
26
 
22
27
  - inspect CodeRepository state and summarize completion status
@@ -45,13 +50,12 @@ This skill must not claim ownership of:
45
50
 
46
51
  This skill audits. It does not implement by default.
47
52
 
48
- ## Route Adjacent Work
53
+ ## Related Skills When Needed
54
+
55
+ Consult these only when the failing operation needs their contract or the user
56
+ requests follow-up work. They are not prerequisites for starting or completing
57
+ an audit:
49
58
 
50
- - Product architecture, platform ontology, and CodeRepository Blueprint work:
51
- use the matching platform-owned design skill declared by the installed
52
- platform catalog; do not assume its filesystem path
53
- - bootstrap, routing, and repository structure:
54
- `.agents/skills/mainsequence/sdk_code_repository_execution/SKILL.md`
55
59
  - MetaTable and table-update implementation issues: use the installed
56
60
  `metatables` package skill that owns the affected contract
57
61
  - Command Center FastAPI contract or release issues:
@@ -11,6 +11,9 @@ authentication, scaffold, and Git behavior. Select and sequence commands here;
11
11
  do not reproduce their Python implementation or replace them with ad hoc shell
12
12
  workflows.
13
13
 
14
+ Use this skill directly for the current checkout and the requested maintenance
15
+ task. No prior routing skill or platform catalog is required.
16
+
14
17
  ## Preserve The Boundary
15
18
 
16
19
  Own:
@@ -22,16 +25,13 @@ Own:
22
25
 
23
26
  Do not own:
24
27
 
25
- - platform ontology or CodeRepository Blueprint design;
26
28
  - domain implementation for data packages, APIs, jobs, or releases;
27
29
  - backend repository reconciliation;
28
30
  - MCP authorization policy, OAuth token storage, or access-token extraction;
29
31
  - repository-owned skills outside `.agents/skills/mainsequence/`.
30
32
 
31
- Route architecture changes to `code_repository_design`, implementation routing to
32
- `sdk_code_repository_execution`, and failure classification to
33
- `maintenance/bug_auditor` when diagnosis extends beyond the maintenance
34
- workflow itself.
33
+ For an unexplained failure, consult `maintenance/bug_auditor` when deeper
34
+ diagnosis is needed. This is an optional handoff, not a maintenance prerequisite.
35
35
 
36
36
  The local identity contract is Git-native. The containing repository remote,
37
37
  attached branch, and exact HEAD commit select the platform CodeRepository and
@@ -45,19 +45,21 @@ fall back to credential claims or injected CodeRepositoryBranch values.
45
45
 
46
46
  ## Inspect Before Changing State
47
47
 
48
- 1. Follow repository instructions, including `AGENTS.md` when present, and read
49
- the relevant skills. The SDK never scaffolds or edits repository `AGENTS.md`.
48
+ 1. Follow repository instructions, including `AGENTS.md` when present. Consult
49
+ domain-specific instructions only when relevant to the requested operation.
50
+ The SDK never scaffolds or edits repository `AGENTS.md`.
50
51
  2. Confirm the repository root and the user's requested maintenance outcome.
51
- 3. Inspect code repository and Git state:
52
+ 3. Inspect SDK and Git state:
52
53
 
53
54
  ```bash
54
- mainsequence code-repository current --debug --json
55
55
  mainsequence code-repository sdk-status --path . --json
56
56
  git status --short
57
57
  ```
58
58
 
59
- Before branch-owned platform operations, require the current Git branch,
60
- `code_repository_branch_uid`, and `code_repository_branch_status=resolved`.
59
+ Before branch-owned platform operations, also inspect
60
+ `mainsequence code-repository current --debug --json` and require the current
61
+ Git branch, `code_repository_branch_uid`, and
62
+ `code_repository_branch_status=resolved`.
61
63
  Local environment and skill updates do not require a registered platform
62
64
  branch or a signed-in session.
63
65
 
@@ -316,7 +318,7 @@ second:
316
318
 
317
319
  ```yaml
318
320
  # .mainsequence/workflows/api-production.yaml
319
- api_version: "2.3.0"
321
+ api_version: "3.0.0"
320
322
  name: api-production
321
323
  scope:
322
324
  environments: [production]
@@ -333,7 +335,7 @@ resources:
333
335
 
334
336
  ```yaml
335
337
  # .mainsequence/workflows/api-development.yaml
336
- api_version: "2.3.0"
338
+ api_version: "3.0.0"
337
339
  name: api-development
338
340
  scope:
339
341
  environments: [development] # the development Environment's exact name
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mainsequence-access-control-and-sharing
3
- description: Use this skill when the task is about RBAC, resource sharing, or access verification in a Main Sequence CodeRepository. This skill owns organization and team access concepts, view and edit semantics, choosing the correct shareable resource boundary, access checks across CodeRepositories, constants, secrets, buckets, artifacts, and releases, and whether an application uses its own grants or acts for its requester (`acts_for_requester`). It does not own job scheduling, domain-package data behavior, or API route design.
3
+ description: Use this skill when the task is about RBAC, resource sharing, or access verification in a Main Sequence CodeRepository. This skill owns organization and team access concepts, the policies of each shareable resource, choosing the correct shareable resource boundary, access checks across CodeRepositories, constants, secrets, buckets, artifacts, Agents, releases and Jobs, and whether an application uses its own grants or acts for its requester (`acts_for_requester`). It does not own job scheduling, domain-package data behavior, or API route design.
4
4
  ---
5
5
 
6
6
  # Main Sequence Access Control And Sharing
@@ -14,7 +14,7 @@ This skill is for:
14
14
  - RBAC reasoning
15
15
  - organization, user, role, and team access concepts
16
16
  - direct sharing vs team sharing
17
- - `view` vs `edit`
17
+ - choosing the policy a person, a workload or a team needs
18
18
  - deciding which resource is the real sharing boundary
19
19
  - choosing between `Constant` and `Secret`
20
20
  - access verification for shared resources
@@ -23,16 +23,22 @@ This skill is for:
23
23
 
24
24
  - explain the Main Sequence access model in operational terms
25
25
  - decide whether a resource should be shared directly to a user or to a team
26
- - decide whether a user needs `view` or `edit`
26
+ - decide which policy a user, a workload or a team needs
27
27
  - identify the correct shareable object boundary:
28
28
  - `CodeRepository`
29
+ - `CodeRepositoryBranch`
30
+ - `OrganizationProject`
29
31
  - `Constant`
30
32
  - `Secret`
31
33
  - `Bucket`
32
34
  - `Artifact`
35
+ - `Agent`
33
36
  - `ResourceRelease`
37
+ - `Job`
34
38
  - choose whether configuration belongs in a `Constant` or a `Secret`
35
39
  - review CLI sharing flows for existing resources
40
+ - manage a team's members and decide who controls the team, through the
41
+ team's policies
36
42
  - verify access assumptions before claiming a workflow is shareable
37
43
  - decide whether an application uses its own grants or acts for its
38
44
  requester, and explain what acting for the requester allows
@@ -61,6 +67,16 @@ This skill only reasons about access to deployed resources such as `ResourceRele
61
67
  1. Repository instructions, including `AGENTS.md` when present.
62
68
  2. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/users_and_access/>
63
69
  3. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/constants_and_secrets/>
70
+ 4. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/object_access/>
71
+ for every shareable object, whose access is decided by policies
72
+ 5. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/code_repositories/>
73
+ for code repositories, their branches and Projects
74
+ 6. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/agents/>
75
+ for Agents and the releases that back them
76
+ 7. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/resource_releases/>,
77
+ <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/scheduling_jobs/>
78
+ and <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/artifacts/>
79
+ for releases, Jobs, buckets and Artifacts
64
80
 
65
81
  The pages above are the authoritative reference for access control and sharing.
66
82
  If the task is specifically about a resource type, also read that resource's own
@@ -74,9 +90,25 @@ Before changing access or advising on sharing, collect or infer:
74
90
  - whether the actor is:
75
91
  - a user
76
92
  - a team
77
- - whether the access should be:
78
- - `view`
79
- - `edit`
93
+ - which policy the access needs:
94
+ - for a `Constant`, which is decided by policies: `reader`, `editor` or `owner`
95
+ - for a `Secret`, which is decided by policies: `reader`, `value_reader`,
96
+ `editor` or `owner`
97
+ - for a `Bucket`, which is decided by policies: `reader`, `contributor`,
98
+ `editor` or `owner`
99
+ - for a `CodeRepository`, a `CodeRepositoryBranch` or an
100
+ `OrganizationProject`, which are decided by policies: `reader`, `editor`
101
+ or `owner`
102
+ - for an `Artifact`, which is decided by policies: `viewer`, `editor` or
103
+ `owner`
104
+ - for an `Agent`, which is decided by policies: `viewer`, `user`,
105
+ `operator`, `editor` or `owner`
106
+ - for a `ResourceRelease`, which is decided by policies: `viewer`, `user`,
107
+ `editor` or `owner`
108
+ - for a `Job`, which is decided by policies: `viewer`, `runner`, `editor` or
109
+ `owner`
110
+ - for a model-provider credential or a custom model provider, which are
111
+ decided by policies: `user`, `editor` or `owner`
80
112
  - whether the goal is:
81
113
  - consumption
82
114
  - maintenance
@@ -92,7 +124,14 @@ For every non-trivial access task, decide:
92
124
 
93
125
  1. What is the real shareable object?
94
126
  2. Is this direct user access or team-based access?
95
- 3. Does the user need `view` or `edit`?
127
+ 3. Which policy does the principal need: on a `Constant`, `reader`, `editor` or `owner`; on a
128
+ `Secret`, `reader`, `value_reader`, `editor` or `owner`; on a `Bucket`, `reader`,
129
+ `contributor`, `editor` or `owner`; on an `Artifact`, `viewer`, `editor` or `owner`; on a
130
+ `CodeRepository`, a `CodeRepositoryBranch` or an `OrganizationProject`, `reader`, `editor` or
131
+ `owner`; on an `Agent`, `viewer`, `user`, `operator`, `editor` or `owner`; on a
132
+ `ResourceRelease`, `viewer`, `user`, `editor` or `owner`; on a `Job`, `viewer`, `runner`,
133
+ `editor` or `owner`; on a model-provider credential or a custom model provider, `user`,
134
+ `editor` or `owner`?
96
135
  4. Is this configuration non-sensitive or sensitive?
97
136
  5. Is the task really an access problem, or is it actually an orchestration or implementation problem?
98
137
  6. Is the task creating a `Constant` or `Secret` by name, and does that name already exist?
@@ -105,17 +144,187 @@ Do not speak loosely about sharing "the code" when the operational boundary is a
105
144
 
106
145
  Examples:
107
146
 
108
- - sharing a deployed experience usually means sharing the `ResourceRelease`
147
+ - sharing a deployed experience usually means a policy on the
148
+ `ResourceRelease`, or on the `Agent` when the release backs one
109
149
  - sharing runtime configuration means sharing the `Constant` or `Secret`
110
150
 
111
- ### 2. `view` is for consumers, `edit` is for maintainers
151
+ ### 2. Consumers get the narrowest policy, maintainers get `editor`
112
152
 
113
153
  Use the simplest rule unless the task requires something more specific:
114
154
 
115
- - `view` for people who need to read, inspect, or consume
116
- - `edit` for people who need to maintain, update, or administer
117
-
118
- Do not grant `edit` when `view` is enough.
155
+ - the narrowest reading or using policy, such as `reader`, `viewer` or
156
+ `user`, for people who need to read, inspect, or consume
157
+ - `editor` for people who need to maintain or update
158
+ - `owner` only for the people who decide who has access
159
+
160
+ Do not grant `editor` when a reading or using policy is enough. No resource
161
+ uses view and edit sharing any more.
162
+
163
+ A `Constant` is decided by its policies:
164
+
165
+ - `reader` sees the constant and its value;
166
+ - `editor` also changes its name and value, deletes it and sees who has access;
167
+ - `owner` also decides who has access.
168
+
169
+ The person or workload that creates a constant holds `owner`. Give `reader` to
170
+ consumers and `editor` to maintainers, with the access methods on `Constant`
171
+ (`get_access()`, `attach_policy()`, `detach_policy()`, `explain_access()`) or
172
+ `mainsequence constants access list|grant|revoke|explain`. A constant has no
173
+ `add_to_view()` or `add_to_edit()`, and its access methods need no Environment.
174
+
175
+ A `Secret` is decided by its policies too:
176
+
177
+ - `reader` sees the secret and its name, never its value;
178
+ - `value_reader` also reads its current value;
179
+ - `editor` also reads earlier values, sets a new value, deletes it and sees who
180
+ has access;
181
+ - `owner` also decides who has access.
182
+
183
+ The person or workload that creates a secret holds `owner`. Give
184
+ `value_reader` to the workloads and the few people that need the value, and
185
+ `editor` to maintainers; `reader` is for people who configure workloads that
186
+ use the secret but must never know it. A workload holding only `reader` cannot
187
+ read the value: `Secret.get()` raises `PermissionDeniedError` with
188
+ `required_action` `secrets.read_value`. Use the access methods on `Secret` or
189
+ `mainsequence secrets access list|grant|revoke|explain`; a secret has no
190
+ `add_to_view()` or `add_to_edit()`. A repository workflow file's `access` entry
191
+ for a secret names the policy it gives (`policy: reader`, `value_reader`,
192
+ `editor` or `owner`). A secret the platform manages, such as a hosted database
193
+ password, cannot get a new value or be deleted.
194
+
195
+ A `Bucket` is decided by its policies too:
196
+
197
+ - `reader` browses its folders and the Artifacts in it shared with the person;
198
+ - `contributor` also uploads Artifacts and creates folders;
199
+ - `editor` also renames the bucket, renames and deletes folders, deletes the
200
+ bucket with every Artifact in it and sees who has access;
201
+ - `owner` also decides who has access.
202
+
203
+ The person or workload that creates a bucket holds `owner`, also when an
204
+ Artifact upload creates it by name. Give `contributor` to the people and the
205
+ workloads that upload into a bucket, and `editor` to maintainers. Uploading
206
+ into an existing bucket without `contributor` raises `PermissionDeniedError`
207
+ with `required_action` `buckets.add_artifact`. Use the access methods on
208
+ `Bucket`; a bucket has no `add_to_view()` or `add_to_edit()`, and the CLI has
209
+ no bucket commands. A repository workflow file's `access` entry for a bucket
210
+ names the policy it gives (`policy: reader`, `contributor`, `editor` or
211
+ `owner`).
212
+
213
+ A `CodeRepository`, its `CodeRepositoryBranch` objects and an
214
+ `OrganizationProject` are decided by their policies too, each with `reader`,
215
+ `editor` and `owner`:
216
+
217
+ - on a repository, `reader` sees it, its GitHub link and issues, and every
218
+ branch in it; `editor` also renames or archives it, adds deploy keys,
219
+ creates branches, edits every branch and sees who has access; `owner` also
220
+ decides who has access. Only Organization admins delete a repository;
221
+ - on a branch, `reader` sees the branch, its files, Jobs, runs, logs and
222
+ releases, and calls its releases; `editor` also changes and deletes it,
223
+ edits its Jobs and releases and manages what its workloads can reach;
224
+ `owner` also decides who has access;
225
+ - on a Project, a named group of branches in one Environment, `reader` sees
226
+ it and its branches; `editor` also renames it, adds and removes branches and
227
+ deletes it; `owner` also decides who has access.
228
+
229
+ A repository's creator and a Project's creator hold `owner`; a branch's
230
+ creator holds nothing for being its creator. Repository and Project policies
231
+ pass down to the branches: `reader` gives branch `reader`, and `editor` and
232
+ `owner` give branch `editor`, so share the repository or the Project when
233
+ every branch should follow. Using a repository or a branch needs the
234
+ platform's `user` product role: without it every route, the access methods
235
+ included, raises `PermissionDeniedError` with `code` `missing_product_role`,
236
+ also through a Team, and no policy gives it. Use the access methods on
237
+ `CodeRepository`, `CodeRepositoryBranch` and `OrganizationProject(uid=...)`,
238
+ or `mainsequence code-repository access list|grant|revoke|explain` for a
239
+ repository; the CLI has no branch or Project access commands. A repository
240
+ workflow file's `access.branch` and `access.branches` entries name the
241
+ workload's policy (`branch: reader`, or `policy: reader` on a `branches`
242
+ entry).
243
+
244
+ Model-provider credentials and custom model providers are decided by policies
245
+ too, as two types:
246
+
247
+ - a model-provider credential, one person's sign-in to a built-in model
248
+ provider: `user` selects it and receives it in sessions and workloads,
249
+ including local Tau, where it can be copied; `editor` also refreshes it,
250
+ signs in again, revokes it and sees who has access; `owner`, which the
251
+ credential's person holds, also decides who has access;
252
+ - a custom model provider, an inference endpoint with its own authentication
253
+ and models: `user` sends requests through it and its models and receives its
254
+ stored authentication in sessions and workloads, including local Tau, where
255
+ it can be copied; `editor` also changes its endpoint, authentication and
256
+ models, deletes it and sees who has access; `owner`, which its creator holds,
257
+ also decides who has access.
258
+
259
+ Give `user` to the people and workloads that send requests through a
260
+ credential or a custom provider, and only to those you trust with a credential
261
+ they can copy; give `editor` to maintainers. The SDK has no model or command
262
+ for these records. A repository workflow file's `access` entry for model
263
+ providers names the policy it gives (`policy: user`, `editor` or `owner`).
264
+
265
+ An `Artifact` is decided by its policies too:
266
+
267
+ - `viewer` sees it and downloads its file;
268
+ - `editor` also replaces its file, deletes it and sees who has access;
269
+ - `owner` also decides who has access.
270
+
271
+ Every policy that sees an Artifact also downloads it, and a downloaded copy
272
+ stays with the person. Uploading under the name of an Artifact you can see
273
+ replaces its file, which needs `editor` or `owner`: with `viewer` alone
274
+ `Artifact.upload_file()` raises `PermissionDeniedError` with
275
+ `required_action` `artifacts.overwrite`. The Jobs whose runs published an
276
+ Artifact give `viewer` on it to everyone who holds a policy on the Job. Use the
277
+ access methods on `Artifact`; the CLI has no Artifact commands. A repository
278
+ workflow file's `access` entry for an Artifact names the policy it gives, such
279
+ as `policy: viewer`.
280
+
281
+ An `Agent` is decided by its policies:
282
+
283
+ - `viewer` talks to it, gives it Tasks, sees all its Tasks and reads the
284
+ person's own log lines;
285
+ - `user` talks to it and gives it Tasks, seeing only the Tasks the person
286
+ asked for;
287
+ - `operator` also stops any Task or session run;
288
+ - `editor` also configures it, moves it to a new runtime build, deletes it,
289
+ manages what its workload can reach and sees who has access;
290
+ - `owner` also decides who has access.
291
+
292
+ Give `user` to most people, and `viewer` only to those who should see other
293
+ people's Tasks. The Agent works with its own access unless it acts for the
294
+ person asking. Its policies also decide its runtime release and that release's
295
+ backing Job: give access on the Agent, never on its release, which refuses a
296
+ policy of its own with `BadRequestError` `code` `sharing_managed_by_owner`.
297
+ Use the access methods on `Agent`, or `mainsequence agent access
298
+ list|grant|revoke|explain`. A repository workflow file's `access` entry for an
299
+ Agent names the policy it gives, such as `policy: user`.
300
+
301
+ A `ResourceRelease` and a `Job` are decided by their policies:
302
+
303
+ - on a release, `viewer` sees its configuration, revisions and logs and calls
304
+ it; `user` calls it without its logs; `editor` also changes its
305
+ configuration, activates static deployments, deletes it and manages what its
306
+ workload can reach; `owner` also decides who has access;
307
+ - on a Job, `viewer` sees it, its runs, logs and outputs; `runner` also runs
308
+ it and stops its runs; `editor` also changes and deletes it and manages what
309
+ its workload can reach; `owner` also decides who has access.
310
+
311
+ A release that backs no Agent and a standalone Job also take the policies of
312
+ their branch: branch `reader` gives `viewer`, and `editor` and `owner` give
313
+ `editor`. A release's backing Job follows the release and is changed, run and
314
+ deleted with it. Give
315
+ `user` on a release to the people who only call it, and `runner` on a Job to
316
+ the people who run it without changing it. Use the access methods on
317
+ `ResourceRelease` and `Job`, or `mainsequence code-repository resources access
318
+ list|grant|revoke|explain` and `mainsequence code-repository jobs access
319
+ list|grant|revoke|explain`. A repository workflow file's `access` entry for a
320
+ release or a Job names the policy it gives, such as `policy: user` on a release
321
+ or `policy: runner` on a Job.
322
+
323
+ The creator of an Agent, a release, a Job or an Artifact holds `owner`, except
324
+ the Organization's automation identity, which creates the objects of
325
+ repository workflows and holds no policy on them. The access methods of all
326
+ four take no Environment; with a workload's runtime credentials they reach
327
+ only the objects of that workload's Environment.
119
328
 
120
329
  ### 3. Team sharing is for repeated access patterns
121
330
 
@@ -136,6 +345,29 @@ Keep these separate:
136
345
  - inherited access to shared resources
137
346
  - administration of the team itself
138
347
 
348
+ Membership is who is in the team. Control is the policies on the team, not view
349
+ and edit sharing:
350
+
351
+ - `viewer` sees the team and its members;
352
+ - `membership_manager` adds and removes members;
353
+ - `editor` renames, describes, activates or deactivates it and sees its policies;
354
+ - `owner` does everything, including deleting it and deciding who manages it;
355
+ - every member holds `member`: they can see the team and its members, and leave it.
356
+
357
+ Any person can create a team and becomes its owner and first member. Use
358
+ `Team.add_member()`, `remove_member()`, `leave()` and the access methods
359
+ (`get_access()`, `attach_policy()`, `detach_policy()`, `explain_access()`), or
360
+ `mainsequence organization teams members ...`, `leave` and `access ...`. A
361
+ team has no `add_to_view()` or `add_to_edit()`. Before saying who can change a
362
+ team, read it with `team.get_access()` or `explain_access()`.
363
+
364
+ Working in an Organization Environment is a policy too: `member` works in it
365
+ and creates Projects, Buckets, Constants, Secrets, model providers and
366
+ repositories there; `observer` works in it without creating anything. Only
367
+ Organization admins attach them, to people and Teams, with the access methods
368
+ on `OrganizationEnvironment`. Admission never shows objects that are not shared
369
+ with the person.
370
+
139
371
  An application that checks whether its caller or requester belongs to a team
140
372
  uses `in_teams()`; the identity carries no team list. See
141
373
  `.agents/skills/mainsequence/application_surfaces/api_surfaces/SKILL.md`.
@@ -182,15 +414,16 @@ Current CLI note:
182
414
 
183
415
  ### 7. Public principal identity is UID-only
184
416
 
185
- All SDK and CLI sharing mutations identify users and teams by public UUID:
417
+ All SDK and CLI access changes identify people, workload identities and teams
418
+ by public UUID:
186
419
 
187
- - `add_to_view(user_uid)` and `add_to_edit(user_uid)`
188
- - `remove_from_view(user_uid)` and `remove_from_edit(user_uid)`
189
- - the corresponding team methods use `team_uid`
420
+ - `attach_policy(policy, principal_type="user", principal_uid=user_uid)` and
421
+ `attach_policy(policy, principal_type="team", principal_uid=team_uid)`
422
+ - `detach_policy(binding_uid)`, with a binding UID that `get_access()` lists
190
423
 
191
- Never pass or request a numeric user or team database ID. CLI sharing commands
192
- take `<USER_UID>` or `<TEAM_UID>`, and access-state output is interpreted through
193
- public UID fields.
424
+ Never pass or request a numeric user or team database ID. CLI access commands
425
+ take `--user <USER_UID>` or `--team <TEAM_UID>` and `<BINDING_UID>`, and access
426
+ output is interpreted through public UID fields.
194
427
 
195
428
  ### 8. Access assumptions must be verified
196
429
 
@@ -207,9 +440,14 @@ release or an Agent, reaches platform data.
207
440
 
208
441
  An application runs as its own workload User (`workload_user_uid` on the
209
442
  `ResourceRelease`, `Job` or `Agent`). Its own access comes from grants to that
210
- User: share what it needs with that User as with any person, with `view`
211
- unless it must maintain the object. These grants cover every call the
212
- application makes for itself.
443
+ User: give it the policies it needs as you would a person, a reading or using
444
+ policy unless it must maintain the object. A `Constant` it reads needs
445
+ `reader`, a `Secret` whose value it reads needs `value_reader`, a `Bucket` it
446
+ uploads Artifacts into needs `contributor`, an `Artifact` it reads needs
447
+ `viewer`, a release it calls needs `user`, a `Job` it runs needs `runner`, an
448
+ `Agent` it gives Tasks to needs `user`, and a model-provider credential or a
449
+ custom model provider it sends requests through needs `user`. These grants
450
+ cover every call the application makes for itself.
213
451
 
214
452
  ### Acting for its requester: `acts_for_requester`
215
453
 
@@ -304,7 +542,8 @@ authority; the application's per-operation permission checks remain necessary.
304
542
  When reviewing an access-control task, look for:
305
543
 
306
544
  - sharing the wrong resource boundary
307
- - granting `edit` when `view` is sufficient
545
+ - granting `editor` or `owner` when a reading or using policy is sufficient
546
+ - a policy on a release that backs an Agent instead of on the Agent
308
547
  - using direct user grants where a team should be used
309
548
  - using a team when the access is clearly one-off
310
549
  - treating team membership as team administration
@@ -331,9 +570,18 @@ Do not claim success until you have checked:
331
570
  - the grant target is intentional:
332
571
  - user
333
572
  - team
334
- - the access level is intentional:
335
- - `view`
336
- - `edit`
573
+ - the policy is intentional:
574
+ - `reader`, `editor` or `owner` on a `Constant`
575
+ - `reader`, `value_reader`, `editor` or `owner` on a `Secret`
576
+ - `reader`, `contributor`, `editor` or `owner` on a `Bucket`
577
+ - `reader`, `editor` or `owner` on a `CodeRepository`, a
578
+ `CodeRepositoryBranch` or an `OrganizationProject`
579
+ - `viewer`, `editor` or `owner` on an `Artifact`
580
+ - `viewer`, `user`, `operator`, `editor` or `owner` on an `Agent`
581
+ - `viewer`, `user`, `editor` or `owner` on a `ResourceRelease`
582
+ - `viewer`, `runner`, `editor` or `owner` on a `Job`
583
+ - `user`, `editor` or `owner` on a model-provider credential or a custom
584
+ model provider
337
585
  - the task is using `Constant` vs `Secret` correctly
338
586
  - any `Constant` or `Secret` creation path first resolved existence by name when idempotency matters
339
587
  - the access claim was verified against the actual resource path
@@ -205,6 +205,17 @@ Artifact and Bucket operations derive their Organization Environment from the
205
205
  process-frozen current Git branch and registered `CodeRepositoryBranch`. Do not ask the
206
206
  user to select an Environment UID or branch UID.
207
207
 
208
+ Uploading an Artifact into an existing Bucket needs the Bucket's `contributor`
209
+ policy or more; give it to the workload that uploads, for example a Job's
210
+ workload User. A refused upload raises `PermissionDeniedError` with
211
+ `required_action` `buckets.add_artifact`. An upload that names a new Bucket
212
+ creates it, and the uploader holds `owner`. An upload under the name of an
213
+ Artifact you can see in the Bucket replaces that Artifact's file, which needs
214
+ its `editor` or `owner` policy; with `viewer` alone it raises
215
+ `PermissionDeniedError` with `required_action` `artifacts.overwrite`. A name
216
+ taken by an Artifact you cannot see raises `ConflictError`. See
217
+ `.agents/skills/mainsequence/platform_operations/access_control_and_sharing/SKILL.md`.
218
+
208
219
  Examples:
209
220
 
210
221
  - vendor drops
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mainsequence-sdk-code-repository-execution
3
- description: Use the installed Main Sequence SDK and CLI for Git-derived CodeRepository context, version-matched contract authority, and selecting the relevant SDK or domain-package skill. Use for repository integration and SDK execution questions; use a platform-owned design skill when architecture or ontology is unresolved.
3
+ description: Use the installed Main Sequence SDK and CLI for Git-derived CodeRepository context, version-matched contract authority, and selecting the relevant SDK or domain-package skill. Use for repository integration and SDK execution questions.
4
4
  ---
5
5
 
6
6
  # Main Sequence SDK CodeRepository Execution
@@ -28,11 +28,8 @@ create, copy, update, or remove it.
28
28
 
29
29
  Use skill descriptions to select the domain involved in the request. This skill
30
30
  is not a mandatory first step for maintenance, audits, or already-scoped domain
31
- work. A platform design skill is useful when product architecture, ontology, or
32
- the CodeRepository Blueprint is unresolved; select it from the installed
33
- platform catalog rather than assuming its filesystem path.
34
- Use that catalog to select platform-owned CodeRepository-to-Agent setup and
35
- other platform capabilities as well.
31
+ work. Use the installed platform catalog to select platform-owned
32
+ CodeRepository-to-Agent setup and other platform capabilities.
36
33
 
37
34
  - Environment repair, authentication, explicitly requested updates, dependency
38
35
  sync, and Git publishing: