@north-light/api 0.3.754 → 0.3.755

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.
@@ -34,6 +34,8 @@ import { isPortableModelToken } from '../runtime/launch.js';
34
34
  import { parseDurationMs } from '../wake.js';
35
35
  import { expandModelCandidates, parseModelSpec } from '../model-routes.js';
36
36
  import { payerOfGrant } from '../grants/mirror.js';
37
+ import { ownsWithoutRow } from '../grants/owner.js';
38
+ import { environmentPayerOfProfile } from '../ledger/index.js';
37
39
  import { runUsage } from '../ledger/read.js';
38
40
  import { ZERO_RUN_USAGE } from '../../api/dto/run-events.js';
39
41
  import { isolatedBrokerLauncherAvailable } from '../runtime/host.js';
@@ -278,6 +280,10 @@ export async function startRun(principal, input, idempotencyKey, resolveAttachme
278
280
  await ensureAppSpace(principal.grantee);
279
281
  const profile = input.profile === undefined ? await ensureAppProfile(principal.grantee) : loadExactProfileManifest(input.profile);
280
282
  const owner = profile.manifest.grantee ?? 'app:terminal';
283
+ // An app environment runs with no person: only an owner principal of the environment's app (no grant row, `sub` in its namespace) may start in it.
284
+ if (await environmentPayerOfProfile(profile.profileId) !== null && !ownsWithoutRow(owner, principal.sub, principal.grant)) {
285
+ throw new RunError(403, 'app_environment', `an app environment starts runs for ${owner} only, not for ${principal.sub}`, 'profile');
286
+ }
281
287
  if (owner !== principal.grantee) {
282
288
  const permission = `crtr:memory:rw:${owner}:profile:${profile.profileId}`;
283
289
  if (!principal.resolved.some((held) => covers(held, permission)) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.754",
3
+ "version": "0.3.755",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",