@isomorph.ai/app-sdk 2.3.0 → 2.3.1

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/dist/aws.js CHANGED
@@ -67,7 +67,11 @@ export async function runtimeCredentials(env = process.env, { fetch: fetcher = f
67
67
  throw new Error('the runtime has no AWS credentials (AWS_ACCESS_KEY_ID, or AWS_ROLE_ARN with AWS_WEB_IDENTITY_TOKEN_FILE)');
68
68
  if (webIdentity?.roleArn === roleArn && webIdentity.expiresAt - now() > 5 * 60_000)
69
69
  return webIdentity.credentials;
70
- const region = env.AWS_REGION || env.AWS_DEFAULT_REGION || 'us-east-1';
70
+ // STS is called in the runtime's own region, which the runtime always has (Lambda and the kit chart set
71
+ // it). No default: a cell outside us-east-1 under a region-pinning policy must never fall back there.
72
+ const region = env.AWS_REGION || env.AWS_DEFAULT_REGION;
73
+ if (!region)
74
+ throw new Error('the runtime has no AWS region (AWS_REGION) for its STS exchange');
71
75
  // The token is read on each exchange: the kubelet rotates the file.
72
76
  const body = new URLSearchParams({ Action: 'AssumeRoleWithWebIdentity', Version: '2011-06-15', RoleArn: roleArn, RoleSessionName: env.AWS_ROLE_SESSION_NAME || 'isomorph-runtime', WebIdentityToken: (await readFile(tokenFile, 'utf8')).trim() });
73
77
  const response = await fetcher(`https://sts.${region}.amazonaws.com/`, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' }, body: body.toString(), signal: AbortSignal.timeout(10_000) });
@@ -10,6 +10,8 @@ export function computerUseApi({ env = process.env, fetch } = {}) {
10
10
  const base = env.ISOMORPH_COMPUTER_USE_URL?.replace(/\/+$/, '');
11
11
  if (!base)
12
12
  throw new Error('This app has no computer use API (ISOMORPH_COMPUTER_USE_URL is not set).');
13
+ // The computer use API is Harbour's own, in Harbour's region: this default names a Harbour-owned endpoint,
14
+ // not the cell's region, and stays until the call moves behind the app gateway (ADR 0078).
13
15
  const region = env.ISOMORPH_COMPUTER_USE_REGION || 'us-east-1';
14
16
  const transport = fetch ? { fetch } : {};
15
17
  const call = async (path, body) => signedJsonPost({ ...await runtimeCredentials(env, transport), region }, 'execute-api', `${base}${path}`, body, transport);
package/dist/runtime.js CHANGED
@@ -685,8 +685,13 @@ export class Runtime {
685
685
  const abort = () => controller.abort();
686
686
  response.once('close', abort);
687
687
  const directory = header(request, 'X-Harbour-Verified-Directory');
688
+ const userId = header(request, 'X-Harbour-Verified-User-ID');
688
689
  const user = {
689
- id: header(request, 'X-Harbour-Verified-User-ID'),
690
+ id: userId,
691
+ // A service credential's call arrives with the credential as the verified user
692
+ // (`service:<clientId>`, ADR 0101); the action sees it as `kind: 'service'`, the
693
+ // shape `/_harbour/identity/current` already answers. Anything else is a person.
694
+ ...(userId.startsWith('service:') ? { kind: 'service' } : {}),
690
695
  email: header(request, 'X-Harbour-Verified-User-Email'),
691
696
  groups: userGroupsFromHeader(header(request, 'X-Harbour-Verified-User-Groups')),
692
697
  role: userRole(header(request, 'X-Harbour-Verified-User-Role')),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isomorph.ai/app-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",