@inneranimalmedia/agentsam-sdk 1.8.0 → 2.0.0-alpha.identity
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/DEVELOPMENT.md +19 -3
- package/README.md +11 -3
- package/docs/RELEASES.iam-mirror.md +20 -0
- package/docs/RELEASES.md +4 -1
- package/docs/identity/README.md +11 -0
- package/examples/gorilla-shell/README.md +7 -14
- package/package.json +9 -4
- package/packages/identity/README.md +68 -0
- package/packages/identity/backend/README.md +26 -0
- package/packages/identity/docs/getting-started.md +16 -0
- package/packages/identity/examples/cloudflare-worker/README.md +5 -0
- package/packages/identity/examples/legendary-os/README.md +27 -0
- package/packages/identity/package.json +29 -0
- package/packages/identity/src/adapters/cloudflare-d1/index.js +4 -0
- package/packages/identity/src/adapters/inneranimalmedia/README.md +7 -0
- package/packages/identity/src/contracts/external-identity.js +35 -0
- package/packages/identity/src/contracts/identity.js +17 -0
- package/packages/identity/src/contracts/provider.js +8 -0
- package/packages/identity/src/contracts/session.js +9 -0
- package/packages/identity/src/core/accounts.js +4 -0
- package/packages/identity/src/core/browser-paths.js +34 -0
- package/packages/identity/src/core/constants.js +9 -0
- package/packages/identity/src/core/errors.js +8 -0
- package/packages/identity/src/core/http-json.js +10 -0
- package/packages/identity/src/core/identity.js +4 -0
- package/packages/identity/src/core/index.js +10 -0
- package/packages/identity/src/core/password-crypto.js +53 -0
- package/packages/identity/src/core/recovery.js +4 -0
- package/packages/identity/src/core/sessions.js +59 -0
- package/packages/identity/src/frontend/auth-portal/README.md +30 -0
- package/packages/identity/src/frontend/auth-portal/pages/login.html +821 -0
- package/packages/identity/src/frontend/auth-portal/pages/reset.html +582 -0
- package/packages/identity/src/frontend/auth-portal/pages/signup.html +835 -0
- package/packages/identity/src/index.js +118 -0
- package/packages/identity/src/migrations/README.md +5 -0
- package/packages/identity/src/oauth/README.md +4 -0
- package/packages/identity/src/oauth/callback.js +24 -0
- package/packages/identity/src/provider-contract.js +61 -0
- package/packages/identity/src/providers/email/index.js +39 -0
- package/packages/identity/src/providers/gcp/index.js +58 -0
- package/packages/identity/src/providers/github/index.js +14 -0
- package/packages/identity/src/providers/github/mapper.js +22 -0
- package/packages/identity/src/providers/github/oauth.js +43 -0
- package/packages/identity/src/providers/github/profile.js +34 -0
- package/packages/identity/src/providers/google/index.js +14 -0
- package/packages/identity/src/providers/google/mapper.js +32 -0
- package/packages/identity/src/providers/google/oauth.js +41 -0
- package/packages/identity/src/providers/google/profile.js +14 -0
- package/packages/identity/src/providers/index.js +25 -0
- package/packages/identity/tests/identity.test.mjs +74 -0
- package/python/README.md +8 -1
- package/python/agentsam_sdk/cli.py +57 -7
- package/python/agentsam_sdk/data/d1_bloat.py +279 -99
- package/python/agentsam_sdk/repository/__init__.py +12 -0
- package/python/agentsam_sdk/repository/inspect.py +496 -0
- package/python/docs/gaps.md +10 -1
- package/python/docs/tooling.md +5 -1
- package/python/tests/test_d1_bloat.py +60 -24
- package/python/tests/test_repository_inspect.py +84 -0
- package/src/index.js +16 -0
- package/src/lib/core-client.js +5 -0
- package/templates/gorilla-shell/App.tsx +28 -28
- package/templates/gorilla-shell/README.md +15 -3
- package/test/smoke.mjs +5 -0
- package/examples/gorilla-shell/App.tsx +0 -540
- package/examples/gorilla-shell/index.html +0 -15
- package/examples/gorilla-shell/main.jsx +0 -9
- package/examples/gorilla-shell/package.json +0 -19
- package/examples/gorilla-shell/vite.config.js +0 -10
- package/src/commands/http-server.js +0 -97
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { normalizeIdentitySession } from '../contracts/session.js';
|
|
2
|
+
|
|
3
|
+
export { normalizeIdentitySession };
|
|
4
|
+
|
|
5
|
+
export function trimSessionField(v) {
|
|
6
|
+
if (v == null) return null;
|
|
7
|
+
const s = String(v).trim();
|
|
8
|
+
return s || null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Portable KV session payload shape (adapter writes to storage). */
|
|
12
|
+
export function buildSessionKvPayload(sessionId, fields = {}) {
|
|
13
|
+
return {
|
|
14
|
+
v: 1,
|
|
15
|
+
session_id: sessionId,
|
|
16
|
+
user_id: trimSessionField(fields.userId ?? fields.user_id) ?? null,
|
|
17
|
+
tenant_id: trimSessionField(fields.tenantId ?? fields.tenant_id) ?? null,
|
|
18
|
+
workspace_id: trimSessionField(fields.workspaceId ?? fields.workspace_id) ?? null,
|
|
19
|
+
person_uuid: trimSessionField(fields.personUuid ?? fields.person_uuid) ?? null,
|
|
20
|
+
email: trimSessionField(fields.email) ?? null,
|
|
21
|
+
provider: trimSessionField(fields.provider) ?? null,
|
|
22
|
+
display_name: trimSessionField(fields.displayName ?? fields.display_name) ?? null,
|
|
23
|
+
avatar_url: trimSessionField(fields.avatarUrl ?? fields.avatar_url) ?? null,
|
|
24
|
+
provider_subject: trimSessionField(fields.providerSubject ?? fields.provider_subject) ?? null,
|
|
25
|
+
expires_at: fields.expiresAt ?? fields.expires_at ?? fields.expiresAtIso ?? null,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {object} InboundOAuthInput
|
|
31
|
+
* @property {string} provider
|
|
32
|
+
* @property {string} [sessionProvider]
|
|
33
|
+
* @property {string} email
|
|
34
|
+
* @property {string} name
|
|
35
|
+
* @property {string} providerUid
|
|
36
|
+
* @property {string|null} [supabaseUserId]
|
|
37
|
+
* @property {string} source
|
|
38
|
+
* @property {string} [pageContext]
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {object} InboundOAuthSuccess
|
|
43
|
+
* @property {true} ok
|
|
44
|
+
* @property {string} authUserId
|
|
45
|
+
* @property {string} sessionId
|
|
46
|
+
* @property {string} sessionToken
|
|
47
|
+
* @property {string|null} tenantId
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {object} InboundOAuthFailure
|
|
52
|
+
* @property {false} ok
|
|
53
|
+
* @property {'provision_failed'|'session_failed'} error
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/** Result contract for finalizeInboundOAuth — IAM implements in auth/oauth-finalize.js */
|
|
57
|
+
export function isInboundOAuthSuccess(result) {
|
|
58
|
+
return result?.ok === true && typeof result.authUserId === 'string';
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Auth portal — CMS-edit friendly
|
|
2
|
+
|
|
3
|
+
Pages copied **verbatim** from IAM `static/pages/auth/*` — reorganize only.
|
|
4
|
+
|
|
5
|
+
## White-label (customer / CMS)
|
|
6
|
+
|
|
7
|
+
| Hook | Location | Customer change |
|
|
8
|
+
|------|----------|-----------------|
|
|
9
|
+
| Brand title | `<title>`, hero copy | CMS field or `portal.brand.name` at init |
|
|
10
|
+
| Logo | header / OAuth buttons | `portal.brand.logoUrl` |
|
|
11
|
+
| Colors | `:root { --auth-bg, ... }` | theme tokens — **no JS changes** |
|
|
12
|
+
| OAuth labels | button text | HTML only |
|
|
13
|
+
|
|
14
|
+
`agentsam init identity` (Phase 5) injects brand tokens into copied HTML — same globe/login UX, new logo/colors in minutes.
|
|
15
|
+
|
|
16
|
+
## Source map
|
|
17
|
+
|
|
18
|
+
| File | IAM source |
|
|
19
|
+
|------|------------|
|
|
20
|
+
| `pages/login.html` | `inneranimalmedia/static/pages/auth/login.html` |
|
|
21
|
+
| `pages/signup.html` | `static/pages/auth/signup.html` |
|
|
22
|
+
| `pages/reset.html` | `static/pages/auth/reset.html` |
|
|
23
|
+
|
|
24
|
+
## API routes (unchanged)
|
|
25
|
+
|
|
26
|
+
- `POST /api/auth/login`
|
|
27
|
+
- OAuth: `/api/oauth/google/start`, `/api/oauth/github/start`
|
|
28
|
+
- GCP: per-client when demanded — scaffold only until requested
|
|
29
|
+
|
|
30
|
+
Sensitive finalize stays server-side (`oauth/callback` → Identity Service).
|